Skip to content

Commit a94e7ee

Browse files
authored
Merge pull request #46 from jayofelony/dev
Dev to master
2 parents cca2ff2 + 1cefae5 commit a94e7ee

File tree

12 files changed

+61
-66
lines changed

12 files changed

+61
-66
lines changed

apt_packages.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

bin/pwnagotchi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def pwnagotchi_cli():
6060
channels = agent.get_access_points_by_channel()
6161
# for each channel
6262
for ch, aps in channels:
63+
time.sleep(0.2) # This is to make sure it doesn't error (https://github.com/seemoo-lab/nexmon/issues/596)
6364
agent.set_channel(ch)
6465

6566
if not agent.is_stale() and agent.any_activity():

builder/data/usr/bin/bettercap-launcher

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ if is_crypted_mode; then
99
done
1010
fi
1111

12-
# check if wifi driver is bugged
13-
if ! check_brcm; then
14-
if ! reload_brcm; then
15-
echo "Could not reload wifi driver. Reboot"
16-
reboot
17-
fi
18-
sleep 10
19-
fi
20-
2112
# start mon0
2213
start_monitor_interface
2314

builder/data/usr/bin/pwnlib

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ blink_led() {
1313
sleep 0.3
1414
}
1515

16-
# check if brcm is stuck
17-
check_brcm() {
18-
if [[ "$(journalctl -n10 -k --since -5m | grep -c 'brcmf_cfg80211_nexmon_set_channel.*Set Channel failed')" -ge 5 ]]; then
19-
return 1
20-
fi
21-
return 0
22-
}
23-
2416
# reload mod
2517
reload_brcm() {
2618
if ! modprobe -r brcmfmac; then

builder/pwnagotchi.json.pkr.hcl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ build {
7474
inline = ["chmod +x /usr/bin/*"]
7575
}
7676

77+
provisioner "shell" {
78+
inline = ["dpkg --add-architecture armhf"]
79+
}
80+
7781
provisioner "file" {
7882
destination = "/etc/systemd/system/"
7983
sources = [
@@ -91,7 +95,11 @@ build {
9195
inline = ["chmod +x /etc/update-motd.d/*"]
9296
}
9397
provisioner "shell" {
94-
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
98+
inline = [
99+
"apt-get -y --allow-releaseinfo-change update",
100+
"apt-get -y dist-upgrade",
101+
"apt-get install -y --no-install-recommends ansible"
102+
]
95103
}
96104
provisioner "ansible-local" {
97105
command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook"

builder/raspberrypi64.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
vars:
77
kernel:
88
min: "6.1"
9-
full: "6.1.0-rpi7-rpi-v8"
10-
full_pi5: "6.1.0-rpi7-rpi-2712"
9+
full: "6.1.0-rpi8-rpi-v8"
10+
full_pi5: "6.1.0-rpi8-rpi-2712"
1111
pwnagotchi:
1212
hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
1313
version: "{{ lookup('env', 'PWN_VERSION') | default('pwnagotchi-torch', true) }}"
@@ -79,6 +79,11 @@
7979
- curl
8080
- dkms
8181
- fbi
82+
- firmware-atheros
83+
- firmware-brcm80211
84+
- firmware-libertas
85+
- firmware-misc-nonfree
86+
- firmware-realtek
8287
- flex
8388
- fonts-dejavu
8489
- fonts-dejavu-core
@@ -97,9 +102,9 @@
97102
- libbz2-dev
98103
- libc-ares-dev
99104
- libc6-dev
105+
- libc6:armhf
100106
- libcap-dev
101107
- libcurl-ocaml-dev
102-
- libssl-ocaml-dev
103108
- libdbus-1-dev
104109
- libdbus-glib-1-dev
105110
- libeigen3-dev
@@ -112,7 +117,10 @@
112117
- libgmp3-dev
113118
- libgstreamer1.0-0
114119
- libhdf5-dev
120+
- libisl23:armhf
115121
- liblapack-dev
122+
- libmpc3:armhf
123+
- libmpfr6:armhf
116124
- libncursesw5-dev
117125
- libnetfilter-queue-dev
118126
- libopenblas-dev
@@ -126,34 +134,31 @@
126134
- libraspberrypi0
127135
- libsqlite3-dev
128136
- libssl-dev
137+
- libssl-ocaml-dev
138+
- libstdc++6:armhf
129139
- libswscale5
130140
- libtiff6
131141
- libtool
132142
- libusb-1.0-0-dev
133143
- lsof
134144
- make
135-
- python3-yaml
136145
- python3-dbus
137146
- python3-flask
138147
- python3-flask-cors
139148
- python3-flaskext.wtf
140149
- python3-gast
141150
- python3-pil
151+
- python3-pip
142152
- python3-pycryptodome
143153
- python3-requests
144154
- python3-scapy
155+
- python3-setuptools
156+
- python3-smbus
145157
- python3-smbus2
146158
- python3-spidev
147159
- python3-tweepy
148160
- python3-werkzeug
149-
- firmware-atheros
150-
- firmware-brcm80211
151-
- firmware-libertas
152-
- firmware-misc-nonfree
153-
- firmware-realtek
154-
- python3-pip
155-
- python3-setuptools
156-
- python3-smbus
161+
- python3-yaml
157162
- qpdf
158163
- raspberrypi-kernel-headers
159164
- rsync
@@ -291,9 +296,21 @@
291296
path: /usr/local/src/hcxtools
292297

293298
# Install nexmon to fix wireless scanning (takes 2.5G of space)
299+
- name: symlink 1
300+
file:
301+
src: "/usr/lib/arm-linux-gnueabihf/libisl.so.23.2.0"
302+
dest: "/usr/lib/arm-linux-gnueabihf/libisl.so.10"
303+
state: link
304+
305+
- name: symlink 2
306+
file:
307+
src: "/usr/lib/arm-linux-gnueabihf/libmpfr.so.6.2.0"
308+
dest: "/usr/lib/arm-linux-gnueabihf/libmpfr.so.4"
309+
state: link
310+
294311
- name: clone nexmon repository
295312
git:
296-
repo: https://github.com/DrSchottky/nexmon.git
313+
repo: https://github.com/seemoo-lab/nexmon.git
297314
dest: /usr/local/src/nexmon
298315

299316
# FIRST WE BUILD DRIVER FOR RPi5
@@ -346,7 +363,7 @@
346363

347364
- name: clone nexmon repository
348365
git:
349-
repo: https://github.com/DrSchottky/nexmon.git
366+
repo: https://github.com/seemoo-lab/nexmon.git
350367
dest: /usr/local/src/nexmon
351368

352369
- name: make firmware, RPi4

pwnagotchi/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.8.0'
1+
__version__ = '2.8.1'

pwnagotchi/agent.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
2323
def __init__(self, view, config, keypair):
24-
Client.__init__(self, config['bettercap']['hostname'],
25-
config['bettercap']['scheme'],
26-
config['bettercap']['port'],
27-
config['bettercap']['username'],
28-
config['bettercap']['password'])
24+
Client.__init__(self,
25+
"127.0.0.1" if "hostname" not in config['bettercap'] else config['bettercap']['hostname'],
26+
"http" if "scheme" not in config['bettercap'] else config['bettercap']['scheme'],
27+
8081 if "port" not in config['bettercap'] else config['bettercap']['port'],
28+
"pwnagotchi" if "username" not in config['bettercap'] else config['bettercap']['username'],
29+
"pwnagotchi" if "password" not in config['bettercap'] else config['bettercap']['password'])
2930
Automata.__init__(self, config, view)
3031
AsyncAdvertiser.__init__(self, config, view, keypair)
3132
AsyncTrainer.__init__(self, config)
@@ -362,7 +363,8 @@ async def _on_event(self, msg):
362363
plugins.on('handshake', self, filename, ap_mac, sta_mac)
363364
else:
364365
(ap, sta) = ap_and_station
365-
self._last_pwnd = ap['hostname'] if ap['hostname'] != '' and ap['hostname'] != '<hidden>' else ap_mac
366+
self._last_pwnd = ap['hostname'] if ap['hostname'] != '' and ap[
367+
'hostname'] != '<hidden>' else ap_mac
366368
logging.warning(
367369
"!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!",
368370
ap['channel'], ap['rssi'], sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'])

pwnagotchi/defaults.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,6 @@ ui.display.enabled = false
198198
ui.display.rotation = 180
199199
ui.display.type = "waveshare_4"
200200

201-
bettercap.scheme = "http"
202-
bettercap.hostname = "localhost"
203-
bettercap.port = 8081
204-
bettercap.username = "pwnagotchi"
205-
bettercap.password = "pwnagotchi"
206201
bettercap.handshakes = "/root/handshakes"
207202
bettercap.silence = [
208203
"ble.device.new",

pwnagotchi/plugins/default/fix_services.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def on_ready(self, agent):
4646
last_lines = self.get_last_lines('journalctl', ['-n10', '-k'], 10)
4747
try:
4848
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
49-
logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
49+
logging.debug("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
5050
if ",UP," in str(cmd_output):
5151
logging.info("wlan0mon is up.")
5252

@@ -122,7 +122,7 @@ def on_epoch(self, agent, epoch, epoch_data):
122122

123123
# Look for pattern 1
124124
if len(self.pattern.findall(last_lines)) >= 3:
125-
logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
125+
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
126126
if hasattr(agent, 'view'):
127127
display = agent.view()
128128
display.set('status', 'Blind-Bug detected. Restarting.')
@@ -135,7 +135,7 @@ def on_epoch(self, agent, epoch, epoch_data):
135135

136136
# Look for pattern 2
137137
elif len(self.pattern2.findall(other_last_lines)) >= 5:
138-
logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
138+
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
139139
if hasattr(agent, 'view'):
140140
display = agent.view()
141141
display.set('status', 'Wifi channel stuck. Restarting recon.')
@@ -167,7 +167,7 @@ def on_epoch(self, agent, epoch, epoch_data):
167167
try:
168168
# Run the monstart command to restart wlan0mon
169169
cmd_output = subprocess.check_output("monstart", shell=True)
170-
logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
170+
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output))
171171
except Exception as err:
172172
logging.error("[Fix_Services monstart]: %s" % repr(err))
173173

@@ -181,7 +181,7 @@ def on_epoch(self, agent, epoch, epoch_data):
181181
try:
182182
# Run the monstart command to restart wlan0mon
183183
cmd_output = subprocess.check_output("monstart", shell=True)
184-
logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
184+
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output))
185185
except Exception as err:
186186
logging.error("[Fix_Services monstart]: %s" % repr(err))
187187

@@ -237,7 +237,7 @@ def _tryTurningItOffAndOnAgain(self, connection):
237237
# is it up?
238238
try:
239239
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
240-
logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
240+
logging.debug("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
241241
if ",UP," in str(cmd_output):
242242
logging.info("wlan0mon is up. Skip reset?")
243243
# not reliable, so don't skip just yet
@@ -309,11 +309,9 @@ def _tryTurningItOffAndOnAgain(self, connection):
309309
# stop looping and get back to recon
310310
break
311311
else:
312-
logging.info(
313-
"[Fix_Services set wifi.interfaceface wlan0mon] failed? %s" % repr(result))
312+
logging.debug("[Fix_Services set wifi.interfaceface wlan0mon] failed? %s" % repr(result))
314313
except Exception as err:
315-
logging.info(
316-
"[Fix_Services set wifi.interface wlan0mon] except: %s" % repr(err))
314+
logging.debug("[Fix_Services set wifi.interface wlan0mon] except: %s" % repr(err))
317315
except Exception as cerr: #
318316
if not display:
319317
print("failed loading wlan0mon attempt #%s: %s" % (tries, repr(cerr)))
@@ -362,7 +360,7 @@ def _tryTurningItOffAndOnAgain(self, connection):
362360
"face": faces.HAPPY})
363361
else:
364362
print("I can see again")
365-
logging.info("[Fix_Services] wifi.recon on")
363+
logging.debug("[Fix_Services] wifi.recon on")
366364
self.LASTTRY = time.time() + 120 # 2-minute pause until next time.
367365
else:
368366
logging.error("[Fix_Services] wifi.recon did not start up")
@@ -378,7 +376,7 @@ def on_unload(self, ui):
378376
try:
379377
logging.info("[Fix_Services] unloaded")
380378
except Exception as err:
381-
logging.info("[Fix_Services] unload err %s " % repr(err))
379+
logging.error("[Fix_Services] unload err %s " % repr(err))
382380
pass
383381

384382

0 commit comments

Comments
 (0)