diff --git a/block.py b/block.py index fb0fc84..ed241b0 100644 --- a/block.py +++ b/block.py @@ -57,7 +57,9 @@ def block_conn(config, datafile, res): continue srcip = line[2].split(":")[0] + srcport = line[2].split(":")[1] destip = line[3].split(":")[0] + destport = line[3].split(":")[1] pid = line[5] try: pid = int(pid) @@ -67,10 +69,12 @@ def block_conn(config, datafile, res): for line in baddata: #fprint(destip + " " + line[4]) badsrcip = line[2] + badsrcport = line[3] baddestip = line[4] + baddestport = line[5] badpid = line[11] - if srcip == badsrcip or destip == baddestip and not pid in badapps: + if ((srcip == badsrcip and srcport == badsrcport) or (destip == baddestip and destport == baddestport)) and not pid in badapps: found = True fprint("FLAG " + srcip + " " + destip + " " + str(pid)) badapps.append(pid) diff --git a/config.yml b/config.yml index 5ee497b..e248712 100644 --- a/config.yml +++ b/config.yml @@ -2,7 +2,7 @@ core: autostart: true clockspeed: 20 interval: 5 - level: 3 + level: 2 localadmin: true sftp: filepath: diff --git a/panel.py b/panel.py index 445f8ca..dec6724 100644 --- a/panel.py +++ b/panel.py @@ -276,10 +276,11 @@ class ServerPanel(wx.Panel): if str(TEST_FILE.iloc[i, 4]).find("TIME_WAIT") >= 0 or str(TEST_FILE.iloc[i, 4]).find("FIN_WAIT_2") >= 0: continue idx = 0 - for ip in settings["badips"]: + for app in settings["badapps"]: #fprint(pid) idx = i - if str(TEST_FILE.iloc[i, 3]).find(ip) >= 0 and str(TEST_FILE.iloc[i, 4]).find("TIME_WAIT") < 0: # "bad" pid, highlight in red at the top + if TEST_FILE.iloc[i, 5] == app: # "bad" pid, highlight in red at the top + fprint("BAD APP UI: " + str(app)) idx = self.list_ctrl.InsertItem(0, TEST_FILE.iloc[i, 0]) self.list_ctrl.SetItemBackgroundColour(idx, wx.Colour(200, 51, 51)) break diff --git a/ssh.py b/ssh.py index 09a78e3..2ecee16 100644 --- a/ssh.py +++ b/ssh.py @@ -3,16 +3,18 @@ from fabric import Connection from util import find_data_file from util import setup_child from util import fprint +from util import macos from invoke import exceptions import sys def sftp_send_data(config, filename, filetype): setup_child() - fprint("Connecting over SSH to " + config['sftp']['host']) - c = Connection(host=config['sftp']['host'], user=config['sftp']['user'], port=config['sftp']['port'], connect_kwargs={"key_filename": find_data_file(config['sftp']['keyfile']),}) - fprint("Sending data over SFTP: " + filename) - fprint(c.put(find_data_file(filename), remote=config['sftp']['filepath'][filetype])) - fprint("Data sent over SFTP successfully") + if not macos: + fprint("Connecting over SSH to " + config['sftp']['host']) + c = Connection(host=config['sftp']['host'], user=config['sftp']['user'], port=config['sftp']['port'], connect_kwargs={"key_filename": find_data_file(config['sftp']['keyfile']),}) + fprint("Sending data over SFTP: " + filename) + fprint(c.put(find_data_file(filename), remote=config['sftp']['filepath'][filetype])) + fprint("Data sent over SFTP successfully") #command = 'ls ' + config['sftp']['filepath'][filetype] #fprint(c.run(command))