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 yourself
1.txt
2.txt
3.txt
4.txt
5.txt
6.txt
7.txt
8.txt
9.txt
10.txt
11.txt
12.bin
14.bin
16.bin
18.bin
20.bin
24.bin
28.bin
30.bin
34.bin
38.txt
TFORM1.dfm

Analyze the files

Dr.Binary
run_sandbox
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file

The txt files look like PE-bear (Russian UI) exports of a Windows PE. Let me inspect the bin files.

run_sandbox
run_sandbox

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.

run_sandbox
run_sandbox

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.

run_sandbox

Empty output — let me debug with exceptions visible.

run_sandbox

Resource tree parsed. Now extract PACKAGEINFO, TFORM1, DVCLAL, and the manifest, and compare TFORM1 with the uploaded TFORM1.dfm.

run_sandbox

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.

run_sandbox

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.

run_sandbox

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.

run_sandbox
run_sandbox

My value-kind mapping was wrong — TPF0 uses TReader's vaX codes. Rewriting with correct semantics:

run_sandbox

Found the bug — in readprops I read the length byte twice. Fixing:

run_sandbox

Still desyncing around Caption. Let me look at the raw bytes to debug the exact encoding.

run_sandbox

The encoding has quirks (e.g. the byte after vaBinary). Let me empirically locate where the Icon.Data binary blob ends by scanning forward.

run_sandbox

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:

run_sandbox

Clean parse of all 243,615 bytes. Let me view the form tree:

read_file

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.

run_sandbox
run_sandbox

The image is a TJPEGImage stream (167,691-byte JPEG). Extracting it, and grepping the strings dump properly (2.txt is UTF-8):

run_sandbox
run_sandbox

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:

run_sandbox

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:

run_sandbox
run_sandbox

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:

run_sandbox

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:

run_sandbox
run_sandbox

Got handler addresses: Button1Click=0x4EA0EC, ComboBox1Change=0x4EA1F0, ComboBox2Change=0x4EA2F4, FormClose=0x4EA328, FormShow=0x4E9BFC, Button3Click=0x4E9B28. Disassembling the handlers with rizin on the reconstructed PE:

run_sandbox

Button3Click reads two edits, calls fcn.004e56bc (license computation), then shows "Import License.reg...". Let me look at that core function:

run_sandbox

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:

run_sandbox
run_sandbox

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:

run_sandbox

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:

run_sandbox
run_sandbox
run_sandbox
run_sandbox

Let me confirm what Button1Click (XML open) does and check dynamic API usage, then I'll compile the report:

run_sandbox
run_sandbox

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:

run_sandbox
run_sandbox
run_sandbox
run_sandbox
run_sandbox
run_sandbox
run_sandbox
run_sandbox
run_sandbox

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:

run_sandbox

The icon extraction offsets were off — let me redo it cleanly:

run_sandbox

The blob already has a proper ICONDIR (00 00 01 00 07 00) — writing it directly:

run_sandbox

mainicon.ico validates (7 images, 16→96px). Quick look at 38.txt (the only unexamined txt), then I'll write up the report:

read_file
run_sandbox
write_file

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 named Keygen, with custom units BlowFish, 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/Registry64 nodes); AkosP4 and License generate akosP4.reg / License.reg templates under HKLM\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 .reg files (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

Dr.Binary

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.

write_file
run_sandbox

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:

run_sandbox

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:

run_sandbox

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:

run_sandbox

Let me look at the exact class code as written:

read_file

The class code reads identical to the debug walk yet yields 2-deep paths — let me instrument it directly to see what's happening:

run_sandbox

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:

read_file

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:

edit_file
edit_file

Now fix the published-methods offset, the reconstruct size, and clean up the leftovers:

edit_file
edit_file
edit_file
edit_file

Now re-run and verify against the known-good results from the manual analysis:

run_sandbox

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:

edit_file
run_sandbox

The headers file was never in the parts list, so reconstruct skipped it. Fixing:

edit_file
run_sandbox

One last mapping nit: the DOS-stub length must be e_lfanew - 0x40 (=0xC0), not to the section table:

edit_file
run_sandbox

All parts mapped. Final verification — artifacts must be byte-identical to the manual-analysis outputs:

run_sandbox
run_sandbox

Two cosmetic diffs in the tree dump (quoting rules and the ICONDIR annotation). Let me match the reference output exactly:

edit_file
edit_file
edit_file
edit_file
edit_file
run_sandbox

form_tree.txt is now byte-identical too. One final full run to show the complete output:

run_sandbox

Done. The analysis workflow is now a single reusable Python program: pe_keygen_analyzer.py (stdlib only, ~650 lines).

What it does

StageFunctionResult on your files
1PeHeaders — COFF/optional/section-table parserPE32, base 0x400000, EP RVA 0xEB98C, build 2013-10-08 UTC
2map_bin_parts — auto-assigns every .bin to its PE region by raw size14.bin=headers, 12.bin=DOS stub, 34/30/28/24/20/18/16.bin = .text/.itext/.data/.idata/.rdata/.reloc/.rsrc
3Resources — 3-level .rsrc directory walker42 entries; extracts DVCLAL, PACKAGEINFO, TFORM1, manifest (→ "Delphi 2007")
4parse_packageinfo — flags, requires, 74 unit namesproject unit Keygen, custom units BlowFish, Md5, License, Corvina, ÔakosP4…
5Tpf0Parser — full binary-DFM parser (all 20 D2007 TValueTypes, collections, blobs)243,615/243,615 bytes parsed → form_tree.txt
5bblob extractors (Icon.Data, Picture.Data/TJPEGImage)mainicon.ico (7 images), embedded.jpg (225×320)
6reconstruct — rebuilds the on-disk PEreconstructed.exe, 1,385,984 B
7load_strings_dump / interesting_strings / feature_keys — mines the PE-bear strings export94 IOC-ish strings, 69 feature keys, Glenisys reg templates
8find_crypto — MD5/Blowfish constant locatorMD5 @0x4E633E, Blowfish P-array @0x4EE8C8
9parse_published_methods — Delphi [size][addr][name] RTTI walkerButton1Click 0x4E8F30, Button2Click 0x4E9B28, Button3Click 0x4E9BFC, …
10writes summary.json + prints the reportmachine-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)

Dr.Binary

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:

run_sandbox

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):

run_sandbox

Now the GUI program itself — every coordinate, caption, default and state taken from the parsed TFORM1 stream:

write_file

Now the sample hardware XML (matching the element names the original binary looks for) and a headless test under Xvfb:

write_file
run_sandbox

SystemButtonFace is Windows-only Tk — need a portable fallback for the clBtnFace background:

edit_file
edit_file
edit_file
edit_file
run_sandbox

19/20 — only the geometry assertion failed. Let me see what geometry() actually returns and look at the screenshot:

run_sandbox

geometry() returns 1x1 before the window maps — the check just runs too early. Moving the update before the checks:

edit_file
edit_file
run_sandbox

20/20. Let me visually verify the screenshot by rendering a coarse ASCII view of it:

run_sandbox

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 elementReplica
TForm1 "Lic", 495×167, bsSingle, poMainFormCenter, clBtnFace, Tahoma 8ptfixed-size window, exact geometry, resizable(False,False)
Label1–5: CpuID / Network / Created Date / Expiry Date / Versionplaced at the exact DFM pixel coords (141,16 / 141,43 / 141,72 / 319,72 / 141,104)
Edit1/Edit2 225×21 ReadOnlyread-only entries auto-filled from combo selection (mirrors ComboBox1Change/2Change)
ComboBox1/2 47×21 csDropDownListttk comboboxes, populated from XML
Created_Edit 2023/01/01, Expire_Edit 2999/12/15, Ver_Edit 8same defaults
CheckBox1 "Beta Tools" checked; Panel1+CheckBox2 "64 bit" disabledsame 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)
FormClosecloses 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).