mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
8
Makefile
8
Makefile
@ -51,9 +51,11 @@ $(SDIST): setup.py pwnagotchi
|
||||
$(PWN_RELEASE).img: | $(PACKER)
|
||||
|
||||
# If the packer or ansible files are updated, rebuild the image.
|
||||
$(PWN_RELEASE).img: $(SDIST) builder/pwnagotchi.json builder/pwnagotchi.yml $(shell find builder/data -type f)
|
||||
sudo $(PACKER) plugins install github.com/solo-io/arm-image
|
||||
cd builder && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json
|
||||
$(PWN_RELEASE).img: $(SDIST) builder/pwnagotchi.json.pkr.hcl builder/pwnagotchi.yml $(shell find builder/data -type f)
|
||||
|
||||
# sudo $(PACKER) plugins install github.com/solo-io/arm-image
|
||||
# sudo $(PACKER) plugins install github.com/hashicorp/ansible
|
||||
cd builder && packer init pwnagotchi.json.pkr.hcl && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json.pkr.hcl
|
||||
|
||||
# If any of these files are updated, rebuild the checksums.
|
||||
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img
|
||||
|
@ -79,7 +79,7 @@ def do_auto_mode(agent):
|
||||
# From Pwnagotchi's perspective, the more new access points
|
||||
# and / or client stations nearby, the longer one epoch of
|
||||
# its relative time will take ... basically, in Pwnagotchi's universe,
|
||||
# WiFi electromagnetic fields affect time like gravitational fields
|
||||
# Wi-Fi electromagnetic fields affect time like gravitational fields
|
||||
# affect ours ... neat ^_^
|
||||
agent.next_epoch()
|
||||
|
||||
|
@ -1,108 +1,75 @@
|
||||
# This file was autogenerated by the BETA 'packer hcl2_upgrade' command. We
|
||||
# recommend double checking that everything is correct before going forward. We
|
||||
# also recommend treating this file as disposable. The HCL2 blocks in this
|
||||
# file can be moved to other files. For example, the variable blocks could be
|
||||
# moved to their own 'variables.pkr.hcl' file, etc. Those files need to be
|
||||
# suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at
|
||||
# once they also need to be in the same folder. 'packer inspect folder/'
|
||||
# will describe to you what is in that folder.
|
||||
|
||||
# Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` )
|
||||
# and HCL2 calls (for example '${ var.string_value_example }' ). They won't be
|
||||
# executed together and the outcome will be unknown.
|
||||
|
||||
# All generated input variables will be of 'string' type as this is how Packer JSON
|
||||
# views them; you can change their type later on. Read the variables type
|
||||
# constraints documentation
|
||||
# https://www.packer.io/docs/from-1.5/variables#type-constraints for more info.
|
||||
# "timestamp" template function replacement
|
||||
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
|
||||
|
||||
# source blocks are generated from your builders; a source can be referenced in
|
||||
# build blocks. A build block runs provisioner and post-processors on a
|
||||
# source. Read the documentation for source blocks here:
|
||||
# https://www.packer.io/docs/from-1.5/blocks/source
|
||||
packer {
|
||||
required_plugins {
|
||||
arm-image = {
|
||||
version = ">= 0.2.7"
|
||||
source = "github.com/solo-io/arm-image"
|
||||
}
|
||||
ansible = {
|
||||
version = ">= 1.1.0"
|
||||
source = "github.com/hashicorp/ansible"
|
||||
}
|
||||
}
|
||||
}
|
||||
source "arm-image" "pwnagotchi" {
|
||||
|
||||
variable "pwn_hostname" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "pwn_version" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "arm-image" "rpi-pwnagotchi" {
|
||||
iso_checksum = "file:https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz.sha256"
|
||||
iso_url = "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz"
|
||||
output_filename = "../../../pwnagotchi-${var.pwn_version}-arm64.img"
|
||||
output_filename = "../../../pwnagotchi-raspios-bullseye-${var.pwn_version}-arm64.img"
|
||||
qemu_binary = "qemu-aarch64-static"
|
||||
target_image_size = 9368709120
|
||||
qemu_args = ["-r", "6.1.21-v8+"]
|
||||
}
|
||||
# "arm-image" "opi-pwnagotchi" {
|
||||
# iso_checksum = ""
|
||||
# iso_url = "https://drive.usercontent.google.com/download?id=12DgsOXXgpDTQLRBsh8cKqVGD2FUUMZDk&export=download&authuser=0&confirm=t&uuid=d97afcec-3979-44e2-838a-f17c576a87fb&at=APZUnTWoYAa6oVoxrZWwPP7o8Hn9:1698613336721"
|
||||
# output_file ="../../../pwnagotchi-orangepi-jammy-${var.pwn_version}-arm64.img"
|
||||
# qemu_binary = "qemu-aarch64-static"
|
||||
# target_image_size = 9368709120
|
||||
# qemu_args = ["-r", "6.1.21-v8+"]
|
||||
#}
|
||||
|
||||
# a build block invokes sources and runs provisioning steps on them. The
|
||||
# documentation for build blocks can be found here:
|
||||
# https://www.packer.io/docs/from-1.5/blocks/build
|
||||
build {
|
||||
sources = ["source.arm-image.pwnagotchi"]
|
||||
name = "Pwnagotchi Torch 64bit"
|
||||
sources = [
|
||||
"source.arm-image.rpi-pwnagotchi",
|
||||
# "source.arm-image.opi-pwnagotchi",
|
||||
]
|
||||
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/pwnlib"
|
||||
source = "../builder/data/usr/bin/pwnlib"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/bettercap-launcher"
|
||||
source = "../builder/data/usr/bin/bettercap-launcher"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/pwnagotchi-launcher"
|
||||
source = "../builder/data/usr/bin/pwnagotchi-launcher"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/monstop"
|
||||
source = "../builder/data/usr/bin/monstop"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/monstart"
|
||||
source = "../builder/data/usr/bin/monstart"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/hdmion"
|
||||
source = "../builder/data/usr/bin/hdmion"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/usr/bin/hdmioff"
|
||||
source = "../builder/data/usr/bin/hdmioff"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/network/interfaces.d/lo-cfg"
|
||||
source = "../builder/data/etc/network/interfaces.d/lo-cfg"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/network/interfaces.d/wlan0-cfg"
|
||||
source = "../builder/data/etc/network/interfaces.d/wlan0-cfg"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/network/interfaces.d/usb0-cfg"
|
||||
source = "../builder/data/etc/network/interfaces.d/usb0-cfg"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/network/interfaces.d/eth0-cfg"
|
||||
source = "../builder/data/etc/network/interfaces.d/eth0-cfg"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/systemd/system/pwngrid-peer.service"
|
||||
source = "../builder/data/etc/systemd/system/pwngrid-peer.service"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/systemd/system/pwnagotchi.service"
|
||||
source = "../builder/data/etc/systemd/system/pwnagotchi.service"
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/systemd/system/bettercap.service"
|
||||
source = "../builder/data/etc/systemd/system/bettercap.service"
|
||||
destination = "/usr/bin/"
|
||||
sources = [
|
||||
"../builder/data/usr/bin/pwnlib",
|
||||
"../builder/data/usr/bin/bettercap-launcher",
|
||||
"../builder/data/usr/bin/pwnagotchi-launcher",
|
||||
"../builder/data/usr/bin/monstop",
|
||||
"../builder/data/usr/bin/monstart",
|
||||
"../builder/data/usr/bin/hdmion",
|
||||
"../builder/data/usr/bin/hdmioff",
|
||||
]
|
||||
}
|
||||
provisioner "shell" {
|
||||
inline = ["chmod +x /usr/bin/*"]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
destination = "/etc/systemd/system/"
|
||||
sources = [
|
||||
"../builder/data/etc/systemd/system/pwngrid-peer.service",
|
||||
"../builder/data/etc/systemd/system/pwnagotchi.service",
|
||||
"../builder/data/etc/systemd/system/bettercap.service",
|
||||
]
|
||||
}
|
||||
provisioner "file" {
|
||||
destination = "/etc/update-motd.d/01-motd"
|
||||
source = "../builder/data/etc/update-motd.d/01-motd"
|
||||
@ -111,7 +78,7 @@ build {
|
||||
inline = ["chmod +x /etc/update-motd.d/*"]
|
||||
}
|
||||
provisioner "shell" {
|
||||
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y ansible"]
|
||||
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
|
||||
}
|
||||
provisioner "ansible-local" {
|
||||
command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook"
|
||||
|
@ -147,6 +147,10 @@
|
||||
ARCHFLAGS: "-arch aarch64"
|
||||
|
||||
tasks:
|
||||
- name: Show facts available on the system
|
||||
debug:
|
||||
var: ansible_facts
|
||||
|
||||
- name: Create pi user
|
||||
copy:
|
||||
dest: /boot/userconf
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '2.5.0'
|
||||
__version__ = '2.5.1'
|
||||
|
@ -166,8 +166,8 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
|
||||
def _filter_included(self, ap):
|
||||
return self._filter is None or \
|
||||
self._filter.match(ap['hostname']) is not None or \
|
||||
self._filter.match(ap['mac']) is not None
|
||||
self._filter.match(ap['hostname']) is not None or \
|
||||
self._filter.match(ap['mac']) is not None
|
||||
|
||||
def set_access_points(self, aps):
|
||||
self._access_points = aps
|
||||
@ -346,7 +346,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
|
||||
# give plugins access to the events
|
||||
try:
|
||||
plugins.on('bcap_%s' % re.sub(r"[^a-z0-9_]+", "_", jmsg['tag'].lower()), self, jmsg)
|
||||
plugins.on('bcap_%s' % re.sub(r"[^a-z0-9_]+", "_", jmsg['tag'].lower()), self, jmsg)
|
||||
except Exception as err:
|
||||
logging.error("Processing event: %s" % err)
|
||||
|
||||
@ -369,10 +369,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
'hostname'] != '<hidden>' else ap_mac
|
||||
logging.warning(
|
||||
"!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!",
|
||||
ap['channel'],
|
||||
ap['rssi'],
|
||||
sta['mac'], sta['vendor'],
|
||||
ap['hostname'], ap['mac'], ap['vendor'])
|
||||
ap['channel'], ap['rssi'], sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'])
|
||||
plugins.on('handshake', self, filename, ap, sta)
|
||||
found_handshake = True
|
||||
self._update_handshakes(1 if found_handshake else 0)
|
||||
@ -436,7 +433,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
|
||||
try:
|
||||
logging.info("sending association frame to %s (%s %s) on channel %d [%d clients], %d dBm...",
|
||||
ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], len(ap['clients']), ap['rssi'])
|
||||
ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], len(ap['clients']), ap['rssi'])
|
||||
self.run('wifi.assoc %s' % ap['mac'])
|
||||
self._epoch.track(assoc=True)
|
||||
except Exception as e:
|
||||
@ -457,7 +454,8 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
|
||||
try:
|
||||
logging.info("deauthing %s (%s) from %s (%s %s) on channel %d, %d dBm ...",
|
||||
sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], ap['rssi'])
|
||||
sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'], ap['channel'],
|
||||
ap['rssi'])
|
||||
self.run('wifi.deauth %s' % sta['mac'])
|
||||
self._epoch.track(deauth=True)
|
||||
except Exception as e:
|
||||
|
@ -44,7 +44,7 @@ class Epoch(object):
|
||||
# number of peers seen during this epoch
|
||||
self.num_peers = 0
|
||||
# cumulative bond factor
|
||||
self.tot_bond_factor = 0.0 # cum_bond_factor sounded really bad ...
|
||||
self.tot_bond_factor = 0.0 # cum_bond_factor sounded worse ...
|
||||
# average bond factor
|
||||
self.avg_bond_factor = 0.0
|
||||
# any activity at all during this epoch?
|
||||
|
@ -99,7 +99,7 @@ class Environment(gym.Env):
|
||||
|
||||
def step(self, policy):
|
||||
# create the parameters from the policy and update
|
||||
# update them in the algorithm
|
||||
# them in the algorithm
|
||||
self._apply_policy(policy)
|
||||
self._epoch_num += 1
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Automata(object):
|
||||
support_factor = total_encounters / bond_factor
|
||||
return support_factor >= factor
|
||||
|
||||
# triggered when it's a sad/bad day but you have good friends around ^_^
|
||||
# triggered when it's a sad/bad day, but you have good friends around ^_^
|
||||
def set_grateful(self):
|
||||
self._view.on_grateful()
|
||||
plugins.on('grateful', self)
|
||||
|
Reference in New Issue
Block a user