{"id":13673747,"url":"https://github.com/JiapengLi/lorawan-parser","last_synced_at":"2025-04-28T11:30:41.555Z","repository":{"id":34644520,"uuid":"38604976","full_name":"JiapengLi/lorawan-parser","owner":"JiapengLi","description":"LoRaWAN protocol parser and packer in C","archived":false,"fork":false,"pushed_at":"2024-05-11T11:09:46.000Z","size":324,"stargazers_count":133,"open_issues_count":1,"forks_count":51,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-11T13:35:42.755Z","etag":null,"topics":["lora","lorawan","lorawan-frames","tool"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"frostycpu/FinalesFunkeln","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JiapengLi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-06T07:49:19.000Z","updated_at":"2024-11-11T05:17:58.000Z","dependencies_parsed_at":"2022-09-15T07:10:15.579Z","dependency_job_id":null,"html_url":"https://github.com/JiapengLi/lorawan-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiapengLi%2Florawan-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiapengLi%2Florawan-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiapengLi%2Florawan-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiapengLi%2Florawan-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JiapengLi","download_url":"https://codeload.github.com/JiapengLi/lorawan-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251304673,"owners_count":21567919,"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":["lora","lorawan","lorawan-frames","tool"],"created_at":"2024-08-02T11:00:21.097Z","updated_at":"2025-04-28T11:30:40.550Z","avatar_url":"https://github.com/JiapengLi.png","language":"C","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# Introduction\r\n\r\nThis LoRaWAN tool is for LoRaWAN developers who need know the details of LoRaWAN protocol.\r\n\r\nWith lorawan-parser, you can see all details of a LoRaWAN frame, like how is the frame structured, how data is encrypted and decrypted, what is DEVEUI / APPEUI / DEVADDR like etc.\r\n\r\n## Features\r\n\r\n- [x] LoRaWAN 1.0\r\n    - V1.0.2 / V1.0.2B\r\n- [x] Support both ABP and OTAA mode device\r\n- [x] Colorful terminal outputs (Windows MiniTTY not supported)\r\n- [x] Cross platform (Tested on Ubuntu, Lubuntu, Raspberry Pi, OpenWRT, Windows)\r\n- [ ] LoRaWAN V1.1\r\n  - Work in progress\r\n- [ ] Support Semtech packet forwarder v1 and v2 protocol\r\n- [ ] Live parse LoRaWAN motes message (To support RisingHF gateway or Semtech IoT Start Kit)\r\n\r\n\r\n## Usage\r\n\r\nRefer to `util/test/main.c` to know the usage of lorawan API.\r\n\r\nAfter compile find `lwp.exe/lwp` under `util/parser/` directory to parse the LoRaWAN frame.\r\n\r\n```\r\n--------------------------------------------------------------------------------\r\nUsage: lwp.exe [OPTIONS]\r\n -h, --help                     Help\r\n -v, --version                  Version 0.3.0\r\n\r\n--------------------------------------------------------------------------------\r\n -c, --burst-parse  \u003cfile\u003e      Parse lwp json format file\r\n -m, --maccmd       \u003chex\u003e       Parse MAC command\r\n -p, --parse        [hex]       Parse packet\r\n -g, --pack         [hex]       Generate packet\r\n -f, --pktfwd       [file]      Packet forwarder mode\r\n     --join                     Analyze JR and JA\r\n\r\n--------------------------------------------------------------------------------\r\n -B, --band         \u003cstring\u003e    PHY band EU868/US915/EU434/AU920/CN780/CN470\r\n -N, --nwkskey      \u003chex\u003e       NwkSKey\r\n -A, --appskey      \u003chex\u003e       AppSKey\r\n -K, --appkey       \u003chex\u003e       AppKey\r\n\r\n--------------------------------------------------------------------------------\r\n -T, --type         \u003cstring\u003e    Frame type (JR/JA/UU/UD/CU/CD/P)\r\n -D, --devaddr      \u003chex\u003e       DevAddr\r\n     --ack                      FCtrl ACK\r\n     --aareq                    FCtrl ADRACKReq\r\n     --adr                      FCtrl ADR\r\n     --classb                   FCtrl CLASSB\r\n     --fpending                 FCtrl FPENDING\r\n -O, --fopts        \u003chex\u003e       FOpts, LoRaWAN Options\r\n -C                 \u003chex\u003e       Frame counter (hex)\r\n     --counter      \u003cint\u003e       Frame counter (int)\r\n -P                 \u003chex\u003e       Port (hex)\r\n     --port         \u003cint\u003e       Port (int)\r\n\r\n--------------------------------------------------------------------------------\r\n     --appeui       \u003chex\u003e       AppEui\r\n     --deveui       \u003chex\u003e       DevEui\r\n     --anonce       \u003chex\u003e       AppNonce (3 byets)\r\n     --dnonce       \u003chex\u003e       DevNonce (2 byets)\r\n     --netid        \u003chex\u003e       NetId (3 byets)\r\n     --cflist       \u003chex\u003e       CFList (16 bytes)\r\n     --rx1droft     \u003cint\u003e       RX1DRoffset (0~7)\r\n     --rx2dr        \u003cint\u003e       RX2DataRate (0~15)\r\n     --rxdelay      \u003cint\u003e       RxDelay (0~15)\r\n     --jr           \u003chex\u003e       JoinRequest raw data\r\n     --ja           \u003chex\u003e       JoinAccept raw data\r\n\r\n--------------------------------------------------------------------------------\r\n     --motes        \u003cfile\u003e      Motes/Nodes JSON file\r\n     --nodes        \u003cfile\u003e      Same as --motes\r\n\r\n--------------------------------------------------------------------------------\r\n -b, --board        \u003cfile\u003e      Board specific TX power table and RSSI offset\r\n -i, --iface        \u003cstring\u003e    Network interface, default eth0\r\n\r\n--------------------------------------------------------------------------------\r\nDefault AppKey/NwkSKey/AppSKey 2B7E151628AED2A6ABF7158809CF4F3C\r\n```\r\n\r\n### Pack LoRaWAN frame\r\n```\r\n# Unconfirmed uplink\r\n$ ./lwp --pack \"00112233\" -T UU --devaddr 01111111 --adr --ack --counter 1113 --port 2\r\n\r\n# Confirmed uplink without payload\r\n$ ./lwp --pack -T CU --devaddr 01111111 --adr --ack --aareq --counter 1113\r\n\r\n# Unconfirmed downlink\r\n$ ./lwp --pack \"00112233\" -T UD --devaddr 01111111 --adr --ack --port 2 --counter 1113\r\n\r\n# Confirmed downlink without payload, frame pending set\r\n$ ./lwp --pack -T CD --devaddr 01111111 --adr --ack --pending --counter 1113\r\n\r\n# Join request\r\n$ ./lwp --pack -T JR --deveui 0123456789ABCDEF --appeui 0000000000000001 --dnonce ABCD\r\n\r\n# Join accept, --dnonce is used to generate NwkSKey and AppSKey\r\n$ ./lwp --pack -T JA --devaddr 0123456 --anonce ABCDEF --netid 000008 --rx1droft 0 --rx2dr 0 --rxdelay 1 --dnonce ABCD\r\n```\r\n\r\n### Parse LoRaWAN frame\r\n```\r\n# Parser with specified keys\r\n$ ./lwp --parse \"40 11 11 11 01 A0 59 04 02 0F A0 9D 7C 61 F3 FA B7\" --nwkskey 2B7E151628AED2A6ABF7158809CF4F3C --appskey 2B7E151628AED2A6ABF7158809CF4F3C --appkey 2B7E151628AED2A6ABF7158809CF4F3C\r\n\r\n# Parse with default key\r\n$ ./lwp --parse \"40 11 11 11 01 A0 59 04 02 0F A0 9D 7C 61 F3 FA B7\"\r\n```\r\n\r\n### Parse LoRaWAN MACCMD\r\n```\r\n$ lwp -T CD -m \"02 30 01\"\r\n```\r\n\r\n### Parse JoinRequest and JoinAccept\r\n\r\n```\r\n# Parse JR/JA pair\r\n$ ./lwp --join --jr \"0001000000000000860100000000000086F79FB4C20660\" --ja \"202D9583ABA736C80F9700DB420A010554\" --appkey \"86000000000000008600000000000000\"\r\n```\r\n\r\n### Burst Parse LoRaWAN Frame\r\n\r\n```\r\n$ ./lwp -c lwp-config.json\r\n```\r\n\r\nTo go further, user could fill their own LoRaWAN frames in a json file to parse it.\r\n\r\n### Packet Forwarder Mode\r\n\r\n```\r\n$ ./lwp --pktfwd global_conf.template.json --board lwp-board.json --iface eth0\r\n```\r\n\r\n## Compile\r\n\r\n### Linux\r\n\r\nDepends on tools *libtool*, *automake*. To build:\r\n\r\n    # install tools if it is not there\r\n    sudo apt-get install autoconf libtool\r\n    \r\n    cd lorawan-parser\r\n    autoreconf -i\r\n    ./configure\r\n    make\r\n\r\n### Windows\r\n\r\n#### Codeblocks\r\nlorawan-parser supports [Codeblocks](http://www.codeblocks.org/) project. One could download Codeblocks from its official website.\r\n\r\n#### CMake\r\n*Not supported yet. You are welcome to submit CMake patches.*\r\n\r\n### Raspberry Pi\r\n\r\n    sudo apt-get install autoconf libtool\r\n    autoreconf -i\r\n    ./configure\r\n    make\r\n\r\n### Big Endian Platform\r\n\r\nThank @huzhifeng help test on MIPS platform\r\n\r\n    autoreconf -i\r\n    ./configure --enable-big-endian\r\n    make\r\n\r\n## Cross Compile\r\n\r\n### Raspberry Pi\r\n\r\n    git clone --depth 1 https://github.com/raspberrypi/tools\r\n\r\nAdd below path to system $PATH\r\n\r\n    // 64bits\r\n    $YOUR_PATH/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin\r\n    \r\n    // 32bits\r\n    $YOUR_PATH/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin\r\n\r\nGenerate Makefile\r\n\r\n    ./configure --host=arm-linux CC=arm-linux-gnueabihf-gcc\r\n\r\n## Limitation\r\n\r\nlorawan-parser only handles frames of which real frame counter is less than 0xFFFF, this is because an exact LoRaWAN frame only record low 16bits of the frame, the parser alwarys assumes the high 16bits is zero.\r\n\r\n### Frame counter enhancement\r\nAPI is updated to receive frame counter 16 most-significante bits passed from user. This makes it possible to emunate the frame counter most significante bits when a frame is known to be valid\r\n\r\n## Contribute\r\n\r\nAny kind of contributions are welcome, issue report, pull requests,  WIKI, suggestions...\r\n\r\nBefore you send pull request, please try to make your code keep same style as the original one.\r\n\r\n## License\r\nlorawan-paser and is licensed under [The MIT License](http://opensource.org/licenses/mit-license.php). Check LICENSE.txt for more information.\r\n\r\nparson, AES, CMAC have its own licenses. Please follow links below to get the details.\r\n\r\n## Acknowledgement\r\n+ Semtech LoRa http://www.semtech.com/wireless-rf/lora.html\r\n+ IBM LoRaWAN IN C http://www.research.ibm.com/labs/zurich/ics/lrsc/lmic.html\r\n+ LoRa Alliance https://www.lora-alliance.org/\r\n+ kgabis. parson (JSON parser) https://github.com/kgabis/parson\r\n+ Semtech LoRa Net lora_gateway https://github.com/lora-net/lora_gateway\r\n+ Semtech LoRa Net packet_forwarder https://github.com/Lora-net/packet_forwarder\r\n+ TTN poly_pkt_fwd https://github.com/TheThingsNetwork/packet_forwarder\r\n+ Brian Gladman. AES library http://www.gladman.me.uk/\r\n+ Lander Casado, Philippas Tsigas. CMAC library http://www.cse.chalmers.se/research/group/dcs/masters/contikisec/\r\n+ diabloneo timespec_diff gitst https://gist.github.com/diabloneo/9619917\r\n+ CCAN (json libary is from CCAN project) https://ccodearchive.net/\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJiapengLi%2Florawan-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJiapengLi%2Florawan-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJiapengLi%2Florawan-parser/lists"}