-
Notifications
You must be signed in to change notification settings - Fork 1
/
AnyXist.py
68 lines (56 loc) · 2.03 KB
/
AnyXist.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
60
61
62
63
64
65
66
67
68
import psutil
import os
import socket
hostname=socket.gethostname()
IPAddr=socket.gethostbyname(hostname)
IPAddr = IPAddr.split(".")
IPAddr = IPAddr[0]+"."+IPAddr[1]
print("""
_____ ____ ___.__ __
/ _ \ ____ ___.__.\ \/ /|__| _______/ |_
/ /_\ \ / < | | \ / | |/ ___/\ __\\
/ | \ | \___ | / \ | |\___ \ | |
\____|__ /___| / ____|/___/\ \|__/____ > |__|
\/ \/\/ \_/ \/
> python anydesk ip grabber for windows
> made by n0nexist
""")
logfile = "ip-grabbati.txt"
process_name = "anydesk"
pidlist = list()
hostlist = list()
print("Looking for anydesk..")
for proc in psutil.process_iter():
if process_name in proc.name().lower():
pidlist.append(proc.pid)
if len(pidlist) == 0:
print("ERROR: no open anydesk found")
exit()
else:
print("ANYDESK found: listening for connections (CNTRL-C to stop)")
while True:
try:
for x in os.popen("netstat -n -a -o").read().split("\n"):
for y in pidlist:
if str(y) in x and ("SYN_SENT" in x or "ESTABILISHED" in x) and ("UDP" not in x):
hostandport = x.split(":")
host = hostandport[1].split(" ")[-1]
port = hostandport[2].split(" ")[0]
if host not in hostlist:
hostlist.append(host)
print("\n"+("#"*20))
flag = ""
if host.startswith(IPAddr):
flag = "!! this may be your local ip address"
print(f"""NEW CONNECTION FOUND!
{flag}
info:
ip -> {host}
port -> {port}
process id -> {str(y)}""")
f = open(logfile,"a")
f.write("INFO:\nip: "+host+"\nport: "+port+"\nPID: "+str(y)+"\n\n")
f.close()
except KeyboardInterrupt:
print("\nCONTROL-C detected, exiting")
exit()