Skip to content

Commit 3260987

Browse files
committed
V1.0 released! Bjorn fixed (and renders on screen), kismet working, green LED turns on when booted, bhtui integrated.
1 parent d69436d commit 3260987

15 files changed

Lines changed: 533 additions & 3 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
[submodule "armbian"]
1010
path = armbian
1111
url = https://github.com/armbian/build
12+
[submodule "package/bhtui/third-party/TermOx"]
13+
path = package/bhtui/third-party/TermOx
14+
url = https://github.com/a-n-t-h-o-n-y/TermOx

armbian_config/userpatches/customize-image.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ echo "extraargs=net.ifnames=0 biosdevname=0" >> /boot/armbianEnv.txt
7777
pip install smbprotocol --break-system-packages
7878
pip install pysmb --break-system-packages
7979

80+
cd /root/bhtui
81+
sudo make install
82+
8083
echo "Customization complete."

build_armbian.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ mkdir -p "$armbian_rootfs"/root/bjorn
4949
cp -r package/bjorn/bjorn/* "$armbian_rootfs"/root/bjorn/
5050
install -D -m 0644 package/blackhat/src/blackhat.conf "$armbian_rootfs"/boot/bh/blackhat.conf
5151

52+
# Copy build files over for bhtui
53+
cp -r package/bhtui "$armbian_rootfs"/root/
54+
5255
mkdir -p armbian/userpatches/overlay/boot/bh/scripts
5356
cp -a package/blackhat/scripts/. "$armbian_rootfs"/boot/bh/scripts/
5457

@@ -89,6 +92,11 @@ echo python3-requests >> $PKG_CONF
8992
echo hostapd >> $PKG_CONF
9093
echo dnsmasq >> $PKG_CONF
9194
echo nftables >> $PKG_CONF
95+
echo chocolate-doom >> $PKG_CONF
96+
echo doom-wad-shareware >> $PKG_CONF
97+
echo cmake >> $PKG_CONF
98+
echo libicu-dev >> $PKG_CONF
99+
echo libicu-dev >> $PKG_CONF
92100

93101
# Bjorn requirements
94102
echo python3-pandas >> $PKG_CONF
@@ -108,10 +116,12 @@ echo python3-legacy-cgi >> $PKG_CONF
108116
cd armbian
109117

110118
# CLEAN_LEVEL=all \
119+
# CLEAN_LEVEL=images,cache \
120+
# ./compile.sh docker-purge # <- This might be required
121+
# ./compile.sh docker-shell # <- Get a shell
111122

112123
./compile.sh build \
113124
BOARD=flipper-blackhat \
114-
CLEAN_LEVEL=images,cache \
115125
BRANCH=${kver} \
116126
BUILD_MINIMAL=no \
117127
KERNEL_CONFIGURE=no \

package/bhtui/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(bhtui LANGUAGES CXX)
4+
5+
set(CMAKE_CXX_STANDARD 20)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
add_subdirectory(third-party/TermOx)
9+
10+
add_executable(bhtui
11+
src/main.cpp
12+
src/menu_app.cpp
13+
src/menu_builder.cpp
14+
src/menu_item.cpp
15+
)
16+
17+
target_link_libraries(bhtui
18+
PRIVATE
19+
TermOx
20+
)
21+
22+
if (MSVC)
23+
target_compile_options(bhtui PRIVATE /W4)
24+
else()
25+
target_compile_options(bhtui PRIVATE -Wall -Wextra -Wpedantic)
26+
endif()

package/bhtui/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.PHONY: all build install clean
2+
3+
BINARY := bhtui
4+
BUILD_DIR := build
5+
PREFIX ?= /usr/local
6+
7+
all: build
8+
9+
build:
10+
cmake -S . -B $(BUILD_DIR)
11+
cmake --build $(BUILD_DIR) --target $(BINARY)
12+
13+
install: build
14+
install -d $(DESTDIR)$(PREFIX)/bin
15+
install -m 0755 $(BUILD_DIR)/$(BINARY) $(DESTDIR)$(PREFIX)/bin/$(BINARY)
16+
17+
clean:
18+
rm -rf $(BUILD_DIR)

package/bhtui/src/main.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#include <cstdlib>
2+
#include <iostream>
3+
#include <string>
4+
#include <vector>
5+
6+
#include <ox/core/core.hpp>
7+
8+
#include "menu_app.h"
9+
#include "menu_builder.h"
10+
11+
int main()
12+
{
13+
try {
14+
auto menu = menu_()
15+
.menu("Networking", "")
16+
.item("Network Manager", "nmtui")
17+
.item("IP Address", "ip a")
18+
.item("Routes", "ip r")
19+
.item("DNS (resolvectl)", "resolvectl status")
20+
.item("Sockets", "ss -tulpen")
21+
.item("Ping", "ping -c 4 1.1.1.1")
22+
.item("Firewall (nft)", "nft list ruleset")
23+
.end()
24+
.menu("System", "")
25+
.item("System Info", "fastfetch")
26+
.item("Uptime/Load", "uptime")
27+
.item("Kernel/OS", "uname -a")
28+
.item("Kernel Logs", "dmesg")
29+
.item("Top", "timeout 5 htop")
30+
.item("Memory", "free -h")
31+
.item("CPU Info", "lscpu")
32+
.item("USB Info", "lsusb")
33+
.item("Block Devices", "lsblk")
34+
.end()
35+
.menu("Files", "")
36+
.item("List Files", "ls -lah")
37+
.item("Disk Usage", "du -sh *")
38+
.item("Filesystem Usage", "df -h")
39+
.end()
40+
.menu("Services", "")
41+
.item("Service Status", "systemctl --failed")
42+
.item("All Services", "systemctl list-units --type=service")
43+
.item("Timers", "systemctl list-timers")
44+
.item("Startup Time", "systemd-analyze")
45+
.end()
46+
.menu("Storage", "")
47+
.item("fstab", "cat /etc/fstab")
48+
.item("blkid", "blkid")
49+
.end()
50+
.menu("Security", "")
51+
.item("Who Is Logged In", "who")
52+
.item("Sudo Version", "sudo -V | head -n 1")
53+
.item("Open Ports", "ss -lntup")
54+
.end()
55+
.build();
56+
57+
std::string output;
58+
int code = 0;
59+
{
60+
auto term = ox::Terminal{};
61+
auto app = MenuApp{std::move(menu), output};
62+
code = ox::process_events(term, app);
63+
}
64+
if (!output.empty()) {
65+
std::cout << output << '\n';
66+
return std::system(output.c_str());
67+
}
68+
return code;
69+
}
70+
catch (std::exception const& e) {
71+
std::cerr << "Error: " << e.what() << '\n';
72+
return 1;
73+
}
74+
catch (...) {
75+
std::cerr << "Unknown error\n";
76+
return 1;
77+
}
78+
}

0 commit comments

Comments
 (0)