Ejemplo n.º 1
0
    def __init__(self):

        # our irc-object
        self.irc = IRC(self.update_window2)

        # init the screen
        self.scr = curses.initscr()
        curses.noecho()
        curses.cbreak()
        self.scr.keypad(1)

        # init the first window as status window
        y, x = self.scr.getmaxyx()
        self.statuswin = curses.newwin(1, x, y - 2, 0)
        self.statuswin.addstr(0, 0, "[NOT CONNECTED]")

        # staus win 2 who@where
        statuswin2W = 10
        self.statuswin2 = curses.newwin(1, statuswin2W, y - 1, 0)
        self.statuswin2.addstr(0, 0, "NICK")

        # type win
        self.typewin = curses.newwin(1, x - statuswin2W - 1, y - 1,
                                     statuswin2W - 1)
        self.typewin.keypad(1)

        # message win
        self.messagewin = curses.newwin(
            y - 2, x - 13, 0,
            0)  # nick lengt is 9 char should be done dynamically
        # so that windows size should depend on nick lenghts

        # nick win
        self.nickwin = curses.newwin(y - 2, 13, 0,
                                     x - 13)  # should also be dynamic

        self.textbuffer = EditBuffer()  # edit buffer for text input

        # list of our window (channel)
        self.mwindows = list()
        self.active_mwindow = 0

        # refresh the windows
        self.messagewin.refresh()
        self.statuswin.refresh()
        self.statuswin2.refresh()
        self.typewin.refresh()
Ejemplo n.º 2
0
import globals
import IRC

#print(globals.channel)

IrcClient = IRC.IRC("irc.chat.twitch.tv", 6667,
                    "#" + globals.channel.user_name, globals.channel.user_name,
                    "robost4r", 'oauth:' + globals.channel.secret)

IrcClient.main()
Ejemplo n.º 3
0
# Umi is a simple IRC client

import IRC, Config, Logger

# An instance of Config to pull configuration options
conf = Config.Config()

# A Logger object for writing to the Terminal
log = Logger.Logger(conf)

# Establish a connection to the IRC network
Umi = IRC.IRC(conf.network(), log, conf)
Ejemplo n.º 4
0
def main(torBool, sslBool):
    global shodanAPI
    global irc
    global botNick
    global channel
    global botPassword
    global email

    ##Shodan
    shodanAPI = shodan.Shodan(shodanKey)

    ##TOR
    if (False):
        tor = TOR(controlPort, torKey)
        tor.torConnect()

    ##IRC
    irc = IRC(serverAddress, ircPort, True, True, socksPort)
    irc.bootStrap(botNick, channel, True, True)

    flag = True
    while flag:
        text = irc.getText()
        if (text != None):
            print text

            if ("NOTICE" in text and "This nickname is registered" in text):
                irc.send('NickServ', 'VERIFY REGISTER PikeBot iwwxzqbtrwsc')
                irc.nickServIdentify(botPassword)
            elif ("NickServ" in text and "PRIVMSG" in text
                  and "is not a registered nickname" in text):
                irc.nickServRegister(botPassword, email)
            elif ("PRIVMSG" in text and channel in text and "?help" in text):
                irc.send(channel, "?help, ?about, ?shodan host")
            elif ("PRIVMSG" in text and channel in text
                  and "?shodan host" in text):
                try:
                    user = re.search(r':(.*)!', text).group(1)
                    host = re.search(r'\?shodan host (.*)\r\n', text).group(1)
                    print '[+] User:'******'[+] URL: ' + host
                except AttributeError:
                    pass
                shodanHost(host, user)
            elif (("JOIN :" + channel + "\r\n") in text
                  and "NOTICE" not in text and botNick not in text):
                try:
                    user = re.search(r':(.*)!', text).group(1)
                    #irc.send(channel, "hey " + user + ". " + "how's it going?")
                except AttributeError:
                    pass
            elif ("PRIVMSG" in text and channel in text and "?about" in text):
                irc.send(channel, "PikeBot V0.1 By:NotPike")
            elif ("PRIVMSG" in text and channel in text
                  and "Nickname is already in use" in text):
                botNick = "IfNot" + botNick
                irc.bootStrap(botNick, channel, True, True)
            elif ("ERROR :Closing link:" in text):
                irc.close()
                print "[!] Reconnecting..."
                time.sleep(5)
                irc.bootStrap(botNick, channel, True, True)
            elif ("JOIN :You have not registered\r\n" in text):
                irc.nickServRegister(botPassword, email)
                irc.nickServIdentify(botPassword)
                irc.nick(botNick)
                irc.join(channel)

        else:
            irc.close()
            print "[!] Reconnecting..."
            time.sleep(5)
            irc.bootStrap(botNick, channel, True, True)
def main(torBool, sslBool):
    global shodanAPI
    global irc
    global botNick
    global channel
    global botPassword
    global email

    ##Shodan
    shodanAPI = shodan.Shodan(shodanKey)

    ##TOR
    if (False):
        tor = TOR(controlPort, torKey)
        tor.torConnect()

    ##IRC
    irc = IRC(serverAddress, ircPort, True, True, socksPort)
    irc.bootStrap(botNick, channel)

    flag = True
    while flag:
        text = irc.getText()
        if (text != None):
            print text

            #NickServ and Bot Name
            if ("NOTICE" in text and "This nickname is registered" in text):
                irc.nickServIdentify(botPassword)
            elif ("NickServ" in text and "PRIVMSG" in text
                  and "is not a registered nickname" in text):
                irc.nickServRegister(botPassword, email)
            elif ("JOIN :You have not registered\r\n" in text):
                irc.nickServRegister(botPassword, email)
                irc.nickServIdentify(botPassword)
                irc.nick(botNick)
                irc.join(channel)
            elif ("PRIVMSG" in text and channel in text
                  and "Nickname is already in use" in text):
                botNick = "IfNot" + botNick
                irc.nick(botNick)

            #Bot Functions
            elif ("PRIVMSG" in text and channel in text and "?help" in text):
                irc.send(channel, "?help, ?about, ?shodan host")
            elif ("PRIVMSG" in text and channel in text
                  and "?shodan host" in text):
                try:
                    user = re.search(r':(.*)!', text).group(1)
                    host = re.search(r'\?shodan host (.*)\r\n', text).group(1)
                    print '[+] User:'******'[+] URL: ' + host
                except AttributeError:
                    pass
                shodanHost(host, user)
            elif (("JOIN :" + channel + "\r\n") in text
                  and "NOTICE" not in text and botNick not in text):
                try:
                    user = re.search(r':(.*)!', text).group(1)
                    irc.send(channel, "hey " + user)
                except AttributeError:
                    pass
            elif ("PRIVMSG" in text and channel in text and "?about" in text):
                irc.send(channel, "PikeBot V0.1 By:NotPike")
            elif ("PRIVMSG" in text and channel in text and killWord in text):
                try:
                    user = re.search(r':(.*)!', text).group(1)
                    if (user == ownerNick):
                        flag = False
                        irc.part(channel, partMsg)
                        irc.close()
                        sys.exit(0)
                    else:
                        irc.send(channel, "try harder")
                except AttributeError:
                    pass

            #Error handling
            elif ("ERROR :Closing link:" in text):
                print "[!] Reconnecting..."
                irc.close()
                irc.restart()
                irc.bootStrap(botNick, channel)

        else:
            print "[!] Reconnecting..."
            irc.close()
            irc.restart()
            irc.bootStrap(botNick, channel)
Ejemplo n.º 6
0
import os
import shlex
import random
from IRC import *
from dcc import *

query = raw_input("Book title: ")

## IRC Config
server = "irc.irchighway.net"
port = 6667
channel = "#ebooks"
botnick = "bOOkbot"
irc = IRC()
irc.connect(server, port, channel, botnick)

irc.send("#ebooks", "@search " + query)

while True:
    text = irc.get_response()
    #if text.find('PRIVMSG') != -1: #see all messages, for fun
    #    print(text)
    if "DCC SEND" in text:
        print(text)
        break

dccString = text.split("DCC SEND ", 1)[1].replace('\x01', '')
dccString = shlex.split(dccString)

downloadfile(dccString)