Tuesday, September 27, 2022
HomeHackerUnoffical Flipper Zero Cli Wrapper Written In Python

Unoffical Flipper Zero Cli Wrapper Written In Python




Unoffical Flipper Zero cli wrapper written in Python

Features and traits:

Setup directions:

$ git clone https://github.com/wh00hw/pyFlipper.git
$ cd pyFlipper
$ python3 -m venv venv
$ supply venv/bin/activate
$ pip set up -r necessities.txt

Examined on:

Utilization/Examples

Connection

from pyflipper import PyFlipper

#Native serial port
flipper = PyFlipper(com="/dev/ttyACM0")

#OR

#Distant serial2websocket server
flipper = PyFlipper(ws="ws://192.168.1.5:1337")

Energy

#Information
information = flipper.energy.information()

#Poweroff
flipper.energy.off()

#Reboot
flipper.energy.reboot()

#Reboot in DFU mode
flipper.energy.reboot2dfu()

Replace/Backup

#Set up replace from .fuf file
flipper.replace.set up(fuf_file="/ext/replace.fuf")

#Backup Flipper to .tar file
flipper.replace.backup(dest_tar_file="/ext/backup.tar")

#Restore Flipper from backup .tar file
flipper.replace.restore(bak_tar_file="/ext/backup.tar")

Loader

#Record put in apps
apps = flipper.loader.record()

#Open app
flipper.loader.open(app_name="Clock")

Flipper Information

bluetooth information
bt_info = flipper.bt.information()”>

#Get flipper date
date = flipper.date.date()

#Get flipper timestamp
timestamp = flipper.date.timestamp()

#Get the processes dict record
ps = flipper.ps.record()

#Get gadget information dict
device_info = flipper.device_info.information()

#Get heap information dict
heap = flipper.free.information()

#Get free_blocks string
free_blocks = flipper.free.blocks()

#Get bluetooth information
bt_info = flipper.bt.information()

Storage

Filesystem Information

#Get the storage filesystem information
ext_info = flipper.storage.information(fs="/ext")

Explorer

#Get the storage /ext dict
ext_list = flipper.storage.record(path="/ext")

#Get the storage /ext tree dict
ext_tree = flipper.storage.tree(path="/ext")

#Get file information
file_info = flipper.storage.stat(file="/ext/foo/bar.txt")

#Make listing
flipper.storage.mkdir(new_dir="/ext/foo")

Information

generator on the Web.
It makes use of a
dictionary of over 200 Latin phrases, mixed with a handful of
mannequin sentence buildings, to generate Lorem Ipsum which seems to be affordable.
The generated Lorem Ipsum is subsequently all the time free from repetition, injected humour, or non-characteristic phrases and many others.
“””
flipper.storage.write.ship(text_two)

time.sleep(3)

#Remember to cease
flipper.storage.write.cease()”>

#Learn file
plain_text = flipper.storage.learn(file="/ext/foo/bar.txt")

#Take away file
flipper.storage.take away(file="/ext/foo/bar.txt")

#Copy file
flipper.storage.copy(src="http://www.kitploit.com/ext/foo/supply.txt", dest="/ext/bar/vacation spot.txt")

#Rename file
flipper.storage.rename(file="/ext/foo/bar.txt", new_file="/ext/foo/rab.txt")

#MD5 Hash file
md5_hash = flipper.storage.md5(file="/ext/foo/bar.txt")

#Write file in a single chunk
file = "/ext/bar.txt"

textual content = """There are numerous variations of passages of Lorem Ipsum obtainable,
however the majority have suffered alteration in some kind, by injected humour,
or randomised phrases which do not look even barely plausible.
If you'll use a passage of Lorem Ipsum,
it's essential make certain there is not something embarrassing hidden in the course of textual content.
"""

flipper.storage.write.file(file, textual content)

#Write file utilizing a listener
file = "/ext/foo.txt"

text_one = """There are numerous variations of passages of Lorem Ipsum obtainable,
however the majority have suffered alteration in some kind, by injected humour,
or randomised phrases which do not look even barely plausible.
If you'll use a passage of Lorem Ipsum,
it's essential make certain there is not something embarrassing hidden in the course of textual content.
"""

flipper.storage.write.begin(file)

time.sleep(2)

flipper.storage.write.ship(text_one)

text_two = """All of the Lorem Ipsum turbines on the Web are inclined to repeat predefined chunks as
needed, making this the primary true generator on the Web.
It makes use of a dictionary of over 200 Latin phrases, mixed with a handful of
mannequin sentence buildings, to generate Lorem Ipsum which seems to be affordable.
The generated Lorem Ipsum is subsequently all the time free from repetition, injected humour, or non-characteristic phrases and many others.
"""
flipper.storage.write.ship(text_two)

time.sleep(3)

#Remember to cease
flipper.storage.write.cease()

LED/Backlight

#Set generic led on (r,b,g,bl)
flipper.led.set(led='r', worth=255)

#Set blue led off
flipper.led.blue(worth=0)

#Set inexperienced led worth
flipper.led.inexperienced(worth=175)

#Set backlight on
flipper.led.backlight_on()

#Set backlight off
flipper.led.backlight_off()

#Flip off led
flipper.led.off()

Vibro

#Set vibro True or False
flipper.vibro.set(True)

#Set vibro on
flipper.vibro.on()

#Set vibro off
flipper.vibro.off()

GPIO

#Set gpio mode: 0 - enter, 1 - output
flipper.gpio.mode(pin_name=PIN_NAME, worth=1)

#Learn gpio pin worth
flipper.gpio.learn(pin_name=PIN_NAME)

#Set gpio pin worth
flipper.gpio.mode(pin_name=PIN_NAME, worth=1)

MusicPlayer

#Play music in RTTTL format
rttl_song = "Littleroot City - Pokemon:d=4,o=5,b=100:8c5,8f5,8g5,4a5,8p,8g5,8a5,8g5,8a5,8a#5,8p,4c6,8d6,8a5,8g5,8a5,8c#6,4d6,4e6,4d6,8a5,8g5,8f5,8e5,8f5,8a5,4d6,8d5,8e5,2f5,8c6,8a#5,8a#5,8a5,2f5,8d6,8a5,8a5,8g5,2f5,8p,8f5,8d5,8f5,8e5,4e5,8f5,8g5"

#Play in loop
flipper.music_player.play(rtttl_code=rttl_song)

#Cease loop
flipper.music_player.cease()

#Play for 20 seconds
flipper.music_player.play(rtttl_code=rttl_song, length=20)

#Beep
flipper.music_player.beep()

#Beep for five seconds
flipper.music_player.beep(length=5)

NFC

#Synchronous default timeout 5 seconds

#Detect NFC
nfc_detected = flipper.nfc.detect()

#Emulate NFC
flipper.nfc.emulate()

#Activate subject
flipper.nfc.subject()

RFID

#Synchronous default timeout 5 seconds

#Learn RFID
rfid = flipper.rfid.learn()

SubGhz

#Transmit hex_key N occasions(default depend = 10)
flipper.subghz.tx(hex_key="DEADBEEF", frequency=433920000, depend=5)

#Decode uncooked .sub file
decoded = flipper.subghz.decode_raw(sub_file="/ext/subghz/foo.sub")

Infrared

#Transmit hex_address and hex_command choosing a protocol
flipper.ir.tx(protocol="Samsung32", hex_address="C000FFEE", hex_command="DEADBEEF")

#Uncooked Transmit samples
flipper.ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=[1337, 8888, 3000, 5555])

#Synchronous default timeout 5 seconds
#Obtain tx
r = flipper.ir.rx(timeout=10)

IKEY

#Learn (default timeout 5 seconds)
ikey = flipper.ikey.learn()

#Write (default timeout 5 seconds)
ikey = flipper.ikey.write(key_type="Dallas", key_data="DEADBEEFCOOOFFEE")

#Emulate (default timeout 5 seconds)
flipper.ikey.emulate(key_type="Dallas", key_data="DEADBEEFCOOOFFEE")

Log

#Connect occasion logger (default timeout 10 seconds)
logs = flipper.log.connect()

Debug

#Activate debug mode
flipper.debug.on()

#Deactivate debug mode
flipper.debug.off()

Onewire

#Search
response = flipper.onewire.search()

I2C

#Get
response = flipper.i2c.get()

Enter

#Enter dump
dump = flipper.enter.dump()

#Ship enter
flipper.enter.ship("up", "press")

Optimizations

Be happy to contribute in any method

License

MIT

Purchase me a pint

ZEC: zs13zdde4mu5rj5yjm2kt6al5yxz2qjjjgxau9zaxs6np9ldxj65cepfyw55qvfp9v8cvd725f7tz7

ETH: 0xef3cF1Eb85382EdEEE10A2df2b348866a35C6A54

BTC: 15umRZXBzgUacwLVgpLPoa2gv7MyoTrKat

Contacts

  • Discord: white_rabbit#4124
  • Twitter: @nic_whr
  • GPG: 0x94EDEADC



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments