def main(): password_list = read_dict('password.dic') for ip in ip_list: executor = TaskExecutor(password_list) executor.run(weak_pass, ip) for t in found_password: logger.info('%s password is %s' % t)
def main(): password_list = read_dict('password.dic') for ip in ip_list: url = 'http://%s/manager/html' % ip executor = TaskExecutor(password_list) executor.run(weak_pass, url) for t in found_password: logger.info('%s password is %s' % t)
def init_dict(self): if self.first_item != '': first_queue = [self.first_item] first_queue.extend(self.make_bak_file_list(self.first_item)) first_queue = [(t, 'HEAD') for t in first_queue] self.first_queue.extend(first_queue) if self.scan_dict is None: self.dict_data['dir'] = read_dict('dictionary/dir.txt') if self.site_lang != '': self.dict_data[self.site_lang] = read_dict( 'dictionary/%s.txt' % self.site_lang) else: tmp_dict_list = [t for t in DICT_LIST if t != 'dir'] for t in tmp_dict_list: self.dict_data[t] = read_dict('dictionary/%s.txt' % t) else: for t in self.scan_dict: self.dict_data[t] = read_dict('dictionary/%s.txt' % t)
def main(): with open('found_ssh.txt', 'w') as f: f.write(str('')) password_list = read_dict('ssh_password.txt') for ip in ip_list: # 如果是爆破,max_workers 设置大一点 executor = TaskExecutor(password_list, max_workers=2) # executor.run(weak_pass, ip) Thread(target=executor.run, args=(weak_pass, ip)).start()
def main(): password_list = read_dict('password.dic') for ip in ip_list: # 测试匿名登录 if anonymous(ip): continue executor = TaskExecutor(password_list, max_workers=20) executor.run(weak_pass, ip) for t in found_password: logger.info('%s password is %s' % t)
def main(): socket.setdefaulttimeout(10) password_list = read_dict('password.dic') for ip in ip_list: sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sk.connect((ip, 3389)) except Exception as e: logger.info(e) logger.info('ip %s port %s can not be connected!' % (ip, 3389)) continue for username in username_list: executor = TaskExecutor(password_list) executor.run(weak_pass, ip, username) for t in found_password: logger.info('%s password is %s' % t)
def init_dict(self): self.task_queue = read_dict(self.ip_file_name) self.total_count = len(self.task_queue)
# -*- coding: utf-8 -*- # Created by restran on 2016/10/10 from __future__ import unicode_literals, absolute_import import logging from ftplib import FTP import os import sys # 把项目的目录加入的环境变量中,这样才可以导入 common.base sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from common.base import read_dict, TaskExecutor logger = logging.getLogger(__name__) ip_list = read_dict('ip.txt') username_list = ['admin', 'root', 'test', 'cmcc', 'ftp'] found_password = [] def weak_pass(password, ip): for name in username_list: try: f = FTP(host=ip) f.login(user=name, passwd=password) found_password.append((ip, password)) logger.info('[True ] %s %s:%s' % (ip, name, password)) return True except Exception as e: logger.info(e) logger.info('[False] %s %s:%s' % (ip, name, password))
import traceback import paramiko import os import sys # 把项目的目录加入的环境变量中,这样才可以导入 common.base sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from common.base import read_dict, TaskExecutor logger = logging.getLogger(__name__) """ ssh 弱口令爆破 """ ip_list = read_dict('ip.txt', clear_none=True) username_list = ['root'] found_password = [] def weak_pass(password, ip, port=22, timeout=5): for name in username_list: try: client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(ip, port, str(name), str(password), timeout=timeout) found_password.append((ip, password)) logger.warning('[True ] %s %s:%s' % (ip, name, password)) return True except Exception as e: logger.info(e)
def init_dict(self): self.list_data = read_dict(self.ip_file_name)