Compare commits
10 Commits
1665536869
...
1666139067
Author | SHA1 | Date | |
---|---|---|---|
258918eecc | |||
f781056b69 | |||
2ee04b59d1 | |||
88b38d1492 | |||
bbb92d1fdb | |||
0b97b2287a | |||
578eea1c1f | |||
5c7cd9b0a5 | |||
a374ec73b4 | |||
b0457865d6 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ admin-key.ppk
|
||||
token.txt
|
||||
*.zip
|
||||
output.log
|
||||
output.log
|
||||
|
BIN
WXPython.png
Normal file
BIN
WXPython.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
WXPython_30x30.png
Normal file
BIN
WXPython_30x30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
28
auth.py
28
auth.py
@ -14,13 +14,25 @@ def login(config, user, password, sysid):
|
||||
ssh.sftp_send_data(config, filename, 'sendlogin')
|
||||
command = "python3 login_service.py " + sysid
|
||||
ssh.run_ssh(config, command, 'scripts')
|
||||
sleep(1)
|
||||
filename = sysid + "success.txt"
|
||||
if ssh.check_for_file(config, filename, 'receivelogin') == False:
|
||||
filename = sysid + "fail.txt"
|
||||
if ssh.check_for_file(config, filename, 'receivelogin') == False:
|
||||
raise ValueError("Unable to determine login status")
|
||||
count = 0
|
||||
while count < 20:
|
||||
output = ssh.check_for_file(config, filename, 'receivelogin')
|
||||
if output == False:
|
||||
filename = sysid + "fail.txt"
|
||||
if ssh.check_for_file(config, filename, 'receivelogin') == False:
|
||||
# try again
|
||||
count += 1
|
||||
sleep(0.1)
|
||||
#raise ValueError("Unable to determine login status")
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
fprint(type(output))
|
||||
if str(output).find("admin") >= 0 or str(output).find("Admin") >= 0:
|
||||
fprint("Authorized as admin!")
|
||||
return True
|
||||
else:
|
||||
fprint("Not admin")
|
||||
return False
|
||||
return False
|
16
block.py
Normal file
16
block.py
Normal file
@ -0,0 +1,16 @@
|
||||
from util import find_data_file
|
||||
from util import setup_child
|
||||
from util import fprint
|
||||
from util import run_cmd
|
||||
from util import win32
|
||||
from util import linux
|
||||
import util
|
||||
import time
|
||||
import csv
|
||||
import ssh
|
||||
|
||||
def get_blocklist(config):
|
||||
setup_child()
|
||||
fprint("Downloading deny list from server")
|
||||
data = check_for_file(config, "BadIPs.csv", "receive")
|
||||
fprint(data.stdout)
|
@ -16,4 +16,5 @@ ui:
|
||||
core:
|
||||
autokill: false
|
||||
localadmin: true
|
||||
interval: 10
|
||||
interval: 10
|
||||
clockspeed: 20
|
||||
|
138
helloWorld.py
138
helloWorld.py
@ -1,138 +0,0 @@
|
||||
import glob
|
||||
import wx
|
||||
import wx.adv
|
||||
import os
|
||||
from time import sleep
|
||||
from multiprocessing import Process, Pipe
|
||||
from sys import platform
|
||||
|
||||
|
||||
TRAY_TOOLTIP = 'IP Pigeon'
|
||||
TRAY_ICON = 'icon.png'
|
||||
|
||||
"""if platform == "linux" or platform == "linux2":
|
||||
# linux
|
||||
elif platform == "darwin":
|
||||
# OS X
|
||||
elif platform == "win32":
|
||||
# Windows...
|
||||
"""
|
||||
displaydata = None
|
||||
settings = None
|
||||
|
||||
class ServerPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.row_obj_dict = {}
|
||||
|
||||
self.list_ctrl = wx.ListCtrl(
|
||||
self, size=(-1, 100),
|
||||
style=wx.LC_REPORT | wx.BORDER_SUNKEN
|
||||
)
|
||||
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.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||
stop_button = wx.Button(self, label='Stop')
|
||||
stop_button.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||
main_sizer.Add(start_button, 0, wx.ALL | 100, 5)
|
||||
main_sizer.Add(stop_button, 0, wx.ALL | 100, 5)
|
||||
self.SetSizer(main_sizer)
|
||||
|
||||
def on_edit(self, event):
|
||||
print('in on_edit')
|
||||
|
||||
def update_mp3_listing(self, folder_path):
|
||||
print(folder_path)
|
||||
|
||||
class ServerFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
super().__init__(parent=None,
|
||||
title='Server Dashboard')
|
||||
self.panel = ServerPanel(self)
|
||||
self.Show()
|
||||
|
||||
### Taskbar Icon
|
||||
|
||||
def create_menu_item(menu, label, func):
|
||||
item = wx.MenuItem(menu, -1, label)
|
||||
menu.Bind(wx.EVT_MENU, func, id=item.GetId())
|
||||
menu.Append(item)
|
||||
return item
|
||||
|
||||
class TaskBarIcon(wx.adv.TaskBarIcon):
|
||||
def __init__(self, frame):
|
||||
self.frame = frame
|
||||
super(TaskBarIcon, self).__init__()
|
||||
self.set_icon(TRAY_ICON)
|
||||
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
|
||||
|
||||
def CreatePopupMenu(self):
|
||||
menu = wx.Menu()
|
||||
create_menu_item(menu, 'Control Panel', self.on_open)
|
||||
menu.AppendSeparator()
|
||||
create_menu_item(menu, 'Exit', self.on_exit)
|
||||
return menu
|
||||
|
||||
def set_icon(self, path):
|
||||
icon = wx.Icon(path)
|
||||
self.SetIcon(icon, TRAY_TOOLTIP)
|
||||
|
||||
def on_left_down(self, event):
|
||||
print ('Tray icon was left-clicked.')
|
||||
|
||||
def on_open(self, event):
|
||||
foreground()
|
||||
#self.close_popup()
|
||||
|
||||
def on_exit(self, event):
|
||||
wx.CallAfter(self.Destroy)
|
||||
self.close_popup()
|
||||
|
||||
def close_popup(self):
|
||||
self.frame.Close()
|
||||
|
||||
class TaskbarApp(wx.App):
|
||||
def OnInit(self):
|
||||
frame=wx.Frame(None)
|
||||
self.SetTopWindow(frame)
|
||||
TaskBarIcon(frame)
|
||||
return True
|
||||
|
||||
class FullApp(wx.App):
|
||||
def OnInit(self):
|
||||
fullframe=ServerFrame()
|
||||
return True
|
||||
|
||||
def background():
|
||||
app = TaskbarApp(False)
|
||||
#with Manager() as manager:
|
||||
app.MainLoop()
|
||||
#displaydata = manager.list()
|
||||
#settings = manager.list()
|
||||
|
||||
|
||||
#rawdata = manager.list()
|
||||
#logdata = manager.list()
|
||||
#uploaddata = manager.list()
|
||||
#downloaddata = manager.list()
|
||||
|
||||
|
||||
def open_fg(outputdata, uisettings):
|
||||
app = FullApp(False)
|
||||
app.MainLoop()
|
||||
|
||||
def foreground():
|
||||
# Open the foreground in a separate process so that UI acts independently of the taskbar icon
|
||||
p = Process(target=open_fg, args=(displaydata, settings))
|
||||
p.start()
|
||||
#p.join()
|
||||
print("Launched foreground")
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
background()
|
48
ippigeon.py
48
ippigeon.py
@ -13,12 +13,16 @@ import util
|
||||
import netstat
|
||||
import ssh
|
||||
import auth
|
||||
import panel
|
||||
import block
|
||||
|
||||
badapps = [756, 278670]
|
||||
displaydata = None
|
||||
settings = None
|
||||
netdata_res = None
|
||||
procdata_res = None
|
||||
killme = None
|
||||
ppanel = None
|
||||
datafile = ""
|
||||
#print(datafile)
|
||||
config = None
|
||||
@ -67,6 +71,8 @@ def login_done(res):
|
||||
settings["message"] = "Login failure"
|
||||
else:
|
||||
fprint("Login result in main: " + str(res))
|
||||
settings["loggedin"] = res
|
||||
settings["continueui"] = True
|
||||
|
||||
|
||||
def killall():
|
||||
@ -76,6 +82,12 @@ def killall():
|
||||
fprint("Every child has been killed")
|
||||
os.kill(os.getpid(), 9) # dirty kill of self
|
||||
|
||||
def kill(pid):
|
||||
setup_child()
|
||||
fprint("Killing PID " + str(pid))
|
||||
#os.kill(pid, 9)
|
||||
fprint("Signal 9 sent to PID " + str(pid))
|
||||
|
||||
def mainloop(pool):
|
||||
# worker pool: netstat, netstat cleanup, upload, download, ui tasks
|
||||
|
||||
@ -84,6 +96,7 @@ def mainloop(pool):
|
||||
global procdata_res
|
||||
global rawdata
|
||||
global killme
|
||||
global ppanel
|
||||
#print(killme)
|
||||
if killme.value > 0:
|
||||
#print("killing")
|
||||
@ -99,16 +112,42 @@ def mainloop(pool):
|
||||
#fprint(netdata_res.successful())
|
||||
|
||||
# runs every 50ms
|
||||
|
||||
if settings["continueui"] == True:
|
||||
settings["continueui"] = False
|
||||
if ppanel is not None:
|
||||
# login panel is already open
|
||||
ppanel.terminate()
|
||||
ppanel = Process(target=panel.openwindow, args=(displaydata,settings,killme))
|
||||
ppanel.start()
|
||||
|
||||
if settings["showui"] == True:
|
||||
settings["showui"] = False
|
||||
ppanel = Process(target=panel.openwindow, args=(displaydata,settings,killme))
|
||||
ppanel.start()
|
||||
|
||||
if settings["login"] == True:
|
||||
login_res = pool.apply_async(auth.login, (config, settings["username"], settings["password"], sysid), callback=login_done)
|
||||
#fprint(auth.login(config, settings["username"], settings["password"], sysid))
|
||||
settings["login"] = False
|
||||
|
||||
|
||||
if settings["block"] == True:
|
||||
blockdata_res = pool.apply_async(block.get_blocklist, (config,)) #, callback=blockdata_done)
|
||||
settings["block"] = False
|
||||
#fprint(settings["killbox"])
|
||||
if len(settings["killbox"]) > 0:
|
||||
fprint("Kill opportunity!")
|
||||
for proc in settings["killbox"]:
|
||||
pool.apply_async(kill, (proc,))
|
||||
settings["killbox"].remove(proc)
|
||||
|
||||
sleep(interval / (interval * 20.0))
|
||||
sleep(interval / (interval * config["core"]["clockspeed"]))
|
||||
counter += 1
|
||||
if counter == interval * 20:
|
||||
if counter == interval * config["core"]["clockspeed"]:
|
||||
counter = 0
|
||||
|
||||
|
||||
class Logger(object):
|
||||
def __init__(self, filename="output.log"):
|
||||
self.log = open(filename, "a")
|
||||
@ -145,6 +184,11 @@ if __name__ == '__main__':
|
||||
settings = manager.dict() # configuration
|
||||
settings["login"] = False
|
||||
settings["loggedin"] = False
|
||||
settings["showui"] = False
|
||||
settings["continueui"] = False
|
||||
settings["killbox"] = list()
|
||||
settings["badapps"] = badapps
|
||||
settings["block"] = True
|
||||
killme = manager.Value('d', 0)
|
||||
#killme = False
|
||||
# launch background UI app as process
|
||||
|
481380
output.log
481380
output.log
File diff suppressed because it is too large
Load Diff
327
panel.py
Normal file
327
panel.py
Normal file
@ -0,0 +1,327 @@
|
||||
import glob
|
||||
import wx
|
||||
import wx.lib.buttons as buttons
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from util import sysid
|
||||
from util import setup_child
|
||||
from util import fprint
|
||||
from util import find_data_file
|
||||
|
||||
BG_IMG = 'icon.png'
|
||||
filename = sysid + "gendata.csv"
|
||||
COLUMN_NAMES = np.flip(['Executable', 'Proto', 'Source IP', 'Destination IP', 'Status', 'PID'])
|
||||
COLUMN_SIZES = np.flip([150, 50, 200, 200, 110, 65])
|
||||
TEST_FILE = None
|
||||
|
||||
displaydata = None
|
||||
settings = None
|
||||
|
||||
killme = False
|
||||
|
||||
class OtherFrame(wx.Frame):
|
||||
"""
|
||||
Class used for creating frames other than the main one
|
||||
"""
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Server Panel', size=(600, 250))
|
||||
panel = ServerPanel(self)
|
||||
self.Show()
|
||||
|
||||
def on_edit(self, event):
|
||||
fprint('in on_edit')
|
||||
|
||||
def on_window(self, event):
|
||||
return
|
||||
|
||||
|
||||
class HelpFrame(wx.Frame):
|
||||
"""
|
||||
Class used for creating frames other than the main one
|
||||
"""
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Help', size=(600, 250))
|
||||
panel = HelpPanel(self)
|
||||
self.Show()
|
||||
|
||||
|
||||
# Panel with all the login widgets
|
||||
class LoginPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super(LoginPanel, self).__init__(parent)
|
||||
self.SetBackgroundColour((44, 51, 51))
|
||||
basicLabel = wx.StaticText(self, -1, "Username")
|
||||
basicLabel.SetForegroundColour((255,255,255))
|
||||
global basicText
|
||||
global pwdText
|
||||
basicText = wx.TextCtrl(self, -1, "", size=(175, -1))
|
||||
# basicText.SetInsertionPoint(0)
|
||||
pwdLabel = wx.StaticText(self, -1, "Password")
|
||||
pwdText = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_PASSWORD)
|
||||
#pwdText.Bind(wx.EVT_TEXT_ENTER, self.on_login) # press enter in password field to login
|
||||
pwdLabel.SetForegroundColour((255, 255, 255))
|
||||
vbox = wx.BoxSizer(wx.VERTICAL)
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
vbox.Add(basicLabel, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
vbox.Add(basicText, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
vbox.Add(pwdLabel, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
vbox.Add(pwdText, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
login_button = wx.Button(self, label='Login')
|
||||
login_button.Bind(wx.EVT_BUTTON, self.on_login)
|
||||
help_button = wx.Button(self, label='Help')
|
||||
help_button.Bind(wx.EVT_BUTTON, self.on_help)
|
||||
# signup_button = wx.Button(self, label='Sign Up')
|
||||
hbox.Add(login_button, 0, wx.ALL | 200, 20)
|
||||
# hbox.Add(signup_button, 0, wx.ALL | 200, 20)
|
||||
hbox.Add(help_button, 0, wx.ALL | 200, 20)
|
||||
vbox.Add(hbox, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
self.SetSizer(vbox)
|
||||
|
||||
def on_login(self, event):
|
||||
# check for login verification
|
||||
settings["username"] = basicText.GetValue()
|
||||
settings["password"] = pwdText.GetValue()
|
||||
settings["login"] = True
|
||||
#OtherFrame()
|
||||
|
||||
def on_help(self, event):
|
||||
HelpFrame()
|
||||
|
||||
|
||||
# Panel with all the login widgets
|
||||
class HelpPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super(HelpPanel, self).__init__(parent)
|
||||
self.SetBackgroundColour((44, 51, 51))
|
||||
# basicLabel = wx.StaticText(self, -1, "Username")
|
||||
# basicLabel.SetForegroundColour((255,255,255))
|
||||
# basicText = wx.TextCtrl(self, -1, "", size=(175, -1))
|
||||
#
|
||||
# # basicText.SetInsertionPoint(0)
|
||||
# pwdLabel = wx.StaticText(self, -1, "Password")
|
||||
# pwdText = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_PASSWORD)
|
||||
# pwdLabel.SetForegroundColour((255, 255, 255))
|
||||
# vbox = wx.BoxSizer(wx.VERTICAL)
|
||||
# hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
# vbox.Add(basicLabel, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
# vbox.Add(basicText, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
# vbox.Add(pwdLabel, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
# vbox.Add(pwdText, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
# login_button = wx.Button(self, label='Login')
|
||||
# login_button.Bind(wx.EVT_BUTTON, self.on_login)
|
||||
# help_button = wx.Button(self, label='Help')
|
||||
# # signup_button = wx.Button(self, label='Sign Up')
|
||||
# hbox.Add(login_button, 0, wx.ALL | 200, 20)
|
||||
# # hbox.Add(signup_button, 0, wx.ALL | 200, 20)
|
||||
# hbox.Add(help_button, 0, wx.ALL | 200, 20)
|
||||
# vbox.Add(hbox, 0, wx.ALIGN_CENTER | 100, 5)
|
||||
# self.SetSizer(vbox)
|
||||
|
||||
|
||||
class ServerPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent, size=(500, 500))
|
||||
#self.SetBackgroundColour((44, 51, 51))
|
||||
|
||||
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
secondary_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.row_obj_dict = {}
|
||||
self.list_ctrl = wx.ListCtrl(
|
||||
self, size=(-1, 200),
|
||||
style=wx.LC_REPORT | wx.BORDER_SUNKEN
|
||||
)
|
||||
tb = wx.ToolBar( self, -1)
|
||||
self.ToolBar = tb
|
||||
tb.SetToolBitmapSize(wx.Size(30, 3))
|
||||
tb.AddTool(wx.ID_ANY, '',wx.Bitmap(find_data_file("WXPython_30x30.png")),)
|
||||
tb.AddTool(wx.ID_ANY, '',wx.Bitmap(find_data_file("settings_30x30.png")))
|
||||
tb.Realize()
|
||||
main_sizer.Add(tb)
|
||||
#main_sizer.SetBackgroundColour((44, 51, 51))
|
||||
# self.pnl1.SetBackgroundColour(wx.BLACK)
|
||||
self.handle_columns()
|
||||
global settings
|
||||
for i in range(len(TEST_FILE)):
|
||||
self.list_ctrl.InsertItem(i, TEST_FILE.iloc[i, 0])
|
||||
#fprint(TEST_FILE.iloc[i, 5] + " in " + str(settings["badapps"]))
|
||||
#if TEST_FILE.iloc[i, 5] in settings["badapps"]:
|
||||
for pid in settings["badapps"]:
|
||||
#fprint(pid)
|
||||
if str(TEST_FILE.iloc[i, 5]) == str(pid):
|
||||
#fprint("Got " + TEST_FILE.iloc[i, 5])
|
||||
settings["killbox"].append(pid)
|
||||
fprint(settings["killbox"])
|
||||
self.list_ctrl.SetItemBackgroundColour(i, wx.Colour(200, 51, 51))
|
||||
for j in range(1, 6):
|
||||
self.list_ctrl.SetItem(i, j, str(TEST_FILE.iloc[i, j]))
|
||||
|
||||
#fprint(i, j, TEST_FILE.iloc[i, j])
|
||||
|
||||
main_sizer.Add(self.list_ctrl, 0, wx.ALL | wx.EXPAND, 20)
|
||||
start_button = wx.Button(self, label='Start')
|
||||
start_button.SetBackgroundColour((205, 215, 206))
|
||||
start_button.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||
start_button.Bind(wx.EVT_ENTER_WINDOW, self.on_edit)
|
||||
stop_button = wx.Button(self, label='Stop')
|
||||
stop_button.SetBackgroundColour('#F08080')
|
||||
|
||||
secondary_frame_button = wx.Button(self, label='Window')
|
||||
secondary_frame_button.Bind(wx.EVT_BUTTON, self.on_window)
|
||||
# wx.BORDER(stop_button, wx.BORDER_NONE)
|
||||
stop_button.Bind(wx.EVT_BUTTON, self.on_edit)
|
||||
main_sizer.Add(start_button, 0, wx.CENTER | wx.ALL | 100, 5)
|
||||
main_sizer.Add(stop_button, 0, wx.CENTER | wx.ALL | 100, 5)
|
||||
main_sizer.Add(secondary_frame_button, 0, wx.CENTER | wx.ALL | 100, 5)
|
||||
self.SetSizer(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])
|
||||
|
||||
|
||||
|
||||
def on_edit(self, event):
|
||||
fprint('in on_edit')
|
||||
|
||||
def on_window(self, event):
|
||||
OtherFrame()
|
||||
|
||||
def ShowImage(self, imageFile):
|
||||
if imageFile == "":
|
||||
self.bitmap = wx.StaticBitmap(self, -1, size=(0, 0))
|
||||
else:
|
||||
bmp = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
|
||||
self.bitmap = wx.StaticBitmap(self, -1, bmp, (0, 0))
|
||||
|
||||
|
||||
class ServerFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
super().__init__(parent=None,
|
||||
title='Server Dashboard')
|
||||
|
||||
self.panel = LoginPanel(self)
|
||||
# image = wx.StaticBitmap(self, wx.ID_ANY)
|
||||
# image.SetBitmap(wx.Bitmap('WXPython.png'))
|
||||
self.Show()
|
||||
|
||||
def openwindow(data, sets, kill):
|
||||
setup_child()
|
||||
global killme
|
||||
global settings
|
||||
global displaydata
|
||||
killme = kill
|
||||
displaydata = data
|
||||
settings = sets
|
||||
if settings["loggedin"]:
|
||||
fprint("Creating server panel")
|
||||
global TEST_FILE
|
||||
try:
|
||||
TEST_FILE = pd.read_csv(find_data_file(filename), skiprows=1)
|
||||
TEST_FILE = TEST_FILE.iloc[1:, :]
|
||||
TEST_FILE.columns = ['Executable', 'Protocol', 'Source IP', 'Destination IP', 'Status', 'PID']
|
||||
fprint(TEST_FILE)
|
||||
fprint(len(TEST_FILE))
|
||||
#fprint(TEST_FILE.iloc[1, 1])
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
app = wx.App(False)
|
||||
frame = OtherFrame()
|
||||
app.MainLoop()
|
||||
else:
|
||||
fprint("Creating login panel")
|
||||
|
||||
app = wx.App(False)
|
||||
frame = ServerFrame()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
openwindow(list(), dict(), int())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""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
|
||||
|
||||
|
||||
#tb.AddTool( wx.ID_ANY, '', wx.Bitmap("IPPigeonLogo.png"))
|
||||
tb.AddTool(wx.ID_ANY, '',wx.Bitmap("WXPython_30x30.png"),)
|
||||
tb.AddTool(wx.ID_ANY, '',wx.Bitmap("settings_30x30.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()"""
|
@ -2,3 +2,5 @@ fabric
|
||||
paramiko
|
||||
wxpython
|
||||
cx_Freeze
|
||||
pandas
|
||||
pyyaml
|
BIN
settings.png
Normal file
BIN
settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
settings_30x30.png
Normal file
BIN
settings_30x30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
4
setup.py
4
setup.py
@ -5,7 +5,7 @@ debug = True
|
||||
#debug = not debug
|
||||
# Dependencies are automatically detected, but it might need fine tuning.
|
||||
# "packages": ["os"] is used as example only
|
||||
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"], "include_msvcr": True, "include_files": ["icon.png", "config.yml", "keyfile-admin.pem"], "optimize": 2}
|
||||
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"], "include_msvcr": True, "include_files": ["icon.png", "config.yml", "keyfile-admin.pem", "WXPython.png", "WXPython_30x30.png", "settings.png", "settings_30x30.png"], "optimize": 1}
|
||||
|
||||
# base="Win32GUI" should be used only for Windows GUI app
|
||||
base = None
|
||||
@ -23,4 +23,4 @@ setup(
|
||||
description="IP Pigeon client application",
|
||||
options={"build_exe": build_exe_options},
|
||||
executables=[Executable("ippigeon.py", base=base, icon="icon.ico", uac_admin=True, target_name=name)],
|
||||
)
|
||||
)
|
||||
|
1
ssh.py
1
ssh.py
@ -37,3 +37,4 @@ def run_ssh(config, command, location):
|
||||
fprint("Running ssh command: " + command)
|
||||
res = c.run(command, hide=True, asynchronous=True)
|
||||
return res
|
||||
|
||||
|
@ -45,20 +45,21 @@ class TaskBarIcon(wx.adv.TaskBarIcon):
|
||||
fprint ('Tray icon was left-clicked.')
|
||||
|
||||
def on_open(self, event):
|
||||
foreground()
|
||||
#self.close_popup()
|
||||
settings["showui"] = True
|
||||
self.close_popup()
|
||||
|
||||
def on_login(self, event):
|
||||
settings["username"] = "Cole"
|
||||
settings["password"] = "12345"
|
||||
settings["username"] = "frontend"
|
||||
settings["password"] = "qwertyuiop"
|
||||
settings["login"] = True
|
||||
|
||||
def on_exit(self, event):
|
||||
wx.CallAfter(self.Destroy)
|
||||
self.close_popup()
|
||||
#print("kill cmd")
|
||||
global killme
|
||||
killme.value += 1
|
||||
self.close_popup()
|
||||
#print("kill cmd")
|
||||
|
||||
|
||||
def close_popup(self):
|
||||
self.frame.Close()
|
||||
|
Reference in New Issue
Block a user