backups
This commit is contained in:
parent
95b9d0ee1e
commit
335e6b1311
10
README.md
10
README.md
@ -116,6 +116,14 @@ usage: ./update_pwnagitchi.sh [OPTIONS]
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Backup your pwnagotchi
|
||||||
|
|
||||||
|
You can use the `scripts/backup.sh` script to backup the important files of your unit.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
usage: ./scripts/backup.sh HOSTNAME backup.zip
|
||||||
|
```
|
||||||
|
|
||||||
### UI
|
### UI
|
||||||
|
|
||||||
The UI is available either via display if installed, or via http://pwnagotchi.local:8080/ if you connect to the unit via `usb0` and set a static address on the network interface (change `pwnagotchi` with the hostname of your unit).
|
The UI is available either via display if installed, or via http://pwnagotchi.local:8080/ if you connect to the unit via `usb0` and set a static address on the network interface (change `pwnagotchi` with the hostname of your unit).
|
||||||
@ -236,7 +244,7 @@ def on_handshake(agent, filename, access_point, client_station):
|
|||||||
- checkout the `ui.video` section of the `config.yml` - if you don't want to use a display, you can connect to it with the browser and a cable.
|
- checkout the `ui.video` section of the `config.yml` - if you don't want to use a display, you can connect to it with the browser and a cable.
|
||||||
- If you get `[FAILED] Failed to start Remount Root and Kernel File Systems.` while booting pwnagotchi, make sure
|
- If you get `[FAILED] Failed to start Remount Root and Kernel File Systems.` while booting pwnagotchi, make sure
|
||||||
the `PARTUUID`s for `rootfs` and `boot` partitions are the same in `/etc/fstab`. Use `sudo blkid` to find those values when you are using `create_sibling.sh`.
|
the `PARTUUID`s for `rootfs` and `boot` partitions are the same in `/etc/fstab`. Use `sudo blkid` to find those values when you are using `create_sibling.sh`.
|
||||||
- You can create a `/root/pwnagotchi.yml` configuration file to override the defaults.
|
- You can create a `/root/custom.yml` configuration file to override the defaults.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
42
scripts/backup.sh
Normal file → Executable file
42
scripts/backup.sh
Normal file → Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# name of the ethernet gadget interface on the host
|
||||||
|
UNIT_HOSTNAME=${1:-10.0.0.2}
|
||||||
|
# output backup zip file
|
||||||
|
OUTPUT=${2:-pwnagotchi-backup.zip}
|
||||||
|
# temporary folder
|
||||||
|
TEMP_BACKUP_FOLDER=/tmp/pwnagotchi_backup
|
||||||
|
# what to backup
|
||||||
|
FILES_TO_BACKUP=(
|
||||||
|
/root/brain.nn
|
||||||
|
/root/brain.json
|
||||||
|
/root/custom.yaml
|
||||||
|
/root/handshakes
|
||||||
|
/etc/ssh
|
||||||
|
/etc/hostname
|
||||||
|
/etc/hosts
|
||||||
|
/etc/motd
|
||||||
|
/var/log/pwnagotchi.log
|
||||||
|
)
|
||||||
|
|
||||||
|
ping -c 1 $UNIT_HOSTNAME >/dev/null || {
|
||||||
|
echo "@ unit $UNIT_HOSTNAME can't be reached, make sure it's connected and a static IP assigned to the USB interface."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "@ backing up $UNIT_HOSTNAME to $OUTPUT ..."
|
||||||
|
|
||||||
|
rm -rf "$TEMP_BACKUP_FOLDER"
|
||||||
|
|
||||||
|
for file in "${FILES_TO_BACKUP[@]}"; do
|
||||||
|
dir=$(dirname $file)
|
||||||
|
echo " $file -> $TEMP_BACKUP_FOLDER$dir/"
|
||||||
|
mkdir -p "$TEMP_BACKUP_FOLDER/$dir"
|
||||||
|
scp -Cr root@$UNIT_HOSTNAME:$file "$TEMP_BACKUP_FOLDER$dir/"
|
||||||
|
done
|
||||||
|
|
||||||
|
ZIPFILE="$PWD/$OUTPUT"
|
||||||
|
pushd $PWD
|
||||||
|
cd "$TEMP_BACKUP_FOLDER"
|
||||||
|
zip -r -9 -q "$ZIPFILE" .
|
||||||
|
popd
|
@ -21,7 +21,7 @@ parser = argparse.ArgumentParser()
|
|||||||
|
|
||||||
parser.add_argument('-C', '--config', action='store', dest='config', default='/root/pwnagotchi/config.yml',
|
parser.add_argument('-C', '--config', action='store', dest='config', default='/root/pwnagotchi/config.yml',
|
||||||
help='Main configuration file.')
|
help='Main configuration file.')
|
||||||
parser.add_argument('-U', '--user-config', action='store', dest='user_config', default='/root/pwnagotchi.yml',
|
parser.add_argument('-U', '--user-config', action='store', dest='user_config', default='/root/custom.yml',
|
||||||
help='If this file exists, configuration will be merged and this will override default values.')
|
help='If this file exists, configuration will be merged and this will override default values.')
|
||||||
|
|
||||||
parser.add_argument('--manual', dest="do_manual", action="store_true", default=False, help="Manual mode.")
|
parser.add_argument('--manual', dest="do_manual", action="store_true", default=False, help="Manual mode.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user