edit bettercap.py

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-09-24 00:28:55 +02:00
parent 3435e6ccec
commit bf4aec75f3
6 changed files with 61 additions and 20 deletions

View File

@ -39,12 +39,17 @@ start_monitor_interface() {
rfkill unblock all
ifconfig wlan0 up
iw dev wlan0 set power_save off
airmon-ng start wlan0
airmon-ng check kill
iw phy "$(iw phy | head -1 | cut -d" " -f2)" interface add wlan0mon type monitor && ifconfig wlan0mon up
# If wlan0 is NOT taken down after bringing up mon0, then when switching to AUTO you will get:
# error 400: error while initializing wlan0mon to channel 1: iw: out=command failed: Device or resource busy (-16) err=exit status 240
ifconfig wlan0 down
}
# stops mon0
stop_monitor_interface() {
airmon-ng stop wlan0mon
ifconfig wlan0mon down && iw dev wlan0mon del
ifconfig wlan0 up
}

View File

@ -15,17 +15,9 @@
"type": "shell",
"inline": [
"uname -a",
"dpkg-architecture",
"mkdir -p /usr/local/src/pwnagotchi"
"dpkg-architecture"
]
},
{
"type": "file",
"sources": [
"../dist/pwnagotchi-{{user `pwn_version`}}.tar.gz"
],
"destination": "/usr/local/src/pwnagotchi/"
},
{
"type": "file",
"source": "../builder/data/usr/bin/pwnlib",

View File

@ -347,10 +347,50 @@
path: /usr/local/share/pwnagotchi/custom-plugins/
state: directory
- name: Install pwnagotchi from source archive
- name: collect python pip package list
command: "pip3 list"
register: pip_output
- name: set python pip package facts
set_fact:
pip_packages: >
{{ pip_packages | default({}) | combine( { item.split()[0]: item.split()[1] } ) }}
with_items: "{{ pip_output.stdout_lines }}"
- name: acquire python3 pip target
command: "python3 -c 'import sys;print(sys.path.pop())'"
register: pip_target
- name: clone pwnagotchi repository
git:
repo: https://github.com/jayofelony/pwnagotchi.git
dest: /usr/local/src/pwnagotchi
register: pwnagotchigit
- name: create /usr/local/share/pwnagotchi/ folder
file:
path: /usr/local/share/pwnagotchi/
state: directory
- name: fetch pwnagotchi version
set_fact:
pwnagotchi_version: "{{ lookup('file', '/usr/local/src/pwnagotchi/pwnagotchi/_version.py') | regex_replace('.*__version__.*=.*''([0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]*)''.*', '\\1') }}"
- name: pwnagotchi version found
debug:
msg: "{{ pwnagotchi_version }}"
- name: build pwnagotchi wheel
command: "python3 setup.py sdist bdist_wheel"
args:
chdir: /usr/local/src/pwnagotchi
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi_version)
- name: install pwnagotchi wheel and dependencies
pip:
name: /usr/local/src/pwnagotchi/pwnagotchi-{{ pwnagotchi.version }}.tar.gz
extra_args: --verbose --prefer-binary --ignore-installed
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
extra_args: "--no-cache-dir"
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi_version)
# Install go-1.20.6
- name: Install go-1.21
@ -372,7 +412,7 @@
- name: download pwngrid
git:
repo: https://github.com/jayofelony/pwngrid.git
dest: /usr/local/src/
dest: /usr/local/src/pwngrid
register: pwngrid
- name: install pwngrid
@ -509,10 +549,10 @@
echo "- sudo pwnagotchi --check-update, to see if there is a new version available"
echo
echo "If you want to know if I'm running, you can use"
echo "systemctl status pwnagotchi"
echo "sudo systemctl status pwnagotchi"
echo
echo "You can restart me using"
echo "systemctl restart pwnagotchi"
echo "sudo systemctl restart pwnagotchi"
echo
echo "You learn more about me at https://pwnagotchi.ai/"
when: hostname.changed

View File

@ -60,7 +60,7 @@ def closest_peer():
return all[0] if len(all) else None
def update_data(last_session):
def update_data(last_session, plugin_data):
brain = {}
try:
with open('/root/brain.json') as fp:
@ -84,7 +84,8 @@ def update_data(last_session):
'uname': subprocess.getoutput("uname -a"),
'brain': brain,
'version': pwnagotchi.__version__,
'build': "Pwnagotchi-Torch by Jayofelony"
'build': "Pwnagotchi-Torch by Jayofelony",
'plugins': plugin_data
}
logging.debug("updating grid data: %s" % data)

View File

@ -5,6 +5,7 @@ import importlib.util
import logging
import os
import threading
import pwnagotchi.grid
default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default")
loaded = {}
@ -130,6 +131,8 @@ def load(config):
enabled = [name for name, options in config['main']['plugins'].items() if
'enabled' in options and options['enabled']]
pwnagotchi.grid.update_data(None, enabled)
# load default plugins
load_from_path(default_path, enabled=enabled)

View File

@ -129,7 +129,7 @@ class Grid(plugins.Plugin):
with self.lock:
try:
grid.update_data(agent.last_session)
grid.update_data(agent.last_session, None)
except Exception as e:
logging.error("error connecting to the pwngrid-peer service: %s" % e)
logging.debug(e, exc_info=True)