mirror of
https://github.com/infinition/Bjorn.git
synced 2026-02-01 18:21:04 +00:00
Merge pull request #52 from infinition/main
Sync the updates for the DEV branch in order to prepare a release on the main
This commit is contained in:
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -10,6 +10,6 @@
|
|||||||
#issuehunt: # Replace with a single IssueHunt username
|
#issuehunt: # Replace with a single IssueHunt username
|
||||||
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
#polar: # Replace with a single Polar username
|
#polar: # Replace with a single Polar username
|
||||||
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
buy_me_a_coffee: infinition
|
||||||
#thanks_dev: # Replace with a single thanks.dev username
|
#thanks_dev: # Replace with a single thanks.dev username
|
||||||
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ We are committed to fostering an open and welcoming environment for all contribu
|
|||||||
|
|
||||||
## 📢 Reporting Misconduct
|
## 📢 Reporting Misconduct
|
||||||
|
|
||||||
If you encounter any behavior that violates this code of conduct, please report it by contacting [email@dominio.com](mailto:email@dominio.com). All complaints will be reviewed and handled appropriately.
|
If you encounter any behavior that violates this code of conduct, please report it by contacting [bjorn-cyberviking@outlook.com](mailto:bjorn-cyberviking@outlook.com). All complaints will be reviewed and handled appropriately.
|
||||||
|
|
||||||
## ⚖️ Enforcement
|
## ⚖️ Enforcement
|
||||||
|
|
||||||
|
|||||||
23
INSTALL.md
23
INSTALL.md
@@ -14,9 +14,8 @@
|
|||||||
Use Raspberry Pi Imager to install your OS
|
Use Raspberry Pi Imager to install your OS
|
||||||
https://www.raspberrypi.com/software/
|
https://www.raspberrypi.com/software/
|
||||||
|
|
||||||
### 📌 Prerequisites
|
### 📌 Prerequisites for RPI zero W (32bits)
|
||||||
|

|
||||||

|
|
||||||
|
|
||||||
- Raspberry Pi OS installed.
|
- Raspberry Pi OS installed.
|
||||||
- Stable:
|
- Stable:
|
||||||
@@ -26,7 +25,23 @@ https://www.raspberrypi.com/software/
|
|||||||
- Username and hostname set to `bjorn`.
|
- Username and hostname set to `bjorn`.
|
||||||
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
||||||
|
|
||||||
At the moment the paper screen v2 & v4 have been tested and implemented.
|
### 📌 Prerequisites for RPI zero W2 (64bits)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
I did not develop Bjorn for the raspberry pi zero w2 64bits, but several feedbacks have attested that the installation worked perfectly.
|
||||||
|
|
||||||
|
- Raspberry Pi OS installed.
|
||||||
|
- Stable:
|
||||||
|
- System: 64-bit
|
||||||
|
- Kernel version: 6.6
|
||||||
|
- Debian version: 12 (bookworm) '2024-10-22-raspios-bookworm-arm64-lite'
|
||||||
|
- Username and hostname set to `bjorn`.
|
||||||
|
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
At the moment the paper screen v2 v4 have been tested and implemented.
|
||||||
I juste hope the V1 & V3 will work the same.
|
I juste hope the V1 & V3 will work the same.
|
||||||
|
|
||||||
### ⚡ Quick Install
|
### ⚡ Quick Install
|
||||||
|
|||||||
79
README.md
79
README.md
@@ -1,8 +1,11 @@
|
|||||||
# <img src="https://github.com/user-attachments/assets/c5eb4cc1-0c3d-497d-9422-1614651a84ab" alt="thumbnail_IMG_0546" width="33"> Bjorn
|
# <img src="https://github.com/user-attachments/assets/c5eb4cc1-0c3d-497d-9422-1614651a84ab" alt="thumbnail_IMG_0546" width="33"> Bjorn
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
[](https://www.reddit.com/r/Bjorn_CyberViking)
|
[](https://www.reddit.com/r/Bjorn_CyberViking)
|
||||||
[](https://discord.com/invite/B3ZH9taVfT)
|
[](https://discord.com/invite/B3ZH9taVfT)
|
||||||
[](https://opensource.org/licenses/MIT)
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://github.com/user-attachments/assets/c5eb4cc1-0c3d-497d-9422-1614651a84ab" alt="thumbnail_IMG_0546" width="150">
|
<img src="https://github.com/user-attachments/assets/c5eb4cc1-0c3d-497d-9422-1614651a84ab" alt="thumbnail_IMG_0546" width="150">
|
||||||
@@ -18,7 +21,7 @@ Bjorn is a « Tamagotchi like » sophisticated, autonomous network scanning,
|
|||||||
- [Features](#-features)
|
- [Features](#-features)
|
||||||
- [Getting Started](#-getting-started)
|
- [Getting Started](#-getting-started)
|
||||||
- [Prerequisites](#-prerequisites)
|
- [Prerequisites](#-prerequisites)
|
||||||
- [Installation](#-Installation)
|
- [Installation](#-installation)
|
||||||
- [Quick Start](#-quick-start)
|
- [Quick Start](#-quick-start)
|
||||||
- [Usage Example](#-usage-example)
|
- [Usage Example](#-usage-example)
|
||||||
- [Contributing](#-contributing)
|
- [Contributing](#-contributing)
|
||||||
@@ -43,9 +46,11 @@ The e-Paper HAT display and web interface make it easy to monitor and interact w
|
|||||||
|
|
||||||
## 🚀 Getting Started
|
## 🚀 Getting Started
|
||||||
|
|
||||||
### 📌 Prerequisites
|
## 📌 Prerequisites
|
||||||
|
|
||||||

|
### 📋 Prerequisites for RPI zero W (32bits)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
- Raspberry Pi OS installed.
|
- Raspberry Pi OS installed.
|
||||||
- Stable:
|
- Stable:
|
||||||
@@ -55,7 +60,22 @@ The e-Paper HAT display and web interface make it easy to monitor and interact w
|
|||||||
- Username and hostname set to `bjorn`.
|
- Username and hostname set to `bjorn`.
|
||||||
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
||||||
|
|
||||||
At the moment the paper screen v2 & v4 have been tested and implemented.
|
### 📋 Prerequisites for RPI zero W2 (64bits)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
I did not develop Bjorn for the raspberry pi zero w2 64bits, but several feedbacks have attested that the installation worked perfectly.
|
||||||
|
|
||||||
|
- Raspberry Pi OS installed.
|
||||||
|
- Stable:
|
||||||
|
- System: 64-bit
|
||||||
|
- Kernel version: 6.6
|
||||||
|
- Debian version: 12 (bookworm) '2024-10-22-raspios-bookworm-arm64-lite'
|
||||||
|
- Username and hostname set to `bjorn`.
|
||||||
|
- 2.13-inch e-Paper HAT connected to GPIO pins.
|
||||||
|
|
||||||
|
|
||||||
|
At the moment the paper screen v2 v4 have been tested and implemented.
|
||||||
I juste hope the V1 & V3 will work the same.
|
I juste hope the V1 & V3 will work the same.
|
||||||
|
|
||||||
### 🔨 Installation
|
### 🔨 Installation
|
||||||
@@ -69,25 +89,60 @@ sudo chmod +x install_bjorn.sh && sudo ./install_bjorn.sh
|
|||||||
# Choose the choice 1 for automatic installation. It may take a while as a lot of packages and modules will be installed. You must reboot at the end.
|
# Choose the choice 1 for automatic installation. It may take a while as a lot of packages and modules will be installed. You must reboot at the end.
|
||||||
```
|
```
|
||||||
|
|
||||||
For **detailed information** about installation process go to [Install Guide](INSTALL.md)
|
For **detailed information** about **installation** process go to [Install Guide](INSTALL.md)
|
||||||
|
|
||||||
## ⚡ Quick Start
|
## ⚡ Quick Start
|
||||||
|
|
||||||
**Need help ? You struggle to find Bjorn's IP after the installation ?**
|
**Need help ? You struggle to find Bjorn's IP after the installation ?**
|
||||||
Use my Bjorn Detector & SSH Launcher :
|
Use my Bjorn Detector & SSH Launcher :
|
||||||
|
|
||||||
https://github.com/infinition/Bjorn_Detector
|
[https://github.com/infinition/bjorn-detector](https://github.com/infinition/bjorn-detector)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
**Hmm, You still need help ?**
|
**Hmm, You still need help ?**
|
||||||
For **detailed information** about **troubleshooting** go to [Troubleshooting](TROUBLESHOOTING.md)
|
For **detailed information** about **troubleshooting** go to [Troubleshooting](TROUBLESHOOTING.md)
|
||||||
|
|
||||||
**Quick Installation**: you can use the fastest way to install Bjorn [Getting Started](#-getting-started)
|
**Quick Installation**: you can use the fastest way to install **Bjorn** [Getting Started](#-getting-started)
|
||||||
|
|
||||||
## 💡 Usage Example
|
## 💡 Usage Example
|
||||||
|
|
||||||
...
|
Here's a demonstration of how Bjorn autonomously hunts through your network like a Viking raider (fake demo for illustration):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Reconnaissance Phase
|
||||||
|
[NetworkScanner] Discovering alive hosts...
|
||||||
|
[+] Host found: 192.168.1.100
|
||||||
|
├── Ports: 22,80,445,3306
|
||||||
|
└── MAC: 00:11:22:33:44:55
|
||||||
|
|
||||||
|
# Attack Sequence
|
||||||
|
[NmapVulnScanner] Found vulnerabilities on 192.168.1.100
|
||||||
|
├── MySQL 5.5 < 5.7 - User Enumeration
|
||||||
|
└── SMB - EternalBlue Candidate
|
||||||
|
|
||||||
|
[SSHBruteforce] Cracking credentials...
|
||||||
|
[+] Success! user:password123
|
||||||
|
[StealFilesSSH] Extracting sensitive data...
|
||||||
|
|
||||||
|
# Automated Data Exfiltration
|
||||||
|
[SQLBruteforce] Database accessed!
|
||||||
|
[StealDataSQL] Dumping tables...
|
||||||
|
[SMBBruteforce] Share accessible
|
||||||
|
[+] Found config files, credentials, backups...
|
||||||
|
```
|
||||||
|
|
||||||
|
This is just a demo output - actual results will vary based on your network and target configuration.
|
||||||
|
|
||||||
|
All discovered data is automatically organized in the data/output/ directory, viewable through both the e-Paper display (as indicators) and web interface.
|
||||||
|
Bjorn works tirelessly, expanding its network knowledge base and growing stronger with each discovery.
|
||||||
|
|
||||||
|
No constant monitoring needed - just deploy and let Bjorn do what it does best: hunt for vulnerabilities.
|
||||||
|
|
||||||
|
🔧 Expand Bjorn's Arsenal!
|
||||||
|
Bjorn is designed to be a community-driven weapon forge. Create and share your own attack modules!
|
||||||
|
|
||||||
|
⚠️ **For educational and authorized testing purposes only** ⚠️
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
@@ -98,7 +153,7 @@ The project welcomes contributions in:
|
|||||||
- Documentation.
|
- Documentation.
|
||||||
- Feature improvements.
|
- Feature improvements.
|
||||||
|
|
||||||
For **detailed information** about contributing process go to [Contributing Docs](CONTRIBUTING.md), [Code Of Conduct](CODE_OF_CONDUCT.md) and [Development Guide](DEVELOPMENT.md).
|
For **detailed information** about **contributing** process go to [Contributing Docs](CONTRIBUTING.md), [Code Of Conduct](CODE_OF_CONDUCT.md) and [Development Guide](DEVELOPMENT.md).
|
||||||
|
|
||||||
## 📫 Contact
|
## 📫 Contact
|
||||||
|
|
||||||
@@ -111,6 +166,10 @@ For **detailed information** about contributing process go to [Contributing Docs
|
|||||||
- **Author**: __infinition__
|
- **Author**: __infinition__
|
||||||
- **GitHub**: [infinition/Bjorn](https://github.com/infinition/Bjorn)
|
- **GitHub**: [infinition/Bjorn](https://github.com/infinition/Bjorn)
|
||||||
|
|
||||||
|
## 🌠 Stargazers
|
||||||
|
|
||||||
|
[](https://star-history.com/#infinition/bjorn&Date)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📜 License
|
## 📜 License
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ If you discover a security vulnerability within this project, please follow thes
|
|||||||
|
|
||||||
1. **Do not create a public issue.** Instead, contact us directly to responsibly disclose the vulnerability.
|
1. **Do not create a public issue.** Instead, contact us directly to responsibly disclose the vulnerability.
|
||||||
|
|
||||||
2. **Email** [email@dominio.com](mailto:email@dominio.com) with the following information:
|
2. **Email** [bjorn-cyberviking@outlook.com](mailto:bjorn-cyberviking@outlook.com) with the following information:
|
||||||
|
|
||||||
- A description of the vulnerability.
|
- A description of the vulnerability.
|
||||||
- Steps to reproduce the issue.
|
- Steps to reproduce the issue.
|
||||||
|
|||||||
@@ -25,12 +25,20 @@
|
|||||||
### Service Issues
|
### Service Issues
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
#See bjorn journalctl service
|
||||||
|
journalctl -fu bjorn.service
|
||||||
|
|
||||||
# Check service status
|
# Check service status
|
||||||
sudo systemctl status bjorn.service
|
sudo systemctl status bjorn.service
|
||||||
|
|
||||||
# View detailed logs
|
# View detailed logs
|
||||||
sudo journalctl -u bjorn.service -f
|
sudo journalctl -u bjorn.service -f
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
sudo tail -f /home/bjorn/Bjorn/data/logs/*
|
||||||
|
|
||||||
|
|
||||||
# Check port 8000 usage
|
# Check port 8000 usage
|
||||||
sudo lsof -i :8000
|
sudo lsof -i :8000
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -112,9 +112,9 @@ check_system_compatibility() {
|
|||||||
|
|
||||||
# Check RAM (Raspberry Pi Zero has 512MB RAM)
|
# Check RAM (Raspberry Pi Zero has 512MB RAM)
|
||||||
total_ram=$(free -m | awk '/^Mem:/{print $2}')
|
total_ram=$(free -m | awk '/^Mem:/{print $2}')
|
||||||
if [ "$total_ram" -lt 429 ]; then
|
if [ "$total_ram" -lt 410 ]; then
|
||||||
log "WARNING" "Low RAM detected. Required: 512MB, Found: ${total_ram}MB"
|
log "WARNING" "Low RAM detected. Required: 512MB (410 With OS Running), Found: ${total_ram}MB"
|
||||||
echo -e "${YELLOW}Your system has less RAM than recommended. This might affect performance.${NC}"
|
echo -e "${YELLOW}Your system has less RAM than recommended. This might affect performance, but you can continue.${NC}"
|
||||||
should_ask_confirmation=true
|
should_ask_confirmation=true
|
||||||
else
|
else
|
||||||
log "SUCCESS" "RAM check passed: ${total_ram}MB available"
|
log "SUCCESS" "RAM check passed: ${total_ram}MB available"
|
||||||
@@ -122,7 +122,7 @@ check_system_compatibility() {
|
|||||||
|
|
||||||
# Check available disk space
|
# Check available disk space
|
||||||
available_space=$(df -m /home | awk 'NR==2 {print $4}')
|
available_space=$(df -m /home | awk 'NR==2 {print $4}')
|
||||||
if [ "$available_space" -lt 1024 ]; then
|
if [ "$available_space" -lt 2048 ]; then
|
||||||
log "WARNING" "Low disk space. Recommended: 1GB, Found: ${available_space}MB"
|
log "WARNING" "Low disk space. Recommended: 1GB, Found: ${available_space}MB"
|
||||||
echo -e "${YELLOW}Your system has less free space than recommended. This might affect installation.${NC}"
|
echo -e "${YELLOW}Your system has less free space than recommended. This might affect installation.${NC}"
|
||||||
should_ask_confirmation=true
|
should_ask_confirmation=true
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.is_initialized = False # New flag to track if the display has been initialized #INFINITION
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
self.dc_pin = epdconfig.DC_PIN
|
self.dc_pin = epdconfig.DC_PIN
|
||||||
self.busy_pin = epdconfig.BUSY_PIN
|
self.busy_pin = epdconfig.BUSY_PIN
|
||||||
@@ -66,10 +67,10 @@ class EPD:
|
|||||||
logger.debug("e-Paper busy release")
|
logger.debug("e-Paper busy release")
|
||||||
|
|
||||||
def init(self, lut):
|
def init(self, lut):
|
||||||
if (epdconfig.module_init() != 0):
|
if not self.is_initialized: # Avoid repeated initialization and accumulation of File descriptors #INFINITION
|
||||||
return -1
|
if epdconfig.module_init() != 0:
|
||||||
# EPD hardware init start
|
return -1
|
||||||
self.reset()
|
self.reset()
|
||||||
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
||||||
self.send_data((EPD_HEIGHT - 1) & 0xFF)
|
self.send_data((EPD_HEIGHT - 1) & 0xFF)
|
||||||
self.send_data(((EPD_HEIGHT - 1) >> 8) & 0xFF)
|
self.send_data(((EPD_HEIGHT - 1) >> 8) & 0xFF)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.is_initialized = False # New flag to track if the display has been initialized #INFINITION
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
self.dc_pin = epdconfig.DC_PIN
|
self.dc_pin = epdconfig.DC_PIN
|
||||||
self.busy_pin = epdconfig.BUSY_PIN
|
self.busy_pin = epdconfig.BUSY_PIN
|
||||||
@@ -99,10 +100,12 @@ class EPD:
|
|||||||
self.ReadBusy()
|
self.ReadBusy()
|
||||||
|
|
||||||
def init(self, update):
|
def init(self, update):
|
||||||
if (epdconfig.module_init() != 0):
|
if not self.is_initialized: # Avoid repeated initialization and accumulation of File descriptors #INFINITION
|
||||||
return -1
|
if epdconfig.module_init() != 0:
|
||||||
# EPD hardware init start
|
return -1
|
||||||
self.reset()
|
self.reset()
|
||||||
|
self.is_initialized = True
|
||||||
|
|
||||||
if(update == self.FULL_UPDATE):
|
if(update == self.FULL_UPDATE):
|
||||||
self.ReadBusy()
|
self.ReadBusy()
|
||||||
self.send_command(0x12) # soft reset
|
self.send_command(0x12) # soft reset
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.is_initialized = False # New flag to track if the display has been initialized #INFINITION
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
self.dc_pin = epdconfig.DC_PIN
|
self.dc_pin = epdconfig.DC_PIN
|
||||||
self.busy_pin = epdconfig.BUSY_PIN
|
self.busy_pin = epdconfig.BUSY_PIN
|
||||||
@@ -200,42 +201,54 @@ class EPD:
|
|||||||
parameter:
|
parameter:
|
||||||
'''
|
'''
|
||||||
def init(self, update=None):
|
def init(self, update=None):
|
||||||
|
# Prevent reinitialization if already initialized #INFINITION
|
||||||
|
if self.is_initialized:
|
||||||
|
logger.debug("EPD is already initialized. Skipping redundant init.")
|
||||||
|
return 0
|
||||||
|
|
||||||
if update is None:
|
if update is None:
|
||||||
update = self.FULL_UPDATE
|
update = self.FULL_UPDATE
|
||||||
|
|
||||||
|
# Initialize the module
|
||||||
if epdconfig.module_init() != 0:
|
if epdconfig.module_init() != 0:
|
||||||
|
logger.error("Failed to initialize module")
|
||||||
return -1
|
return -1
|
||||||
# EPD hardware init start
|
|
||||||
self.reset()
|
|
||||||
|
|
||||||
self.ReadBusy()
|
|
||||||
self.send_command(0x12) #SWRESET
|
|
||||||
self.ReadBusy()
|
|
||||||
|
|
||||||
self.send_command(0x01) #Driver output control
|
# EPD hardware initialization start
|
||||||
|
self.reset()
|
||||||
|
|
||||||
|
self.ReadBusy()
|
||||||
|
self.send_command(0x12) # SWRESET
|
||||||
|
self.ReadBusy()
|
||||||
|
|
||||||
|
self.send_command(0x01) # Driver output control
|
||||||
self.send_data(0xf9)
|
self.send_data(0xf9)
|
||||||
self.send_data(0x00)
|
self.send_data(0x00)
|
||||||
self.send_data(0x00)
|
self.send_data(0x00)
|
||||||
|
|
||||||
self.send_command(0x11) #data entry mode
|
self.send_command(0x11) # Data entry mode
|
||||||
self.send_data(0x03)
|
self.send_data(0x03)
|
||||||
|
|
||||||
self.SetWindow(0, 0, self.width-1, self.height-1)
|
self.SetWindow(0, 0, self.width - 1, self.height - 1)
|
||||||
self.SetCursor(0, 0)
|
self.SetCursor(0, 0)
|
||||||
|
|
||||||
self.send_command(0x3c)
|
self.send_command(0x3c)
|
||||||
self.send_data(0x05)
|
self.send_data(0x05)
|
||||||
|
|
||||||
self.send_command(0x21) # Display update control
|
self.send_command(0x21) # Display update control
|
||||||
self.send_data(0x00)
|
self.send_data(0x00)
|
||||||
self.send_data(0x80)
|
self.send_data(0x80)
|
||||||
|
|
||||||
self.send_command(0x18)
|
self.send_command(0x18)
|
||||||
self.send_data(0x80)
|
self.send_data(0x80)
|
||||||
|
|
||||||
self.ReadBusy()
|
self.ReadBusy()
|
||||||
|
|
||||||
self.SetLut(self.lut_full_update)
|
self.SetLut(self.lut_full_update)
|
||||||
|
|
||||||
|
# Mark the EPD as initialized #INFINITION
|
||||||
|
self.is_initialized = True
|
||||||
|
logger.info("EPD initialized successfully")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.is_initialized = False # New flag to track if the display has been initialized #INFINITION
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
self.dc_pin = epdconfig.DC_PIN
|
self.dc_pin = epdconfig.DC_PIN
|
||||||
self.busy_pin = epdconfig.BUSY_PIN
|
self.busy_pin = epdconfig.BUSY_PIN
|
||||||
@@ -138,11 +139,11 @@ class EPD:
|
|||||||
parameter:
|
parameter:
|
||||||
'''
|
'''
|
||||||
def init(self):
|
def init(self):
|
||||||
if (epdconfig.module_init() != 0):
|
if not self.is_initialized: # Avoid repeated initialization and accumulation of File descriptors #INFINITION
|
||||||
return -1
|
if epdconfig.module_init() != 0:
|
||||||
# EPD hardware init start
|
return -1
|
||||||
self.reset()
|
self.reset()
|
||||||
|
self.is_initialized = True
|
||||||
self.ReadBusy()
|
self.ReadBusy()
|
||||||
self.send_command(0x12) #SWRESET
|
self.send_command(0x12) #SWRESET
|
||||||
self.ReadBusy()
|
self.ReadBusy()
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.is_initialized = False # New flag to track if the display has been initialized #INFINITION
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
self.dc_pin = epdconfig.DC_PIN
|
self.dc_pin = epdconfig.DC_PIN
|
||||||
self.busy_pin = epdconfig.BUSY_PIN
|
self.busy_pin = epdconfig.BUSY_PIN
|
||||||
@@ -222,11 +223,10 @@ class EPD:
|
|||||||
self.send_data(self.gray_lut_ww[count])
|
self.send_data(self.gray_lut_ww[count])
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if (epdconfig.module_init() != 0):
|
if not self.is_initialized: # Avoid repeated initialization and accumulation of File descriptors #INFINITION
|
||||||
return -1
|
if epdconfig.module_init() != 0:
|
||||||
|
return -1
|
||||||
# EPD hardware init start
|
self.reset()
|
||||||
self.reset()
|
|
||||||
|
|
||||||
self.send_command(0x01) # POWER_SETTING
|
self.send_command(0x01) # POWER_SETTING
|
||||||
self.send_data(0x03) # VDS_EN, VDG_EN
|
self.send_data(0x03) # VDS_EN, VDG_EN
|
||||||
|
|||||||
4
utils.py
4
utils.py
@@ -728,6 +728,10 @@ method=auto
|
|||||||
elif isinstance(value, (int, float)):
|
elif isinstance(value, (int, float)):
|
||||||
current_config[key] = value
|
current_config[key] = value
|
||||||
elif isinstance(value, list):
|
elif isinstance(value, list):
|
||||||
|
# Lets boot any values in a list that are just empty strings
|
||||||
|
for val in value[:]:
|
||||||
|
if val == "" :
|
||||||
|
value.remove(val)
|
||||||
current_config[key] = value
|
current_config[key] = value
|
||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
if value.replace('.', '', 1).isdigit():
|
if value.replace('.', '', 1).isdigit():
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ html {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar a:hover, .toolbar button:hover, .toolbar-button:hover, .action-button:hover {
|
.toolbar a:hover, .toolbar button:hover, .toolbar-button:hover, .toolbar-button:hover button.toolbar-button, .action-button:hover {
|
||||||
background-color: #e99f00;
|
background-color: #e99f00;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
@@ -514,6 +514,7 @@ td:first-child, th:first-child {
|
|||||||
background-color: #333;
|
background-color: #333;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-content button:hover {
|
.dropdown-content button:hover {
|
||||||
|
|||||||
@@ -68,12 +68,21 @@ function generateConfigForm(config) {
|
|||||||
|
|
||||||
const formData = new FormData(formElement);
|
const formData = new FormData(formElement);
|
||||||
const formDataObj = {};
|
const formDataObj = {};
|
||||||
|
// Each of these fields contains an array of data. Lets track these so we can ensure the format remains an array for the underlying structure.
|
||||||
|
const arrayFields = [
|
||||||
|
"portlist",
|
||||||
|
"mac_scan_blacklist",
|
||||||
|
"ip_scan_blacklist",
|
||||||
|
"steal_file_names",
|
||||||
|
"steal_file_extensions",
|
||||||
|
];
|
||||||
|
|
||||||
formData.forEach((value, key) => {
|
formData.forEach((value, key) => {
|
||||||
if (value.includes(',')) {
|
// Check if the input from the user contains a `,` character or is a known array field
|
||||||
|
if (value.includes(',') || arrayFields.includes(key)) {
|
||||||
formDataObj[key] = value.split(',').map(item => {
|
formDataObj[key] = value.split(',').map(item => {
|
||||||
const trimmedItem = item.trim();
|
const trimmedItem = item.trim();
|
||||||
return isNaN(trimmedItem) ? trimmedItem : parseFloat(trimmedItem);
|
return isNaN(trimmedItem) || trimmedItem == "" ? trimmedItem : parseFloat(trimmedItem);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
formDataObj[key] = value === 'on' ? true : (isNaN(value) ? value : parseFloat(value));
|
formDataObj[key] = value === 'on' ? true : (isNaN(value) ? value : parseFloat(value));
|
||||||
|
|||||||
Reference in New Issue
Block a user