mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
5844e51cf8 | |||
5ca0bebea7 | |||
5824a6d77c | |||
bee02ab0cb | |||
211b60dcf6 | |||
7ce497e56e | |||
baf31f4523 |
@ -4,7 +4,7 @@
|
||||
|
||||
It seems the Pi 5 is unable to run in monitor mode, will keep you updated on this.
|
||||
|
||||
If you are using an older 32-bit version Raspberry Pi, ZeroWH, use this [fork](https://github.com/jayofelony/pwnagotchi-torch/releases/tag/v2.5.4) and make sure you download the `armhf` version.
|
||||
If you are using an older 32-bit version Raspberry Pi, ZeroWH, use this [fork](https://github.com/jayofelony/pwnagotchi-torch/releases/tag/v2.6.4) and make sure you download the `armhf` version.
|
||||
|
||||
---
|
||||
Download latest image file [here](https://github.com/jayofelony/pwnagotchi-bookworm/releases/tag/v2.6.2), and let it auto-update from here on out.
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '2.6.4'
|
||||
__version__ = '2.6.6'
|
||||
|
@ -31,6 +31,7 @@ import os
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -45,16 +46,48 @@ class RaspberryPi:
|
||||
|
||||
def __init__(self):
|
||||
import spidev
|
||||
import RPi.GPIO
|
||||
import gpiozero
|
||||
|
||||
self.GPIO = RPi.GPIO
|
||||
self.SPI = spidev.SpiDev()
|
||||
self.GPIO_RST_PIN = gpiozero.LED(self.RST_PIN)
|
||||
self.GPIO_DC_PIN = gpiozero.LED(self.DC_PIN)
|
||||
# self.GPIO_CS_PIN = gpiozero.LED(self.CS_PIN)
|
||||
self.GPIO_PWR_PIN = gpiozero.LED(self.PWR_PIN)
|
||||
self.GPIO_BUSY_PIN = gpiozero.Button(self.BUSY_PIN, pull_up=False)
|
||||
|
||||
def digital_write(self, pin, value):
|
||||
self.GPIO.output(pin, value)
|
||||
if pin == self.RST_PIN:
|
||||
if value:
|
||||
self.GPIO_RST_PIN.on()
|
||||
else:
|
||||
self.GPIO_RST_PIN.off()
|
||||
elif pin == self.DC_PIN:
|
||||
if value:
|
||||
self.GPIO_DC_PIN.on()
|
||||
else:
|
||||
self.GPIO_DC_PIN.off()
|
||||
# elif pin == self.CS_PIN:
|
||||
# if value:
|
||||
# self.GPIO_CS_PIN.on()
|
||||
# else:
|
||||
# self.GPIO_CS_PIN.off()
|
||||
elif pin == self.PWR_PIN:
|
||||
if value:
|
||||
self.GPIO_PWR_PIN.on()
|
||||
else:
|
||||
self.GPIO_PWR_PIN.off()
|
||||
|
||||
def digital_read(self, pin):
|
||||
return self.GPIO.input(pin)
|
||||
if pin == self.BUSY_PIN:
|
||||
return self.GPIO_BUSY_PIN.value
|
||||
elif pin == self.RST_PIN:
|
||||
return self.RST_PIN.value
|
||||
elif pin == self.DC_PIN:
|
||||
return self.DC_PIN.value
|
||||
# elif pin == self.CS_PIN:
|
||||
# return self.CS_PIN.value
|
||||
elif pin == self.PWR_PIN:
|
||||
return self.PWR_PIN.value
|
||||
|
||||
def delay_ms(self, delaytime):
|
||||
time.sleep(delaytime / 1000.0)
|
||||
@ -66,15 +99,7 @@ class RaspberryPi:
|
||||
self.SPI.writebytes2(data)
|
||||
|
||||
def module_init(self):
|
||||
self.GPIO.setmode(self.GPIO.BCM)
|
||||
self.GPIO.setwarnings(False)
|
||||
self.GPIO.setup(self.RST_PIN, self.GPIO.OUT)
|
||||
self.GPIO.setup(self.DC_PIN, self.GPIO.OUT)
|
||||
self.GPIO.setup(self.CS_PIN, self.GPIO.OUT)
|
||||
self.GPIO.setup(self.PWR_PIN, self.GPIO.OUT)
|
||||
self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN)
|
||||
|
||||
self.GPIO.output(self.PWR_PIN, 1)
|
||||
self.GPIO_PWR_PIN.on()
|
||||
|
||||
# SPI device, bus = 0, device = 0
|
||||
self.SPI.open(0, 0)
|
||||
@ -82,16 +107,21 @@ class RaspberryPi:
|
||||
self.SPI.mode = 0b00
|
||||
return 0
|
||||
|
||||
def module_exit(self):
|
||||
def module_exit(self, cleanup=False):
|
||||
logger.debug("spi end")
|
||||
self.SPI.close()
|
||||
|
||||
self.GPIO_RST_PIN.off()
|
||||
self.GPIO_DC_PIN.off()
|
||||
self.GPIO_PWR_PIN.off()
|
||||
logger.debug("close 5V, Module enters 0 power consumption ...")
|
||||
self.GPIO.output(self.RST_PIN, 0)
|
||||
self.GPIO.output(self.DC_PIN, 0)
|
||||
self.GPIO.output(self.PWR_PIN, 0)
|
||||
|
||||
self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN, self.PWR_PIN])
|
||||
if cleanup:
|
||||
self.GPIO_RST_PIN.close()
|
||||
self.GPIO_DC_PIN.close()
|
||||
# self.GPIO_CS_PIN.close()
|
||||
self.GPIO_PWR_PIN.close()
|
||||
self.GPIO_BUSY_PIN.close()
|
||||
|
||||
|
||||
class JetsonNano:
|
||||
@ -230,7 +260,15 @@ class SunriseX3:
|
||||
self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN], self.PWR_PIN)
|
||||
|
||||
|
||||
if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'):
|
||||
if sys.version_info[0] == 2:
|
||||
process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE)
|
||||
else:
|
||||
process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE, text=True)
|
||||
output, _ = process.communicate()
|
||||
if sys.version_info[0] == 2:
|
||||
output = output.decode(sys.stdout.encoding)
|
||||
|
||||
if "Raspberry" in output:
|
||||
implementation = RaspberryPi()
|
||||
elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'):
|
||||
implementation = SunriseX3()
|
||||
|
@ -10,7 +10,7 @@ import flask
|
||||
|
||||
# https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server
|
||||
logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
||||
os.environ['WERKZEUG_RUN_MAIN'] = 'true'
|
||||
os.environ['WERKZEUG_RUN_MAIN'] = 'false'
|
||||
|
||||
import pwnagotchi
|
||||
import pwnagotchi.grid as grid
|
||||
|
@ -5,7 +5,7 @@ import os
|
||||
|
||||
# https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server
|
||||
logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
||||
os.environ['WERKZEUG_RUN_MAIN'] = 'true'
|
||||
os.environ['WERKZEUG_RUN_MAIN'] = 'false'
|
||||
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
|
@ -27,8 +27,8 @@ dependencies = [
|
||||
"spidev",
|
||||
"stable_baselines3",
|
||||
"toml",
|
||||
"torch==2.0.1",
|
||||
"torchvision==0.15.2",
|
||||
"torch",
|
||||
"torchvision",
|
||||
"tweepy",
|
||||
"websockets"
|
||||
]
|
||||
|
@ -1,7 +1,6 @@
|
||||
OPi.GPIO; platform_release=="6.1.31-sun50iw9"
|
||||
Pillow
|
||||
PyYAML
|
||||
RPi.GPIO; platform_release!="6.1.31-sun50iw9"
|
||||
RPi.GPIO
|
||||
file-read-backwards
|
||||
flask
|
||||
flask-cors
|
||||
@ -13,13 +12,12 @@ pycryptodome
|
||||
pydrive2
|
||||
python-dateutil
|
||||
requests
|
||||
rpi_hardware_pwm; platform_release!="6.1.31-sun50iw9"
|
||||
rpi_hardware_pwm
|
||||
scapy
|
||||
shimmy; platform_machine!="armv6l"
|
||||
shimmy
|
||||
smbus2
|
||||
spidev
|
||||
stable_baselines3; platform_machine!="armv6l"
|
||||
stable_baselines3==1.8.0; platform_machine=="armv6l"
|
||||
stable_baselines3
|
||||
toml
|
||||
torch
|
||||
torchvision
|
||||
|
Reference in New Issue
Block a user