samtap / fang-hacks

Collection of modifications for the XiaoFang WiFi Camera
1.68k stars 340 forks source link

Fang Hacks

Collection of modifications for the XiaoFang WiFi Camera

For questions, support and collaboration please join us on gitter. The discord channel is not used anymore.

Join the chat at https://gitter.im/samtap/fang-hacks

General usage

Download an sd-card image from the releases page or follow the manual steps below.

Updating: If you've applied the hack before and are updating to a newer release, the web-interface will not allow you to apply the hack since (older versions of) scripts are already on the device. Make sure to click the Update button on the status page before rebooting!! This will copy all relevant files to the device, overwriting the previous version.

1. Prepare an sd-card with two partitions.

The first partition on the device must be a vfat partition. It will only contain some small scripts so 100MiB should be more than enough. The second partition must be an ext2 partition and will contain all other files.

2. Copy bootstrap folder and snx_autorun.sh

The bootstrap folder contains CGI scripts for the embedded Boa webserver. The snx_autorun.sh script is the entry-point for enabling the hacks.

Both must be copied to the vfat partition.

3. Copy data folder

The data folder must be copied to the ext2 partition.

4. Place sd-card in device

Boot the device without sd-card, wait until the blue led stops flashing. The device will automatically run snx_autorun.sh when the sd-card is inserted. Do not boot the device with the card inserted and then re-insert it, to prevent it from being mounted incorrectly (mmcblk1 instead of mmcblk0).

5. Enable hacks

When you visit http://device-ip/cgi-bin/status you should now be presented with a status page. If you get a '404 Not Found' page, the snx_autorun.sh script didn't run. You can visit http://device-ip/cgi-bin/hello.cgi to check if the sd-card is mounted correctly.

Click 'Apply' to enable the hacks.

Background

The modifications aim to be as least intrusive as possible. Currently there's no known recovery methode, i.e. an image to flash to the device when it doesn't boot, though you can solder wires to it and get access to a serial console. When it still boots and mounts vfat partitions automatically, limited recovery options are available through snx_autorun.sh and config files in the bootstrap folder. As long as you don't completely disable the cloud apps (DISABLE_CLOUD=1), you can always revert to original behavior by simply removing the sd-card. When cloud apps are disabled and no boot scripts are found on the sd-card (i.e. when it's not inserted), nothing is started when the device boots so you will not be able to access it through the web-interface, telnet, etc.

Small system modifications are made when you click Apply on the status page:

Hacks

When the status page shows the hacks have been applied successfully, the following features are available:

Services

By default the following services are enabled:

License

Any files in this repo that are not already licensed (i.e. my scripts and tools but not 3rd party binaries like busybox, dropbear et.al) are licensed under CC BY-SA 3.0.