Skip to content

Commit

Permalink
reduce crash, add 900 payloads, update SD
Browse files Browse the repository at this point in the history
  • Loading branch information
0x1iii1ii committed Aug 17, 2024
1 parent fe16ba6 commit 7b9a13c
Show file tree
Hide file tree
Showing 72 changed files with 410 additions and 341 deletions.
60 changes: 23 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and thanks to xfangfang <a href=https://github.com/xfangfang/PPPwn_cpp>PPPwn-CPP
- The average PPPwned time is around `1min - 2min` sometimes it loads under `1 minute`
- Using `pppwn` nightly build from xfangfang PPPwn_cpp <be>

## Web Server Features on NAND
## Web Server Features

Thanks to [@harsha-0110](https://github.com/harsha-0110) for the webserver base scripts and PHP.<br>

Expand All @@ -26,31 +26,46 @@ You can manually edit the configuration file located at `/etc/pppwn/config.json`

## Support Boards

- <b>Luckfox Pico</b><br>
- <b>Luckfox Pico Pro</b><br>
- <b>Luckfox Pico Max</b><br>
- <b>Luckfox Pico Plus</b><be>
- <b>Luckfox Pico Mini B</b><br>
- <b>Luckfox Pico Mini A/B</b><br>

## Requirements

- Luckfox Pico Pro/Max/Plus/Mini B
- One of Luckfox Pico models above
- SD Card 4GB or above (for Luckfox Pico/Mini A)
- Ethernet Cable
- USB Type-C
- A USB drive with exFAT32 formatted (only use for the first time to load GoldHEN)
- PC/Laptop for config the Luckfox


## Installation in NAND Flash <a name="nandinstallation"></a>
## Installation

Before proceeding make sure to disable your anti-virus software, it is a false positive and completely safe. If you are still concerned please don't proceed any further!

Download the custom buildroot image for your Luckfox models below or from the [release](https://github.com/0x1iii1ii/PPPwn-Luckfox/releases) pages.
Download one of the custom buildroot image for your respective Luckfox models below or from the [release](https://github.com/0x1iii1ii/PPPwn-Luckfox/releases) pages.

- NAND Flash boot

Luckfox Model | Buildroot Image
------------- | -------------
Luckfox Pico Pro/Max | [download](https://github.com/0x1iii1ii/PPPwn-Luckfox/releases/download/1.2.0/luckfox_pico_pro_max_image_pppwn.zip)
Luckfox Pico Plus/Mini B | [download](https://github.com/0x1iii1ii/PPPwn-Luckfox/releases/download/1.2.0/luckfox_pico_plus_image_pppwn.zip)

1. Use [SocToolKit](https://drive.google.com/file/d/1ALo4G7rEaF1GNhUHINoYHT_RGWGddzYw) to burn the buildroot image you downloaded above to your Luckfox. Proceed to burn it by following the official Luckfox tutorial <a href=https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1103/Luckfox-Pico-Flash-burn-image>here</a>.

- SD Card boot

Luckfox Model | Buildroot Image
------------- | -------------
Luckfox Pico/Mini A | [download](https://github.com/0x1iii1ii/PPPwn-Luckfox/releases/download/1.2.0/luckfox_pico_plus_image_pppwn.zip)


1. Use [SocToolKit](https://drive.google.com/file/d/1ALo4G7rEaF1GNhUHINoYHT_RGWGddzYw) to burn the buildroot image you downloaded above to your Luckfox.
- If you're using luckfox with `NAND Flash`, proceed to burn the OS by following the official Luckfox tutorial <a href=https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1103/Luckfox-Pico-Flash-burn-image>here</a>.
- If you're using luckfox with `SD Card`, proceed to burn the OS by following the official Luckfox tutorial <a href=https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1103/Luckfox-Pico-SD-Card-burn-image>here</a>.
2. Plug your luckfox to your PC via USB type-c port and wait a few minutes until you hear the device connect sound.
3. On your PC open `Control Panel -> Network and Internet -> Network and Sharing Center -> Change Adapter Options`. You will find `Remote NDIS based Internet Sharing Device`. Right-click and choose Properties.<be>

Expand Down Expand Up @@ -78,26 +93,11 @@ Download the custom buildroot image for your Luckfox models below or from the [r

```sh
cd PPPwn-Luckfox
chmod +x install_NAND.sh
./install_NAND.sh
chmod +x install.sh
./install.sh
```
Once the Luckfox reboots pppwn will run automatically.<be>

## Installation in SD Card

An alternative option of <a href=https://github.com/harsha-0110/PPPwn-Luckfox>PPPwn-Luckfox</a> with more features for SD card install.

1. Download <a href=https://drive.google.com/drive/folders/1sFUWjYpDDisf92q9EwP1Ia7lHgp9PaFS>Ubuntu</a>. After you download, extract one of the zip files according to your Luckfox pico models (for Pico/Mini A use `Pico_Plus_Ubuntu` image for it to support LAN). <br>
2. Download <a href=https://drive.google.com/file/d/1ALo4G7rEaF1GNhUHINoYHT_RGWGddzYw>SocToolKit</a> and unzip the burning tool. Burn the image onto an SD Card by following the official tutorial [here](https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-RV1103/Luckfox-Pico-SD-Card-burn-image).<br>
5. After done, follow instructions from steps 2, 3, and 4 in [Installation in NAND Flash](#nandinstallation), for step 5 log in using static IP `172.32.0.70` login name `pico` and password `luckfox`.
6. After you logged in, follow step 6 in [Installation in NAND Flash](#nandinstallation), then run the following commands, and follow the setup instruction

```sh
cd PPPwn-Luckfox
chmod +x install_SD.sh
sudo ./install_SD.sh
```
Once the Luckfox reboots pppwn will run automatically.<be>
## Installation Hardware

1. You simply need to connect the LAN cable from Luckfox Pico to the PS4 and power the Luckfox from the PS4 via a USB Type-C cable or other sources.
Expand All @@ -114,17 +114,3 @@ Once the Luckfox reboots pppwn will run automatically.<be>
For Goldhen you need to place the goldhen.bin file onto the root of a USB drive and plug it into the console.<br>
Once Goldhen has been loaded for the first time it will be copied to the console's internal HDD and the USB is no longer required.<br>
To update Goldhen just repeat the above process and the new version will be copied to the internal HDD. <be>

## Update PPPwn-Luckfox
For SD card with Ubuntu.
log in to your luckfox, connect it to the internet, then run this cmd:
```sh
cd PPPwn-Luckfox
sudo ./update.sh
```
For NAND, you need to manually copy the update files to luckfox using MobaXterm, then run this cmd.
```sh
cd PPPwn-Luckfox
./install_NAND.sh
```

48 changes: 23 additions & 25 deletions exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,28 @@ read_json() {
awk -F"[,:}]" '/"'$key'"/{gsub(/"/, "", $2); gsub(/[ \t]/, "", $2); print $2}' "$CONFIG_FILE"
}

while true; do
if [ -f "$CONFIG_FILE" ]; then
EXECUTE_FLAG=$(read_json 'execute_flag')
SHUTDOWN_FLAG=$(read_json 'shutdown_flag')
PPPWNDIR=$(read_json 'install_dir')
if [ "$SHUTDOWN_FLAG" = "true" ]; then
killall nginx
killall php-fpm
killall pppoe-server
sleep 5
awk -v OFS=: '{gsub("\"shutdown_flag\": true", "\"shutdown_flag\": false")}1' "$CONFIG_FILE" > /tmp/tmp.$$.json && mv /tmp/tmp.$$.json "$CONFIG_FILE"
chmod 777 "$CONFIG_FILE"
ifconfig ppp0 down
sleep 1
ifconfig eth0 down
sleep 5
halt -f
check_input() {
while true; do
if [ -f "$CONFIG_FILE" ]; then
EXECUTE_FLAG=$(read_json 'execute_flag')
SHUTDOWN_FLAG=$(read_json 'shutdown_flag')
PPPWNDIR=$(read_json 'install_dir')
if [ "$SHUTDOWN_FLAG" = "true" ]; then
killall pppoe-server
sleep 1
awk -v OFS=: '{gsub("\"shutdown_flag\": true", "\"shutdown_flag\": false")}1' "$CONFIG_FILE" >/tmp/tmp.$$.json && mv /tmp/tmp.$$.json "$CONFIG_FILE"
chmod 777 "$CONFIG_FILE"
sleep 5
halt -f
fi
if [ "$EXECUTE_FLAG" = "true" ]; then
sh "$PPPWNDIR/web-run.sh"
awk -v OFS=: '{gsub("\"execute_flag\": true", "\"execute_flag\": false")}1' "$CONFIG_FILE" >/tmp/tmp.$$.json && mv /tmp/tmp.$$.json "$CONFIG_FILE"
chmod 777 "$CONFIG_FILE"
fi
fi
sleep 5
done
}

if [ "$EXECUTE_FLAG" = "true" ]; then
sh "$PPPWNDIR/web-run.sh"
awk -v OFS=: '{gsub("\"execute_flag\": true", "\"execute_flag\": false")}1' "$CONFIG_FILE" > /tmp/tmp.$$.json && mv /tmp/tmp.$$.json "$CONFIG_FILE"
chmod 777 "$CONFIG_FILE"
fi
fi
sleep 5
done
check_input &
88 changes: 55 additions & 33 deletions install_NAND.sh → install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

cat << "EOF"
cat <<"EOF"
______________________________
\______ \______ \______ \__ _ ______
| ___/| ___/| ___/\ \/ \/ / \
Expand All @@ -15,7 +15,7 @@ ______________________________
EOF

echo ""
echo "★ NAND ★ v1.2.0"
echo "★ NAND ★ v1.2.2"
echo ""
echo "by: https://github.com/0x1iii1ii/PPPwn-Luckfox"
echo "credit to:"
Expand All @@ -25,12 +25,12 @@ echo "https://github.com/harsha-0110/PPPwn-Luckfox for webserver"
echo ""

# Constants
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
BGreen='\033[1;32m' # Bold Green
BYellow='\033[1;33m' # Bold Yellow
BCyan='\033[1;36m' # Cyan
NC='\033[0m' # No Color
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
BGreen='\033[1;32m' # Bold Green
BYellow='\033[1;33m' # Bold Yellow
BCyan='\033[1;36m' # Cyan
NC='\033[0m' # No Color

CURRENT_DIR=$(pwd)
WEB_DIR="/var/www/data"
Expand All @@ -49,15 +49,30 @@ echo "e) 11.00"
# Prompt the user for the selection
while true; do
# Firmware selection
echo ""
echo ""
read -p "Enter your choice (a/b/c/d/e): " FW_CHOICE
case $FW_CHOICE in
a) FW_VERSION="900"; READABLE_FW_VERSION="9.00" ;;
b) FW_VERSION="960"; READABLE_FW_VERSION="9.60" ;;
c) FW_VERSION="1000"; READABLE_FW_VERSION="10.00" ;;
d) FW_VERSION="1001"; READABLE_FW_VERSION="10.01" ;;
e) FW_VERSION="1100"; READABLE_FW_VERSION="11.00" ;;
*) echo "Invalid choice. Please select a valid option." ;;
a)
FW_VERSION="900"
READABLE_FW_VERSION="9.00"
;;
b)
FW_VERSION="960"
READABLE_FW_VERSION="9.60"
;;
c)
FW_VERSION="1000"
READABLE_FW_VERSION="10.00"
;;
d)
FW_VERSION="1001"
READABLE_FW_VERSION="10.01"
;;
e)
FW_VERSION="1100"
READABLE_FW_VERSION="11.00"
;;
*) echo "Invalid choice. Please select a valid option." ;;
esac

# Confirmation of firmware version
Expand All @@ -80,7 +95,7 @@ while true; do
echo -e "Do you want to use the ${BGreen}Web Server${NC} features? (y/n)"
read -p "Enter your choice: " USE_WEBSERVER
if [[ "$USE_WEBSERVER" == "y" || "$USE_WEBSERVER" == "n" ]]; then
READABLE_WEBSERVER=$( [ "$USE_WEBSERVER" = "y" ] && echo "yes" || echo "no" )
READABLE_WEBSERVER=$([ "$USE_WEBSERVER" = "y" ] && echo "yes" || echo "no")
if [[ "$USE_WEBSERVER" == "y" ]]; then
HALT_CHOICE="false"
READABLE_HALT_CHOICE="no"
Expand All @@ -92,8 +107,8 @@ while true; do
echo "Do you want your luckfox to shutdown after successfully jailbreak? (y/n)"
read -p "Enter your choice: " HALT
if [[ "$HALT" == "y" || "$HALT" == "n" ]]; then
READABLE_HALT_CHOICE=$( [ "$HALT" = "y" ] && echo "yes" || echo "no" )
HALT_CHOICE=$( [ "$HALT" = "y" ] && echo "true" || echo "false" )
READABLE_HALT_CHOICE=$([ "$HALT" = "y" ] && echo "yes" || echo "no")
HALT_CHOICE=$([ "$HALT" = "y" ] && echo "true" || echo "false")
break
else
echo "Invalid choice. Please enter 'y' or 'n'."
Expand All @@ -116,9 +131,17 @@ echo -e "${BYellow}Note:${NC} if your PS4 doesn't work with \"pppwn\", try \"ppp
while true; do
read -p "Enter your choice (a/b): " PPPWN_CHOICE
case $PPPWN_CHOICE in
a) PPPWN_EXEC="pppwn"; READABLE_PPPWN_EXEC="PPPwn"; break ;;
b) PPPWN_EXEC="pppwn_ipv6"; READABLE_PPPWN_EXEC="PPPwn IPV6"; break ;;
*) echo "Invalid choice. Please select a valid option." ;;
a)
PPPWN_EXEC="pppwn"
READABLE_PPPWN_EXEC="PPPwn"
break
;;
b)
PPPWN_EXEC="pppwn_ipv6"
READABLE_PPPWN_EXEC="PPPwn IPV6"
break
;;
*) echo "Invalid choice. Please select a valid option." ;;
esac
done

Expand Down Expand Up @@ -146,7 +169,7 @@ fi

# Create the config.json file with the install directory if it doesn't exist
if [ ! -f "$CONFIG_FILE" ]; then
cat > $CONFIG_FILE <<EOL
cat >$CONFIG_FILE <<EOL
{
"FW_VERSION": "$FW_VERSION",
"TIMEOUT": "5",
Expand Down Expand Up @@ -174,19 +197,19 @@ fi

if [ "\$HALT_CHOICE" != "true" ]; then

# Set up the web directory
mkdir -p $WEB_DIR
cp -r $CURRENT_DIR/web/* $WEB_DIR/
cp -r $CURRENT_DIR/config/* $WEB_CONF/
chown -R www-data:www-data $WEB_DIR
chmod -R 755 $WEB_DIR
# Set up pppoe configuration
cp $CURRENT_DIR/pppoe/pppoe-server-options /etc/ppp/
cp $CURRENT_DIR/pppoe/pap-secrets /etc/ppp/
# Set up the web directory
mkdir -p $WEB_DIR
cp -r $CURRENT_DIR/web/data/* $WEB_DIR/
cp -r $CURRENT_DIR/web/config/* $WEB_CONF/
chown -R www-data:www-data $WEB_DIR
chmod -R 755 $WEB_DIR
# Set up pppoe configuration
cp $CURRENT_DIR/web/pppoe/pppoe-server-options /etc/ppp/
cp $CURRENT_DIR/web/pppoe/pap-secrets /etc/ppp/

fi

cat <<EOL > /etc/init.d/S99pppwn
cat <<EOL >/etc/init.d/S99pppwn
#!/bin/sh
PPPWNDIR=$CURRENT_DIR
Expand All @@ -212,7 +235,6 @@ EOL

chmod +x pppwn pppwn_ipv6 run.sh exec.sh web-run.sh
chmod +x /etc/init.d/S99pppwn

echo "install to NAND completed! rebooting..."

reboot
Loading

0 comments on commit 7b9a13c

Please sign in to comment.