-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFingerUserEnum.py
More file actions
executable file
·66 lines (52 loc) · 1.81 KB
/
FingerUserEnum.py
File metadata and controls
executable file
·66 lines (52 loc) · 1.81 KB
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
60
61
62
63
64
65
66
#!/usr/bin/python3
import socket
import argparse
import time
import concurrent.futures
def sock(user):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((rhost, rport))
s.send(bytes(user, encoding='utf-8'))
r = s.recv(4096)
s.close()
bytes_list = r.strip().split()
last1 = bytes_list[-1].decode('utf-8')
last2 = bytes_list[-2].decode('utf-8')
if last1 == '???' and last2 == user[:-1]:
#print(f"user {user[:-1]} not found")
return
else:
print(f"possible user {user[:-1]} found:")
print(r.decode('utf-8'))
return
parser = argparse.ArgumentParser()
parser.add_argument("rhost", help="set the remote host", type=str)
parser.add_argument("wordlist", help="enumerate user from this wordlist", type=str)
parser.add_argument("--rport", help="set the remote port", default=79, type=int)
parser.add_argument("--threads", help="set the number of threads", default=10, type=int)
args = parser.parse_args()
rhost = args.rhost
rport = args.rport
th = args.threads
wordlist = args.wordlist
print(f"""
[+] rhost: {rhost}
[+] rport: {rport}
[+] wordlist: {wordlist}
""")
# User not found
#Login Name TTY Idle When Where
#info ???
# User found
#
#Login Name TTY Idle When Where
#root Super-User console <Dec 19 10:30>
#
#Login Name TTY Idle When Where
#sunny ??? console <Dec 19 09:56>
start_time = time.perf_counter()
with open(wordlist, 'r') as userlist:
with concurrent.futures.ThreadPoolExecutor(max_workers=th) as executor:
results = [executor.submit(sock, user) for user in userlist]
duration = time.perf_counter() - start_time
print(f'Finished in {round(duration, 2)} second(s)')