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)
|
$(PWN_RELEASE).img: | $(PACKER)
|
||||||
|
|
||||||
# If the packer or ansible files are updated, rebuild the image.
|
# 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)
|
$(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
|
|
||||||
cd builder && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json
|
# 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.
|
# If any of these files are updated, rebuild the checksums.
|
||||||
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img
|
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img
|
||||||
|
@ -79,7 +79,7 @@ def do_auto_mode(agent):
|
|||||||
# From Pwnagotchi's perspective, the more new access points
|
# From Pwnagotchi's perspective, the more new access points
|
||||||
# and / or client stations nearby, the longer one epoch of
|
# and / or client stations nearby, the longer one epoch of
|
||||||
# its relative time will take ... basically, in Pwnagotchi's universe,
|
# 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 ^_^
|
# affect ours ... neat ^_^
|
||||||
agent.next_epoch()
|
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 {
|
packer {
|
||||||
required_plugins {
|
required_plugins {
|
||||||
arm-image = {
|
arm-image = {
|
||||||
version = ">= 0.2.7"
|
version = ">= 0.2.7"
|
||||||
source = "github.com/solo-io/arm-image"
|
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_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"
|
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"
|
qemu_binary = "qemu-aarch64-static"
|
||||||
target_image_size = 9368709120
|
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
|
# a build block invokes sources and runs provisioning steps on them. The
|
||||||
# documentation for build blocks can be found here:
|
# documentation for build blocks can be found here:
|
||||||
# https://www.packer.io/docs/from-1.5/blocks/build
|
# https://www.packer.io/docs/from-1.5/blocks/build
|
||||||
build {
|
build {
|
||||||
sources = ["source.arm-image.pwnagotchi"]
|
name = "Pwnagotchi Torch 64bit"
|
||||||
|
sources = [
|
||||||
|
"source.arm-image.rpi-pwnagotchi",
|
||||||
|
# "source.arm-image.opi-pwnagotchi",
|
||||||
|
]
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
destination = "/usr/bin/pwnlib"
|
destination = "/usr/bin/"
|
||||||
source = "../builder/data/usr/bin/pwnlib"
|
sources = [
|
||||||
}
|
"../builder/data/usr/bin/pwnlib",
|
||||||
provisioner "file" {
|
"../builder/data/usr/bin/bettercap-launcher",
|
||||||
destination = "/usr/bin/bettercap-launcher"
|
"../builder/data/usr/bin/pwnagotchi-launcher",
|
||||||
source = "../builder/data/usr/bin/bettercap-launcher"
|
"../builder/data/usr/bin/monstop",
|
||||||
}
|
"../builder/data/usr/bin/monstart",
|
||||||
provisioner "file" {
|
"../builder/data/usr/bin/hdmion",
|
||||||
destination = "/usr/bin/pwnagotchi-launcher"
|
"../builder/data/usr/bin/hdmioff",
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = ["chmod +x /usr/bin/*"]
|
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" {
|
provisioner "file" {
|
||||||
destination = "/etc/update-motd.d/01-motd"
|
destination = "/etc/update-motd.d/01-motd"
|
||||||
source = "../builder/data/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/*"]
|
inline = ["chmod +x /etc/update-motd.d/*"]
|
||||||
}
|
}
|
||||||
provisioner "shell" {
|
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" {
|
provisioner "ansible-local" {
|
||||||
command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook"
|
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"
|
ARCHFLAGS: "-arch aarch64"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Show facts available on the system
|
||||||
|
debug:
|
||||||
|
var: ansible_facts
|
||||||
|
|
||||||
- name: Create pi user
|
- name: Create pi user
|
||||||
copy:
|
copy:
|
||||||
dest: /boot/userconf
|
dest: /boot/userconf
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = '2.5.0'
|
__version__ = '2.5.1'
|
||||||
|
@ -369,10 +369,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
|||||||
'hostname'] != '<hidden>' else ap_mac
|
'hostname'] != '<hidden>' else ap_mac
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!",
|
"!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!",
|
||||||
ap['channel'],
|
ap['channel'], ap['rssi'], sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'])
|
||||||
ap['rssi'],
|
|
||||||
sta['mac'], sta['vendor'],
|
|
||||||
ap['hostname'], ap['mac'], ap['vendor'])
|
|
||||||
plugins.on('handshake', self, filename, ap, sta)
|
plugins.on('handshake', self, filename, ap, sta)
|
||||||
found_handshake = True
|
found_handshake = True
|
||||||
self._update_handshakes(1 if found_handshake else 0)
|
self._update_handshakes(1 if found_handshake else 0)
|
||||||
@ -457,7 +454,8 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logging.info("deauthing %s (%s) from %s (%s %s) on channel %d, %d dBm ...",
|
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.run('wifi.deauth %s' % sta['mac'])
|
||||||
self._epoch.track(deauth=True)
|
self._epoch.track(deauth=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -44,7 +44,7 @@ class Epoch(object):
|
|||||||
# number of peers seen during this epoch
|
# number of peers seen during this epoch
|
||||||
self.num_peers = 0
|
self.num_peers = 0
|
||||||
# cumulative bond factor
|
# 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
|
# average bond factor
|
||||||
self.avg_bond_factor = 0.0
|
self.avg_bond_factor = 0.0
|
||||||
# any activity at all during this epoch?
|
# any activity at all during this epoch?
|
||||||
|
@ -99,7 +99,7 @@ class Environment(gym.Env):
|
|||||||
|
|
||||||
def step(self, policy):
|
def step(self, policy):
|
||||||
# create the parameters from the policy and update
|
# create the parameters from the policy and update
|
||||||
# update them in the algorithm
|
# them in the algorithm
|
||||||
self._apply_policy(policy)
|
self._apply_policy(policy)
|
||||||
self._epoch_num += 1
|
self._epoch_num += 1
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class Automata(object):
|
|||||||
support_factor = total_encounters / bond_factor
|
support_factor = total_encounters / bond_factor
|
||||||
return support_factor >= 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):
|
def set_grateful(self):
|
||||||
self._view.on_grateful()
|
self._view.on_grateful()
|
||||||
plugins.on('grateful', self)
|
plugins.on('grateful', self)
|
||||||
|
Reference in New Issue
Block a user