def doCrack(address, username, password): host = h.getPath(address) port = h.getPort(address) if h.getPort(address) != None else 23 try: tn = telnetlib.Telnet(host, port, timeout=10) tn.set_debuglevel(0) #2是为了看更多东西 # tn.read_until("login: "******"\r\n".encode('ascii')) # tn.read_until("password: "******"\r\n".encode('ascii')) tn.read_until("login:"******"\r\n") tn.read_until("assword:") tn.write(password + "\r\n") res = tn.read_some() res = tn.read_some() res = tn.read_some() tn.write("exit\r\n") tn.close() # Windows下登录失败关键字为Login Failed,Linux下登录失败关键字为Login incorrect。 rex = r'Login\s+(Failed|incorrect)' tmp = re.search(rex, res) if tmp == None: return True, u'Crack success!' else: return False, u'Crack fail!' except Exception as e: return False, str(e)
def crack_in_linux(address, username, password): ''' 中文提示:用户 'sa' 登录失败。 英文提示:Login failed for user 经过测试在linux下成功 window7下报错:struct.error: ('unpack requires a string argument of length 1', "When unpacking field 'Type | <B | ''[:1]'") ''' host = h.getPath(address) port = h.getPort(address) if h.getPort(address) != None else 1433 fp = tds.MSSQL(host, int(port)) fp.connect() r = fp.login(None, username, password, None, None, False) # 第二种登录方式:r = fp.login(None, username, password, domain, password_hash, True) if not r: key = fp.replies[TDS_ERROR_TOKEN][0] code = key['Number'] mesg = key['MsgText'].decode('utf-16le') else: key = fp.replies[TDS_LOGINACK_TOKEN][0] code = '0' mesg = '%s (%d%d %d%d)' % (key['ProgName'].decode('utf-16le'), key['MajorVer'], key['MinorVer'], key['BuildNumHi'], key['BuildNumLow']) fp.disconnect() code = int(code) if code == 0: return True, mesg elif code == 18456: return False, mesg else: return False, mesg
def doCrack(address, username, password): ''' # ORA-28000 代表账号被锁 # ORA-01017 代表账号或密码不正确 # ORA-12505 代表sid不正确 ''' host = h.getPath(address) port = h.getPort(address) if h.getPort(address) != None else 1521 ## 该处存在问题,如果没有传入参数,也没有报错。 sid = h.getParameters(address).get('sid') service_name = h.getParameters(address).get('service_name') if sid and sid != None: dsn = cx_Oracle.makedsn(host=host, port=port, sid=sid) elif service_name and service_name != None: dsn = cx_Oracle.makedsn(host=host, port=port, service_name=service_name) else: mesg = 'Options sid and service_name cannot be both empty' return False, mesg try: fp = cx_Oracle.connect(username, password, dsn, threaded=True) code, mesg = '0', fp.version return True, mesg except cx_Oracle.DatabaseError as e: code, mesg = e.args[0].message[:-1].split(': ', 1) return False, mesg
def doCheck(address,username_list,password_list): hash_str = getPath(address) if len(hash_str) != 128: return False,u'%s格式错误,sha512密文长度应该为128!' % hash_str elif not (len(username_list) == 1 and username_list[0] == ''): return False,u'sha512破解,无需设置账号!' else: return True,None
def doCheck(address, username, password): hash_str = getPath(address) if len(hash_str) != 40: return False, u'%s格式错误,sha1密文长度应该为40!' % hash_str elif not (len(username) == 1 and username[0] == ''): return False, u'sha1破解,无需设置账号!' else: return True, None
def doCheck(address, username, password): hash_str = getPath(address) if len(hash_str) != 16 and len(hash_str) != 32: return False, u'%s格式错误,md5密文长度应该为16或者32!' % hash_str elif not (len(username) == 1 and username[0] == ''): return False, u'md5破解,无需设置账号!' else: return True, None
def doCrack(address, username, password): hash_str = getPath(address) m = MD2.new() m.update(password) encrypt_str = m.hexdigest() if encrypt_str.lower() == hash_str.lower(): return True, 'Crack success!' else: return False, 'Crack fail!'
def doCrack(address, username, password): try: filename = getPath(address) print filename #rfile = rarfile.RarFile(filename) #rfile.extractall(path=getTmpPath(), pwd=password) return True, None except: return False, u'解压失败'
def doCrack(address, username, password): hash_str = getPath(address) m = hashlib.sha256() m.update(password) encrypt_str = m.hexdigest() if encrypt_str.lower() == hash_str.lower(): return True, u'Crack success!' else: return False, 'Crack fail!' #搞不懂这里加u就报编码错误
def doCrack(address, username, password): try: tmp_path = os.getcwd() + '\\tmp\\crackRAR' filename = getPath(address) rfile = rarfile.RarFile(filename) rfile.extractall(path=tmp_path, pwd=password) del_dir(tmp_path) return True, None except: return False, u'解压失败'
def doCrack(address, username, password): filename = getPath(address) pdfReader = PyPDF2.PdfFileReader(open(filename, 'rb')) if pdfReader.isEncrypted: if pdfReader.decrypt(password): return True, u'破解成功' else: return False, u'破解失败' else: return False, u'该pdf未加密'
def doCrack(address,username,password): host = getPath(address) port = getPort(address) try: ftp = ftplib.FTP(host) ftp.connect(host, port, timeout = 10) ftp.login(username, password) ftp.quit() return True,u'Crack success!' except ftplib.all_errors: return False,u'Crack fail!'
def crack_in_windows(address, username, password): host = h.getPath(address) port = h.getPort(address) if h.getPort(address) != None else 1433 try: db = pymssql.connect(server=host, port=port, user=username, password=password) return True, None except Exception, e: return False, str(e)
def doCrack(address, username, password): host = getPath(address) port = getPort(address) db = None try: db = MySQLdb.connect(host=host, user=username, passwd=password, db='mysql', port=int(port)) return True, u'Crack success!' except: return False, u'Crack fail!' finally: if db: db.close()
def doCrack(address,username,password): ''' # ORA-28000 代表账号被锁 # ORA-01017 代表账号或密码不正确 # ORA-12505 代表sid不正确 ''' host = h.getPath(address) port = h.getPort(address) if h.getPort(address) !=None else 1521 dsn = cx_Oracle.makedsn(host=host, port=port, sid=password) try: fp = cx_Oracle.connect('SYS', '', dsn, threaded=True) code, mesg = '0',fp.version return True,mesg except cx_Oracle.DatabaseError as e: code,mesg = e.args[0].message[:-1].split(': ', 1) #print code,mesg if code == 'ORA-12505': return False,u'Crack fail!' else: return True,u'Crack success!'
def doCrack(address,username,password=None): v = VNC() host = h.getPath(address) port = h.getPort(address) timeout='10' try: with Timing() as timing: code, mesg = 0, v.connect(host, int(port or 5900), int(timeout)) with Timing() as timing: code, mesg = v.login(password) except VNC_Error as e: #print 'VNC_Error: %s' % e code, mesg = 2, str(e) print code,mesg if code == 0: return True,u'Crack success!' elif code == 1: return False,u'Crack fail!' else: return False,u'Crack fail!'