simplify OS detection

formac
Cole Deck 2 years ago
parent e043a03890
commit 166aa5d93a

@ -1 +0,0 @@
,FRAMEWORKWIN/Cole,frameworkwin,19.09.2022 23:09,file:///C:/Users/Cole/AppData/Roaming/LibreOffice/4;

@ -13,8 +13,11 @@ settings = None
netdata_res = None netdata_res = None
procdata_res = None procdata_res = None
win32 = platform == "win32"
linux = platform == "linux" or platform == "linux2"
macos = platform == "darwin"
# Get unique system values # Get unique system values
if platform == "win32": if win32:
sysid = hex(uuid.getnode()) sysid = hex(uuid.getnode())
# Python is running as Administrator (so netstat can get filename, to block, etc), # Python is running as Administrator (so netstat can get filename, to block, etc),
# so we use this to see who is actually logged in # so we use this to see who is actually logged in
@ -23,13 +26,13 @@ if platform == "win32":
userid, sysdom = username.rsplit("\\", 1) userid, sysdom = username.rsplit("\\", 1)
def run_ps(cmd): def run_ps(cmd):
if platform == "win32": if win32:
completed = subprocess.run(["powershell", "-Command", cmd], capture_output=True) completed = subprocess.run(["powershell", "-Command", cmd], capture_output=True)
return completed return completed
def netstat(): def netstat():
print("netstat started") print("netstat started")
if platform == "win32": if win32:
data = run_ps("netstat -n -o -b") data = run_ps("netstat -n -o -b")
return data return data
@ -41,7 +44,7 @@ def netstat_done(res):
def process_netstat(data): def process_netstat(data):
print("netstat processing") print("netstat processing")
if platform == 'win32': if win32:
#output = data.stdout #output = data.stdout
#print(output) #print(output)
output = data.stdout.decode().split('\r\n') # split stdout into lines output = data.stdout.decode().split('\r\n') # split stdout into lines

@ -1,7 +1,14 @@
0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663647380 0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663648244
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53387,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53494,[2606:4700:3035::ac43:ca7b]:443,TIME_WAIT,0
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53386,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53484,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53377,[2606:4700:3035::ac43:ca7b]:443,TIME_WAIT,0 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53483,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53482,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53481,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53480,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53479,[2607:f8b0:4009:808::2003]:80,ESTABLISHED,8008
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53478,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53474,[2607:f8b0:4009:81a::200a]:443,ESTABLISHED,8008
firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53473,[2607:f8b0:4009:81a::200a]:443,ESTABLISHED,8008
python.exe,TCP,127.0.0.1:51987,127.0.0.1:51986,ESTABLISHED,17244 python.exe,TCP,127.0.0.1:51987,127.0.0.1:51986,ESTABLISHED,17244
python.exe,TCP,127.0.0.1:51986,127.0.0.1:51987,ESTABLISHED,17244 python.exe,TCP,127.0.0.1:51986,127.0.0.1:51987,ESTABLISHED,17244
VSCodium.exe,TCP,127.0.0.1:51978,127.0.0.1:51977,ESTABLISHED,17828 VSCodium.exe,TCP,127.0.0.1:51978,127.0.0.1:51977,ESTABLISHED,17828
@ -36,6 +43,7 @@ tailscaled.exe,TCP,127.0.0.1:41112,127.0.0.1:50530,ESTABLISHED,8076
nxserver.bin,TCP,127.0.0.1:31770,127.0.0.1:49766,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:31770,127.0.0.1:49766,ESTABLISHED,8116
nxnode.bin,TCP,127.0.0.1:28488,127.0.0.1:50402,ESTABLISHED,11608 nxnode.bin,TCP,127.0.0.1:28488,127.0.0.1:50402,ESTABLISHED,11608
nxclient.bin,TCP,127.0.0.1:26068,127.0.0.1:50408,ESTABLISHED,11836 nxclient.bin,TCP,127.0.0.1:26068,127.0.0.1:50408,ESTABLISHED,11836
nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:53491,TIME_WAIT,0
nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:50406,ESTABLISHED,11836 nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:50406,ESTABLISHED,11836
nxnode.bin,TCP,127.0.0.1:23938,127.0.0.1:50405,ESTABLISHED,11608 nxnode.bin,TCP,127.0.0.1:23938,127.0.0.1:50405,ESTABLISHED,11608
nxserver.bin,TCP,127.0.0.1:22921,127.0.0.1:49762,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:22921,127.0.0.1:49762,ESTABLISHED,8116
@ -54,10 +62,13 @@ nxserver.bin,TCP,127.0.0.1:6363,127.0.0.1:49761,ESTABLISHED,8116
mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49674,ESTABLISHED,4076 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49674,ESTABLISHED,4076
mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49670,ESTABLISHED,4076 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49670,ESTABLISHED,4076
nxserver.bin,TCP,127.0.0.1:4742,127.0.0.1:50778,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:4742,127.0.0.1:50778,ESTABLISHED,8116
firefox.exe,TCP,104.194.122.206:53385,104.192.142.9:443,ESTABLISHED,8008 nxserver.bin,TCP,127.0.0.1:1045,127.0.0.1:53489,TIME_WAIT,0
firefox.exe,TCP,104.194.122.206:53384,142.250.190.78:443,ESTABLISHED,8008 nxserver.bin,TCP,104.194.122.206:53497,208.59.79.12:443,TIME_WAIT,0
firefox.exe,TCP,104.194.122.206:53383,54.201.164.58:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53493,142.250.190.78:443,ESTABLISHED,8008
firefox.exe,TCP,104.194.122.206:53382,35.186.227.140:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53477,146.75.78.2:443,ESTABLISHED,8008
firefox.exe,TCP,104.194.122.206:53476,162.159.130.232:443,TIME_WAIT,0
firefox.exe,TCP,104.194.122.206:53475,162.159.133.232:443,ESTABLISHED,8008
firefox.exe,TCP,104.194.122.206:53454,35.186.227.140:443,TIME_WAIT,0
VSCodium.exe,TCP,104.194.122.206:53314,76.76.21.61:443,ESTABLISHED,3816 VSCodium.exe,TCP,104.194.122.206:53314,76.76.21.61:443,ESTABLISHED,3816
VSCodium.exe,TCP,104.194.122.206:53313,76.76.21.164:443,ESTABLISHED,3816 VSCodium.exe,TCP,104.194.122.206:53313,76.76.21.164:443,ESTABLISHED,3816
firefox.exe,TCP,104.194.122.206:53289,162.159.135.234:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53289,162.159.135.234:443,ESTABLISHED,8008

1 0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663647380 0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663648244
2 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53387,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53494,[2606:4700:3035::ac43:ca7b]:443,TIME_WAIT,0
3 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53386,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53484,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
4 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53377,[2606:4700:3035::ac43:ca7b]:443,TIME_WAIT,0 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53483,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
5 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53482,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
6 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53481,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
7 Unknown,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53480,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
8 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53479,[2607:f8b0:4009:808::2003]:80,ESTABLISHED,8008
9 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53478,[2607:f8b0:4009:80b::200a]:443,TIME_WAIT,0
10 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53474,[2607:f8b0:4009:81a::200a]:443,ESTABLISHED,8008
11 firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53473,[2607:f8b0:4009:81a::200a]:443,ESTABLISHED,8008
12 python.exe,TCP,127.0.0.1:51987,127.0.0.1:51986,ESTABLISHED,17244 python.exe,TCP,127.0.0.1:51987,127.0.0.1:51986,ESTABLISHED,17244
13 python.exe,TCP,127.0.0.1:51986,127.0.0.1:51987,ESTABLISHED,17244 python.exe,TCP,127.0.0.1:51986,127.0.0.1:51987,ESTABLISHED,17244
14 VSCodium.exe,TCP,127.0.0.1:51978,127.0.0.1:51977,ESTABLISHED,17828 VSCodium.exe,TCP,127.0.0.1:51978,127.0.0.1:51977,ESTABLISHED,17828
43 nxserver.bin,TCP,127.0.0.1:31770,127.0.0.1:49766,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:31770,127.0.0.1:49766,ESTABLISHED,8116
44 nxnode.bin,TCP,127.0.0.1:28488,127.0.0.1:50402,ESTABLISHED,11608 nxnode.bin,TCP,127.0.0.1:28488,127.0.0.1:50402,ESTABLISHED,11608
45 nxclient.bin,TCP,127.0.0.1:26068,127.0.0.1:50408,ESTABLISHED,11836 nxclient.bin,TCP,127.0.0.1:26068,127.0.0.1:50408,ESTABLISHED,11836
46 nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:53491,TIME_WAIT,0
47 nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:50406,ESTABLISHED,11836 nxclient.bin,TCP,127.0.0.1:25001,127.0.0.1:50406,ESTABLISHED,11836
48 nxnode.bin,TCP,127.0.0.1:23938,127.0.0.1:50405,ESTABLISHED,11608 nxnode.bin,TCP,127.0.0.1:23938,127.0.0.1:50405,ESTABLISHED,11608
49 nxserver.bin,TCP,127.0.0.1:22921,127.0.0.1:49762,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:22921,127.0.0.1:49762,ESTABLISHED,8116
62 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49674,ESTABLISHED,4076 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49674,ESTABLISHED,4076
63 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49670,ESTABLISHED,4076 mDNSResponder.exe,TCP,127.0.0.1:5354,127.0.0.1:49670,ESTABLISHED,4076
64 nxserver.bin,TCP,127.0.0.1:4742,127.0.0.1:50778,ESTABLISHED,8116 nxserver.bin,TCP,127.0.0.1:4742,127.0.0.1:50778,ESTABLISHED,8116
65 firefox.exe,TCP,104.194.122.206:53385,104.192.142.9:443,ESTABLISHED,8008 nxserver.bin,TCP,127.0.0.1:1045,127.0.0.1:53489,TIME_WAIT,0
66 firefox.exe,TCP,104.194.122.206:53384,142.250.190.78:443,ESTABLISHED,8008 nxserver.bin,TCP,104.194.122.206:53497,208.59.79.12:443,TIME_WAIT,0
67 firefox.exe,TCP,104.194.122.206:53383,54.201.164.58:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53493,142.250.190.78:443,ESTABLISHED,8008
68 firefox.exe,TCP,104.194.122.206:53382,35.186.227.140:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53477,146.75.78.2:443,ESTABLISHED,8008
69 firefox.exe,TCP,104.194.122.206:53476,162.159.130.232:443,TIME_WAIT,0
70 firefox.exe,TCP,104.194.122.206:53475,162.159.133.232:443,ESTABLISHED,8008
71 firefox.exe,TCP,104.194.122.206:53454,35.186.227.140:443,TIME_WAIT,0
72 VSCodium.exe,TCP,104.194.122.206:53314,76.76.21.61:443,ESTABLISHED,3816 VSCodium.exe,TCP,104.194.122.206:53314,76.76.21.61:443,ESTABLISHED,3816
73 VSCodium.exe,TCP,104.194.122.206:53313,76.76.21.164:443,ESTABLISHED,3816 VSCodium.exe,TCP,104.194.122.206:53313,76.76.21.164:443,ESTABLISHED,3816
74 firefox.exe,TCP,104.194.122.206:53289,162.159.135.234:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53289,162.159.135.234:443,ESTABLISHED,8008
Loading…
Cancel
Save