| Just solved it. I really enjoyed this one. No miles of C++ GTK code to sift through, just pure ASM goodness. As an older beginner it took me just longer than 2 hours. |
==> |
| Oops something got messed up in my last post. Trying one more time. Sorry, I'm new here.
*** SPOILER BELOW ***
```
import struct
import sys
def generate_key(username):
# ---
# Step 0: xor each lot of 4 characters with each other so we end up with a username 4 bytes long for the key generation.
# We pad with null bytes if the chunks are shorter than 4 chars.
# ---
chunk_size = 4
starting_chunk = username.ljust(chunk_size, '\0').encode('ascii')[:4]
starting_chunk_int = struct.unpack(' 4:
for i in range(4, len(username), chunk_size):
chunk = username[i:i + chunk_size].ljust(4, '\0').encode('ascii')[:4]
chunk_int = struct.unpack('")
print("\nExample: python {sys.argv[0]} asdf")
else:
username_input = sys.argv[1]
key = generate_key(username_input)
if key:
print(f"Username: {username_input}")
print(f"Key: {key}")
``` |
==> |
| Lots of fun. Thanks a lot.
There was lots of cruft in the code. I never realized how messy C++ / GUI code is.
I couldn't be bothered writing a full write up but here's my solution so BEWARE SPOILERS BELOW!
*** SPOILER ***
First upx unpack the executable.
Then see this keygen python script for the solution.
```
import struct
import sys
def generate_key(username):
# ---
# Step 0: xor each lot of 4 characters with each other so we end up with a username 4 bytes long for the key generation.
# We pad with null bytes if the chunks are shorter than 4 chars.
# ---
chunk_size = 4
starting_chunk = username.ljust(chunk_size, '\0').encode('ascii')[:4]
starting_chunk_int = struct.unpack(' 4:
for i in range(4, len(username), chunk_size):
chunk = username[i:i + chunk_size].ljust(4, '\0').encode('ascii')[:4]
chunk_int = struct.unpack('")
print("\nExample: python {sys.argv[0]} asdf")
else:
username_input = sys.argv[1]
key = generate_key(username_input)
if key:
print(f"Username: {username_input}")
print(f"Key: {key}")
```
*** SPOILER ***
|
==> |
| I really enjoyed this. I learned so much! How much would PIE complicate things? |
==> |