Skip to content

Instantly share code, notes, and snippets.

@pawlos
Created February 1, 2020 20:27
Show Gist options
  • Select an option

  • Save pawlos/a5b9958bd90e6b26c83d3671642e434d to your computer and use it in GitHub Desktop.

Select an option

Save pawlos/a5b9958bd90e6b26c83d3671642e434d to your computer and use it in GitHub Desktop.
''' i = 0;
sum = 0xffffffff;
while (*(char *)(param_1 + i) != '\0') {
iVar1 = i + 1;
sum = sum ^ (int)*(char *)(param_1 + i);
cnt = 7;
while (i = iVar1, -1 < cnt) {
sum = -(sum & 1) & 0xedb88320 ^ sum >> 1;
cnt = cnt + -1;
}
}
return (ulong)(sum == 0x29990129);'''
import string
import itertools
def brute(data):
s = 0xffffffff
for i in range(len(data)):
if data[i] == 0x00:
break
#iVar1 = i + 1
s = s ^ ord(data[i])
s = s & 0xffffffff
cnt = 7
while (cnt > -1):
s = -(s & 1) & 0xedb88320 ^ (s >> 1)
s = s & 0xffffffff
cnt -= 1
#print s
return s
alphabet = string.ascii_lowercase + string.ascii_uppercase + string.digits + '!@#$%^&*-_<>[]{}'
for a in itertools.product(alphabet, repeat=4):
if brute(a) == 0x29990129:
print ''.join(a)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment