From 8edf72c8ef5d9dbc9e2c7c15ca80010cf8efa821 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Sun, 1 Dec 2024 12:54:06 +0100 Subject: [PATCH] Remove builder/data folder, we don't need that anymore. Signed-off-by: jayofelony --- .../pwnagotchi_completion.sh | 36 ---- builder/data/etc/dphys-swapfile | 26 --- builder/data/etc/modules-load.d/modules.conf | 6 - .../data/etc/network/interfaces.d/eth0-cfg | 2 - builder/data/etc/network/interfaces.d/lo-cfg | 2 - .../data/etc/network/interfaces.d/usb0-cfg | 8 - .../data/etc/network/interfaces.d/wlan0-cfg | 2 - .../data/etc/systemd/system/bettercap.service | 13 -- .../data/etc/systemd/system/bluetooth.service | 20 -- .../etc/systemd/system/pwnagotchi.service | 19 -- .../etc/systemd/system/pwngrid-peer.service | 16 -- builder/data/etc/update-motd.d/01-motd | 34 ---- builder/data/root/client_secrets.json | 0 builder/data/root/settings.yaml | 15 -- builder/data/usr/bin/bettercap-launcher | 19 -- builder/data/usr/bin/decryption-webserver | 148 --------------- builder/data/usr/bin/hdmioff | 2 - builder/data/usr/bin/hdmion | 2 - builder/data/usr/bin/monstart | 3 - builder/data/usr/bin/monstop | 3 - builder/data/usr/bin/pwnagotchi-launcher | 17 -- builder/data/usr/bin/pwnlib | 176 ------------------ pwnagotchi/automata.py | 8 +- pyproject.toml | 2 +- requirements.txt | 25 --- setup.py | 110 ----------- 26 files changed, 8 insertions(+), 706 deletions(-) delete mode 100644 builder/data/etc/bash_completion.d/pwnagotchi_completion.sh delete mode 100644 builder/data/etc/dphys-swapfile delete mode 100644 builder/data/etc/modules-load.d/modules.conf delete mode 100644 builder/data/etc/network/interfaces.d/eth0-cfg delete mode 100644 builder/data/etc/network/interfaces.d/lo-cfg delete mode 100644 builder/data/etc/network/interfaces.d/usb0-cfg delete mode 100644 builder/data/etc/network/interfaces.d/wlan0-cfg delete mode 100644 builder/data/etc/systemd/system/bettercap.service delete mode 100644 builder/data/etc/systemd/system/bluetooth.service delete mode 100644 builder/data/etc/systemd/system/pwnagotchi.service delete mode 100644 builder/data/etc/systemd/system/pwngrid-peer.service delete mode 100755 builder/data/etc/update-motd.d/01-motd delete mode 100644 builder/data/root/client_secrets.json delete mode 100644 builder/data/root/settings.yaml delete mode 100755 builder/data/usr/bin/bettercap-launcher delete mode 100755 builder/data/usr/bin/decryption-webserver delete mode 100755 builder/data/usr/bin/hdmioff delete mode 100755 builder/data/usr/bin/hdmion delete mode 100755 builder/data/usr/bin/monstart delete mode 100755 builder/data/usr/bin/monstop delete mode 100755 builder/data/usr/bin/pwnagotchi-launcher delete mode 100755 builder/data/usr/bin/pwnlib delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/builder/data/etc/bash_completion.d/pwnagotchi_completion.sh b/builder/data/etc/bash_completion.d/pwnagotchi_completion.sh deleted file mode 100644 index 68edc4e9..00000000 --- a/builder/data/etc/bash_completion.d/pwnagotchi_completion.sh +++ /dev/null @@ -1,36 +0,0 @@ -_show_complete() -{ - local cur opts node_names all_options opt_line - all_options=" -pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --wizard --check-update --donate {plugins,google} -pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade} -pwnagotchi plugins list -i --installed -h --help -pwnagotchi plugins install -h --help -pwnagotchi plugins uninstall -h --help -pwnagotchi plugins enable -h --help -pwnagotchi plugins disable -h --help -pwnagotchi plugins update -h --help -pwnagotchi plugins upgrade -h --help -pwnagotchi google -h --help {login,refresh} -pwnagotchi google login -h --help -pwnagotchi google refresh -h --help -" - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - # shellcheck disable=SC2124 - cmd="${COMP_WORDS[@]:0:${#COMP_WORDS[@]}-1}" - opt_line="$(grep -m1 "$cmd" <<<"$all_options")" - if [[ ${cur} == -* ]] ; then - opts="$(echo "$opt_line" | tr ' ' '\n' | awk '/^ *-/{gsub("[^a-zA-Z0-9-]","",$1);print $1}')" - # shellcheck disable=SC2207 - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - fi - - # shellcheck disable=SC2086 - opts="$(echo $opt_line | grep -Po '{\K[^}]+' | tr ',' '\n')" - # shellcheck disable=SC2207 - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) -} - -complete -F _show_complete pwnagotchi diff --git a/builder/data/etc/dphys-swapfile b/builder/data/etc/dphys-swapfile deleted file mode 100644 index 1c908a10..00000000 --- a/builder/data/etc/dphys-swapfile +++ /dev/null @@ -1,26 +0,0 @@ -# /etc/dphys-swapfile - user settings for dphys-swapfile package -# author Neil Franklin, last modification 2010.05.05 -# copyright ETH Zuerich Physics Departement -# use under either modified/non-advertising BSD or GPL license - -# this file is sourced with . so full normal sh syntax applies - -# the default settings are added as commented out CONF_*=* lines - - -# where we want the swapfile to be, this is the default -#CONF_SWAPFILE=/var/swap - -# set size to absolute value, leaving empty (default) then uses computed value -# you most likely don't want this, unless you have an special disk situation -CONF_SWAPSIZE=2048 - -# set size to computed value, this times RAM size, dynamically adapts, -# guarantees that there is enough swap without wasting disk space on excess -#CONF_SWAPFACTOR=2 - -# restrict size (computed and absolute!) to maximally this limit -# can be set to empty for no limit, but beware of filled partitions! -# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it -# but is also sensible on 64bit to prevent filling /var or even / partition -#CONF_MAXSWAP=2048 \ No newline at end of file diff --git a/builder/data/etc/modules-load.d/modules.conf b/builder/data/etc/modules-load.d/modules.conf deleted file mode 100644 index bb4fa86c..00000000 --- a/builder/data/etc/modules-load.d/modules.conf +++ /dev/null @@ -1,6 +0,0 @@ -# /etc/modules: kernel modules to load at boot time. -# -# This file contains the names of kernel modules that should be loaded -# at boot time, one per line. Lines beginning with "#" are ignored. -# Parameters can be specified after the module name. -i2c-dev \ No newline at end of file diff --git a/builder/data/etc/network/interfaces.d/eth0-cfg b/builder/data/etc/network/interfaces.d/eth0-cfg deleted file mode 100644 index 2166051a..00000000 --- a/builder/data/etc/network/interfaces.d/eth0-cfg +++ /dev/null @@ -1,2 +0,0 @@ -allow-hotplug eth0 -iface eth0 inet dhcp \ No newline at end of file diff --git a/builder/data/etc/network/interfaces.d/lo-cfg b/builder/data/etc/network/interfaces.d/lo-cfg deleted file mode 100644 index a283b0ff..00000000 --- a/builder/data/etc/network/interfaces.d/lo-cfg +++ /dev/null @@ -1,2 +0,0 @@ -auto lo usb0 -iface lo inet loopback \ No newline at end of file diff --git a/builder/data/etc/network/interfaces.d/usb0-cfg b/builder/data/etc/network/interfaces.d/usb0-cfg deleted file mode 100644 index 3521780a..00000000 --- a/builder/data/etc/network/interfaces.d/usb0-cfg +++ /dev/null @@ -1,8 +0,0 @@ -allow-hotplug usb0 -iface usb0 inet static - address 10.0.0.2 - netmask 255.255.255.0 - network 10.0.0.0 - broadcast 10.0.0.255 - gateway 10.0.0.1 - metric 101 diff --git a/builder/data/etc/network/interfaces.d/wlan0-cfg b/builder/data/etc/network/interfaces.d/wlan0-cfg deleted file mode 100644 index f5425694..00000000 --- a/builder/data/etc/network/interfaces.d/wlan0-cfg +++ /dev/null @@ -1,2 +0,0 @@ -allow-hotplug wlan0 -iface wlan0 inet static \ No newline at end of file diff --git a/builder/data/etc/systemd/system/bettercap.service b/builder/data/etc/systemd/system/bettercap.service deleted file mode 100644 index ce8e8290..00000000 --- a/builder/data/etc/systemd/system/bettercap.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=bettercap api.rest service. -Documentation=https://bettercap.org -Wants=network.target - -[Service] -Type=simple -ExecStart=/usr/bin/bettercap-launcher -Restart=always -RestartSec=30 - -[Install] -WantedBy=multi-user.target diff --git a/builder/data/etc/systemd/system/bluetooth.service b/builder/data/etc/systemd/system/bluetooth.service deleted file mode 100644 index 6780e4b8..00000000 --- a/builder/data/etc/systemd/system/bluetooth.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=Bluetooth service -Documentation=man:bluetoothd(8) -ConditionPathIsDirectory=/sys/class/bluetooth - -[Service] -Type=dbus -BusName=org.bluez -ExecStart=/usr/libexec/bluetooth/bluetoothd --noplugin=sap,a2dp -NotifyAccess=main -#WatchdogSec=10 -#Restart=on-failure -CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE -LimitNPROC=1 -ProtectHome=true -ProtectSystem=full - -[Install] -WantedBy=bluetooth.target -Alias=dbus-org.bluez.service diff --git a/builder/data/etc/systemd/system/pwnagotchi.service b/builder/data/etc/systemd/system/pwnagotchi.service deleted file mode 100644 index daa53acc..00000000 --- a/builder/data/etc/systemd/system/pwnagotchi.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=pwnagotchi Deep Reinforcement Learning instrumenting bettercap for WiFI pwning. -Documentation=https://pwnagotchi.org -Wants=network.target -After=pwngrid-peer.service - -[Service] -Type=simple -WorkingDirectory=~ -ExecStart=/usr/bin/pwnagotchi-launcher -Restart=always -RestartSec=30 -TasksMax=infinity -LimitNPROC=infinity -StandardOutput=null -StandardError=null - -[Install] -WantedBy=multi-user.target diff --git a/builder/data/etc/systemd/system/pwngrid-peer.service b/builder/data/etc/systemd/system/pwngrid-peer.service deleted file mode 100644 index d6ff2223..00000000 --- a/builder/data/etc/systemd/system/pwngrid-peer.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=pwngrid peer service. -Documentation=https://pwnagotchi.org -Wants=network.target -After=bettercap.service - -[Service] -Environment=LD_PRELOAD=/usr/local/lib/libpcap.so.1 -Environment=LD_LIBRARY_PATH=/usr/local/lib -Type=simple -ExecStart=/usr/local/bin/pwngrid -keys /etc/pwnagotchi -peers /root/peers -address 127.0.0.1:8666 -client-token /root/.api-enrollment.json -wait -log /etc/pwnagotchi/log/pwngrid-peer.log -iface wlan0mon -Restart=always -RestartSec=30 - -[Install] -WantedBy=multi-user.target diff --git a/builder/data/etc/update-motd.d/01-motd b/builder/data/etc/update-motd.d/01-motd deleted file mode 100755 index aa4258c9..00000000 --- a/builder/data/etc/update-motd.d/01-motd +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -_hostname=$(hostname) -_version=$(cut -d"'" -f2 < /usr/local/lib/python3.11/dist-packages/pwnagotchi/_version.py) -echo -echo "(◕‿‿◕) $_hostname" -echo -echo " Hi! I'm a pwnagotchi $_version, please take good care of me!" -echo " Here are some basic things you need to know to raise me properly!" -echo -echo " If you want to change my configuration, use /etc/pwnagotchi/config.toml" -echo " All plugin config files are located in /etc/pwnagotchi/conf.d/" -echo " Read the readme if you want to use gdrivesync plugin!!" -echo -echo " All the configuration options can be found on /etc/pwnagotchi/default.toml," -echo " but don't change this file because I will recreate it every time I'm restarted!" -echo -echo " I use oPwnGrid as my main API, you can check stats at https://opwngrid.xyz" -echo -echo " I'm managed by systemd. Here are some basic commands." -echo -echo " If you want to know what I'm doing, you can check my logs with the command" -echo " - pwnlog" -echo " - sudo pwnagotchi --wizard, to help set up a config.toml" -echo " - sudo pwnagotchi --version, to check the current version" -echo " - sudo pwnagotchi --donate, to see how you can donate to this project" -echo " - sudo pwnagotchi --check-update, to see if there is a new version available" -echo -echo " If you want to know if I'm running, you can use" -echo " sudo systemctl status pwnagotchi" -echo -echo " You can restart me using" -echo " pwnkill" -echo -echo " You can learn more about me at https://pwnagotchi.org/" diff --git a/builder/data/root/client_secrets.json b/builder/data/root/client_secrets.json deleted file mode 100644 index e69de29b..00000000 diff --git a/builder/data/root/settings.yaml b/builder/data/root/settings.yaml deleted file mode 100644 index 5f198bde..00000000 --- a/builder/data/root/settings.yaml +++ /dev/null @@ -1,15 +0,0 @@ -client_config_backend: file -client_config_file: /root/client_secrets.json -client_config: - client_id: - client_secret: - -save_credentials: True -save_credentials_backend: file -save_credentials_file: /root/credentials.json - -get_refresh_token: True - -oauth_scope: - - https://www.googleapis.com/auth/drive - - https://www.googleapis.com/auth/drive.install \ No newline at end of file diff --git a/builder/data/usr/bin/bettercap-launcher b/builder/data/usr/bin/bettercap-launcher deleted file mode 100755 index b44c253b..00000000 --- a/builder/data/usr/bin/bettercap-launcher +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -source /usr/bin/pwnlib - -# we need to decrypt something -if is_crypted_mode; then - while ! is_decrypted; do - echo "Waiting for decryption..." - sleep 1 - done -fi - -reload_brcm -start_monitor_interface - -if is_auto_mode_no_delete; then - /usr/local/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface wlan0mon -else - /usr/local/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface wlan0mon -fi diff --git a/builder/data/usr/bin/decryption-webserver b/builder/data/usr/bin/decryption-webserver deleted file mode 100755 index 7eb9c52f..00000000 --- a/builder/data/usr/bin/decryption-webserver +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 - -from http.server import HTTPServer, BaseHTTPRequestHandler -from urllib.parse import parse_qsl - - -_HTML_FORM_TEMPLATE = """ - - - - Decryption - - - -
-

Decryption

-

Some of your files are encrypted.

-

Please provide the decryption password.

-
-
- {password_fields} - -
-
-
- - -""" - -POST_RESPONSE = """ - - - - - - - - - -
- - - -""" - -HTML_FORM = None - -class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): - - def do_GET(self): - self.send_response(200) - self.end_headers() - self.wfile.write(HTML_FORM.encode()) - - def do_POST(self): - content_length = int(self.headers['Content-Length']) - body = self.rfile.read(content_length) - for mapping, password in parse_qsl(body.decode('UTF-8')): - with open('/tmp/.pwnagotchi-secret-{}'.format(mapping), 'wt') as pwfile: - pwfile.write(password) - self.send_response(200) - self.end_headers() - self.wfile.write(POST_RESPONSE.encode()) - - -with open('/root/.pwnagotchi-crypted') as crypted_file: - mappings = [line.split()[0] for line in crypted_file.readlines()] - fields = ''.join(['\n
'.format(m=m) - for m in mappings]) - HTML_FORM = _HTML_FORM_TEMPLATE.format(password_fields=fields) - -httpd = HTTPServer(('0.0.0.0', 80), SimpleHTTPRequestHandler) -httpd.serve_forever() diff --git a/builder/data/usr/bin/hdmioff b/builder/data/usr/bin/hdmioff deleted file mode 100755 index 5c32d62c..00000000 --- a/builder/data/usr/bin/hdmioff +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -sudo /usr/bin/tvservice -o \ No newline at end of file diff --git a/builder/data/usr/bin/hdmion b/builder/data/usr/bin/hdmion deleted file mode 100755 index eec440fc..00000000 --- a/builder/data/usr/bin/hdmion +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -sudo /usr/bin/tvservice -p \ No newline at end of file diff --git a/builder/data/usr/bin/monstart b/builder/data/usr/bin/monstart deleted file mode 100755 index 4c00a5c5..00000000 --- a/builder/data/usr/bin/monstart +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -source /usr/bin/pwnlib -start_monitor_interface diff --git a/builder/data/usr/bin/monstop b/builder/data/usr/bin/monstop deleted file mode 100755 index c90a3aef..00000000 --- a/builder/data/usr/bin/monstop +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -source /usr/bin/pwnlib -stop_monitor_interface \ No newline at end of file diff --git a/builder/data/usr/bin/pwnagotchi-launcher b/builder/data/usr/bin/pwnagotchi-launcher deleted file mode 100755 index be0ceb03..00000000 --- a/builder/data/usr/bin/pwnagotchi-launcher +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -source /usr/bin/pwnlib - -# we need to decrypt something -if is_crypted_mode; then - while ! is_decrypted; do - echo "Waiting for decryption..." - sleep 1 - done -fi - -if is_auto_mode; then - /opt/.pwn/bin/pwnagotchi - systemctl restart bettercap -else - /opt/.pwn/bin/pwnagotchi --manual -fi diff --git a/builder/data/usr/bin/pwnlib b/builder/data/usr/bin/pwnlib deleted file mode 100755 index 7cb7b335..00000000 --- a/builder/data/usr/bin/pwnlib +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env bash - -# reload mod -reload_brcm() { - if ! modprobe -r brcmfmac; then - return 1 - fi - sleep 1 - if ! modprobe brcmfmac; then - return 1 - fi - sleep 2 - iw dev wlan0 set power_save off - return 0 -} - -# starts mon0 -start_monitor_interface() { - ifconfig wlan0 up - sleep 3 - iw phy "$(iw phy | head -1 | cut -d" " -f2)" interface add wlan0mon type monitor - sleep 2 - rfkill unblock all - ifconfig wlan0 down - ifconfig wlan0mon up - iw dev wlan0mon set power_save off -} - -# stops mon0 -stop_monitor_interface() { - ifconfig wlan0mon down && iw dev wlan0mon del - reload_brcm - ifconfig wlan0 up -} - -# returns 0 if the specified network interface is up -is_interface_up() { - if grep -qi 'up' /sys/class/net/"$1"/operstate; then - return 0 - fi - return 1 -} - -# returns 0 if conditions for AUTO mode are met -is_auto_mode() { - # check override file first - if [ -f /root/.pwnagotchi-manual ]; then - # remove the override file if found - rm -rf /root/.pwnagotchi-manual - return 1 - fi - - # check override file first - if [ -f /root/.pwnagotchi-auto ]; then - # remove the override file if found - rm -rf /root/.pwnagotchi-auto - return 0 - fi - - # if usb0 is up, we're in MANU - if is_interface_up usb0; then - return 1 - fi - - # if eth0 is up (for other boards), we're in MANU - if is_interface_up eth0; then - return 0 - fi - - # no override, but none of the interfaces is up -> AUTO - return 0 -} - -# returns 0 if conditions for AUTO mode are met -is_auto_mode_no_delete() { - # check override file first - if [ -f /root/.pwnagotchi-manual ]; then - return 1 - fi - - # check override file first - if [ -f /root/.pwnagotchi-auto ]; then - return 0 - fi - - # if usb0 is up, we're in MANU - if is_interface_up usb0; then - return 1 - fi - - # if eth0 is up (for other boards), we're in MANU - if is_interface_up eth0; then - return 0 - fi - - # no override, but none of the interfaces is up -> AUTO - return 0 -} - -# check if we need to decrypt something -is_crypted_mode() { - if [ -f /root/.pwnagotchi-crypted ]; then - return 0 - fi - return 1 -} - -# decryption loop -is_decrypted() { - while read -r mapping container mount; do - # mapping = name the device or file will be mapped to - # container = the luks encrypted device or file - # mount = the mountpoint - - # fail if not mounted - if ! mountpoint -q "$mount" >/dev/null 2>&1; then - if [ -f /tmp/.pwnagotchi-secret-"$mapping" ]; then - /dev/null 2>&1; then - echo "Container decrypted!" - fi - fi - - if mount /dev/mapper/"$mapping" "$mount" >/dev/null 2>&1; then - echo "Mounted /dev/mapper/$mapping to $mount" - continue - fi - fi - - if ! ip -4 addr show wlan0 | grep inet >/dev/null 2>&1; then - >/dev/null 2>&1 ip addr add 192.168.0.10/24 dev wlan0 - fi - - if ! pgrep -f decryption-webserver >/dev/null 2>&1; then - >/dev/null 2>&1 decryption-webserver & - fi - - if ! pgrep wpa_supplicant >/dev/null 2>&1; then - >/tmp/wpa_supplicant.conf cat </dev/null 2>&1 wpa_supplicant -u -s -O -D nl80211 -i wlan0 -c /tmp/wpa_supplicant.conf & - fi - - if ! pgrep dnsmasq >/dev/null 2>&1; then - >/dev/null 2>&1 dnsmasq -k -p 53 -h -O "6,192.168.0.10" -A "/#/192.168.0.10" -i wlan0 -K -F 192.168.0.50,192.168.0.60,255.255.255.0,24h & - fi - - return 1 - fi - done /dev/null - # delete - rm /tmp/.pwnagotchi-secret-* - sync # flush - - pkill wpa_supplicant - pkill dnsmasq - pid="$(pgrep -f "decryption-webserver")" - [[ -n "$pid" ]] && kill "$pid" - - return 0 -} diff --git a/pwnagotchi/automata.py b/pwnagotchi/automata.py index 9b7f9c8e..6e6b2e20 100644 --- a/pwnagotchi/automata.py +++ b/pwnagotchi/automata.py @@ -2,6 +2,7 @@ import logging import pwnagotchi.plugins as plugins from pwnagotchi.ai.epoch import Epoch +import os # basic mood system @@ -136,7 +137,12 @@ class Automata(object): self.set_grateful() plugins.on('epoch', self, self._epoch.epoch - 1, self._epoch.data()) - + if self._epoch.blind_for % 10 == 2: + logging.info("two blind epochs -> restarting wifi.recon...", self._epoch.blind_for) + self.run('wifi.recon on') + if self._epoch.blind_for and self._epoch.blind_for % 5 == 0: + logging.info("%d epochs without visible access points -> restarting bettercap...", self._epoch.blind_for) + os.system("systemctl restart bettercap") if self._epoch.blind_for >= self._config['main']['mon_max_blind_epochs']: logging.critical("%d epochs without visible access points -> restarting ...", self._epoch.blind_for) self._restart() diff --git a/pyproject.toml b/pyproject.toml index eac141ae..8ed3ee3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "tweepy", "websockets", ] -requires-python = ">=3.9" +requires-python = ">=3.11" authors = [ {name = "Evilsocket", email = "evilsocket@gmail.com"}, {name = "Jayofelony", email = "oudshoorn.jeroen@gmail.com"} diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c6921379..00000000 --- a/requirements.txt +++ /dev/null @@ -1,25 +0,0 @@ -PyYAML -dbus-python -file-read-backwards -flask -flask-cors -flask-wtf -gast -gpiozero -inky -numpy -pycryptodome -pydrive2 -python-dateutil -requests -rpi-lgpio -rpi_hardware_pwm -scapy -setuptools -shimmy -smbus -smbus2 -spidev -toml -tweepy -websockets \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 9b132347..00000000 --- a/setup.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -from setuptools import setup, find_packages -from setuptools.command.install import install -import glob -import logging -import os -import re -import shutil -import warnings -import platform - -log = logging.getLogger(__name__) - - -def install_file(source_filename, dest_filename): - # do not overwrite network configuration if it exists already - # https://github.com/evilsocket/pwnagotchi/issues/483 - if dest_filename.startswith('/etc/network/interfaces.d/') and os.path.exists(dest_filename): - log.info(f"{dest_filename} exists, skipping ...") - return - elif dest_filename.startswith('/root/') and os.path.exists(dest_filename): - log.info(f"{dest_filename} exists, skipping ...") - return - - log.info(f"installing {source_filename} to {dest_filename} ...") - dest_folder = os.path.dirname(dest_filename) - if not os.path.isdir(dest_folder): - os.makedirs(dest_folder) - - shutil.copy2(source_filename, dest_filename) - if dest_filename.startswith("/usr/bin/"): - os.chmod(dest_filename, 0o755) - - -def install_system_files(): - data_path = None - if os.stat("apt_packages.txt").st_size != 0: - f = open("apt_packages.txt", "r") - for x in f: - os.system(f"apt-get install -y {x}") - f.close() - setup_path = os.path.dirname(__file__) - data_path = os.path.join(setup_path, "builder/data") - - for source_filename in glob.glob("%s/**" % data_path, recursive=True): - if os.path.isfile(source_filename): - dest_filename = source_filename.replace(data_path, '') - install_file(source_filename, dest_filename) - - -def restart_services(): - # reload systemd units - os.system("systemctl daemon-reload") - - # for people updating https://github.com/evilsocket/pwnagotchi/pull/551/files - os.system("systemctl enable fstrim.timer") - - -class CustomInstall(install): - def run(self): - super().run() - if os.geteuid() != 0: - warnings.warn("Not running as root, can't install pwnagotchi system files!") - return - install_system_files() - restart_services() - - -def version(version_file): - with open(version_file, 'rt') as vf: - version_file_content = vf.read() - - version_match = re.search(r"__version__\s*=\s*[\"\']([^\"\']+)", version_file_content) - if version_match: - return version_match.groups()[0] - - return None - - -with open('requirements.txt') as fp: - required = [ - line.strip() - for line in fp - if line.strip() and not line.startswith("--") - ] - -VERSION_FILE = 'pwnagotchi/_version.py' -pwnagotchi_version = version(VERSION_FILE) - -setup(name='pwnagotchi', - version=pwnagotchi_version, - description='(⌐■_■) - Deep Reinforcement Learning instrumenting bettercap for WiFI pwning.', - author='evilsocket && the dev team', - author_email='evilsocket@gmail.com', - url='https://pwnagotchi.ai/', - license='GPL', - cmdclass={ - "install": CustomInstall, - }, - scripts=['bin/pwnagotchi'], - package_data={'pwnagotchi': ['defaults.toml', 'pwnagotchi/defaults.toml', 'locale/*/LC_MESSAGES/*.mo']}, - include_package_data=True, - packages=find_packages(), - classifiers=[ - 'Programming Language :: Python :: 3', - 'Development Status :: 5 - Production/Stable', - 'License :: OSI Approved :: GNU General Public License (GPL)', - 'Environment :: Console', - ])