{"id":13440153,"url":"https://github.com/schollz/howmanypeoplearearound","last_synced_at":"2025-05-13T21:07:20.089Z","repository":{"id":20811441,"uuid":"90980182","full_name":"schollz/howmanypeoplearearound","owner":"schollz","description":"Count the number of people around you :family_man_man_boy: by monitoring wifi signals :satellite:","archived":false,"fork":false,"pushed_at":"2024-08-17T14:14:41.000Z","size":1768,"stargazers_count":6948,"open_issues_count":26,"forks_count":382,"subscribers_count":161,"default_branch":"master","last_synced_at":"2025-04-28T11:58:19.613Z","etag":null,"topics":["location","sensor","tshark","wifi"],"latest_commit_sha":null,"homepage":"","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/schollz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"schollz"}},"created_at":"2017-05-11T13:06:29.000Z","updated_at":"2025-04-27T03:34:38.000Z","dependencies_parsed_at":"2024-09-30T16:20:55.649Z","dependency_job_id":"1726ed36-748c-4831-b6db-99b5549c38f1","html_url":"https://github.com/schollz/howmanypeoplearearound","commit_stats":{"total_commits":110,"total_committers":14,"mean_commits":7.857142857142857,"dds":"0.23636363636363633","last_synced_commit":"b05e06a78c8182d2a92a5a817ba5ad3cb373ee10"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fhowmanypeoplearearound","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fhowmanypeoplearearound/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fhowmanypeoplearearound/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fhowmanypeoplearearound/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schollz","download_url":"https://codeload.github.com/schollz/howmanypeoplearearound/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311332,"owners_count":21569008,"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":["location","sensor","tshark","wifi"],"created_at":"2024-07-31T03:01:20.250Z","updated_at":"2025-04-28T11:58:34.431Z","avatar_url":"https://github.com/schollz.png","language":"Python","funding_links":["https://github.com/sponsors/schollz"],"categories":["Python","Python (1887)","Tools","\u003ca id=\"a76463feb91d09b3d024fae798b92be6\"\u003e\u003c/a\u003e侦察\u0026\u0026信息收集\u0026\u0026子域名发现与枚举\u0026\u0026OSINT","\u003ca id=\"d4efda1853b2cb0909727188116a2a8c\"\u003e\u003c/a\u003e未分类-WiFi","Networking","Network"],"sub_categories":["Python","\u003ca id=\"05ab1b75266fddafc7195f5b395e4d99\"\u003e\u003c/a\u003e未分类-OSINT","\u003ca id=\"37ca6907aa42dfd32db5973ff9eec83d\"\u003e\u003c/a\u003e新添加的","Network Troubleshooting","Satellite"],"readme":"\n# howmanypeoplearearound \n\nCount the number of people around you :family_man_man_boy: by monitoring wifi signals :satellite:.\n\n*howmanypeoplearearound* calculates the number of people in the vicinity\nusing the approximate number of smartphones as a proxy (since [~70% of people have smartphones nowadays](https://twitter.com/conradhackett/status/701798230619590656)). \nA cellphone is determined to be in proximity to the computer based on sniffing WiFi probe \nrequests. Possible uses of *howmanypeoplearearound* include: monitoring foot traffic in your house\nwith Raspberry Pis, seeing if your roommates are home, etc.\n\nTested on Linux (Raspbian and Ubuntu) and Mac OS X.\n\n### **It may be illegal** to monitor networks for MAC addresses, especially on networks that *you do not own*. Please check your country's laws (for US [Section 18 U.S. Code § 2511](https://www.law.cornell.edu/uscode/text/18/2511)) - [discussion](https://github.com/schollz/howmanypeoplearearound/issues/4).\n\nGetting started\n===============\n\nFor a video walkthrough on how to install, checkout [PNPtutorials](https://youtu.be/dLzouUfJyMM?t=3m2s).\n\n## Dependencies\n\nPython 2.7 or preferably Python 3 must be installed on your machine with the `pip` command also available.\n```\n  python -V\n  pip -V\n```\n\n### WiFi adapter that supports monitor mode\n\nThere are a number of possible USB WiFi adapters that support monitor mode. Here's a list that are popular:\n\n- [USB Rt3070 $14](https://www.amazon.com/gp/product/B00NAXX40C/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B00NAXX40C\u0026linkId=b72d3a481799c15e483ea93c551742f4)\n- [Panda PAU5 $14](https://www.amazon.com/gp/product/B00EQT0YK2/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B00EQT0YK2\u0026linkId=e5b954672d93f1e9ce9c9981331515c4)\n- [Panda PAU6 $15](https://www.amazon.com/gp/product/B00JDVRCI0/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B00JDVRCI0\u0026linkId=e73e93e020941cada0e64b92186a2546)\n- [Panda PAU9 $36](https://www.amazon.com/gp/product/B01LY35HGO/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B01LY35HGO\u0026linkId=e63f3beda9855abd59009d6173234918)\n- [Alfa AWUSO36NH $33](https://www.amazon.com/gp/product/B0035APGP6/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B0035APGP6\u0026linkId=b4e25ba82357ca6f1a33cb23941befb3)\n- [Alfa AWUS036NHA $40](https://www.amazon.com/gp/product/B004Y6MIXS/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B004Y6MIXS\u0026linkId=0277ca161967134a7f75dd7b3443bded)\n- [Alfa AWUS036NEH $40](https://www.amazon.com/gp/product/B0035OCVO6/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B0035OCVO6\u0026linkId=bd45697540120291a2f6e169dcf81b96)\n- [Sabrent NT-WGHU $15 (b/g) only](https://www.amazon.com/gp/product/B003EVO9U4/ref=as_li_tl?ie=UTF8\u0026tag=scholl-20\u0026camp=1789\u0026creative=9325\u0026linkCode=as2\u0026creativeASIN=B003EVO9U4\u0026linkId=06d4784d38b6bcef5957f3f6e74af8c8)\n\nNamely you want to find a USB adapter with one of the following chipsets: Atheros AR9271, Ralink RT3070, Ralink RT3572, or Ralink RT5572.\n\n### Mac OS X\n```\n  brew install wireshark\n  brew cask install wireshark-chmodbpf\n```\n\nYou need to dissociate from any AP before initiating the scanning:\n```\nsudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z\n```\n\n### Linux [tshark](https://www.wireshark.org/docs/man-pages/tshark.html) \n```\nsudo apt-get install tshark\n```\n\nThen update it so it can be run as non-root:\n```\nsudo dpkg-reconfigure wireshark-common     (select YES)\nsudo usermod -a -G wireshark ${USER:-root}\nnewgrp wireshark\n```\n\n## Install\n```\npip install howmanypeoplearearound\n```\n\n\n## Run\n\n### Quickstart\n\nTo run, simply type in\n```bash\n$ howmanypeoplearearound\nUsing wlan1 adapter and scanning for 60 seconds...\n[==================================================] 100%        0s left\nThere are about 3 people around.\n```\n\nYou will be prompted for the WiFi adapter to use for scanning. Make sure to use\nan adapter that supports \"monitor\" mode.\n\n### Docker alternative\n\nIf Docker is installed locally and you want to take *howmanypeoplearearound* out for a quick spin, you can try the following:\n1. Copy Dockerfile from this repo in your current working directory\n2. `docker build -t howmanypeoplearearound .`  # that . at the end is important\n3. `docker run -it --net=host --name howmanypeoplearearound howmanypeoplearearound`\n\nNOTE: This Docker alternative is known to work on Ubuntu but *not* on Mac OS X.  Feedback on other platforms would be appreciated.\n\n\n### Options\n\nYou can modify the scan time, designate the adapter, or modify the output using some command-line options.\n```bash\n$ howmanypeoplearearound --help\n\nOptions:\n  -a, --adapter TEXT   adapter to use\n  -z, --analyze TEXT   analyze file\n  -s, --scantime TEXT  time in seconds to scan\n  -o, --out TEXT       output cellphone data to file\n  -v, --verbose        verbose mode\n  --number             just print the number\n  -j, --jsonprint      print JSON of cellphone data\n  -n, --nearby         only quantify signals that are nearby (rssi \u003e -70)\n  --nocorrection       do not apply correction\n  --loop               loop forever\n  --sort               sort cellphone data by distance (rssi)\n```\n\n### Print JSON\n\nYou can generate an JSON-formatted output to see what kind of phones are around:\n```bash\n$ howmanypeoplearearound -o test.json -a wlan1\n[==================================================] 100%         0s left\nThere are about 4 people around.\n$ cat test.json | python3 -m json.tool\n[\n  {\n    \"rssi\": -86.0,\n    \"mac\": \"90:e7:c4:xx:xx:xx\",\n    \"company\": \"HTC Corporation\"\n  },\n  {\n    \"rssi\": -84.0,\n    \"mac\": \"80:e6:50:xx:xx:xx\",\n    \"company\": \"Apple, Inc.\"\n  },\n  {\n    \"rssi\": -49.0,\n    \"mac\": \"ac:37:43:xx:xx:xx\",\n    \"company\": \"HTC Corporation\"\n  }\n]\n```\n\nA higher rssi means closer (one of these phones is mine, and the other two are my roommates' who were upstairs). \n\n### Run forever\n\nYou can add `--loop` to make this run forever and append new lines an output file, `test.json`:\n```bash\n$ howmanypeoplearearound -o test.json -a wlan1 --loop\n```\n\n### Visualize \n\nYou can visualize the output from a looped command via a browser using:\n```bash\n$ howmanypeoplearearound --analyze test.json \nWrote index.html\nOpen browser to http://localhost:8001\nType Ctl+C to exit\n```\n\nThen just open up `index.html` in a browser and you should see plots. The first plot shows the number of people over time. Here you can see that people start arriving at work place around 8-9am (when work starts!).\n\n![newplot](https://cloud.githubusercontent.com/assets/6550035/26174159/b478b764-3b0b-11e7-9600-2aa215b789d0.png)\n\nThe second plot shows the RSSI values for the mac addresses seen. You can double-click on one of them in particular to highlight that trajectory, as I have done here for my phone (you can see when I leave from and when I arrive to work!):\n\n![newplot 1](https://cloud.githubusercontent.com/assets/6550035/26174160/b4911ae8-3b0b-11e7-93b2-92c3efaa01aa.png)\n\n\nHow does it work?\n==================\n\n*howmanypeoplearearound* counts up the number of probe requests coming from cellphones in a given amount of time.\nThe probe requests can be \"sniffed\" from a monitor-mode enabled WiFi adapter using `tshark`. An accurate count does \ndepend on everyone having cellphone and also scanning long enough (1 - 10 minutes) to capture the packet when \na phone pings the WiFi network (which happens every 1 to 10 minutes unless the phone is off or WiFi is disabled).\n\nThis is a simplification of another program I wrote, [find-lf](https://github.com/schollz/find-lf) which uses a similar idea with a cluster of Raspberry Pis to geolocate positions of cellphones within the vicinity.\n\nLicense\n=======\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fhowmanypeoplearearound","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschollz%2Fhowmanypeoplearearound","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fhowmanypeoplearearound/lists"}