flipperzero-protobuf


Nameflipperzero-protobuf JSON
Version 0.1.20221108 PyPI version JSON
download
home_pagehttps://github.com/evilpete/flipperzero_protobuf_py
SummaryPython bindings for Flipper Zero protobuf protocol
upload_time2024-03-05 04:04:37
maintainer
docs_urlNone
authorFlipper & Community
requires_python>=3
licenseBSD 3-Clause License
keywords flipperzero protobuf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python bindings for Flipper Zero protobuf protocol 

Python API binding/wrappers for Flipper Zero protobuf protocol and command line tool

> [!NOTE]  
> This is a fork based on the [original repo](https://github.com/flipperdevices/flipperzero_protobuf_py) by Flipper Zero. I'm just a guy with no affiliation to Flipper Devices Inc.

---
### flipperCmd ###

The command tool `flipperCmd` is terminal based tool for file transfer and remote command.
It can be run from the command line or as an interactive app.

It is still a work in progress (Alpha) but is functional. We are looking for help
with stabilization of this build, making it work on any system.

If you want to contribute, we run black and isort for code formatting purposes.

---


### Command Line Examples ###

List and manage files from command line
```
$ flipperCmd ls
Using port /dev/cu.usbmodemflip_Unyana1
.fseventsd/              .Spotlight-V100/         badusb/                  dolphin/
ibutton/                 infrared/                lfrfid/                  music_player/
nfc/                     subghz/                  u2f/                     wav_player/
.metadata_never_index    favorites.txt            Manifest                 rwfiletest.bin

```

Copy single files to fromFlipper device
```
$ flipperCmd put My_Home_TV.ir /ext/infrared
Using port /dev/cu.usbmodemflip_UOhBaby
PUT My_Home_TV.ir /ext/infrared
putting 206 bytes

```

Copy directory tree to Flipper device
```
$ flipperCmd put-tree subghz/samples /ext/subghz

```

#### Interactive Command Mode Examples ####


```
$ flipperCmd
Using port /dev/cu.usbmodemflip_UOhBaby
Entering interactive mode

/ext flipper> help
    CAT                 : read flipper file to screen
    CD CHDIR            : change current directory on flipper
    DEV-INFO            : print device info
    DF INFO             : get Filesystem info
    DU DISK-USAGE       : display disk usage statistic
    GET GETFILE         : copy file from flipper
    GET-TREE GETTREE    : copy directory tree from flipper
    HELP ?              : print command list
    HISTORY HIST        : Print command history
    LCD LCHDIR          : Change local current directory
    LPWD                : print local working directory
    LS LIST             : list files and dirs on Flipper device
    MD MKDIR            : create a new directory
    MD5SUM MD5          : md5 hash of the file
    MV RENAME           : rename file or dir
    PRINT-SCREEN        : Take screendump in ascii or PBM format
    PUT PUTFILE         : copy file to flipper
    PUT-TREE PUTTREE    : copy directory tree to flipper
    QUIT EXIT           : Exit Program
    REBOOT              : reboot flipper
    RM DEL DELETE       : delete file of directory on flipper device
    SEND SEND-COMMAND   : Send non rpc command to flipper
    SET                 : set or print current option value
    STAT                : get info about file or dir
    START-SESSION       : (re) start RPC session
    STOP-SESSION        : stop RPC session
    TIME                : Set or Get Current time from Flipper
    ZIP                 : Generate Zip Archive

```

```
/ext flipper> ls
.Spotlight-V100/         .Trashes/                apps/                    badusb/
dolphin/                 elf/                     ibutton/                 infrared/
lfrfid/                  music_player/            nfc/                     subghz/
u2f/                     wav_player/              .metadata_never_index    favorites.txt
Manifest                 rwfiletest.bin
```

```
/ext flipper> ls ?
Syntax :
	LS [-l] [-m] <path>
    
/ext flipper> ls -lm
Storage List result:  /ext
.Spotlight-V100          	   DIR
.Trashes                 	   DIR
apps                     	   DIR
badusb                   	   DIR
dolphin                  	   DIR
elf                      	   DIR
ibutton                  	   DIR
infrared                 	   DIR
lfrfid                   	   DIR
music_player             	   DIR
nfc                      	   DIR
subghz                   	   DIR
u2f                      	   DIR
wav_player               	   DIR
.metadata_never_index    	     0 d41d8cd98f00b204e9800998ecf8427e
favorites.txt            	    93 50c7a56f93d8f6c87f205691def774fa
Manifest                 	 16871 c74a84dea8d644198d27755313942614
rwfiletest.bin           	 16384 3df67097cee5e4cea36e0f941c134ffc
Total Bytes: 33348

/ext flipper> rcd infrared/
remote directory = /ext/infrared 

/ext/infrared flipper> ls
assets/                  IRDB/                    Sanyo/                   TV_Philips/
Minolta.ir               My_Home_TV.ir

/ext/infrared flipper> quit
Quit interactive mode
```


---

### API Examples: ###
```
#!/usr/bin/env python3

from flipperzero_protobuf.cli_helpers import print_hex, dict2datetime
from flipperzero_protobuf.flipper_proto import FlipperProto


def main():

    proto = FlipperProto()

    print("\n\nPing")
    ping_rep = proto.rpc_system_ping()
    print_hex(ping_rep)

    print("\n\n]DeviceInfo")
    device_info = proto.rpc_device_info()
    print(device_info)

    print("\n\nGetDateTime")
    dtime_resp = proto.rpc_get_datetime()
    dt = dict2datetime(dtime_resp)
    print(dt.ctime())

    print("\n\nList files")
    list_resp = proto.rpc_storage_list('/ext')
    for li in list_resp:
        print(f"[{li['type']}]\t{li['name']}")

    # run Infrared App
    print("\n\nrun Infrared App")
    proto.rpc_app_start('Infrared', '/ext/infrared/Tv_Tivo.ir')


if __name__ == '__main__':
    main()

```

---

See Also:<br>
[flipperdevices/flipperzero-protobuf](http://github.com/flipperdevices/flipperzero-protobuf)<br>
[flipperdevices/go-flipper](https://github.com/flipperdevices/go-flipper)

Special thanks:
Evilpete - for making a wrapper and a code cleanup for our internal tool!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/evilpete/flipperzero_protobuf_py",
    "name": "flipperzero-protobuf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "flipperzero,protobuf",
    "author": "Flipper & Community",
    "author_email": "flipper devices <hello@flipperzero.one>, peter shipley <peter.shipley@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9a/56/d395d8d4f1267c63d4159b0f00b91a60e4345d990bb108e184bbd5167b12/flipperzero_protobuf-0.1.20221108.tar.gz",
    "platform": null,
    "description": "# Python bindings for Flipper Zero protobuf protocol \n\nPython API binding/wrappers for Flipper Zero protobuf protocol and command line tool\n\n> [!NOTE]  \n> This is a fork based on the [original repo](https://github.com/flipperdevices/flipperzero_protobuf_py) by Flipper Zero. I'm just a guy with no affiliation to Flipper Devices Inc.\n\n---\n### flipperCmd ###\n\nThe command tool `flipperCmd` is terminal based tool for file transfer and remote command.\nIt can be run from the command line or as an interactive app.\n\nIt is still a work in progress (Alpha) but is functional. We are looking for help\nwith stabilization of this build, making it work on any system.\n\nIf you want to contribute, we run black and isort for code formatting purposes.\n\n---\n\n\n### Command Line Examples ###\n\nList and manage files from command line\n```\n$ flipperCmd ls\nUsing port /dev/cu.usbmodemflip_Unyana1\n.fseventsd/              .Spotlight-V100/         badusb/                  dolphin/\nibutton/                 infrared/                lfrfid/                  music_player/\nnfc/                     subghz/                  u2f/                     wav_player/\n.metadata_never_index    favorites.txt            Manifest                 rwfiletest.bin\n\n```\n\nCopy single files to fromFlipper device\n```\n$ flipperCmd put My_Home_TV.ir /ext/infrared\nUsing port /dev/cu.usbmodemflip_UOhBaby\nPUT My_Home_TV.ir /ext/infrared\nputting 206 bytes\n\n```\n\nCopy directory tree to Flipper device\n```\n$ flipperCmd put-tree subghz/samples /ext/subghz\n\n```\n\n#### Interactive Command Mode Examples ####\n\n\n```\n$ flipperCmd\nUsing port /dev/cu.usbmodemflip_UOhBaby\nEntering interactive mode\n\n/ext flipper> help\n    CAT                 : read flipper file to screen\n    CD CHDIR            : change current directory on flipper\n    DEV-INFO            : print device info\n    DF INFO             : get Filesystem info\n    DU DISK-USAGE       : display disk usage statistic\n    GET GETFILE         : copy file from flipper\n    GET-TREE GETTREE    : copy directory tree from flipper\n    HELP ?              : print command list\n    HISTORY HIST        : Print command history\n    LCD LCHDIR          : Change local current directory\n    LPWD                : print local working directory\n    LS LIST             : list files and dirs on Flipper device\n    MD MKDIR            : create a new directory\n    MD5SUM MD5          : md5 hash of the file\n    MV RENAME           : rename file or dir\n    PRINT-SCREEN        : Take screendump in ascii or PBM format\n    PUT PUTFILE         : copy file to flipper\n    PUT-TREE PUTTREE    : copy directory tree to flipper\n    QUIT EXIT           : Exit Program\n    REBOOT              : reboot flipper\n    RM DEL DELETE       : delete file of directory on flipper device\n    SEND SEND-COMMAND   : Send non rpc command to flipper\n    SET                 : set or print current option value\n    STAT                : get info about file or dir\n    START-SESSION       : (re) start RPC session\n    STOP-SESSION        : stop RPC session\n    TIME                : Set or Get Current time from Flipper\n    ZIP                 : Generate Zip Archive\n\n```\n\n```\n/ext flipper> ls\n.Spotlight-V100/         .Trashes/                apps/                    badusb/\ndolphin/                 elf/                     ibutton/                 infrared/\nlfrfid/                  music_player/            nfc/                     subghz/\nu2f/                     wav_player/              .metadata_never_index    favorites.txt\nManifest                 rwfiletest.bin\n```\n\n```\n/ext flipper> ls ?\nSyntax :\n\tLS [-l] [-m] <path>\n    \n/ext flipper> ls -lm\nStorage List result:  /ext\n.Spotlight-V100          \t   DIR\n.Trashes                 \t   DIR\napps                     \t   DIR\nbadusb                   \t   DIR\ndolphin                  \t   DIR\nelf                      \t   DIR\nibutton                  \t   DIR\ninfrared                 \t   DIR\nlfrfid                   \t   DIR\nmusic_player             \t   DIR\nnfc                      \t   DIR\nsubghz                   \t   DIR\nu2f                      \t   DIR\nwav_player               \t   DIR\n.metadata_never_index    \t     0 d41d8cd98f00b204e9800998ecf8427e\nfavorites.txt            \t    93 50c7a56f93d8f6c87f205691def774fa\nManifest                 \t 16871 c74a84dea8d644198d27755313942614\nrwfiletest.bin           \t 16384 3df67097cee5e4cea36e0f941c134ffc\nTotal Bytes: 33348\n\n/ext flipper> rcd infrared/\nremote directory = /ext/infrared \n\n/ext/infrared flipper> ls\nassets/                  IRDB/                    Sanyo/                   TV_Philips/\nMinolta.ir               My_Home_TV.ir\n\n/ext/infrared flipper> quit\nQuit interactive mode\n```\n\n\n---\n\n### API Examples: ###\n```\n#!/usr/bin/env python3\n\nfrom flipperzero_protobuf.cli_helpers import print_hex, dict2datetime\nfrom flipperzero_protobuf.flipper_proto import FlipperProto\n\n\ndef main():\n\n    proto = FlipperProto()\n\n    print(\"\\n\\nPing\")\n    ping_rep = proto.rpc_system_ping()\n    print_hex(ping_rep)\n\n    print(\"\\n\\n]DeviceInfo\")\n    device_info = proto.rpc_device_info()\n    print(device_info)\n\n    print(\"\\n\\nGetDateTime\")\n    dtime_resp = proto.rpc_get_datetime()\n    dt = dict2datetime(dtime_resp)\n    print(dt.ctime())\n\n    print(\"\\n\\nList files\")\n    list_resp = proto.rpc_storage_list('/ext')\n    for li in list_resp:\n        print(f\"[{li['type']}]\\t{li['name']}\")\n\n    # run Infrared App\n    print(\"\\n\\nrun Infrared App\")\n    proto.rpc_app_start('Infrared', '/ext/infrared/Tv_Tivo.ir')\n\n\nif __name__ == '__main__':\n    main()\n\n```\n\n---\n\nSee Also:<br>\n[flipperdevices/flipperzero-protobuf](http://github.com/flipperdevices/flipperzero-protobuf)<br>\n[flipperdevices/go-flipper](https://github.com/flipperdevices/go-flipper)\n\nSpecial thanks:\nEvilpete - for making a wrapper and a code cleanup for our internal tool!\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Python bindings for Flipper Zero protobuf protocol",
    "version": "0.1.20221108",
    "project_urls": {
        "Bug Tracker": "https://github.com/oltenxyz/flipperzero_protobuf_py/issues",
        "Homepage": "https://github.com/oltenxyz/flipperzero_protobuf_py"
    },
    "split_keywords": [
        "flipperzero",
        "protobuf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ef6b7f86453c691d40bd772b14d94ec5c48b5f46d376cb710f7c3739dfeed4f",
                "md5": "7cbc013d3d5bfdbe09f9a7eec824c0cf",
                "sha256": "f96a99aec1e01f46d24f05ef1dcab11d9b4d7c6f92abece030b414ef62c82fd2"
            },
            "downloads": -1,
            "filename": "flipperzero_protobuf-0.1.20221108-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7cbc013d3d5bfdbe09f9a7eec824c0cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 42895,
            "upload_time": "2024-03-05T04:04:34",
            "upload_time_iso_8601": "2024-03-05T04:04:34.604767Z",
            "url": "https://files.pythonhosted.org/packages/3e/f6/b7f86453c691d40bd772b14d94ec5c48b5f46d376cb710f7c3739dfeed4f/flipperzero_protobuf-0.1.20221108-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a56d395d8d4f1267c63d4159b0f00b91a60e4345d990bb108e184bbd5167b12",
                "md5": "b049143c996b06f5b56ea5deec15d61c",
                "sha256": "64e4117a9fe3e06f7d652c513774ade7fc22bd25c2ddcef3f460582e9d31fe80"
            },
            "downloads": -1,
            "filename": "flipperzero_protobuf-0.1.20221108.tar.gz",
            "has_sig": false,
            "md5_digest": "b049143c996b06f5b56ea5deec15d61c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 34318,
            "upload_time": "2024-03-05T04:04:37",
            "upload_time_iso_8601": "2024-03-05T04:04:37.031284Z",
            "url": "https://files.pythonhosted.org/packages/9a/56/d395d8d4f1267c63d4159b0f00b91a60e4345d990bb108e184bbd5167b12/flipperzero_protobuf-0.1.20221108.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 04:04:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "evilpete",
    "github_project": "flipperzero_protobuf_py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "flipperzero-protobuf"
}
        
Elapsed time: 0.30178s