You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from msvcrt import getch
import os
import rainbow_table
while True:
print("""\n
欢迎使用随便做的破烂版彩虹表/生成破解程序。
使用说明如下:
1. 输入1生成彩虹表
2. 输入2破解哈希值
3. 输入3退出程序
""")
op = input("请输入操作选项:")
if op == '1':
print("""
生成命令格式如下algorithm charset min_length max_length cahin_length chain_number index\n
参数详解:
-algorithm:LM,NTLM,MD5,SHA1,SHA256
-charset:'numeric', 'alpha', 'alpha_numeric', 'loweralpha', 'loweralpha_numeric',
'mixalpha', 'mixalpha_numeric', 'ascii_32_95', 'ascii_32_65_123_4', 'alpha_numeric_symbol32_space'
具体可以看同目录下的charset.txt进行确认。
-min_length and max_length:指定想生成的表的密码范围。
-chain_length:指定单条链的长度(进行几次约简函数和哈希函数操作)。
-chain_number:指定表内总共的链数量。
-index:索引值,用于确保使用的归约函数不同。""")
try:
algorithm, charset_type, min_length, max_length, chain_length, chain_number, table_index = input("").split()
rainbow_table.rtgen(algorithm, charset_type, int(min_length), int(max_length), int(chain_length), int(chain_number), int(table_index)).table_generate()
except Exception as e:
print(f'发生错误,请检查输入的指令格式是否有误.',e)
elif op == '2':
print("""
破解指令格式如下to_crack_hash_string rainbow_table_name\n
参数详解:
-to_ceack_hash_string:输入要查表的哈希值。
-rainbow_table_name:默认读取工作目录下'.\\output'内的文件,请确保其中存在生成的表。\n""")
try:
value = input("").split()
hash_string,f_name = value
file_path = os.path.join(".\\output", f_name)
search = rainbow_table.rtsearch(hash_string,file_path)
search.crack()
except Exception as e:
print(f'\n发生错误,请检查输入的指令格式或哈希格式是否有误.',e)
elif op == '3':
print("\n感谢您的使用^_^")
break
else:
print("还没有定义这个操作哦。")
input("按任意键继续...")