Add notification support

testing 1669761100
Cole Deck 2 years ago
parent d62fa3b79f
commit 2680f78cd6

@ -2,7 +2,7 @@ core:
autostart: true autostart: true
clockspeed: 20 clockspeed: 20
interval: 10 interval: 10
level: 2 level: 3
localadmin: true localadmin: true
sftp: sftp:
filepath: filepath:
@ -16,4 +16,4 @@ sftp:
port: 22 port: 22
user: ec2-user user: ec2-user
ui: ui:
darkmode: false darkmode: true

@ -10,6 +10,7 @@ from util import find_data_file
from util import fprint from util import fprint
from util import kill from util import kill
from util import run_cmd from util import run_cmd
from notification import send_notification
import taskbartool import taskbartool
import util import util
import netstat import netstat
@ -18,6 +19,7 @@ import auth
import panel import panel
import block import block
history = list() history = list()
displaydata = None displaydata = None
settings = None settings = None
@ -215,9 +217,11 @@ def mainloop(pool):
tmplist = settings["badapps"] tmplist = settings["badapps"]
settings["badapps"] = list() settings["badapps"] = list()
for x in tmplist: for x in tmplist:
send_notification("Killing PID " + str(x))
kill(x) kill(x)
if settings["fwll"] == True: if settings["fwll"] == True:
global history
tmplist = settings["badlines"] tmplist = settings["badlines"]
tmpstat = settings["stats"] tmpstat = settings["stats"]
tmpstat[0] += len(tmplist) tmpstat[0] += len(tmplist)
@ -227,8 +231,10 @@ def mainloop(pool):
badproto = line[1] badproto = line[1]
badip = line[4] badip = line[4]
badport = line[5] badport = line[5]
fprint("Firewalling " + badip + ":" + str(badport))
if (badip, badport) not in history: if (badip, badport) not in history:
fprint("Firewalling " + badip + ":" + str(badport))
send_notification("Firewalling " + badip + ":" + str(badport))
if win32: 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) 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) run_cmd(cmd)
@ -237,6 +243,7 @@ def mainloop(pool):
run_cmd(cmd) run_cmd(cmd)
else: else:
history.append((badip, badport)) history.append((badip, badport))
settings["badapps"] = list()
if settings["applyconfig"] == True: if settings["applyconfig"] == True:

@ -6,3 +6,5 @@ pandas
pyyaml pyyaml
numpy numpy
bcrypt bcrypt
plyer
playsound
Loading…
Cancel
Save