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:
|
while True:
|
||||||
logging.info("[bettercap] creating new websocket...")
|
logging.info("[bettercap] creating new websocket...")
|
||||||
try:
|
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
|
# listener loop
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -17,8 +17,8 @@ LAST_SESSION_FILE = '/root/.pwnagotchi-last-session'
|
|||||||
|
|
||||||
class LastSession(object):
|
class LastSession(object):
|
||||||
EPOCH_TOKEN = '[epoch '
|
EPOCH_TOKEN = '[epoch '
|
||||||
EPOCH_PARSER = re.compile(r'^.+\[epoch (\d+)\] (.+)')
|
EPOCH_PARSER = re.compile(r'^.+\[epoch (\d+)] (.+)')
|
||||||
EPOCH_DATA_PARSER = re.compile(r'([a-z_]+)=([^\s]+)')
|
EPOCH_DATA_PARSER = re.compile(r'([a-z_]+)=(\S+)')
|
||||||
TRAINING_TOKEN = ' training epoch '
|
TRAINING_TOKEN = ' training epoch '
|
||||||
START_TOKEN = 'connecting to http'
|
START_TOKEN = 'connecting to http'
|
||||||
DEAUTH_TOKEN = 'deauthing '
|
DEAUTH_TOKEN = 'deauthing '
|
||||||
@ -46,7 +46,7 @@ class LastSession(object):
|
|||||||
self.max_reward = -1000
|
self.max_reward = -1000
|
||||||
self.avg_reward = 0
|
self.avg_reward = 0
|
||||||
self._peer_parser = re.compile(
|
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
|
self.parsed = False
|
||||||
|
|
||||||
def _get_last_saved_session_id(self):
|
def _get_last_saved_session_id(self):
|
||||||
@ -197,7 +197,7 @@ class LastSession(object):
|
|||||||
lines.reverse()
|
lines.reverse()
|
||||||
|
|
||||||
if len(lines) == 0:
|
if len(lines) == 0:
|
||||||
lines.append("Initial Session");
|
lines.append("Initial Session")
|
||||||
|
|
||||||
ui.on_reading_logs()
|
ui.on_reading_logs()
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import os
|
|
||||||
import glob
|
|
||||||
import _thread
|
import _thread
|
||||||
import threading
|
import glob
|
||||||
import importlib, importlib.util
|
import importlib
|
||||||
|
import importlib.util
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import threading
|
||||||
|
|
||||||
default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default")
|
default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default")
|
||||||
loaded = {}
|
loaded = {}
|
||||||
|
@ -579,7 +579,7 @@ class BTTether(plugins.Plugin):
|
|||||||
def on_ui_setup(self, ui):
|
def on_ui_setup(self, ui):
|
||||||
with ui._lock:
|
with ui._lock:
|
||||||
ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-',
|
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))
|
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||||
|
|
||||||
def on_ui_update(self, ui):
|
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.view as view
|
||||||
import pwnagotchi.ui.fonts as fonts
|
import pwnagotchi.ui.fonts as fonts
|
||||||
import pwnagotchi.plugins as plugins
|
import pwnagotchi.plugins as plugins
|
||||||
import pwnagotchi
|
|
||||||
import subprocess
|
|
||||||
import socket
|
import socket
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class InternetConnectionPlugin(plugins.Plugin):
|
class InternetConnectionPlugin(plugins.Plugin):
|
||||||
__author__ = 'adi1708, edited by jayofelony'
|
__author__ = 'adi1708, edited by jayofelony'
|
||||||
__version__ = '1.1'
|
__version__ = '1.2'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'A plugin that displays the Internet connection status on the pwnagotchi display.'
|
__description__ = 'A plugin that displays the Internet connection status on the pwnagotchi display.'
|
||||||
__name__ = 'InternetConnectionPlugin'
|
__name__ = 'InternetConnectionPlugin'
|
||||||
@ -21,35 +20,44 @@ class InternetConnectionPlugin(plugins.Plugin):
|
|||||||
'pip': ['scapy']
|
'pip': ['scapy']
|
||||||
}
|
}
|
||||||
__defaults__ = {
|
__defaults__ = {
|
||||||
'enabled': False,
|
'enabled': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
logging.info("[Internet-Connection] plugin loaded.")
|
logging.info("[Internet-Connection] plugin loaded.")
|
||||||
|
|
||||||
def on_ui_setup(self, ui):
|
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:
|
with ui._lock:
|
||||||
# add a LabeledValue element to the UI with the given label and value
|
# add a LabeledValue element to the UI with the given label and value
|
||||||
# the position and font can also be specified
|
# the position and font can also be specified
|
||||||
ui.add_element('connection_status', components.LabeledValue(color=view.BLACK, label='WWW', value='-',
|
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))
|
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||||
|
|
||||||
def on_ui_update(self, ui):
|
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
|
# check if there is an active Internet connection
|
||||||
try:
|
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
|
# Connect to the host - tells us if the host is actually reachable
|
||||||
s = socket.create_connection((host, 80), 2)
|
socket.create_connection(("1.1.1.1", 80), 2).close()
|
||||||
s.close()
|
|
||||||
ui.set('connection_status', 'C')
|
ui.set('connection_status', 'C')
|
||||||
except:
|
except TimeoutError as err:
|
||||||
# if the command failed, it means there is no active Internet connection
|
# 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')
|
ui.set('connection_status', 'D')
|
||||||
|
|
||||||
def on_unload(self, ui):
|
def on_unload(self, ui):
|
||||||
with ui._lock:
|
with ui._lock:
|
||||||
logging.info("[Internet-Connection] plugin unloaded")
|
logging.info("[Internet-Connection] plugin unloaded")
|
||||||
ui.remove_element('connection_status')
|
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'):
|
if not retstr.endswith('\n\n'):
|
||||||
retstr += '\n'
|
retstr += '\n'
|
||||||
else:
|
else:
|
||||||
retstr += (pre + qsection + " = " +
|
retstr += (pre + qsection + " = " + str(self.dump_value(value)) + '\n')
|
||||||
str(self.dump_value(value)) + '\n')
|
|
||||||
return retstr, self._dict()
|
return retstr, self._dict()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user