Analysis
Convert reconstructed.exe into a Python GUI replica
- Analysis:
- Rebuilt a Tkinter GUI from the parsed Delphi form stream and disabled the license-generation routine.
- Conclusion:
- A safe, non-functional replica GUI (lic_gui.py) was produced with XML loading, controls, artwork, and self-test; core keygen logic left disabled.
Tools: run_sandbox, read_file, write_file, edit_file
Run it yourselfAnalyze the files
The txt files look like PE-bear (Russian UI) exports of a Windows PE. Let me inspect the bin files.
The txt files are PE-bear (Russian UI) exports of a PE32 binary, and the .bin files look like extracted PE regions/sections. Let me verify by parsing the section table from 14.bin (the headers) and checking heads of the big dumps.
Section table decoded — the .bin files map cleanly to PE regions. Now let me parse the resource directory in 16.bin (the .rsrc section) and verify how TFORM1.dfm relates to the TFORM1 RCDATA resource.
Empty output — let me debug with exceptions visible.
Resource tree parsed. Now extract PACKAGEINFO, TFORM1, DVCLAL, and the manifest, and compare TFORM1 with the uploaded TFORM1.dfm.
Confirmed: TFORM1.dfm = a 16-byte wrapper header (contains name "TFORM1" + size 0x0003B79F) followed byte-for-byte by the PE's RT_RCDATA "TFORM1" resource (a binary TPF0 Delphi form stream). The manifest says CodeGear RAD Studio 11.0.2902.10471 → Delphi 2007. My PACKAGEINFO parse was wrong — let me look at it raw and parse properly, then build a TPF0 parser for the form.
PACKAGEINFO parsed: header flags 0xCC100000, 0 requires, 74 units. First unit is "Keygen" — the project's own unit name. Let me extract all unit names and then parse the TPF0 form stream.
Custom units: BlowFish, DataList, Md5, License, Corvina, ÔakosP4 (byte 0xD4 = 'Ô'), Unit1 — plus WinInet, UrlMon, ImageHlp, Registry, XML/MSXML. Now let me parse the binary TPF0 form stream of TFORM1.
My value-kind mapping was wrong — TPF0 uses TReader's vaX codes. Rewriting with correct semantics:
Found the bug — in readprops I read the length byte twice. Fixing:
Still desyncing around Caption. Let me look at the raw bytes to debug the exact encoding.
The encoding has quirks (e.g. the byte after vaBinary). Let me empirically locate where the Icon.Data binary blob ends by scanning forward.
Icon.Data = 0x1200E bytes (the full 7-image MAINICON .ico, matching the 7 RT_ICON resources = 73,624 bytes of imagery). Value enum in D2007's TReader: vaBinary=10, vaSet=11, vaCollection=12. Re-running the parser with the correct enum:
Clean parse of all 243,615 bytes. Let me view the form tree:
The form is a license generator UI: CPUID/Network selectors, Created/Expiry dates, version, "Beta Tools"/"64 bit" checkboxes, and buttons Open / AkosP4 / License, plus an embedded 167,706-byte image and XML (MSXML) support. Let me extract that image and mine the strings dump for IOCs.
The image is a TJPEGImage stream (167,691-byte JPEG). Extracting it, and grepping the strings dump properly (2.txt is UTF-8):
A clear picture: license generator for Glenisys products (Corvina, RIP, GS Vector / GS Vector Premium) writing License.reg / akosP4.reg. Let me extract the full string context around those regions and the RT_STRING tables:
Now I can see the full picture — feature-module lists, registry templates ("Checksum"/"Created"/"Expire"/"License"/"Platform"="x64"/"Version"), and a BetaTester switch. Let me decode the RT_STRING tables and hunt for the crypto constants (MD5/Blowfish) and the XML license format:
MD5 constants confirmed at one site. Blowfish P-array isn't in .text — let me check .data and reconstruct the full PE from all the parts (I have headers + every section), so I can disassemble the actual license-generation code:
Blowfish P-array found in .data (VA ≈ 0x4EE8C8). Now let me parse the TForm1 published-methods table to get the handler addresses, then disassemble them in the reconstructed PE:
Got handler addresses: Button1Click=0x4EA0EC, ComboBox1Change=0x4EA1F0, ComboBox2Change=0x4EA2F4, FormClose=0x4EA328, FormShow=0x4E9BFC, Button3Click=0x4E9B28. Disassembling the handlers with rizin on the reconstructed PE:
Button3Click reads two edits, calls fcn.004e56bc (license computation), then shows "Import License.reg...". Let me look at that core function:
This is the akosP4 (legacy akos4) .reg generator iterating the feature-module list. Let me pull the remaining strings in the XML/UI region and check the imports for the full API surface:
All handler addresses resolve (record format [size][addr][name]): Button1Click=0x4E8F30 (Open XML), Button2Click=0x4E9B28 (AkosP4 — the one I disassembled), Button3Click=0x4E9BFC (License). Let me disassemble Button3Click and Button1Click:
Button3Click (License) builds the Corvina License.reg from three feature lists + Created/Expire/Version. Let me trace where MD5 and the Checksum are computed — find the MD5 function and its callers:
Let me confirm what Button1Click (XML open) does and check dynamic API usage, then I'll compile the report:
Button1Click = OpenDialog → XML parse → populate the two combo boxes. Let me find where the Corvina "Checksum" value is computed (refs to the template string) and check the Blowfish usage:
The globals are the License unit's finalized strings — unit-level vars filled at runtime. I now have the full picture. Let me finalize the extracted artifacts (proper .ico from the form's icon blob, hashes) and check the JPEG for metadata:
The icon extraction offsets were off — let me redo it cleanly:
The blob already has a proper ICONDIR (00 00 01 00 07 00) — writing it directly:
mainicon.ico validates (7 images, 16→96px). Quick look at 38.txt (the only unexamined txt), then I'll write up the report:
Summary
The upload is a dissected Windows PE32 binary — the .txt files are PE-bear (Russian UI) table exports and the .bin files are the raw header + all 9 sections of the same executable. I reassembled the whole file as reconstructed.exe and verified every part against its export (3.txt ↔ TLS dir in 20.bin, 4.txt ↔ .reloc in 18.bin, 1.txt ↔ resource tree in 16.bin, TFORM1.dfm ↔ RT_RCDATA "TFORM1", byte-for-byte after a 16-byte wrapper).
What the program is (full write-up in analysis_report.md):
- Delphi 2007 (manifest
CodeGear RAD Studio 11.0.2902.10471, FastMM Borland Edition), built 2013-10-08; PACKAGEINFO shows the project unit is literally namedKeygen, with custom unitsBlowFish, Md5, License, Corvina, ÔakosP4, DataList. - It's a license/registration generator for Glenisys products (Corvina, GS Vector RIP, legacy akos4): UI caption "Lic" with CpuID/Network selectors, Created/Expiry dates (
2023/01/01→2999/12/15), Version, "Beta Tools" and "64 bit" checkboxes, and buttons Open / AkosP4 / License. - Open loads an XML (MSXML
TXMLDocument) with hardware info (Hardware/Processor/Network/Ethernet/Registry64nodes); AkosP4 and License generateakosP4.reg/License.regtemplates underHKLM\SOFTWARE\Glenisys\License\{Corvina,RIP,GS Vector…}with"Checksum"/"Created"/"Expire"/"License"/"Platform"="x64"/"Version"values, a"BetaTester"="1"switch, and ~60 per-feature registry keys (\ArtScreen],\Impose],\VectorPremium],\XeroShield]…). MD5 (inlined constants at ≈0x4E6330) and Blowfish (P-array at 0x4EE8C8) are present for the license/checksum values. - No malware behaviour: no network APIs, no anti-debug/packing, no file patching — it only writes
.regfiles (legal caveats about distributing it still apply).
Artifacts I produced in the workspace: analysis_report.md (full evidence-backed report), reconstructed.exe, form_tree.txt (fully parsed 243 KB TPF0 form), PACKAGEINFO.bin, embedded.jpg (225×320 image from the form's TImage), mainicon.ico (7-image icon, 16–96 px), picture.bin.
Convert to Python code
I'll convert the whole analysis workflow I performed into a single, reusable Python program (stdlib only), then run it against the workspace files to verify it reproduces the same artifacts.
Nearly there — three bugs to fix: (1) reconstructed file size should be the on-disk layout end, not SizeOfImage; (2) published-methods table start offset is off by one (i-6, not i-7), so it returned empty; (3) resource lookups silently failed — plus cleanup of dead code. Let me check why the RCDATA finds failed first:
The Resources class standalone gives 2-level paths and negative rsrc_off — the class walks fine but I passed the VA instead of the RVA as rsrc_rva, and the tree depth differs from my original parse. Let me debug the actual tree structure:
The raw tree is 3-level and correct, so the class must have a subtle bug. Let me check the actual class behavior in detail:
Let me look at the exact class code as written:
The class code reads identical to the debug walk yet yields 2-deep paths — let me instrument it directly to see what's happening:
Found it — in _walk, data entries are appended with the directory's path, dropping the language component (should be path + (name,)). And in main I passed the VA instead of the RVA. Let me view the main() resource block to see why its prints vanished too:
All three bugs identified: (1) data entries drop the language component, (2) main passes VA instead of RVA so slices clamp to empty, (3) parse_published_methods start is off by one, plus the wrong reconstruct size. Applying fixes:
Now fix the published-methods offset, the reconstruct size, and clean up the leftovers:
Now re-run and verify against the known-good results from the manual analysis:
Two remaining issues: I still passed the VA as rsrc_rva in main (must be the section RVA), and the rebuilt exe differs from my earlier build — let me fix the former and diff the latters:
The headers file was never in the parts list, so reconstruct skipped it. Fixing:
One last mapping nit: the DOS-stub length must be e_lfanew - 0x40 (=0xC0), not to the section table:
All parts mapped. Final verification — artifacts must be byte-identical to the manual-analysis outputs:
Two cosmetic diffs in the tree dump (quoting rules and the ICONDIR annotation). Let me match the reference output exactly:
form_tree.txt is now byte-identical too. One final full run to show the complete output:
Done. The analysis workflow is now a single reusable Python program: pe_keygen_analyzer.py (stdlib only, ~650 lines).
What it does
| Stage | Function | Result on your files |
|---|---|---|
| 1 | PeHeaders — COFF/optional/section-table parser | PE32, base 0x400000, EP RVA 0xEB98C, build 2013-10-08 UTC |
| 2 | map_bin_parts — auto-assigns every .bin to its PE region by raw size | 14.bin=headers, 12.bin=DOS stub, 34/30/28/24/20/18/16.bin = .text/.itext/.data/.idata/.rdata/.reloc/.rsrc |
| 3 | Resources — 3-level .rsrc directory walker | 42 entries; extracts DVCLAL, PACKAGEINFO, TFORM1, manifest (→ "Delphi 2007") |
| 4 | parse_packageinfo — flags, requires, 74 unit names | project unit Keygen, custom units BlowFish, Md5, License, Corvina, ÔakosP4… |
| 5 | Tpf0Parser — full binary-DFM parser (all 20 D2007 TValueTypes, collections, blobs) | 243,615/243,615 bytes parsed → form_tree.txt |
| 5b | blob extractors (Icon.Data, Picture.Data/TJPEGImage) | mainicon.ico (7 images), embedded.jpg (225×320) |
| 6 | reconstruct — rebuilds the on-disk PE | reconstructed.exe, 1,385,984 B |
| 7 | load_strings_dump / interesting_strings / feature_keys — mines the PE-bear strings export | 94 IOC-ish strings, 69 feature keys, Glenisys reg templates |
| 8 | find_crypto — MD5/Blowfish constant locator | MD5 @0x4E633E, Blowfish P-array @0x4EE8C8 |
| 9 | parse_published_methods — Delphi [size][addr][name] RTTI walker | Button1Click 0x4E8F30, Button2Click 0x4E9B28, Button3Click 0x4E9BFC, … |
| 10 | writes summary.json + prints the report | machine-readable findings |
Verification (vs. the manual analysis)
All regenerated artifacts are byte-identical to the originals: form_tree.txt, PACKAGEINFO.bin, embedded.jpg, picture.bin, and reconstructed.exe (sha256 76b5ddaa…872a29), plus a valid 7-image mainicon.ico. Along the way I fixed three bugs that surfaced during verification (resource paths dropped the language component; VA-vs-RVA for .rsrc; published-methods table anchor offset).
Usage
python3 pe_keygen_analyzer.py # defaults to the uploaded filenames
python3 pe_keygen_analyzer.py --outdir out # artifacts under ./out
python3 pe_keygen_analyzer.py --headers X.bin --rsrc Y.bin --dfm Z.dfm --no-reconstruct
The out/ directory now contains the seven artifacts, including summary.json with all structured findings (sections, resource tree, package info, form objects, crypto VAs, handler addresses, IOC strings, feature keys).
Convert reconstructed.exe into a Python program with a graphical user interface (GUI)
Converting reconstructed.exe means recreating the Delphi app itself — the "Lic" keygen UI for Glenisys products. I'll rebuild the UI shell faithfully from the parsed form data, but I need to be upfront about one boundary: the actual license/Checksum generation is the cracktool's piracy-enabling core (and I never fully reversed its MD5/Blowfish data flow), so I'll wire everything harmless — XML loading, hardware selection, layout, embedded artwork — and leave the license-generation buttons as clearly-marked stubs rather than shipping a working keygen.
Let me check what the sandbox offers for building/testing this:
tkinter 8.6, PIL, and Xvfb are all available — I can build this and actually test it headless with screenshots. First, prepare the logo (the form's Image1 was a 132×168 stretched view of the 225×320 JPEG):
Now the GUI program itself — every coordinate, caption, default and state taken from the parsed TFORM1 stream:
Now the sample hardware XML (matching the element names the original binary looks for) and a headless test under Xvfb:
SystemButtonFace is Windows-only Tk — need a portable fallback for the clBtnFace background:
19/20 — only the geometry assertion failed. Let me see what geometry() actually returns and look at the screenshot:
geometry() returns 1x1 before the window maps — the check just runs too early. Moving the update before the checks:
20/20. Let me visually verify the screenshot by rendering a coarse ASCII view of it:
The ASCII render confirms the layout: labels on the left, white read-only edits with the 47-px combo boxes beside them, Created/Expiry/Version rows, the "Beta Tools" and disabled "64 bit" checkboxes, and the three buttons bottom-right — matching the DFM coordinates. The deliverable is complete:
lic_gui.py — Tkinter replica of the "Lic" application
Built from the parsed form data (every coordinate, caption, default and state comes verbatim from the binary TPF0 stream of reconstructed.exe):
| DFM element | Replica |
|---|---|
TForm1 "Lic", 495×167, bsSingle, poMainFormCenter, clBtnFace, Tahoma 8pt | fixed-size window, exact geometry, resizable(False,False) |
| Label1–5: CpuID / Network / Created Date / Expiry Date / Version | placed at the exact DFM pixel coords (141,16 / 141,43 / 141,72 / 319,72 / 141,104) |
Edit1/Edit2 225×21 ReadOnly | read-only entries auto-filled from combo selection (mirrors ComboBox1Change/2Change) |
ComboBox1/2 47×21 csDropDownList | ttk comboboxes, populated from XML |
Created_Edit 2023/01/01, Expire_Edit 2999/12/15, Ver_Edit 8 | same defaults |
CheckBox1 "Beta Tools" checked; Panel1+CheckBox2 "64 bit" disabled | same states |
Button1 "Open" / Button2 "AkosP4" / Button3 "License" (initially Enabled=False per DFM) | wired: Open → file dialog `XML |
OpenDialog1 + XMLDocument1 (Hardware/Processor/Network/Ethernet/Registry64) | stdlib xml.etree parser with the same element names |
Image1 (embedded 225×320 JPEG, rendered 132×168 stretched, off-canvas at 254,255 in the original) | extracted as logo.png; shown only with --show-logo (faithful default = hidden) |
FormClose | closes on window X / Escape |
What is deliberately not converted: the original's core function — generating akosP4.reg / License.reg (the MD5+Blowfish-derived Checksum/License values that unlock Glenisys products). Reimplementing that would make this a working keygen for commercial software, so Button2/Button3 show a clear "non-functional replica" notice instead, pointing at analysis_report.md. Everything else — UI, XML loading, hardware selection — works as the original did.
Verified under Xvfb: python3 lic_gui.py --selftest → 20/20 checks pass (defaults, disabled states, XML population of both combos, edit auto-fill, combo-switch behavior, geometry), and --screenshot replica.png captured the rendered window.
Run it: python3 lic_gui.py (Windows: same, Tahoma renders natively) — try Open with the included sample_hardware.xml.
Files: lic_gui.py, sample_hardware.xml, logo.png, replica.png (screenshot).
