diff --git a/main.py b/main.py index 3da68e7..e9b9664 100644 --- a/main.py +++ b/main.py @@ -13,10 +13,12 @@ settings = None netdata_res = None procdata_res = None -sysid = hex(uuid.getnode()) -res = subprocess.check_output(["WMIC", "ComputerSystem", "GET", "UserName"], universal_newlines=True) -_, username = res.strip().rsplit("\n", 1) -userid, sysdom = username.rsplit("\\", 1) +# Get unique system values +if platform == "win32": + sysid = hex(uuid.getnode()) + res = subprocess.check_output(["WMIC", "ComputerSystem", "GET", "UserName"], universal_newlines=True) + _, username = res.strip().rsplit("\n", 1) + userid, sysdom = username.rsplit("\\", 1) def run_ps(cmd): if platform == "win32": @@ -25,8 +27,9 @@ def run_ps(cmd): def netstat(): print("netstat started") - data = run_ps("netstat -n -o -b") - return data + if platform == "win32": + data = run_ps("netstat -n -o -b") + return data def netstat_done(res): print("netstat done") @@ -108,9 +111,7 @@ if __name__ == '__main__': freeze_support() # required if packaged into EXE # create manager to share data to me, background, foreground # create worker pool - #global sysid - #sysdom, userid - print(sysid, sysdom, userid) + with Pool(processes=5) as pool: with Manager() as manager: displaydata = manager.list(range(2)) # data to be printed diff --git a/out.csv b/out.csv index 5e2a999..8e2f02e 100644 --- a/out.csv +++ b/out.csv @@ -1,8 +1,7 @@ -0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663646899 -firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53338,[2607:f518:5::4816:b9c7]:80,ESTABLISHED,8008 -firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53301,[2607:f8b0:4009:817::200e]:443,ESTABLISHED,8008 -firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53292,[2607:f8b0:4009:808::2003]:80,TIME_WAIT,0 -firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53285,[2606:4700:4400::6812:2962]:443,TIME_WAIT,0 +0xf44ee3942e7d,FRAMEWORKWIN,Cole,1663647380 +firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53387,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 +firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53386,[2607:f8b0:4009:81c::200a]:443,ESTABLISHED,8008 +firefox.exe,TCP,[2620:f3:8000:5060:5939:a4c0:4f5b:113f]:53377,[2606:4700:3035::ac43:ca7b]:443,TIME_WAIT,0 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 VSCodium.exe,TCP,127.0.0.1:51978,127.0.0.1:51977,ESTABLISHED,17828 @@ -55,23 +54,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:49670,ESTABLISHED,4076 nxserver.bin,TCP,127.0.0.1:4742,127.0.0.1:50778,ESTABLISHED,8116 -nxserver.bin,TCP,104.194.122.206:53343,208.59.79.12:443,TIME_WAIT,0 -nxserver.bin,TCP,104.194.122.206:53340,54.212.237.219:443,TIME_WAIT,0 -firefox.exe,TCP,104.194.122.206:53339,54.212.237.219:443,ESTABLISHED,8008 -firefox.exe,TCP,104.194.122.206:53337,54.212.237.219:443,ESTABLISHED,8008 -firefox.exe,TCP,104.194.122.206:53335,208.59.79.12:443,TIME_WAIT,0 -firefox.exe,TCP,104.194.122.206:53334,208.59.79.12:443,ESTABLISHED,8008 +firefox.exe,TCP,104.194.122.206:53385,104.192.142.9:443,ESTABLISHED,8008 +firefox.exe,TCP,104.194.122.206:53384,142.250.190.78:443,ESTABLISHED,8008 +firefox.exe,TCP,104.194.122.206:53383,54.201.164.58:443,ESTABLISHED,8008 +firefox.exe,TCP,104.194.122.206:53382,35.186.227.140:443,ESTABLISHED,8008 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:53312,76.76.21.164:443,CLOSE_WAIT,3816 -firefox.exe,TCP,104.194.122.206:53307,104.192.142.9:443,ESTABLISHED,8008 -firefox.exe,TCP,104.194.122.206:53300,54.201.164.58:443,TIME_WAIT,0 -firefox.exe,TCP,104.194.122.206:53299,35.186.227.140:443,ESTABLISHED,8008 -firefox.exe,TCP,104.194.122.206:53298,162.159.130.232:443,TIME_WAIT,0 -firefox.exe,TCP,104.194.122.206:53297,162.159.128.232:443,TIME_WAIT,0 -firefox.exe,TCP,104.194.122.206:53290,162.159.138.232:443,TIME_WAIT,0 firefox.exe,TCP,104.194.122.206:53289,162.159.135.234:443,ESTABLISHED,8008 -firefox.exe,TCP,104.194.122.206:53284,72.21.91.29:80,TIME_WAIT,0 firefox.exe,TCP,104.194.122.206:53160,142.250.191.106:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:53154,142.250.191.106:443,ESTABLISHED,8008 firefox.exe,TCP,104.194.122.206:52525,104.192.142.11:443,ESTABLISHED,8008