This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import itertools | |
import struct | |
import string | |
import sys | |
def send_data( rsocket, data ): | |
length = struct.pack('I',len(data)) | |
rsocket.send(length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle(self): | |
nonce = os.urandom(8) | |
self.wfile.write(nonce) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import zlib | |
import sys | |
PROBLEM_KEY = 'crime_sometimes_pays' | |
print len(zlib.compress(sys.argv[1]+PROBLEM_KEY)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0x080485ef <main+89>: mov DWORD PTR [esp+0x4],0x8049140 | |
0x080485f7 <main+97>: mov DWORD PTR [esp],0x80491a0 | |
0x080485fe <main+104>: call 0x80483d8 <wcscmp@plt> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) call wprintf(0x8049140) | |
$1 = 8 | |
(gdb) call fflush(stdout) | |
SecretPW$2 = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from time import time | |
from os import system | |
from Crypto.PublicKey import RSA | |
SEED = int(time()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |