Add quit button

testing 1669164586
Cole Deck 2 years ago
parent 9ac35912dd
commit b4a46ad253

@ -10,7 +10,7 @@ import time
import csv
import ssh
def get_blocklist(config):
def get_blocklist(config, appendbad):
setup_child()
fprint("Downloading deny list from server")
data = ssh.check_for_file(config, "BadIPs.csv", "receive")
@ -21,13 +21,9 @@ def get_blocklist(config):
data2.append(row)
data2 = [i for i in data2 if i]
#fprint(data2)
data2.append(["N/A", "TCP", "N/A", "N/A", "20.112.52.29", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "20.81.111.85", "80", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "100.115.71.78", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "100.115.71.78", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "174.143.130.167", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "216.47.134.203", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
data2.append(["N/A", "TCP", "N/A", "N/A", "34.111.83.189", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
for line in appendbad:
data2.append(line)
fprint(data2)

@ -192,7 +192,7 @@ def mainloop(pool):
if settings["block"] == True and settings["running"] == True:
blockdata_res = pool.apply_async(block.get_blocklist, (config,), callback=blockdata_done)
blockdata_res = pool.apply_async(block.get_blocklist, (config, settings["appendbad"]), callback=blockdata_done)
#block.get_blocklist(config)
settings["block"] = False
@ -302,6 +302,16 @@ if __name__ == '__main__':
settings["fwll"] = 0
settings["running"] = config["core"]["autostart"]
settings["newdata"] = False
settings["appendbad"] = list()
tmp = list()
tmp.append(["N/A", "TCP", "N/A", "N/A", "20.112.52.29", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "20.81.111.85", "80", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "100.115.71.78", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "100.115.71.78", "5000", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "174.143.130.167", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "216.47.134.203", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
tmp.append(["N/A", "TCP", "N/A", "N/A", "34.111.83.189", "443", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"])
settings["appendbad"] = tmp
# connections blocked, total connections allowed, count of data sent, data recieved, ratio blocked-unblocked
settings["stats"] = [0, 0, 0, 0, 0.0]

@ -199,6 +199,9 @@ class ServerPanel(wx.Panel):
self.login_button = wx.Button(self, label='Login')
#self.login_button.SetBackgroundColour((205, 215, 206))
self.login_button.Bind(wx.EVT_BUTTON, self.on_login)
self.quit_button = wx.Button(self, label='Quit IPPigeon')
#self.login_button.SetBackgroundColour((205, 215, 206))
self.quit_button.Bind(wx.EVT_BUTTON, self.on_quit)
self.sub_sizer_right.Add(self.statustext, 0, wx.CENTER | wx.ALL | 100, 5)
self.sub_sizer_right.Add(self.logintext, 0, wx.CENTER | wx.ALL | 100, 5)
@ -206,6 +209,7 @@ class ServerPanel(wx.Panel):
self.sub_sizer_left.Add(self.stop_button, 0, wx.CENTER | wx.ALL | 100, 5)
self.sub_sizer_left.Add(self.secondary_frame_button, 0, wx.CENTER | wx.ALL | 100, 5)
self.sub_sizer_right.Add(self.login_button, 0, wx.CENTER | wx.ALL | 100, 5)
self.sub_sizer_right.Add(self.quit_button, 0, wx.CENTER | wx.ALL | 100, 5)
self.sub_sizer_stats.Add(self.stattext, 0, wx.CENTER | wx.ALL | 100, 5)
self.SetSizer(self.main_sizer)
self.start_button.Enable(enable=settings["loggedin"])
@ -224,6 +228,7 @@ class ServerPanel(wx.Panel):
self.start_button.Enable(enable=settings["loggedin"])
self.stop_button.Enable(enable=settings["loggedin"])
self.secondary_frame_button.Enable(enable=settings["loggedin"])
self.quit_button.Enable(enable=settings["loggedin"])
def updatedata(self):
global settings
if settings["running"] == True:
@ -304,7 +309,11 @@ class ServerPanel(wx.Panel):
dg2 = ServerFrame()
#dg2.ShowModal()
def on_quit(self, event):
global killme
killme.value += 1
self.close_popup()
def ShowImage(self, imageFile):
if imageFile == "":
self.bitmap = wx.StaticBitmap(self, -1, size=(0, 0))

Loading…
Cancel
Save