flipper zero multi-tool / developing
Here are some pointers on how to get started editing/developing plugins for the Flipper Zero multi-tool.
(When writing this, the stable version was at 0.63.3. Things are moving fast, so some of the next bits may be outdated when you read them.)
Starting
Starting the Flipper Zero and adding an SD-card is documented in Flipper Zero first-start.
Now you can use all the nice pentest features already included. The SD-card is necessary to unlock some features.
When you first get your hands on your Flipper, you'll likely want to play around a bit now, scanning your NFC tags and radio controls.
Firmware
To update the firmware, you'll need to download
qFlipper, attach the Flipper Zero to
your USB port and click the INSTALL button, as documented in Flipper
Zero
firmware-update.
On Linux you may need to add the following to
/etc/udev/rules.d/42-flipperzero.rules
first (and then run
udevadm control --reload-rules
and udevadm trigger
as root):
#Flipper Zero serial port
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess"
#Flipper Zero DFU
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess"
#Flipper ESP32s2 BlackMagic
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="40??", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess"
The usage of qFlipper should be self-explanatory.
Plugins
At this point — while writing, we're on firmware 0.63.3 — adding plugins is not trivial yet. The Flipper Zero development page is empty.
No, this page did not help me ;-)
Some tutorials/examples exist elsewhere, like mfulz/Flipper-Plugin-Tutorial. A good alternative is to take the existing Snake game and remove all the code until you're left with something that does little more than print Hello World.
Building
Building a plugin means building the entire firmware. The steps involved are:
git clone https://github.com/flipperdevices/flipperzero-firmware
cd flipperzero-firmware/
git submodule init
git submodule update
sudo apt-get install scons openocd clang-format-13 dfu-util protobuf-compiler # see ReadMe.md
Check out an appropriate version:
$ git tag -l | sort -V | tail -n3
0.63.2-rc
0.63.3
0.63.3-rc
$ git checkout -b branch-0.63.3 0.63.3
$ ./fbt
This yields a nice ./build/latest/firmware.dfu
which can be uploaded
using qFlipper.
If you want your (modified) version recorded in the About screen,
you'll need to tag it. If git describe --exact-match
returns no
match, then the version shown will be "unknown". The git commit id
is always shown regardless.
I'll plan on following up on this post with some documentation on using the GPIO-ports and connecting a temperature sensor. To be continued...
P.S. If you've managed to freeze your Flipper, have no fear. The LEFT+BACK button combination makes it reset. Or, alternately, holding BACK for 30+ seconds.
Update 2022-09-02
In the mean time, I did get some fixes in:
- Fix U2F counter endianness
- Start U2F counter above zero
- Automatically remove exec permissions from sources
Changes so I can attach a temperature sensor and read it, are still pending:
In the mean time, you can look at these repositories for more inspiration:
- A collection of Awesome resources (djsime1/awesome-flipperzero)
- Tetris (on evilaliv3/flipperzero-sequencerz-app)
- Older Flipper development documentation (by Aiden Manos)
Getting U2F to work on Ubuntu with snap
If you're using Chromium or Firefox in snap, you may need some extra udev rules too:
--- 70-snap.chromium.rules 2022-08-12 18:07:02.865910207 +0200
+++ 70-snap.chromium.rules 2022-08-12 18:07:43.297930862 +0200
@@ -107,6 +107,8 @@ SUBSYSTEM=="hidraw", KERNEL=="hidraw*",
# u2f-devices
# Yubico YubiKey
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0121|0200|0402|0403|0406|0407|0410", TAG+="snap_chromium_chromedriver"
+# Flipper Zero
+SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", TAG+="snap_chromium_chromedriver"
TAG=="snap_chromium_chromedriver", RUN+="/usr/lib/snapd/snap-device-helper $env{ACTION} snap_chromium_chromedriver $devpath $major:$minor"
# bluez
KERNEL=="rfkill", TAG+="snap_chromium_chromium"
@@ -216,4 +218,6 @@ SUBSYSTEM=="hidraw", KERNEL=="hidraw*",
# u2f-devices
# Yubico YubiKey
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0121|0200|0402|0403|0406|0407|0410", TAG+="snap_chromium_chromium"
+# Flipper Zero
+SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", TAG+="snap_chromium_chromium"
TAG=="snap_chromium_chromium", RUN+="/usr/lib/snapd/snap-device-helper $env{ACTION} snap_chromium_chromium $devpath $major:$minor"
--- 70-snap.firefox.rules 2022-08-12 18:06:09.309883567 +0200
+++ 70-snap.firefox.rules 2022-08-12 18:06:33.853895670 +0200
@@ -105,6 +105,8 @@ SUBSYSTEM=="hidraw", KERNEL=="hidraw*",
# u2f-devices
# Yubico YubiKey
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0121|0200|0402|0403|0406|0407|0410", TAG+="snap_firefox_firefox"
+# Flipper Zero
+SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", TAG+="snap_firefox_firefox"
TAG=="snap_firefox_firefox", RUN+="/usr/lib/snapd/snap-device-helper $env{ACTION} snap_firefox_firefox $devpath $major:$minor"
# camera
KERNEL=="vchiq", TAG+="snap_firefox_geckodriver"
@@ -212,4 +214,6 @@ SUBSYSTEM=="hidraw", KERNEL=="hidraw*",
# u2f-devices
# Yubico YubiKey
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0121|0200|0402|0403|0406|0407|0410", TAG+="snap_firefox_geckodriver"
+# Flipper Zero
+SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", TAG+="snap_firefox_geckodriver"
TAG=="snap_firefox_geckodriver", RUN+="/usr/lib/snapd/snap-device-helper $env{ACTION} snap_firefox_geckodriver $devpath $major:$minor"
Reloading udev: udevadm control --reload-rules && udevadm trigger