|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
import glob
|
|
|
|
|
import logging
|
|
|
|
|
import sys
|
|
|
|
|
import wx
|
|
|
|
|
import wx.lib.buttons as buttons
|
|
|
|
|
import numpy as np
|
|
|
|
@ -47,7 +49,7 @@ class OtherFrame(wx.Frame):
|
|
|
|
|
self.Show()
|
|
|
|
|
|
|
|
|
|
def on_edit(self, event):
|
|
|
|
|
fprint('in on_edit')
|
|
|
|
|
fprint('in on_edit', settings)
|
|
|
|
|
|
|
|
|
|
def on_window(self, event):
|
|
|
|
|
return
|
|
|
|
@ -173,11 +175,20 @@ class ServerPanel(wx.Panel):
|
|
|
|
|
start_button.SetBackgroundColour((205, 215, 206))
|
|
|
|
|
start_button.Bind(wx.EVT_BUTTON, self.on_start)
|
|
|
|
|
#start_button.Bind(wx.EVT_ENTER_WINDOW, self.on_start)
|
|
|
|
|
|
|
|
|
|
stop_button = wx.Button(self, label='Stop IPPigeon')
|
|
|
|
|
stop_button.SetBackgroundColour('#F08080')
|
|
|
|
|
|
|
|
|
|
secondary_frame_button = wx.Button(self, label='Settings')
|
|
|
|
|
secondary_frame_button.Bind(wx.EVT_BUTTON, self.on_window)
|
|
|
|
|
|
|
|
|
|
log_button = wx.Button(self, label='Logs')
|
|
|
|
|
log_button.Bind(wx.EVT_BUTTON, self.on_log)
|
|
|
|
|
|
|
|
|
|
#self.log_window = wx.LogWindow(self, 'Log Window', True)
|
|
|
|
|
|
|
|
|
|
#show_log_button = wx.Button(self, wx.NewId(), 'Show Log')
|
|
|
|
|
#show_log_button.Bind(wx.EVT_BUTTON, self._show_log)
|
|
|
|
|
# wx.BORDER(stop_button, wx.BORDER_NONE)
|
|
|
|
|
stop_button.Bind(wx.EVT_BUTTON, self.on_stop)
|
|
|
|
|
self.main_sizer.Add(self.statustext, 0, wx.CENTER | wx.ALL | 100, 5)
|
|
|
|
@ -186,6 +197,7 @@ class ServerPanel(wx.Panel):
|
|
|
|
|
self.main_sizer.Add(secondary_frame_button, 0, wx.CENTER | wx.ALL | 100, 5)
|
|
|
|
|
self.SetSizer(self.main_sizer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_columns(self):
|
|
|
|
|
for col in range(len(COLUMN_NAMES)):
|
|
|
|
|
self.list_ctrl.InsertColumn(0, COLUMN_NAMES[col], width=COLUMN_SIZES[col])
|
|
|
|
@ -203,12 +215,13 @@ class ServerPanel(wx.Panel):
|
|
|
|
|
else:
|
|
|
|
|
wx.CallLater(1000, self.updatedata)
|
|
|
|
|
return
|
|
|
|
|
fprint("updatedata called")
|
|
|
|
|
fprint("updatedata called", settings)
|
|
|
|
|
loaddata()
|
|
|
|
|
#logData.doLogging(logData)
|
|
|
|
|
if self.list_ctrl.DeleteAllItems():
|
|
|
|
|
fprint("Items deleted")
|
|
|
|
|
fprint("Items deleted", settings)
|
|
|
|
|
else:
|
|
|
|
|
fprint("Unable to delete")
|
|
|
|
|
fprint("Unable to delete", settings)
|
|
|
|
|
for i in range(len(TEST_FILE)):
|
|
|
|
|
if str(TEST_FILE.iloc[i, 4]).find("TIME_WAIT") >= 0 or str(TEST_FILE.iloc[i, 4]).find("FIN_WAIT_2") >= 0:
|
|
|
|
|
continue
|
|
|
|
@ -236,19 +249,29 @@ class ServerPanel(wx.Panel):
|
|
|
|
|
wx.CallLater(1000, self.updatedata)
|
|
|
|
|
|
|
|
|
|
def on_start(self, event):
|
|
|
|
|
fprint('in on_start')
|
|
|
|
|
fprint('in on_start', settings)
|
|
|
|
|
settings["running"] = True
|
|
|
|
|
|
|
|
|
|
def on_stop(self, event):
|
|
|
|
|
fprint('in on_stop')
|
|
|
|
|
fprint('in on_stop', settings)
|
|
|
|
|
settings["running"] = False
|
|
|
|
|
util.clear_fwll()
|
|
|
|
|
|
|
|
|
|
def on_window(self, event):
|
|
|
|
|
fprint("open settings")
|
|
|
|
|
fprint("open settings", settings)
|
|
|
|
|
dg = GetData(parent = None)
|
|
|
|
|
dg.ShowModal()
|
|
|
|
|
|
|
|
|
|
def on_log(self, event):
|
|
|
|
|
fprint("open log", settings)
|
|
|
|
|
dg = logData(parent = None)
|
|
|
|
|
#fprint("attempting logLoop", settings)
|
|
|
|
|
logData.logLoop(dg)
|
|
|
|
|
#fprint("did logLoop work?", settings)
|
|
|
|
|
dg.ShowModal()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ShowImage(self, imageFile):
|
|
|
|
|
if imageFile == "":
|
|
|
|
|
self.bitmap = wx.StaticBitmap(self, -1, size=(0, 0))
|
|
|
|
@ -277,19 +300,64 @@ def openwindow(data, sets, kill):
|
|
|
|
|
displaydata = data
|
|
|
|
|
settings = sets
|
|
|
|
|
if settings["loggedin"]:
|
|
|
|
|
fprint("Creating server panel")
|
|
|
|
|
fprint("Creating server panel", settings)
|
|
|
|
|
loaddata()
|
|
|
|
|
app = wx.App(False)
|
|
|
|
|
frame = OtherFrame()
|
|
|
|
|
frame.SetIcon(wx.Icon(find_data_file("icon.ico"), wx.BITMAP_TYPE_ICO))
|
|
|
|
|
app.MainLoop()
|
|
|
|
|
else:
|
|
|
|
|
fprint("Creating login panel")
|
|
|
|
|
fprint("Creating login panel", settings)
|
|
|
|
|
|
|
|
|
|
app = wx.App(False)
|
|
|
|
|
frame = ServerFrame()
|
|
|
|
|
frame.SetIcon(wx.Icon(find_data_file("icon.ico"), wx.BITMAP_TYPE_ICO))
|
|
|
|
|
app.MainLoop()
|
|
|
|
|
class RedirectText(object):
|
|
|
|
|
def __init__(self,aWxTextCtrl):
|
|
|
|
|
self.out = aWxTextCtrl
|
|
|
|
|
|
|
|
|
|
def write(self,string):
|
|
|
|
|
self.out.WriteText(string)
|
|
|
|
|
|
|
|
|
|
class logData(wx.Dialog):
|
|
|
|
|
def __init__(self, parent):
|
|
|
|
|
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Logs: ", size = (800,500))
|
|
|
|
|
self.p = wx.Panel(self, wx.ID_ANY)
|
|
|
|
|
#self.logBox = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
self.logsTitle = wx.StaticText(self.p, label="Logs", pos=(20,20))
|
|
|
|
|
self.logs = wx.TextCtrl(self.p, pos=(20,40), size= (700, 400), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
|
|
|
|
|
self.logs.WriteText("init\n")
|
|
|
|
|
#keepLoop = False
|
|
|
|
|
|
|
|
|
|
def logLoop(self):
|
|
|
|
|
self.logs.WriteText("before while loop\n")
|
|
|
|
|
i=0
|
|
|
|
|
if (settings["logMsg"] is not None):
|
|
|
|
|
while(i < len(settings["logMsg"])):
|
|
|
|
|
#for i in range(len(settings["logMsg"])):
|
|
|
|
|
#self.logs.WriteText("in while loop\n")
|
|
|
|
|
self.logs.WriteText(settings["logMsg"][i])
|
|
|
|
|
self.logs.WriteText("\n")
|
|
|
|
|
i+=1
|
|
|
|
|
else:
|
|
|
|
|
self.logs.WriteText("settings is none :(")
|
|
|
|
|
settings["logMsg"].add("init string for list")
|
|
|
|
|
logData.logLoop(self)
|
|
|
|
|
self.logs.WriteText("after while loop\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#redir = RedirectText(self.logs)
|
|
|
|
|
#sys.stdout = redir
|
|
|
|
|
#self.logs.WriteText(redir)
|
|
|
|
|
|
|
|
|
|
#self.logs.LoadFile('output.log')
|
|
|
|
|
|
|
|
|
|
#def doLogging(self):
|
|
|
|
|
#self.logs.WriteText("hi from doLogging\n")
|
|
|
|
|
#self.logs.WriteText(settings["logMsg"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GetData(wx.Dialog):
|
|
|
|
|
def __init__(self, parent):
|
|
|
|
@ -338,7 +406,7 @@ class GetData(wx.Dialog):
|
|
|
|
|
|
|
|
|
|
def OnQuit(self, event):
|
|
|
|
|
# save changes
|
|
|
|
|
fprint("saving changes...")
|
|
|
|
|
fprint("saving changes...", settings)
|
|
|
|
|
config = settings["config"]
|
|
|
|
|
config["sftp"]["host"] = self.hostnametext.GetValue()
|
|
|
|
|
config["sftp"]["user"] = self.usertext.GetValue()
|
|
|
|
|