Skip to content

Instantly share code, notes, and snippets.

from Crypto.PublicKey import pubkey
from Crypto.Util import number
from Crypto.PublicKey import RSA
from Crypto.PublicKey import _slowmath
import fractions
import sys
import os
e = long(65537)
p = long(13097286606179453667665592444299109782484218865253457545521978739889248320232481682880143106432871469494586765663594908396375009598486558938138835723794021)
from Crypto.PublicKey import pubkey
from Crypto.Util import number
import fractions
import sys
MIN_SEED = int(sys.argv[1])
MAX_SEED = int(sys.argv[2])
SEED = MAX_SEED
#!/usr/bin/python
import sys
import base64
import struct
filename = sys.argv[1]
file_contents = open(filename,'rb').read()
base64_encoded_info = file_contents.split(' ')[1]
raw_bytes = base64.b64decode(base64_encoded_info)
#!/usr/bin/env python
from time import time
from os import system
from Crypto.PublicKey import RSA
SEED = int(time())
def hex2bytes(hex_string):
bytes = bytearray()
for i in range(0,len(hex_string),2):
bytes.append( int(data[i:i+2],16) )
return bytes
def conv_chunk( chunk, i = 0, max = 4 ):
charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
return conv_chunk(chunk>>6,i+1,max)+(charset[(chunk)&0x3F]) if i < max else ''
rik@sec:~/ctf/plaid2013/compression$ python ctest.py aaaa
30
rik@sec:~/ctf/plaid2013/compression$ python ctest.py bbbb
30
rik@sec:~/ctf/plaid2013/compression$ python ctest.py cccc
29
rik@sec:~/ctf/plaid2013/compression$ python ctest.py dddd
30
(gdb) call wprintf(0x8049140)
$1 = 8
(gdb) call fflush(stdout)
SecretPW$2 = 0
0x080485ef <main+89>: mov DWORD PTR [esp+0x4],0x8049140
0x080485f7 <main+97>: mov DWORD PTR [esp],0x80491a0
0x080485fe <main+104>: call 0x80483d8 <wcscmp@plt>
(gdb) disas main
Dump of assembler code for function main:
0x08048596 <main+0>: push ebp
0x08048597 <main+1>: mov ebp,esp
0x08048599 <main+3>: sub esp,0x18
0x0804859c <main+6>: and esp,0xfffffff0
0x0804859f <main+9>: mov eax,0x0
0x080485a4 <main+14>: sub esp,eax
0x080485a6 <main+16>: cmp DWORD PTR [ebp+0x8],0x2
0x080485aa <main+20>: je 0x80485ca <main+52>
#!/usr/bin/python
import zlib
import sys
PROBLEM_KEY = 'crime_sometimes_pays'
print len(zlib.compress(sys.argv[1]+PROBLEM_KEY))