Sneaker's Stub – The Grey Stuff!

Hacking with Python Series: SSH bruteforcing script using PXSSH

This is a guide about how you can create SSH bruteforcing script using python. With this script you can bruteforce the username and password for SSH protocol. Below is the requirement and explanation to create this script.

This code can do more than just brute forcing, It checks, if SSH port is open. If it is open, It takes the banner. Since I have already told you about how to make socket connection in Python so I thought to add its code in this script.

Code Explanation:

import os: I have imported this to run OS commands, If you have gone through Part 1 of Hacking with Python, I have shared a pdf, that gave you a thorough introduction to important packages in os command. I will be running KALI OS command through this.

found=1 : It is just a variable that will act as a flag. This will check if the username and password works.

def usg(): Simple function to give out the usage property of our function.

def brute(): Function that actually runs brute function and run pxssh to make connection.

def scan(): Function that scans the target for SSH port and grab its banner.