forked from SlamDunkn/LOIC_Python
/
rungui.py
95 lines (75 loc) · 2.85 KB
/
rungui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# -*- coding: utf8 -*-
import wx
import os
import gui
#import main
from multiprocessing import Process, Queue
from Core.Events import *
from Core.IRC import *
from Core.Flooder import *
from main import *
#Here you overload all the functons you want
class framelogic(gui.MyFrame):
def init(self):
self.running = False;#is the flooder backend running
self.listener = Listener(LAZER_RECV, lazerParseHook)
getEventManager().addListener(self.listener)
self.listener = Listener(START_LAZER, lazerStartHook)
getEventManager().addListener(self.listener)
self.listener = Listener(IRC_RESTART, restartIRCHook)
getEventManager().addListener(self.listener)
getEventManager().start()#opens a new thread
self.irc=None;
return
def EvtConnectToHive(self,event):
if not self.running:
host = self.TextHive.GetValue();
port = int(self.TextPort.GetValue())
channel = self.TextChan.GetValue()
self.irc = IRC(host, int(port), channel)
if True:
newhost = host
newport =int(port)
newchannel = channel.replace("\\", "")
if newhost == host and newport == port and self.irc.connected:
self.echo("changing channel to " + newchannel)
self.irc.changeChannel(newchannel)
channel = newchannel
else:
host = newhost
port = newport
channel = newchannel
self.echo("changing host to "+ host + str(port) + channel)
self.ircirc.disconnect()
self.ircirc.host = host
self.ircirc.port = port
self.ircirc.channel = channel
self.ircirc.connect()
#sanity check channel
if channel[0] != '#':
channel = '#' + channel
self.irc = IRC(host, port, channel)
self.running= True;
'''
p = Process(target=backend, args=(None,host,port,channel))
p.start();
'''
return
def echo(self,message):
'''
This lets you print to the gui info screen
'''
self.TextOut.SetValue(self.TextOut.GetValue() +"\n" + message );
def backend(nothing,host,port,channel):
#get process info
parentProcess =os.getppid()
processId=os.getpid();
#main.main([nothing,host,port,channel])
#do cool things here if we need
app = wx.PySimpleApp()
wx.InitAllImageHandlers()
frame = framelogic(None, -1, "")
frame.init() #things to do at startup
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()