From 0c3af2ecaebcda0eae948d0c457d2ce224d2a0c7 Mon Sep 17 00:00:00 2001 From: n0m4d1k Date: Thu, 27 Jul 2023 11:11:23 -0400 Subject: [PATCH 1/4] Adding info --- .../library/util/update-enabler/payload.sh | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 payloads/library/util/update-enabler/payload.sh diff --git a/payloads/library/util/update-enabler/payload.sh b/payloads/library/util/update-enabler/payload.sh new file mode 100644 index 0000000..fc78205 --- /dev/null +++ b/payloads/library/util/update-enabler/payload.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Title: Update enabler +# Author: n0m4d1k +# Version: 1.0 +# +# Description: This payload sets the shark jack to DHCP_CLIENT mode to +# allow access to the internet and then enables SSH on the +# shark jack allowing you to SSH into the device an perform updates or download additional tools +# +# Note: As of 07/27/2023 the /etc/opkg/distfeeds.conf file that comes with the stock shark jack is incorrect and will error out. +# to fix this remove the original text and add the below. +# +# src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.0/targets/ramips/mt76x8/packages +# src/gz openwrt_base http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/base +# src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/luci +# src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/packages +# src/gz openwrt_routing http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/routing +# src/gz openwrt_telephony http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/telephony +# +# Additionally, there is currently nothing in the Hak5 packages repo so this will also throw and error. +# to fix this you can simply comment out the second line in the /etc/opkg/customfeeds.conf +# +# Keep in mind that the shark jack will most likely have a 10.42.0.0/24 IP address and you will need to SSH to that. +# +# LED SETUP (Magenta)... Setting NETMODE to DHCP_CLIENT and starting SSH +# LED Green... Ready + +# Setup DHCP client, and determine subnet +LED SETUP +NETMODE DHCP_CLIENT + +# Start SSH server +/etc/init.d/sshd start +sleep 10 + +LED FINISH From ceb3ab690652badd2105226b7b9513eb175a2374 Mon Sep 17 00:00:00 2001 From: n0m4d1k Date: Thu, 27 Jul 2023 11:13:24 -0400 Subject: [PATCH 2/4] Added corrected files and README --- .../library/util/update-enabler/README.md | 32 +++++++++++++++++++ .../util/update-enabler/customfeeds.conf | 2 ++ .../util/update-enabler/distfeeds.conf | 6 ++++ 3 files changed, 40 insertions(+) create mode 100644 payloads/library/util/update-enabler/README.md create mode 100644 payloads/library/util/update-enabler/customfeeds.conf create mode 100644 payloads/library/util/update-enabler/distfeeds.conf diff --git a/payloads/library/util/update-enabler/README.md b/payloads/library/util/update-enabler/README.md new file mode 100644 index 0000000..f8e826d --- /dev/null +++ b/payloads/library/util/update-enabler/README.md @@ -0,0 +1,32 @@ +# Title: Update enabler +### Author: n0m4d1k +### Version: 1.0 + +### Description: + +This payload sets the shark jack to DHCP_CLIENT mode toallow access to the internet and then enables SSH on the shark jack allowing you to SSH into the device an perform updates or download additional tools + +Note: +As of 07/27/2023 the /etc/opkg/distfeeds.conf file that comes with the stock shark jack is incorrect and will error out. I have included the corrected files in this directory. To fix this manually remove the original text and add the below. + +``` +src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.0/targets/ramips/mt76x8/packages +src/gz openwrt_base http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/base +src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/luci +src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/packages +src/gz openwrt_routing http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/routing +src/gz openwrt_telephony http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/telephony +``` + +Additionally, there is currently nothing in the Hak5 packages repo so this will also throw and error. +to fix this you can simply comment out the second line in the /etc/opkg/customfeeds.conf + +Keep in mind that the shark jack will most likely have a 10.42.0.0/24 IP address and you will need to SSH to that. You can find the new IP using nmap by running the below command. + +`nmap -sn 10.42.0.0/24` + +#### LED Key: + +LED SETUP (Magenta)... Setting NETMODE to DHCP_CLIENT and starting SSH + +LED Green... Ready \ No newline at end of file diff --git a/payloads/library/util/update-enabler/customfeeds.conf b/payloads/library/util/update-enabler/customfeeds.conf new file mode 100644 index 0000000..0011103 --- /dev/null +++ b/payloads/library/util/update-enabler/customfeeds.conf @@ -0,0 +1,2 @@ +# Hak5 Packages +# src/gz 1907_shark http://downloads.hak5.org/packages/shark/1907 diff --git a/payloads/library/util/update-enabler/distfeeds.conf b/payloads/library/util/update-enabler/distfeeds.conf new file mode 100644 index 0000000..0a65b4a --- /dev/null +++ b/payloads/library/util/update-enabler/distfeeds.conf @@ -0,0 +1,6 @@ +src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.0/targets/ramips/mt76x8/packages +src/gz openwrt_base http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/base +src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/luci +src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/packages +src/gz openwrt_routing http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/routing +src/gz openwrt_telephony http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/telephony \ No newline at end of file From 17cb024c35c3328288e9334df6dc963edfaa703b Mon Sep 17 00:00:00 2001 From: n0m4d1k Date: Thu, 27 Jul 2023 13:55:14 -0400 Subject: [PATCH 3/4] Modified payload to automatically change distfeeds and customfeeds --- .../library/util/update-enabler/payload.sh | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/payloads/library/util/update-enabler/payload.sh b/payloads/library/util/update-enabler/payload.sh index fc78205..46fe675 100644 --- a/payloads/library/util/update-enabler/payload.sh +++ b/payloads/library/util/update-enabler/payload.sh @@ -2,7 +2,7 @@ # # Title: Update enabler # Author: n0m4d1k -# Version: 1.0 +# Version: 2.0 # # Description: This payload sets the shark jack to DHCP_CLIENT mode to # allow access to the internet and then enables SSH on the @@ -26,12 +26,37 @@ # LED SETUP (Magenta)... Setting NETMODE to DHCP_CLIENT and starting SSH # LED Green... Ready -# Setup DHCP client, and determine subnet LED SETUP + +# Variables +DISTFEEDS=/etc/opkg/distfeeds.conf +CUSTOMFEEDS=/etc/opkg/customfeeds.conf + +# Setup DHCP client, and determine subnet NETMODE DHCP_CLIENT # Start SSH server /etc/init.d/sshd start sleep 10 +# Wait until Shark Jack has an IP address +while [ -z "$IPADDR" ]; do sleep 1 && IPADDR=$(ifconfig eth0 | grep "inet addr"); done + +LED ATTACK + +# Fixes config files +mv $DISTFEEDS /etc/opkg/distfeeds.conf.og +touch $DISTFEEDS +echo "src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.0/targets/ramips/mt76x8/packages" >> $DISTFEEDS +echo "src/gz openwrt_base http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/base" >> $DISTFEEDS +echo "src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/luci" >> $DISTFEEDS +echo "src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/packages" >> $DISTFEEDS +echo "src/gz openwrt_routing http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/routing" >> $DISTFEEDS +echo "src/gz openwrt_telephony http://downloads.openwrt.org/releases/18.06.0/packages/mipsel_24kc/telephony" >> $DISTFEEDS + +mv $CUSTOMFEEDS /etc/opkg/customfeeds.conf.og +touch $CUSTOMFEEDS +echo "# Hak5 Packages" >> $CUSTOMFEEDS +echo "# src/gz 1907_shark http://downloads.hak5.org/packages/shark/1907" >> $CUSTOMFEEDS + LED FINISH From 8b2affd0ad013dd2ebe3429f4d6f0aff216b5e14 Mon Sep 17 00:00:00 2001 From: n0m4d1k Date: Thu, 27 Jul 2023 14:02:15 -0400 Subject: [PATCH 4/4] Auto update broken .conf files --- payloads/library/util/update-enabler/README.md | 6 +++--- payloads/library/util/update-enabler/payload.sh | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/payloads/library/util/update-enabler/README.md b/payloads/library/util/update-enabler/README.md index f8e826d..796899b 100644 --- a/payloads/library/util/update-enabler/README.md +++ b/payloads/library/util/update-enabler/README.md @@ -1,13 +1,13 @@ # Title: Update enabler ### Author: n0m4d1k -### Version: 1.0 +### Version: 2.0 ### Description: -This payload sets the shark jack to DHCP_CLIENT mode toallow access to the internet and then enables SSH on the shark jack allowing you to SSH into the device an perform updates or download additional tools +This payload sets the shark jack to DHCP_CLIENT mode toallow access to the internet and then enables SSH on the shark jack allowing you to SSH into the device an perform updates or download additional tools. It also automatically updates the distfeeds.conf and customfeeds.conf file to fix update errors. Note: -As of 07/27/2023 the /etc/opkg/distfeeds.conf file that comes with the stock shark jack is incorrect and will error out. I have included the corrected files in this directory. To fix this manually remove the original text and add the below. +As of 07/27/2023 the /etc/opkg/distfeeds.conf file that comes with the stock shark jack is incorrect and will error out. I have also included the corrected files in this directory. To fix this manually remove the original text and add the below. ``` src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.0/targets/ramips/mt76x8/packages diff --git a/payloads/library/util/update-enabler/payload.sh b/payloads/library/util/update-enabler/payload.sh index 46fe675..925910f 100644 --- a/payloads/library/util/update-enabler/payload.sh +++ b/payloads/library/util/update-enabler/payload.sh @@ -7,6 +7,7 @@ # Description: This payload sets the shark jack to DHCP_CLIENT mode to # allow access to the internet and then enables SSH on the # shark jack allowing you to SSH into the device an perform updates or download additional tools +# It also automatically updates the distfeeds.conf and customfeeds.conf file to fix update errors. # # Note: As of 07/27/2023 the /etc/opkg/distfeeds.conf file that comes with the stock shark jack is incorrect and will error out. # to fix this remove the original text and add the below.