Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
f56b145097 | |||
43f0f2ad3a | |||
c6f45ae2d9 | |||
c9e71c7376 | |||
870a4559f8 | |||
6997899788 | |||
84003128e6 | |||
4298d8da16 | |||
f80115da99 |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"python.pythonPath": "/usr/bin/python3"
|
|
||||||
}
|
|
BIN
IPPigeonLogo.png
Normal file
BIN
IPPigeonLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 KiB |
@ -2,7 +2,7 @@ core:
|
|||||||
autostart: false
|
autostart: false
|
||||||
clockspeed: 20
|
clockspeed: 20
|
||||||
interval: 10
|
interval: 10
|
||||||
level: 2
|
level: 3
|
||||||
localadmin: true
|
localadmin: true
|
||||||
sftp:
|
sftp:
|
||||||
filepath:
|
filepath:
|
||||||
|
90
helloWorld.py
Normal file
90
helloWorld.py
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import glob
|
||||||
|
import wx
|
||||||
|
import wx.lib.buttons as buttons
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ServerPanel(wx.Frame):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
secondary_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
|
menubar = wx.MenuBar()
|
||||||
|
menu = wx.Menu()
|
||||||
|
menubar.Append(menu,"File")
|
||||||
|
self.SetMenuBar(menubar)
|
||||||
|
|
||||||
|
tb = wx.ToolBar( self, -1)
|
||||||
|
self.ToolBar = tb
|
||||||
|
|
||||||
|
#home/data, settings, profile/logout
|
||||||
|
tb.AddTool(wx.ID_ANY, '',wx.Bitmap("WXPython.png"))
|
||||||
|
tb.AddTool(wx.ID_ANY, '',wx.Bitmap("settings.png"))
|
||||||
|
tb.AddTool( wx.ID_ANY, '', wx.Bitmap("profileIMG.png"))
|
||||||
|
#tb.Bind(wx.EVT_TOOL, self.Onright)
|
||||||
|
#tb.Bind(wx.EVT_COMBOBOX,self.OnCombo)
|
||||||
|
#self.combo = wx.ComboBox( tb, 555, value = "Times", choices = ["Papyrus","Times","Comic Sans"])
|
||||||
|
|
||||||
|
|
||||||
|
#tb.AddControl(self.combo )
|
||||||
|
tb.Realize()
|
||||||
|
main_sizer.Add(tb)
|
||||||
|
|
||||||
|
self.Show(True)
|
||||||
|
|
||||||
|
|
||||||
|
self.row_obj_dict = {}
|
||||||
|
self.list_ctrl = wx.ListCtrl(
|
||||||
|
self, size=(-1, 100),
|
||||||
|
style=wx.LC_REPORT | wx.BORDER_SUNKEN
|
||||||
|
)
|
||||||
|
self.SetBackgroundColour(wx.BLACK)
|
||||||
|
self.list_ctrl.InsertColumn(0, 'Server name', width=140)
|
||||||
|
self.list_ctrl.InsertColumn(1, 'Port number', width=140)
|
||||||
|
self.list_ctrl.InsertColumn(2, 'Status', width=200)
|
||||||
|
main_sizer.Add(self.list_ctrl, 0, wx.ALL | wx.EXPAND, 5)
|
||||||
|
start_button = wx.Button(self, label='Start')
|
||||||
|
start_button.SetBackgroundColour((205, 215, 206))
|
||||||
|
start_button.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||||
|
stop_button = wx.Button(self, label='Stop')
|
||||||
|
stop_button.SetBackgroundColour('#F08080')
|
||||||
|
# wx.BORDER(stop_button, wx.BORDER_NONE)
|
||||||
|
stop_button.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||||
|
main_sizer.Add(start_button, 0, wx.CENTER | 100, 5)
|
||||||
|
main_sizer.Add(stop_button, 0, wx.CENTER | 100, 5)
|
||||||
|
# start_button.SetWindowStyleFlag(wx.SIMPLE_BORDER)
|
||||||
|
# stop_button.SetWindowStyleFlag(wx.SIMPLE_BORDER)
|
||||||
|
# wx.StaticBitmap(self, -1, png, (500, 300), (png.GetWidth(), png.GetHeight()))
|
||||||
|
self.SetSizer(main_sizer)
|
||||||
|
|
||||||
|
def OnQuit(self, e):
|
||||||
|
self.Close()
|
||||||
|
|
||||||
|
def on_edit(self, event):
|
||||||
|
print('in on_edit')
|
||||||
|
|
||||||
|
def update_mp3_listing(self, folder_path):
|
||||||
|
print(folder_path)
|
||||||
|
|
||||||
|
# def Onright(self, event):
|
||||||
|
# self.text.AppendText(str(event.GetId())+"\n")
|
||||||
|
|
||||||
|
# def OnCombo(self,event):
|
||||||
|
# self.text.AppendText( self.combo.GetValue()+"\n")
|
||||||
|
|
||||||
|
class ServerFrame(wx.Frame):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(parent=None, title='Server Dashboard')
|
||||||
|
self.frame = ServerPanel(self)
|
||||||
|
# image = wx.StaticBitmap(self, wx.ID_ANY)
|
||||||
|
# image.SetBitmap(wx.Bitmap('WXPython.png'))
|
||||||
|
self.Show()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = wx.App(False)
|
||||||
|
frame = ServerFrame()
|
||||||
|
|
||||||
|
app.MainLoop()
|
@ -48,7 +48,7 @@ if win32:
|
|||||||
_, username = res.strip().rsplit("\n", 1)
|
_, username = res.strip().rsplit("\n", 1)
|
||||||
userid, sysdom = username.rsplit("\\", 1)
|
userid, sysdom = username.rsplit("\\", 1)
|
||||||
|
|
||||||
if linux or macos:
|
if linux:
|
||||||
sysid = hex(uuid.getnode())
|
sysid = hex(uuid.getnode())
|
||||||
#fprint(sysid)
|
#fprint(sysid)
|
||||||
datafile += sysid
|
datafile += sysid
|
||||||
@ -60,8 +60,8 @@ if linux or macos:
|
|||||||
|
|
||||||
def netstat_done(res):
|
def netstat_done(res):
|
||||||
fprint("netstat done, processing")
|
fprint("netstat done, processing")
|
||||||
#procdata_res = pool.apply_async(netstat.process, (res,), callback=process_done)
|
procdata_res = pool.apply_async(netstat.process, (res,), callback=process_done)
|
||||||
netstat.process(res)
|
#netstat.process(res)
|
||||||
|
|
||||||
def process_done(res):
|
def process_done(res):
|
||||||
if settings["running"] == True:
|
if settings["running"] == True:
|
||||||
|
34
netstat.py
34
netstat.py
@ -4,7 +4,6 @@ from util import fprint
|
|||||||
from util import run_cmd
|
from util import run_cmd
|
||||||
from util import win32
|
from util import win32
|
||||||
from util import linux
|
from util import linux
|
||||||
from util import macos
|
|
||||||
import util
|
import util
|
||||||
import time
|
import time
|
||||||
import csv
|
import csv
|
||||||
@ -71,10 +70,8 @@ def process(data):
|
|||||||
writer.writerows(output2)
|
writer.writerows(output2)
|
||||||
fprint("done creating csv")
|
fprint("done creating csv")
|
||||||
|
|
||||||
if linux or macos:
|
if linux:
|
||||||
output = data.stdout.decode().split('\n') # split stdout into lines
|
output = data.stdout.decode().split('\n') # split stdout into lines
|
||||||
#output = data.stdout.decode().split(',')
|
|
||||||
#fprint("output data: " + str(output))
|
|
||||||
output = [i for i in output if i]
|
output = [i for i in output if i]
|
||||||
if output[0].find("Not all processes could be identified") >= 0:
|
if output[0].find("Not all processes could be identified") >= 0:
|
||||||
fprint("Not enough permissions")
|
fprint("Not enough permissions")
|
||||||
@ -84,24 +81,27 @@ def process(data):
|
|||||||
for line in output:
|
for line in output:
|
||||||
string_split = line.split(" ")
|
string_split = line.split(" ")
|
||||||
string_split = [i for i in string_split if i]
|
string_split = [i for i in string_split if i]
|
||||||
fprint("Input: " + str(string_split))
|
#fprint("Input: " + str(string_split))
|
||||||
|
|
||||||
if string_split[1].find("Multipath") >= 0:
|
|
||||||
break
|
|
||||||
if string_split[0].find("Active") >= 0 or string_split[0].find("Proto") >= 0:
|
if string_split[0].find("Active") >= 0 or string_split[0].find("Proto") >= 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if len(string_split) == 10: # no connection status
|
if len(string_split) == 6: # no connection status
|
||||||
fprint(string_split)
|
#fprint(string_split)
|
||||||
string_split.append(string_split[-1])
|
string_split.append(string_split[-1])
|
||||||
string_split[-7] = "UNKNOWN"
|
string_split[-2] = "UNKNOWN"
|
||||||
string_split[-4] = string_split[-5]
|
#fprint(string_split)
|
||||||
fprint(string_split)
|
|
||||||
|
|
||||||
|
procname = string_split[6]
|
||||||
|
if procname != "-":
|
||||||
|
string_split2 = procname.split("/")
|
||||||
|
procname = string_split2[1]
|
||||||
|
pid = string_split2[0]
|
||||||
|
else:
|
||||||
|
pid = "Unknown"
|
||||||
|
|
||||||
output2.append(["", string_split[0], string_split[3], string_split[4], string_split[5], string_split[8]])
|
output2.append([procname, string_split[0], string_split[3], string_split[4], string_split[5], pid])
|
||||||
fprint("FINAL CSV: " + str(output2))
|
#fprint(output2)
|
||||||
|
|
||||||
with open(find_data_file(util.datafile), "w", newline="") as f:
|
with open(find_data_file(util.datafile), "w", newline="") as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
@ -123,7 +123,3 @@ def start():
|
|||||||
fprint("data acquired")
|
fprint("data acquired")
|
||||||
return data
|
return data
|
||||||
|
|
||||||
if macos:
|
|
||||||
data = run_cmd("netstat -anv")
|
|
||||||
fprint("data acquired")
|
|
||||||
return data
|
|
||||||
|
BIN
profileIMG.png
Normal file
BIN
profileIMG.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -32,7 +32,7 @@ class TaskBarIcon(wx.adv.TaskBarIcon):
|
|||||||
def CreatePopupMenu(self):
|
def CreatePopupMenu(self):
|
||||||
menu = wx.Menu()
|
menu = wx.Menu()
|
||||||
create_menu_item(menu, 'Control Panel', self.on_open)
|
create_menu_item(menu, 'Control Panel', self.on_open)
|
||||||
create_menu_item(menu, 'Login test', self.on_login)
|
#create_menu_item(menu, 'Login test', self.on_login)
|
||||||
menu.AppendSeparator()
|
menu.AppendSeparator()
|
||||||
create_menu_item(menu, 'Exit', self.on_exit)
|
create_menu_item(menu, 'Exit', self.on_exit)
|
||||||
return menu
|
return menu
|
||||||
|
4
util.py
4
util.py
@ -26,7 +26,7 @@ if win32:
|
|||||||
_, username = res.strip().rsplit("\n", 1)
|
_, username = res.strip().rsplit("\n", 1)
|
||||||
userid, sysdom = username.rsplit("\\", 1)
|
userid, sysdom = username.rsplit("\\", 1)
|
||||||
|
|
||||||
if linux or macos:
|
if linux:
|
||||||
sysid = hex(uuid.getnode())
|
sysid = hex(uuid.getnode())
|
||||||
#fprint(sysid)
|
#fprint(sysid)
|
||||||
datafile += sysid
|
datafile += sysid
|
||||||
@ -91,7 +91,7 @@ def run_cmd(cmd):
|
|||||||
fprint("ran PS command successfully")
|
fprint("ran PS command successfully")
|
||||||
#completed = subprocess.run(["powershell", "-WindowStyle", "hidden", "-Command", cmd], capture_output=True, startupinfo=startupinfo)
|
#completed = subprocess.run(["powershell", "-WindowStyle", "hidden", "-Command", cmd], capture_output=True, startupinfo=startupinfo)
|
||||||
return completed
|
return completed
|
||||||
if linux or macos:
|
if linux:
|
||||||
fprint("running sh command: " + cmd)
|
fprint("running sh command: " + cmd)
|
||||||
completed = subprocess.run(["sh", "-c", cmd], capture_output=True)
|
completed = subprocess.run(["sh", "-c", cmd], capture_output=True)
|
||||||
fprint("ran sh command successfully")
|
fprint("ran sh command successfully")
|
||||||
|
34
wizard.py
34
wizard.py
@ -1,34 +0,0 @@
|
|||||||
import wx
|
|
||||||
from wx.adv import Wizard, WizardPageSimple
|
|
||||||
|
|
||||||
class TitlePage(WizardPageSimple):
|
|
||||||
|
|
||||||
def __init__(self, parent, title):
|
|
||||||
WizardPageSimple.__init__(self, parent)
|
|
||||||
|
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
||||||
self.SetSizer(sizer)
|
|
||||||
|
|
||||||
title = wx.StaticText(self, wx.ID_ANY, title)
|
|
||||||
title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
|
|
||||||
sizer.Add(title, 0, wx.ALIGN_CENTER|wx.ALL, 5)
|
|
||||||
sizer.Add(wx.StaticLine(self, wx.ID_ANY), 0, wx.EXPAND|wx.ALL, 5)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
wizard = Wizard(None, wx.ID_ANY, "Simple Wizard")
|
|
||||||
page1 = TitlePage(wizard, "Page 1")
|
|
||||||
page2 = TitlePage(wizard, "Page 2")
|
|
||||||
page3 = TitlePage(wizard, "Page 3")
|
|
||||||
|
|
||||||
WizardPageSimple.Chain(page1, page2)
|
|
||||||
WizardPageSimple.Chain(page2, page3)
|
|
||||||
wizard.FitToPage(page1)
|
|
||||||
|
|
||||||
wizard.RunWizard(page1)
|
|
||||||
wizard.Destroy()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app = wx.App()
|
|
||||||
main()
|
|
||||||
app.MainLoop()
|
|
@ -1,111 +0,0 @@
|
|||||||
import wx
|
|
||||||
########################################################################
|
|
||||||
class WizardPage(wx.Panel):
|
|
||||||
""""""
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def __init__(self, parent, title=None):
|
|
||||||
"""Constructor"""
|
|
||||||
wx.Panel.__init__(self, parent)
|
|
||||||
|
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
||||||
self.SetSizer(sizer)
|
|
||||||
|
|
||||||
if title:
|
|
||||||
title = wx.StaticText(self, -1, title)
|
|
||||||
title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
|
|
||||||
sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
|
|
||||||
sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, 5)
|
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
class WizardPanel(wx.Panel):
|
|
||||||
""""""
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def __init__(self, parent):
|
|
||||||
"""Constructor"""
|
|
||||||
wx.Panel.__init__(self, parent=parent)
|
|
||||||
self.pages = []
|
|
||||||
self.page_num = 0
|
|
||||||
|
|
||||||
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
|
|
||||||
self.panelSizer = wx.BoxSizer(wx.VERTICAL)
|
|
||||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
||||||
|
|
||||||
# add prev/next buttons
|
|
||||||
self.prevBtn = wx.Button(self, label="Previous")
|
|
||||||
self.prevBtn.Bind(wx.EVT_BUTTON, self.onPrev)
|
|
||||||
btnSizer.Add(self.prevBtn, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
|
|
||||||
|
|
||||||
self.nextBtn = wx.Button(self, label="Next")
|
|
||||||
self.nextBtn.Bind(wx.EVT_BUTTON, self.onNext)
|
|
||||||
btnSizer.Add(self.nextBtn, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
|
|
||||||
|
|
||||||
# finish layout
|
|
||||||
self.mainSizer.Add(self.panelSizer, 1, wx.EXPAND)
|
|
||||||
self.mainSizer.Add(btnSizer, 0, wx.ALIGN_RIGHT)
|
|
||||||
self.SetSizer(self.mainSizer)
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def addPage(self, title=None):
|
|
||||||
""""""
|
|
||||||
panel = WizardPage(self, title)
|
|
||||||
self.panelSizer.Add(panel, 2, wx.EXPAND)
|
|
||||||
self.pages.append(panel)
|
|
||||||
if len(self.pages) > 1:
|
|
||||||
# hide all panels after the first one
|
|
||||||
panel.Hide()
|
|
||||||
self.Layout()
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def onNext(self, event):
|
|
||||||
""""""
|
|
||||||
pageCount = len(self.pages)
|
|
||||||
if pageCount-1 != self.page_num:
|
|
||||||
self.pages[self.page_num].Hide()
|
|
||||||
self.page_num += 1
|
|
||||||
self.pages[self.page_num].Show()
|
|
||||||
self.panelSizer.Layout()
|
|
||||||
else:
|
|
||||||
print("End of pages!")
|
|
||||||
|
|
||||||
if self.nextBtn.GetLabel() == "Finish":
|
|
||||||
# close the app
|
|
||||||
self.GetParent().Close()
|
|
||||||
|
|
||||||
if pageCount == self.page_num+1:
|
|
||||||
# change label
|
|
||||||
self.nextBtn.SetLabel("Finish")
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def onPrev(self, event):
|
|
||||||
""""""
|
|
||||||
pageCount = len(self.pages)
|
|
||||||
if self.page_num-1 != -1:
|
|
||||||
self.pages[self.page_num].Hide()
|
|
||||||
self.page_num -= 1
|
|
||||||
self.pages[self.page_num].Show()
|
|
||||||
self.panelSizer.Layout()
|
|
||||||
else:
|
|
||||||
print("You're already on the first page!")
|
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
class MainFrame(wx.Frame):
|
|
||||||
""""""
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
def __init__(self):
|
|
||||||
"""Constructor"""
|
|
||||||
wx.Frame.__init__(self, None, title="Generic Wizard", size=(800,600))
|
|
||||||
|
|
||||||
self.panel = WizardPanel(self)
|
|
||||||
self.panel.addPage("Page 1")
|
|
||||||
self.panel.addPage("Page 2")
|
|
||||||
self.panel.addPage("Page 3")
|
|
||||||
|
|
||||||
self.Show()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app = wx.App()
|
|
||||||
frame = MainFrame()
|
|
||||||
app.MainLoop()
|
|
Reference in New Issue
Block a user