misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-09-24 15:54:41 +02:00
parent c794a02c6a
commit 5bac6ba5c0
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E
3 changed files with 6 additions and 29 deletions

@ -45,10 +45,10 @@ For hackers to learn reinforcement learning, WiFi networking and have an excuse
You can use the `scripts/create_sibling.sh` script to create an - ready to flash - rasbian image with pwnagotchi.
```shell
usage: ./create_sibling.sh [OPTIONS]
usage: ./scripts/create_sibling.sh [OPTIONS]
Options:
-n <name> # Name of the pwnagotchi (default: alpha)
-n <name> # Name of the pwnagotchi (default: pwnagotchi)
-o <file> # Name of the img-file (default: pwnagotchi.img)
-s <size> # Size which should be added to second partition (in Gigabyte) (default: 4)
-p # Only run provisioning (assumes the image is already mounted)
@ -81,29 +81,6 @@ The UI is available either via display if installed, or via http://10.0.0.2:8080
- if connected to a laptop via usb data port, with internet connectivity shared, magic things will happen.
- 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.
Magic scripts that makes it talk to the internet:
```sh
#!/bin/bash
# name of the ethernet gadget interface on the host
USB_IFACE=${1:-enp0s20f0u1}
USB_IFACE_IP=10.0.0.1
USB_IFACE_NET=10.0.0.0/24
# host interface to use for upstream connection
UPSTREAM_IFACE=enxe4b97aa99867
ip addr add $USB_IFACE_IP/24 dev $USB_IFACE
ip link set $USB_IFACE up
iptables -A FORWARD -o $UPSTREAM_IFACE -i $USB_IFACE -s $USB_IFACE_NET -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o $UPSTREAM_IFACE -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
```
## License
`pwnagotchi` is made with ♥ by [@evilsocket](https://twitter.com/evilsocket) and it's released under the GPL3 license.

@ -5,7 +5,7 @@
REQUIREMENTS=( wget gunzip git dd e2fsck resize2fs parted losetup qemu-system-x86_64 )
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
PWNI_NAME="alpha"
PWNI_NAME="pwnagotchi"
PWNI_OUTPUT="pwnagotchi.img"
PWNI_SIZE="4"
@ -96,7 +96,7 @@ function provision_raspbian() {
# configure pwnagotchi
echo -e "$PWNI_NAME" > /etc/hostname
sed -i "s@^127\.0\.0\.1 .*@127.0.0.1 localhost "$PWNI_NAME" "$PWNI_NAME".local@g" /etc/hosts
sed -i "s@alpha@$PWNI_NAME@g" /etc/motd
sed -i "s@pwnagotchi@$PWNI_NAME@g" /etc/motd
chmod +x /etc/rc.local
@ -157,7 +157,7 @@ function usage() {
usage: $0 [OPTIONS]
Options:
-n <name> # Name of the pwnagotchi (default: alpha)
-n <name> # Name of the pwnagotchi (default: pwnagotchi)
-o <file> # Name of the img-file (default: pwnagotchi.img)
-s <size> # Size which should be added to second partition (in Gigabyte) (default: 4)
-p # Only run provisioning (assumes the image is already mounted)

@ -8,7 +8,7 @@ USB_IFACE_NET=10.0.0.0/24
UPSTREAM_IFACE=${2:-enxe4b97aa99867}
ip addr add $USB_IFACE_IP/24 dev $USB_IFACE
ifconfig $USB_IFACE up
ip link set $USB_IFACE up
iptables -A FORWARD -o $UPSTREAM_IFACE -i $USB_IFACE -s $USB_IFACE_NET -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT