Skip to content

Commit 6acc75e

Browse files
Merge pull request #7 from o7-machinehum/routersploit
Routersploit
2 parents ddaeaed + c24051c commit 6acc75e

10 files changed

Lines changed: 151 additions & 4 deletions

File tree

.github/workflows/push.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,60 @@ jobs:
2020
sudo apt-get install -y make binutils build-essential diffutils gcc g++ patch gzip bzip2 perl tar cpio unzip rsync bc findutils cmake
2121
sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
2222
23+
- name: Disable Swapfile
24+
run: |
25+
swapfile=$(sudo swapon --show=NAME --noheadings); echo "$swapfile"
26+
sudo swapoff "$swapfile"
27+
sudo rm -rf $swapfile
28+
29+
- name: Remove apt cache
30+
run: |
31+
sudo apt clean
32+
33+
- name: Clean up Docker
34+
run: |
35+
docker system prune -a -f
36+
sudo docker system prune -a -f
37+
38+
- name: Free disk space
39+
continue-on-error: true
40+
run: |
41+
sudo rm -rf \
42+
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
43+
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
44+
/usr/lib/jvm || true
45+
echo "some directories deleted"
46+
sudo apt install aptitude -y >/dev/null 2>&1
47+
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
48+
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
49+
google-cloud-sdk imagemagick \
50+
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
51+
mercurial apt-transport-https mono-complete libmysqlclient \
52+
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
53+
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
54+
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
55+
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
56+
-y -f >/dev/null 2>&1
57+
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
58+
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
59+
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
60+
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
61+
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
62+
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
63+
sudo apt-get autoremove -y >/dev/null 2>&1
64+
sudo apt-get autoclean -y >/dev/null 2>&1
65+
echo "some packages purged"
66+
2367
- name: Check Disk
2468
run: |
2569
df -h
70+
free
2671
2772
- name: Build
2873
run: |
29-
cd buildroot && make BR2_EXTERNAL=$PWD/../ flipper_blackhat_a33_defconfig && make
74+
cd buildroot
75+
make BR2_EXTERNAL=$PWD/../ flipper_blackhat_a33_defconfig
76+
make
3077
3178
- name: Upload Artifact
3279
uses: actions/upload-artifact@v4

Config.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
source "$BR2_EXTERNAL_BLACKHAT_PATH/package/blackhat/Config.in"
2+
source "$BR2_EXTERNAL_BLACKHAT_PATH/package/python-routersploit/Config.in"
3+
source "$BR2_EXTERNAL_BLACKHAT_PATH/package/python-pycryptodome/Config.in"

buildroot

Submodule buildroot updated 2033 files

configs/flipper_blackhat_a33_defconfig

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
BR2_arm=y
22
BR2_cortex_a7=y
3-
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_11=y
3+
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
4+
BR2_BINUTILS_VERSION_2_42_X=y
45
BR2_TOOLCHAIN_BUILDROOT_CXX=y
6+
BR2_CURL="curl -q --ftp-pasv --retry 3"
7+
BR2_WGET="wget -nd -t 3"
8+
BR2_SVN="svn --non-interactive"
9+
BR2_SCP="scp"
10+
BR2_SFTP="sftp"
11+
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BLACKHAT_PATH)/patches/global/"
512
BR2_TARGET_GENERIC_HOSTNAME="flipper-blackhat"
613
BR2_TARGET_GENERIC_ISSUE="Welcome to the Flipper Blackhat"
714
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
@@ -17,7 +24,7 @@ BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_BLACKHAT_PATH)/genimage/genimage.
1724
BR2_LINUX_KERNEL=y
1825
BR2_LINUX_KERNEL_CUSTOM_GIT=y
1926
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
20-
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v6.14-rc2"
27+
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v6.14"
2128
BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_BLACKHAT_PATH)/patches/linux/0001-dts.patch"
2229
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
2330
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_BLACKHAT_PATH)/configs/linux_flipper_a33_defconfig"
@@ -29,9 +36,11 @@ BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
2936
BR2_PACKAGE_BINUTILS=y
3037
BR2_PACKAGE_DOS2UNIX=y
3138
BR2_PACKAGE_GAWK=y
39+
BR2_PACKAGE_GIT=y
3240
BR2_PACKAGE_GPERF=y
3341
BR2_PACKAGE_GREP=y
3442
BR2_PACKAGE_MAKE=y
43+
BR2_PACKAGE_PATCH=y
3544
BR2_PACKAGE_SED=y
3645
BR2_PACKAGE_E2FSPROGS=y
3746
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
@@ -109,6 +118,7 @@ BR2_PACKAGE_NMAP=y
109118
BR2_PACKAGE_NMAP_NCAT=y
110119
BR2_PACKAGE_NMAP_NMAP=y
111120
BR2_PACKAGE_NMAP_NPING=y
121+
BR2_PACKAGE_NTP=y
112122
BR2_PACKAGE_TCPDUMP=y
113123
BR2_PACKAGE_WPA_SUPPLICANT=y
114124
BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
@@ -148,3 +158,4 @@ BR2_PACKAGE_HOST_UBOOT_TOOLS=y
148158
BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
149159
BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_BLACKHAT_PATH)/board/boot.cmd"
150160
BR2_PACKAGE_BLACKHAT=y
161+
BR2_PACKAGE_PYTHON_ROUTERSPLOIT=y
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config BR2_PACKAGE_PYTHON_PYCRYPTODOME
2+
bool "python-pycryptodome"
3+
help
4+
PyCryptodome is a self-contained Python package of low-level cryptographic primitives.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
################################################################################
2+
#
3+
# python‑pycryptodome
4+
#
5+
################################################################################
6+
7+
PYTHON_PYCRYPTODOME_VERSION = v3.22.0
8+
9+
PYTHON_PYCRYPTODOME_SITE = https://github.com/Legrandin/pycryptodome
10+
PYTHON_PYCRYPTODOME_SITE_METHOD = git
11+
PYTHON_PYCRYPTODOME_LICENSE = BSD-3-Clause
12+
PYTHON_PYCRYPTODOME_LICENSE_FILES = LICENSE
13+
14+
PYTHON_PYCRYPTODOME_SETUP_TYPE = pep517
15+
16+
$(eval $(python-package))
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/routersploit/core/exploit/utils.py b/routersploit/core/exploit/utils.py
2+
index 420db6d..e75cb14 100644
3+
--- a/routersploit/core/exploit/utils.py
4+
+++ b/routersploit/core/exploit/utils.py
5+
@@ -92,7 +92,7 @@ def index_modules(modules_directory: str = MODULES_DIR) -> list:
6+
for root, dirs, files in os.walk(modules_directory):
7+
_, package, root = root.rpartition("routersploit/modules/".replace("/", os.sep))
8+
root = root.replace(os.sep, ".")
9+
- files = filter(lambda x: not x.startswith("__") and x.endswith(".py"), files)
10+
+ files = filter(lambda x: not x.startswith("__") and x.endswith(".pyc"), files)
11+
modules.extend(map(lambda x: ".".join((root, os.path.splitext(x)[0])), files))
12+
13+
return modules
14+
diff --git a/routersploit/interpreter.py b/routersploit/interpreter.py
15+
index d65f981..cf037b4 100644
16+
--- a/routersploit/interpreter.py
17+
+++ b/routersploit/interpreter.py
18+
@@ -229,7 +229,7 @@ class RoutersploitInterpreter(BaseInterpreter):
19+
self.module_commands.extend(self.global_commands)
20+
self.module_commands.sort()
21+
22+
- self.modules = index_modules()
23+
+ self.modules = index_modules("/usr/lib/python3.12/site-packages/routersploit")
24+
self.modules_count = Counter()
25+
self.modules_count.update([module.split('.')[0] for module in self.modules])
26+
self.main_modules_dirs = [module for module in os.listdir(MODULES_DIR) if not module.startswith("__")]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config BR2_PACKAGE_PYTHON_ROUTERSPLOIT
2+
bool "python-routersploit"
3+
help
4+
Exploitation Framework for Embedded Devices
5+
6+
select BR2_PACKAGE_PYTHON_REQUESTS
7+
select BR2_PACKAGE_PYTHON_PARAMIKO
8+
select BR2_PACKAGE_PYTHON_PYSNMP
9+
select BR2_PACKAGE_PYTHON_PYCRYPTODOME
10+
select BR2_PACKAGE_PYTHON_TELNETLIB3
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
################################################################################
2+
#
3+
# python‑routersploit
4+
#
5+
################################################################################
6+
7+
PYTHON_ROUTERSPLOIT_VERSION = v3.4.7
8+
9+
PYTHON_ROUTERSPLOIT_SITE = https://github.com/threat9/routersploit
10+
PYTHON_ROUTERSPLOIT_SITE_METHOD = git
11+
PYTHON_ROUTERSPLOIT_LICENSE = BSD-3-Clause
12+
PYTHON_ROUTERSPLOIT_LICENSE_FILES = LICENSE
13+
14+
PYTHON_ROUTERSPLOIT_SETUP_TYPE = pep517
15+
16+
PYTHON_ROUTERSPLOIT_DEPENDENCIES = \
17+
python-requests \
18+
python-paramiko \
19+
python-pysnmp \
20+
python-pycryptodome \
21+
python-telnetlib3 \
22+
23+
$(eval $(python-package))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--- a/CMakeLists.txt
2+
+++ b/CMakeLists.txt
3+
@@ -1,4 +1,4 @@
4+
-cmake_minimum_required(VERSION 2.8.12)
5+
+cmake_minimum_required(VERSION 3.5)
6+
# When using CMake 3.4 and later, don't export symbols from executables unless
7+
# the CMAKE_ENABLE_EXPORTS variable is set.
8+
if(POLICY CMP0065)

0 commit comments

Comments
 (0)