From 2680f78cd640189f9e24984ec5654cc3468af4b2 Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Tue, 29 Nov 2022 16:31:24 -0600 Subject: [PATCH] Add notification support --- config.yml | 4 ++-- ippigeon.py | 9 ++++++++- requirements.txt | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config.yml b/config.yml index 6730710..a2ba196 100644 --- a/config.yml +++ b/config.yml @@ -2,7 +2,7 @@ core: autostart: true clockspeed: 20 interval: 10 - level: 2 + level: 3 localadmin: true sftp: filepath: @@ -16,4 +16,4 @@ sftp: port: 22 user: ec2-user ui: - darkmode: false + darkmode: true diff --git a/ippigeon.py b/ippigeon.py index cc8beca..6b50c29 100644 --- a/ippigeon.py +++ b/ippigeon.py @@ -10,6 +10,7 @@ from util import find_data_file from util import fprint from util import kill from util import run_cmd +from notification import send_notification import taskbartool import util import netstat @@ -18,6 +19,7 @@ import auth import panel import block + history = list() displaydata = None settings = None @@ -215,9 +217,11 @@ def mainloop(pool): tmplist = settings["badapps"] settings["badapps"] = list() for x in tmplist: + send_notification("Killing PID " + str(x)) kill(x) if settings["fwll"] == True: + global history tmplist = settings["badlines"] tmpstat = settings["stats"] tmpstat[0] += len(tmplist) @@ -227,8 +231,10 @@ def mainloop(pool): badproto = line[1] badip = line[4] badport = line[5] - fprint("Firewalling " + badip + ":" + str(badport)) + if (badip, badport) not in history: + fprint("Firewalling " + badip + ":" + str(badport)) + send_notification("Firewalling " + badip + ":" + str(badport)) if win32: cmd = 'New-NetFirewallRule -DisplayName "IPPigeon Security Rule ' + badip + ':' + str(badport) + '" -Group "IPPigeon" -Direction Outbound -LocalPort Any -Protocol ' + badproto + ' -Action Block -RemoteAddress ' + badip + ' -RemotePort ' + str(badport) run_cmd(cmd) @@ -237,6 +243,7 @@ def mainloop(pool): run_cmd(cmd) else: history.append((badip, badport)) + settings["badapps"] = list() if settings["applyconfig"] == True: diff --git a/requirements.txt b/requirements.txt index 8f85568..6461a9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,6 @@ cx_Freeze pandas pyyaml numpy -bcrypt \ No newline at end of file +bcrypt +plyer +playsound \ No newline at end of file