Esempio n. 1
0
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)
Esempio n. 2
0
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()
Esempio n. 3
0
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()