mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Remove builder/data folder, we don't need that anymore.
Signed-off-by: jayofelony <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||||||
allow-hotplug eth0
|
|
||||||
iface eth0 inet dhcp
|
|
@ -1,2 +0,0 @@
|
|||||||
auto lo usb0
|
|
||||||
iface lo inet loopback
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||||||
allow-hotplug wlan0
|
|
||||||
iface wlan0 inet static
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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/"
|
|
@ -1,15 +0,0 @@
|
|||||||
client_config_backend: file
|
|
||||||
client_config_file: /root/client_secrets.json
|
|
||||||
client_config:
|
|
||||||
client_id: <YOUR CLIENT ID>
|
|
||||||
client_secret: <YOUR 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
|
|
@ -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
|
|
@ -1,148 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
|
||||||
from urllib.parse import parse_qsl
|
|
||||||
|
|
||||||
|
|
||||||
_HTML_FORM_TEMPLATE = """
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Decryption</title>
|
|
||||||
<style>
|
|
||||||
body {{ text-align: center; padding: 150px; }}
|
|
||||||
h1 {{ font-size: 50px; }}
|
|
||||||
body {{ font: 20px Helvetica, sans-serif; color: #333; }}
|
|
||||||
article {{ display: block; text-align: center; width: 650px; margin: 0 auto;}}
|
|
||||||
input {{
|
|
||||||
padding: 12px 20px;
|
|
||||||
margin: 8px 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}}
|
|
||||||
input[type=password] {{
|
|
||||||
width: 75%;
|
|
||||||
font-size: 24px;
|
|
||||||
}}
|
|
||||||
input[type=submit] {{
|
|
||||||
cursor: pointer;
|
|
||||||
width: 75%;
|
|
||||||
}}
|
|
||||||
input[type=submit]:hover {{
|
|
||||||
background-color: #d9d9d9;
|
|
||||||
}}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<article>
|
|
||||||
<h1>Decryption</h1>
|
|
||||||
<p>Some of your files are encrypted.</p>
|
|
||||||
<p>Please provide the decryption password.</p>
|
|
||||||
<div>
|
|
||||||
<form action="/set-password" method="POST">
|
|
||||||
{password_fields}
|
|
||||||
<input type="submit" value="Submit">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
POST_RESPONSE = """
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<style>
|
|
||||||
/* Center the loader */
|
|
||||||
#loader {
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
z-index: 1;
|
|
||||||
width: 150px;
|
|
||||||
height: 150px;
|
|
||||||
margin: -75px 0 0 -75px;
|
|
||||||
border: 16px solid #f3f3f3;
|
|
||||||
border-radius: 50%;
|
|
||||||
border-top: 16px solid #3498db;
|
|
||||||
width: 120px;
|
|
||||||
height: 120px;
|
|
||||||
-webkit-animation: spin 2s linear infinite;
|
|
||||||
animation: spin 2s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes spin {
|
|
||||||
0% { -webkit-transform: rotate(0deg); }
|
|
||||||
100% { -webkit-transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
0% { transform: rotate(0deg); }
|
|
||||||
100% { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
#myDiv {
|
|
||||||
display: none;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
function checkPwnagotchi() {
|
|
||||||
var target = 'http://' + document.location.hostname + ':8080/';
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open('GET', target);
|
|
||||||
xhr.onreadystatechange = function () {
|
|
||||||
if (xhr.readyState == 4) {
|
|
||||||
if (xhr.status == 200 || xhr.status == 401) {
|
|
||||||
window.location.replace(target);
|
|
||||||
}else{
|
|
||||||
setTimeout(checkPwnagotchi, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xhr.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(checkPwnagotchi, 1000);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="margin:0;">
|
|
||||||
|
|
||||||
<div id="loader"></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
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(['<label for="{m}">Passphrase for {m}:</label>\n<input type="password" id="{m}" name="{m}" value=""><br>'.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()
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
sudo /usr/bin/tvservice -o
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
sudo /usr/bin/tvservice -p
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source /usr/bin/pwnlib
|
|
||||||
start_monitor_interface
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source /usr/bin/pwnlib
|
|
||||||
stop_monitor_interface
|
|
@ -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
|
|
@ -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
|
|
||||||
</tmp/.pwnagotchi-secret-"$mapping" read -r SECRET
|
|
||||||
if ! test -b /dev/disk/by-id/dm-uuid-*"$(cryptsetup luksUUID "$container" | tr -d -)"*; then
|
|
||||||
if echo -n "$SECRET" | cryptsetup luksOpen -d- "$container" "$mapping" >/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 <<EOF
|
|
||||||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
|
||||||
update_config=1
|
|
||||||
ap_scan=2
|
|
||||||
|
|
||||||
network={
|
|
||||||
ssid="DECRYPT-ME"
|
|
||||||
mode=2
|
|
||||||
key_mgmt=WPA-PSK
|
|
||||||
psk="pwnagotchi"
|
|
||||||
frequency=2437
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
>/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 </root/.pwnagotchi-crypted
|
|
||||||
|
|
||||||
# overwrite passwords
|
|
||||||
python3 -c 'print("A"*4096)' | tee /tmp/.pwnagotchi-secret-* >/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
|
|
||||||
}
|
|
@ -2,6 +2,7 @@ import logging
|
|||||||
|
|
||||||
import pwnagotchi.plugins as plugins
|
import pwnagotchi.plugins as plugins
|
||||||
from pwnagotchi.ai.epoch import Epoch
|
from pwnagotchi.ai.epoch import Epoch
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
# basic mood system
|
# basic mood system
|
||||||
@ -136,7 +137,12 @@ class Automata(object):
|
|||||||
self.set_grateful()
|
self.set_grateful()
|
||||||
|
|
||||||
plugins.on('epoch', self, self._epoch.epoch - 1, self._epoch.data())
|
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']:
|
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)
|
logging.critical("%d epochs without visible access points -> restarting ...", self._epoch.blind_for)
|
||||||
self._restart()
|
self._restart()
|
||||||
|
@ -32,7 +32,7 @@ dependencies = [
|
|||||||
"tweepy",
|
"tweepy",
|
||||||
"websockets",
|
"websockets",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.11"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Evilsocket", email = "evilsocket@gmail.com"},
|
{name = "Evilsocket", email = "evilsocket@gmail.com"},
|
||||||
{name = "Jayofelony", email = "oudshoorn.jeroen@gmail.com"}
|
{name = "Jayofelony", email = "oudshoorn.jeroen@gmail.com"}
|
||||||
|
@ -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
|
|
110
setup.py
110
setup.py
@ -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',
|
|
||||||
])
|
|
Reference in New Issue
Block a user