mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
multiple edits
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
26
builder/data/etc/dphys-swapfile
Normal file
26
builder/data/etc/dphys-swapfile
Normal file
@ -0,0 +1,26 @@
|
||||
# /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 +1 @@
|
||||
__version__ = '2.4.2'
|
||||
__version__ = '2.4.3'
|
||||
|
@ -70,7 +70,8 @@ class Client(object):
|
||||
while True:
|
||||
logging.info("[bettercap] creating new websocket...")
|
||||
try:
|
||||
async with websockets.connect(s, ping_interval=ping_interval, ping_timeout=ping_timeout, max_queue=max_queue) as ws:
|
||||
async with websockets.connect(s, ping_interval=ping_interval, ping_timeout=ping_timeout,
|
||||
max_queue=max_queue) as ws:
|
||||
# listener loop
|
||||
while True:
|
||||
try:
|
||||
@ -78,7 +79,7 @@ class Client(object):
|
||||
try:
|
||||
await consumer(msg)
|
||||
except Exception as ex:
|
||||
logging.debug("error while parsing event (%s)", ex)
|
||||
logging.debug("error while parsing event (%s)", ex)
|
||||
except websockets.ConnectionClosedError:
|
||||
try:
|
||||
pong = await ws.ping()
|
||||
|
@ -17,8 +17,8 @@ LAST_SESSION_FILE = '/root/.pwnagotchi-last-session'
|
||||
|
||||
class LastSession(object):
|
||||
EPOCH_TOKEN = '[epoch '
|
||||
EPOCH_PARSER = re.compile(r'^.+\[epoch (\d+)\] (.+)')
|
||||
EPOCH_DATA_PARSER = re.compile(r'([a-z_]+)=([^\s]+)')
|
||||
EPOCH_PARSER = re.compile(r'^.+\[epoch (\d+)] (.+)')
|
||||
EPOCH_DATA_PARSER = re.compile(r'([a-z_]+)=(\S+)')
|
||||
TRAINING_TOKEN = ' training epoch '
|
||||
START_TOKEN = 'connecting to http'
|
||||
DEAUTH_TOKEN = 'deauthing '
|
||||
@ -46,7 +46,7 @@ class LastSession(object):
|
||||
self.max_reward = -1000
|
||||
self.avg_reward = 0
|
||||
self._peer_parser = re.compile(
|
||||
'detected unit (.+)@(.+) \(v.+\) on channel \d+ \(([\d\-]+) dBm\) \[sid:(.+) pwnd_tot:(\d+) uptime:(\d+)\]')
|
||||
'detected unit (.+)@(.+) \(v.+\) on channel \d+ \(([\d\-]+) dBm\) \[sid:(.+) pwnd_tot:(\d+) uptime:(\d+)]')
|
||||
self.parsed = False
|
||||
|
||||
def _get_last_saved_session_id(self):
|
||||
@ -197,7 +197,7 @@ class LastSession(object):
|
||||
lines.reverse()
|
||||
|
||||
if len(lines) == 0:
|
||||
lines.append("Initial Session");
|
||||
lines.append("Initial Session")
|
||||
|
||||
ui.on_reading_logs()
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import os
|
||||
import glob
|
||||
import _thread
|
||||
import threading
|
||||
import importlib, importlib.util
|
||||
import glob
|
||||
import importlib
|
||||
import importlib.util
|
||||
import logging
|
||||
|
||||
import os
|
||||
import threading
|
||||
|
||||
default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default")
|
||||
loaded = {}
|
||||
|
@ -473,7 +473,7 @@ class BTTether(plugins.Plugin):
|
||||
|
||||
devices_to_try = list()
|
||||
connected_priorities = list()
|
||||
any_device_connected = False # if this is true, last status on screen should be C
|
||||
any_device_connected = False # if this is true, last status on screen should be C
|
||||
|
||||
for _, device in self.devices.items():
|
||||
if device.connected():
|
||||
@ -579,7 +579,7 @@ class BTTether(plugins.Plugin):
|
||||
def on_ui_setup(self, ui):
|
||||
with ui._lock:
|
||||
ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-',
|
||||
position=(ui.width() / 2 - 10, 0),
|
||||
position=(ui.width() / 2 - 5, 0),
|
||||
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||
|
||||
def on_ui_update(self, ui):
|
||||
|
@ -3,14 +3,13 @@ import pwnagotchi.ui.components as components
|
||||
import pwnagotchi.ui.view as view
|
||||
import pwnagotchi.ui.fonts as fonts
|
||||
import pwnagotchi.plugins as plugins
|
||||
import pwnagotchi
|
||||
import subprocess
|
||||
import socket
|
||||
import os
|
||||
|
||||
|
||||
class InternetConnectionPlugin(plugins.Plugin):
|
||||
__author__ = 'adi1708, edited by jayofelony'
|
||||
__version__ = '1.1'
|
||||
__version__ = '1.2'
|
||||
__license__ = 'GPL3'
|
||||
__description__ = 'A plugin that displays the Internet connection status on the pwnagotchi display.'
|
||||
__name__ = 'InternetConnectionPlugin'
|
||||
@ -21,35 +20,44 @@ class InternetConnectionPlugin(plugins.Plugin):
|
||||
'pip': ['scapy']
|
||||
}
|
||||
__defaults__ = {
|
||||
'enabled': False,
|
||||
'enabled': True,
|
||||
}
|
||||
|
||||
def on_loaded(self):
|
||||
logging.info("[Internet-Connection] plugin loaded.")
|
||||
|
||||
def on_ui_setup(self, ui):
|
||||
if ui.is_waveshare35lcd():
|
||||
v_pos = (180, 61)
|
||||
with ui._lock:
|
||||
ui.add_element('connection_ip', components.LabeledValue(color=view.BLACK, label='eth0:', value='',
|
||||
position=v_pos, label_font=fonts.Bold,
|
||||
text_font=fonts.Small))
|
||||
with ui._lock:
|
||||
# add a LabeledValue element to the UI with the given label and value
|
||||
# the position and font can also be specified
|
||||
ui.add_element('connection_status', components.LabeledValue(color=view.BLACK, label='WWW', value='-',
|
||||
position=(ui.width() / 2 - 40, 0),
|
||||
position=(ui.width() / 2 - 35, 0),
|
||||
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||
|
||||
def on_ui_update(self, ui):
|
||||
if ui.is_wavehare35lcd():
|
||||
ip = os.popen('ifconfig eth0 | grep inet | awk \'{print $2}\'').read()
|
||||
ui.set('connection_ip', ip)
|
||||
# check if there is an active Internet connection
|
||||
try:
|
||||
# See if we can resolve the host name - tells us if there is
|
||||
# A DNS listening
|
||||
host = socket.gethostbyname("1.1.1.1")
|
||||
# Connect to the host - tells us if the host is actually reachable
|
||||
s = socket.create_connection((host, 80), 2)
|
||||
s.close()
|
||||
socket.create_connection(("1.1.1.1", 80), 2).close()
|
||||
ui.set('connection_status', 'C')
|
||||
except:
|
||||
except TimeoutError as err:
|
||||
# if the command failed, it means there is no active Internet connection
|
||||
# we could log the error, but no need really
|
||||
# logging.error('[Internet-Connection] Socket creation failed: %s' % err)
|
||||
ui.set('connection_status', 'D')
|
||||
|
||||
def on_unload(self, ui):
|
||||
with ui._lock:
|
||||
logging.info("[Internet-Connection] plugin unloaded")
|
||||
ui.remove_element('connection_status')
|
||||
if ui.is_waveshare35lcd():
|
||||
ui.remove_element('connection_ip')
|
||||
|
@ -58,8 +58,7 @@ class DottedTomlEncoder(TomlEncoder):
|
||||
if not retstr.endswith('\n\n'):
|
||||
retstr += '\n'
|
||||
else:
|
||||
retstr += (pre + qsection + " = " +
|
||||
str(self.dump_value(value)) + '\n')
|
||||
retstr += (pre + qsection + " = " + str(self.dump_value(value)) + '\n')
|
||||
return retstr, self._dict()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user