{"id":13540287,"url":"https://github.com/securing/gattacker","last_synced_at":"2025-04-02T07:30:47.552Z","repository":{"id":37664608,"uuid":"64836808","full_name":"securing/gattacker","owner":"securing","description":"A Node.js package for BLE (Bluetooth Low Energy) security assessment using Man-in-the-Middle and other attacks","archived":false,"fork":false,"pushed_at":"2022-01-31T05:53:09.000Z","size":312,"stargazers_count":702,"open_issues_count":17,"forks_count":141,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-10-23T12:29:05.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.gattack.io","language":"JavaScript","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/securing.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":"2016-08-03T10:21:08.000Z","updated_at":"2024-10-07T09:52:51.000Z","dependencies_parsed_at":"2022-07-12T16:42:39.571Z","dependency_job_id":null,"html_url":"https://github.com/securing/gattacker","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/securing%2Fgattacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securing%2Fgattacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securing%2Fgattacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securing%2Fgattacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/securing","download_url":"https://codeload.github.com/securing/gattacker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429493,"owners_count":20775808,"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":[],"created_at":"2024-08-01T09:01:45.047Z","updated_at":"2025-04-02T07:30:43.284Z","avatar_url":"https://github.com/securing.png","language":"JavaScript","readme":"![gattacker](https://raw.githubusercontent.com/securing/gattacker/master/img/gattacker.png)\n\n\nA Node.js package for BLE (Bluetooth Low Energy) Man-in-the-Middle \u0026 more.\n\n\n## Prerequisites\n\nsee:\n\nhttps://github.com/sandeepmistry/noble\n\nhttps://github.com/sandeepmistry/bleno\n\n\n## Install\n\n```sh\nnpm install gattacker\n```\n\n## Usage\n\n### Configure \n\nRunning both components Set up variables in config.env:\n\n* NOBLE_HCI_DEVICE_ID : noble (\"central\", ws-slave) device\n* BLENO_HCI_DEVICE_ID : bleno (\"peripheral\", advertise) device\n\nIf you run \"central\" and \"peripheral\" modules on separate boxes with just one BT4 interface, you can leave the values commented.\n\n\n* WS_SLAVE : IP address of ws-slave box\n* DEVICES_PATH : path to store json files \n\n### Start \"central\" device \n\n```sh\nsudo node ws-slave\n```\nConnects to targeted peripheral and acts as websocket server.\n\n\nDebug: \n\n```sh\nDEBUG=ws-slave sudo node ws-slave\n```\n\n### Scanning\n\n#### Scan for advertisements\n\n```sh\nnode scan\n```\nWithout parameters scans for broadcasted advertisements, and records them as json files (.adv.json) in DEVICES_PATH \n\n\n#### Explore services and characteristics\n\n```sh\nnode scan \u003cperipheral\u003e\n```\nExplore services and characteristics of chosen peripheral. \nSaves the explored service structure in json file (.srv.json) in DEVICES_PATH.\n\n\n### Hook configuration (option)\n\nFor active request/response tampering configure hook functions for characteristic in device's json services file.\n\nExample:\n\n```javascript\n            {\n                \"uuid\": \"06d1e5e779ad4a718faa373789f7d93c\",\n                \"name\": null,\n                \"properties\": [\n                    \"write\",\n                    \"notify\"\n                ],\n                \"startHandle\": 8,\n                \"valueHandle\": 9,\n                \"endHandle\": 10,\n                \"descriptors\": [\n                    {\n                        \"handle\": 10,\n                        \"uuid\": \"2902\",\n                        \"value\": \"\"\n                    }\n                ],\n                \"hooks\": {\n                    \"dynamicWrite\": \"dynamicWriteFunction\",\n                    \"dynamicNotify\": \"customLog\"\n                }\n            }\n```\n\nFunctions:\n\n\u003cdynamic|static\u003e\u003cWrite|Read|Notify\u003e \n\n dynamic: connect to original device\n\n static: do not connect to original device, run the tampering function locally\n\n It will try to invoke the specified function from hookFunctions, include your own.\n A few examples provided in hookFunctions subdir.\n\nstaticValue - static value\n\n\n\n### Start \"peripheral\" device \n\n```sh\nnode advertise -a \u003cadvertisement_json_file\u003e [ -s \u003cservices_json_file\u003e ]\n```\n\nIt connects via websocket to ws-slave in order to forward requests to original device.\nStatic run (-s) sets services locally, does not connect to ws-slave. You have to configure the hooks properly.\n\n## MAC address cloning\n\nFor many applications it is necessary to clone MAC address of original device.\nA helper tool bdaddr from Bluez is provided in helpers/bdaddr.\n\n```sh\ncd helpers/bdaddr\nmake\n```\n\nwrapper script:\n\n```sh\n./mac_adv -a \u003cadvertisement_json_file\u003e [ -s \u003cservices_json_file\u003e ]\n```\n\n## Dump, replay\n\nDump files are saved in a path configured by `DUMP_PATH` in config.env (by default `dump`).\nMore info:\nhttps://github.com/securing/gattacker/wiki/Dump-and-replay\n\n## Troubleshooting\n\nTurn off, cross fingers, try again ;)\n\n### reset device\n\n```sh\nhciconfig \u003chci_interface\u003e reset\n```\n\n### Running ws-slave and advertise on the same box\n\nWith this configuration you may experience various problems.\n\nTry switching NOBLE_HCI_INTERFACE and BLENO_HCI_INTERFACE\n\n\n### hcidump debug\n\n```sh\nhcidump -x -t \u003chci_interface\u003e\n```\n\n## FAQ, more information\n\nFAQ: [https://github.com/securing/gattacker/wiki/FAQ](https://github.com/securing/gattacker/wiki/FAQ)\n\nMore information: [www.gattack.io](www.gattack.io)\n\n\n\n## License\n\nCopyright (C) 2016 Slawomir Jasek, SecuRing \u003cslawomir.jasek@securing.pl\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","funding_links":[],"categories":["\u003ca id=\"79499aeece9a2a9f64af6f61ee18cbea\"\u003e\u003c/a\u003e浏览嗅探\u0026\u0026流量拦截\u0026\u0026流量分析\u0026\u0026中间人","JavaScript","JavaScript (485)","\u003ca id=\"42f9e068b6511bcbb47d6b2b273097da\"\u003e\u003c/a\u003e未分类","\u003ca name=\"bluetooth_security_tools\"\u003e\u003c/a\u003eBluetooth Security Tools","2. [↑](#-content) Pentesting","TODO List","Wireless Protocols"],"sub_categories":["\u003ca id=\"11c73d3e2f71f3914a3bca35ba90de36\"\u003e\u003c/a\u003e中间人\u0026\u0026MITM","\u003ca id=\"3bd67ee9f322e2c85854991c85ed6da0\"\u003e\u003c/a\u003e投毒\u0026\u0026Poisoning","Man-in-the-middle \u0026 Packet Injection","[↑](#-content) 2.9 Bluetooth","Vulnerabilities to be added soon","Bluetooth / BLE"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecuring%2Fgattacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecuring%2Fgattacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecuring%2Fgattacker/lists"}