{"id":13826532,"url":"https://github.com/macr0phag3/sniffer","last_synced_at":"2026-04-03T21:01:46.757Z","repository":{"id":49778439,"uuid":"123878049","full_name":"Macr0phag3/Sniffer","owner":"Macr0phag3","description":"A Sniffer for Open-WLAN ","archived":false,"fork":false,"pushed_at":"2021-12-24T08:19:12.000Z","size":407,"stargazers_count":121,"open_issues_count":0,"forks_count":42,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-05T09:15:28.100Z","etag":null,"topics":["information-security","python","wlan"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Macr0phag3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-05T06:58:15.000Z","updated_at":"2024-07-31T11:58:11.000Z","dependencies_parsed_at":"2022-08-29T17:40:30.434Z","dependency_job_id":null,"html_url":"https://github.com/Macr0phag3/Sniffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macr0phag3%2FSniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macr0phag3%2FSniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macr0phag3%2FSniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macr0phag3%2FSniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Macr0phag3","download_url":"https://codeload.github.com/Macr0phag3/Sniffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476383,"owners_count":17480215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["information-security","python","wlan"],"created_at":"2024-08-04T09:01:39.849Z","updated_at":"2026-04-03T21:01:46.750Z","avatar_url":"https://github.com/Macr0phag3.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"7bf0f5839fb2827fdc1b93ae6ac7f53d\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"32739127f0c38d61b14448c66a797098\"\u003e\u003c/a\u003e嗅探\u0026\u0026Sniff"],"readme":"```\n     _______..__   __.  __   _______  _______  _______ .______      \n    /       ||  \\ |  | |  | |   ____||   ____||   ____||   _  \\      \n   |   (----`|   \\|  | |  | |  |__   |  |__   |  |__   |  |_)  |    \n    \\   \\    |  . `  | |  | |   __|  |   __|  |   __|  |      /      \n.----)   |   |  |\\   | |  | |  |     |  |     |  |____ |  |\\  \\----.\n|_______/    |__| \\__| |__| |__|     |__|     |_______|| _| `._____| v3.0\n```\n# 中文\n\n## 介绍\n\n有一天我在无意中发现，学校的WLAN是开放的。\n\n也就是说，身边充满了Cookie与明文密码，我们只需要伸伸手，便可以拿到。\n\n然后又发现了add在freebuf发的[一篇文章](http://www.freebuf.com/articles/network/129721.html)，进而对写一个嗅探器愈发有兴趣，于是就有了这个工具。\n\n总之一句话，这个工具是用来嗅探开放WLAN下的数据包，具体嗅探的是含Cookie或者Method为Post的数据包。\n\n\n\n**把一些东西发在[freebuf](http://www.freebuf.com/wireless/165806.html?preview=true)了，转载请联系fb**\n\n\n\n## 食用方法\n\n### V2.0及以下\n\n嗅探器是一个类，有以下参数：\n\n1. iface：可选参数；嗅探使用的原始无线网卡的名字，若不填则代码会自动指定无线网卡\n\n2. newiface：可选参数；默认值为‘mon0’；由于嗅探需要开启无线网卡的监听模式（monitor），这个是将原始无线网卡改为监听模式后的名字（改为监听模式并非直接改原无线网卡，而是生成一个处于监控模式的虚拟无线网卡）；这个虚拟的无线网卡在嗅探器停止后会自动删除。\n\n3. filename：可选参数；默认为空；嗅探器可以实时嗅探，也可以解析本地的pcap包，这个参数就是本地pcaps包的名字，注意一定要放在Pcaps目录里；只需填写文件名；\n\n4. outputmode：可选参数；默认为1；嗅探器一旦发现Cookie或者Post的包，就会进行对应的输出，若不想看见实时输出，则置0，否则置1。\n\n5. savingPkt：可选参数；默认为1；嗅探器发现符合filter的数据时，会对输出的结果进行保存；若不想保存这些结果，置0；默认保存在Pkts下；若置1，则在嗅探结束的时候会提示是否删除本次捕获的所有pkts；\n\n6. savingPcap：可选参数；默认为0；嗅探器可以保存符合filter的原始数据包；1为保存；0为不保存；默认保存在Pcaps下；若置1，则在嗅探结束的时候会提示是否删除本次捕获的pcap；\n\n7. filtermode：可选参数；默认为空；与scapy的过滤语法一致，对数据包进行过滤；代码在后面默认过滤自己的ip，以及只嗅探web相关的包；\n\n8. iHost：可选参数；默认为空列表；在这里面包含的host，在停止嗅探后会高亮显示。\n\n   ​\n\n代码中有插件功能，用意是捕获到指定的数据包时，可以由插件来完成后续的工作。例如，我校的校园网帐号密码可以用cookie拿到，那么这个功能就可以写成插件。弄插件的另一个目的是分离核心代码与其他代码。\n\n\n\n举个调用的例子：\n\n```\nSniffer(savingPkt = 1, savingPcap = 1)\n```\n\n运行方式：`sudo python sniffer.py`\n\n运行截图：\n\n![example](https://github.com/Macr0phag3/Sniffer/blob/master/PicForReadme/example.png)\n\n捕获cookie时的截图：\n\n![outputmode](https://github.com/Macr0phag3/Sniffer/blob/master/PicForReadme/outputmode.png)\n\n停止时（Ctrl+c）的截图：\n\n![stop](https://github.com/Macr0phag3/Sniffer/blob/master/PicForReadme/stop.png)\n\n![stop](https://github.com/Macr0phag3/Sniffer/blob/master/PicForReadme/stop1.png)\n\n### V3.0及以上\n\nv3.0开始均为命令行参数，具体可以使用`-h` 参数来获得详细帮助信息\n\n## 注意\n\n1. 需要的库：\n\n   scapy\n\n   scapy_http\n\n   termcolor\n\n   这些库可以手动安装。\n\n   嗅探器在启动的时候也会自动检查环境并进行修复。\n\n   修复是直接使用`sudo pip install` 语句，若电脑中存在多版本的python，注意一下pip的使用，可能需要修改ToolBox中`EnvirTools` 的`autoFix`函数语句。\n\n   注意：Python 3.x 的scapy需要手动安装\n\n   *[安装scapy for Py3.x](http://scapy.readthedocs.io/en/latest/installation.html)*  \n\n2. 配置：\n\n   Ubuntu（其他Linux应该也可以）\n\n   `pip`，`iw`，`iwconfig`，`ifconfig` 需可用\n\n   以管理员权限运行\n\n   终端的宽度要足够，否则会出现很多换行。因为覆盖同一行输出的时候是用 '\\r' 实现的。\n\n\n3. Python版本\n\n   2.x and 3.x\n\n\n## 版本更新\n\n1. v1.0：实现基本功能\n2. v2.0：简化代码，完善自动检查环境脚本，修复n个Bug\n3. v2.0 Py3.x：移植v2.0到Py 3.x\n4. v3.0：增加命令行参数；完善自动检查环境脚本；简化部分代码；增加提醒气泡(嗅探的时候，无论是异常终止还是手动终止，Sniffer都会发一个气泡作为通知，前提是你的系统能使用`notify-send`。这个命令ubuntu自带，其他系统可能需要安装\n\n## 后续更新\n\n1. 代码不够简洁（逃\n2. 插件功能的实现没有我希望的那样方便，后续会改进。\n3. Sniffer的自动更新功能\n\n## 一些话\n\n目前写的比较粗糙，后续有时间会改进。但是功能是比较完善的。\n\n欢迎评论以及修改\n\n（仅限学术交流，用于非法用途概不负责）\n\n## 其他\n\u003cimg src=\"https://clean-1252075454.cos.ap-nanjing.myqcloud.com/20200528120800990.png\" width=\"500\"\u003e\n\n[![Stargazers over time](https://starchart.cc/Macr0phag3/Sniffer.svg)](https://starchart.cc/Macr0phag3/Sniffer)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacr0phag3%2Fsniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacr0phag3%2Fsniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacr0phag3%2Fsniffer/lists"}