############################################################## ####### Download and install Armbian ############### ############################################################## #####Armbian_22.05.3_Orangepizero2_focal_current_5.15.48.img## ############################################################## ######### Orange Pi Zero 2 1gb ######### ############################################################## #### OrangePi Zero 2 Dependencies install script #!/usr/bin/env bash # install all dependencies, bettercap and pwngrid, generate keys, download pwnagotchi on rpi cat > /tmp/dependencies << EOF rsync vim wget screen git build-essential dkms python3-pip python3-smbus unzip gawk libopenmpi-dev libatlas-base-dev libelf-dev libopenjp2-7 libtiff5 tcpdump lsof libgstreamer1.0-0 libavcodec58 libavformat58 libswscale5 libpcap-dev libusb-1.0-0-dev libnetfilter-queue-dev libopenmpi3 dphys-swapfile libdbus-1-dev libdbus-glib-1-dev liblapack-dev libhdf5-dev libc-ares-dev libeigen3-dev fonts-dejavu fonts-dejavu-core fonts-dejavu-extra python3-pil python3-smbus libfuse-dev libatlas-base-dev libopenblas-dev libblas-dev bc libgl1-mesa-glx libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev fonts-freefont-ttf fbi python3-flask python3-flask-cors python3-flaskext.wtf EOF sudo apt -q update for pkg in $(cat /tmp/dependencies) do sudo apt install -y $pkg done ####### try and fix go crash as best as possible wget https://go.dev/dl/go1.20.2.linux-arm64.tar.gz sudo rm -r /usr/local/go sudo rm -r /usr/local/bin/go sudo rm -r /usr/bin/go sudo tar -C /usr/local -xzf go1.20.2.linux-arm64.tar.gz export PATH=$PATH:/usr/local/go/bin/ source .bashrc wget https://github.com/bettercap/bettercap/archive/refs/tags/v2.32.0.zip unzip v2.32.0.zip cd better* make build sudo mv bettercap /usr/bin/ ## install the caplets and the web ui in /usr/local/share/bettercap and quit sudo bettercap -eval "caplets.update; ui.update; quit" || exit ## create system services sudo bash -c 'cat > /usr/bin/bettercap-launcher' << EOF #!/usr/bin/env bash /usr/bin/monstart if [[ \$(ifconfig | grep usb0 | grep RUNNING) ]] || [[ \$(cat /sys/class/net/eth0/carrier) ]]; then # if override file exists, go into auto mode if [ -f /root/.pwnagotchi-auto ]; then /usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0 else /usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0 fi else /usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0 fi EOF sudo chmod u+x /usr/bin/bettercap-launcher sudo bash -c 'cat > /etc/systemd/system/bettercap.service' << EOF [Unit] Description=bettercap api.rest service. Documentation=https://bettercap.org Wants=network.target #After=pwngrid.service [Service] Type=simple PermissionsStartOnly=true ExecStart=/usr/bin/bettercap-launcher Restart=always RestartSec=30 [Install] WantedBy=multi-user.target EOF sudo systemctl enable bettercap.service # 2. pwngrid # method to create pwngrid-peer.service sudo bash -c 'cat > /etc/systemd/system/pwngrid-peer.service' << EOF [Unit] Description=pwngrid peer service. Documentation=https://pwnagotchi.ai Wants=network.target [Service] Type=simple PermissionsStartOnly=true ExecStart=/usr/bin/pwngrid -keys /etc/pwnagotchi -address 127.0.0.1:8666 -client-token /root/.api-enrollment.json -wait -log /var/log/pwngrid-peer.log -iface $WIFI_DEV Restart=always RestartSec=30 [Install] WantedBy=multi-user.target EOF ## download and uncompress code wget "https://github.com/evilsocket/pwngrid/releases/download/v1.10.3/pwngrid_linux_aarch64_v1.10.3.zip" unzip pwngrid_linux_aarch64_v1.10.3.zip ## ... check the sha256 digest before doing this ... sudo mv pwngrid /usr/bin/ ## generate the keypair sudo pwngrid -generate -keys /etc/pwnagotchi ## create system service create_pwngrid_service if ! $PWN_GRID then sudo systemctl stop pwngrid-peer.service sudo systemctl disable pwngrid-peer.service ## disable dependency in bettercap service launch script sudo bash -c "sed -i 's/^After=pwngrid.service/#After=pwngrid.service/g' /etc/systemd/system/bettercap.service" else sudo systemctl enable pwngrid-peer.service fi # 3. pwnagotchi ## download pwnagotchi git clone https://github.com/Fikolmij/Pwnagotchi-For-Banana-Orange-Pi ################# second part ################# ## Modifying the http-ui.cap file sudo sed -i 's/set api.rest.username user/set api.rest.username pwnagotchi/' /usr/local/share/bettercap/caplets/http-ui.cap sudo sed -i 's/set api.rest.password pass/set api.rest.password pwnagotchi/' /usr/local/share/bettercap/caplets/http-ui.cap ## Install Python 3.7.x ## Add the repo for Python3.7: echo 'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main' | sudo tee -a /etc/apt/sources.list echo 'deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main' | sudo tee -a /etc/apt/sources.list ## Download key and install python3.7 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA6932366A755776 sudo apt-get update sudo apt-get install -y python3.7 python3.7-dev python3.7-distutils python3.7-pip ## Update some Python3.7 modules sudo python3.7 -m pip install --upgrade pip wheel setuptools ## Download and install tensorflow: sudo wget 'https://drive.google.com/uc?export=download&confirm=t&id=1D9IT2WC2mrWOixsNKohxiJJIlY2IzmQQ' -O ~/tensorflow-1.15.0-cp37-cp37m-linux_aarch64.whl TMPDIR=/root/tmp python3.7 -m pip install ~/tensorflow-1.15.0-cp37-cp37m-linux_aarch64.whl ### Temporarily Increase Swap size to compile the wheels. dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 chown root:root /swapfile1 chmod 0600 /swapfile1 mkswap /swapfile1 ## modifying tensorflow/tensorflow-estimator and removing numpy from the requirements.txt sudo sed -i 's/tensorflow==1.13.1/tensorflow==1.15.0/' ~/pwnagotchi-1.5.5/requirements.txt sudo sed -i 's/tensorflow-estimator==1.14.0/tensorflow-estimator==1.15.1/' ~/pwnagotchi-1.5.5/requirements.txt ## Last few bits needed to get through requirements.txt TMPDIR=/root/tmp python3.7 -m pip install scikit-build TMPDIR=/root/tmp python3.7 -m pip install cython sudo apt install cmake ## Install requirements.txt followed by the Pwnagotchi ## Setuptools 65.5.0 as any later fails SciPy buld TMPDIR=/root/tmp python3.7 -m pip install setuptools==65.5.0 TMPDIR=/root/tmp python3.7 -m pip install -r requirements.txt TMPDIR=/root/tmp python3.7 -m pip install . sudo apt --fix-broken install TMPDIR=/root/tmp python3.7 -m pip install protobuf==3.8 ############ edit pwnlib and change interface mon0 command to below ############ wlanxxxxxx should be the name of the external wifi device in iwconfig eg wlx00ee11ff00cc iwconfig ##### copy iface name and change wlanxxxxxx to that device name and change command in /usr/bin/pwnlib iw phy `iw dev wlanxxxxxx info | gawk '/wiphy/ {printf "phy" $2}'` interface add mon0 type monitor sudo systemctl enable bettercap pwngrid-peer pwnagotchi sudo systemctl start bettercap pwngrid-peer pwnagotchi