Skip to content

Commit 50ae175

Browse files
author
Invers3
committed
Update Package
Added option auto retry Added option real sleep Fixing update option
1 parent 14b0770 commit 50ae175

8 files changed

Lines changed: 136 additions & 125 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This activation method works for devices with the OpenWrt Linux system as long a
2222
chmod +x installer.sh && ./installer.sh
2323
```
2424
You will receive a message about the type of installation. If you require the full installation, enter `y`. For minimal installation, select the corresponding option.
25-
7. Go to `http://192.168.1.1:81` and complete the necessary configuration.
25+
7. Go to `http://192.168.1.1/pppwn.html` and complete the necessary configuration.
2626
8. The minimal installation requires additional adjustments and does not install the web interface.
2727

2828
## Installation with Download (Requires Internet Connection)
@@ -89,7 +89,7 @@ Interfaz web para arrancar PPPwn_cpp desde el navegador web de PS4.
8989
chmod +x installer.sh && ./installer.sh
9090
```
9191
Recibirás un mensaje con el tipo de instalación. Si requieres la instalación completa, ingresa `y`. Si prefieres la mínima, elige la opción correspondiente.
92-
7. Ve a `http://192.168.1.1:81` y realiza la configuración necesaria.
92+
7. Ve a `http://192.168.1.1/pppwn.html` y realiza la configuración necesaria.
9393
8. La instalación mínima requiere ajustes adicionales y no incluye la interfaz web.
9494

9595
## Instalación con descarga (Requiere conexión a Internet)

etc/config/pw

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ config params
44
option interface 'br-lan'
55
option version '1100'
66
option timeout '0'
7+
option retry 'no'
8+
option sleep 'yes'
79
option stage1 '/root/stage1/1100.bin'
810
option stage2 '/root/stage2/1100.bin'

etc/init.d/pw

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ start() {
88
if ! pgrep pppwn > /dev/null; then
99

1010
interface=$(uci get pw.@params[0].interface)
11+
retry=$(uci get pw.@params[0].retry)
12+
sleep=$(uci get pw.@params[0].sleep)
1113
version=$(uci get pw.@params[0].version)
1214
stage1=$(uci get pw.@params[0].stage1)
1315
stage2=$(uci get pw.@params[0].stage2)
@@ -22,7 +24,18 @@ start() {
2224
sleep 5
2325
ip link set $interface up
2426

25-
result=$(pppwn --interface "$interface" --fw "$version" --stage1 "$stage1" --stage2 "$stage2" --timeout $timeout --auto-retry)
27+
if [ "$sleep" = "yes" ]; then
28+
sleep="--real-sleep"
29+
elif [ "$sleep" = "no" ]; then
30+
sleep=""
31+
fi
32+
if [ "$retry" = "yes" ]; then
33+
retry="--auto-retry"
34+
elif [ "$retry" = "no" ]; then
35+
retry=""
36+
fi
37+
38+
result=$(pppwn --interface "$interface" --fw "$version" --stage1 "$stage1" --stage2 "$stage2" --timeout $timeout $sleep $retry)
2639

2740
if [[ "$result" == *"\[\+\] Done\!"* ]]; then
2841
if ! pgrep pppoe-server > /dev/null; then

installer.sh

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ fi
3434
if [ -d /root/stage2 ]; then
3535
rm -r /root/stage2
3636
fi
37-
if [ -d /www/pppwn ]; then
38-
rm -r /www/pppwn
37+
if [ -d /www/assets ]; then
38+
rm -r /www/assets
39+
fi
40+
if [ -f /www/cgi-bin/pw.cgi ]; then
41+
rm /www/cgi-bin/pw.cgi
42+
fi
43+
if [ -f /www/pppwn.html ]; then
44+
rm /www/pppwn.html
3945
fi
4046
if [ -f /root/pw.conf ]; then
4147
rm /root/pw.conf
@@ -46,10 +52,6 @@ fi
4652
if [ -f /root/run.sh ]; then
4753
rm /root/run.sh
4854
fi
49-
if [ -f /www/cgi-bin/pw.cgi ]; then
50-
rm /www/cgi-bin/pw.cgi
51-
fi
52-
5355

5456
installer_setup(){
5557

@@ -90,38 +92,26 @@ installer_setup(){
9092

9193
fi
9294

93-
mkdir /www/pppwn
94-
9595
mv -f ${dir_root}etc/config/pw /etc/config
9696
mv -f ${dir_root}etc/config/pppoe /etc/config
9797
mv -f ${dir_root}etc/init.d/pppoe-server /etc/init.d
9898
mv -f ${dir_root}etc/ppp/pap-secrets /etc/ppp
9999
mv -f ${dir_root}etc/ppp/chap-secrets /etc/ppp
100100
mv -f ${dir_root}etc/ppp/pppoe-server-options /etc/ppp
101-
mv -f ${dir_root}www/* /www/pppwn
101+
mv -f ${dir_root}www/cgi-bin/pw.cgi /www/cgi-bin/
102+
mv -f ${dir_root}www/pppwn.html /www/
103+
mv -f ${dir_root}www/assets /www/
102104

103105
chmod +x /etc/init.d/pppoe-server /www/cgi-bin/pw.cgi
104106

105-
uci set uhttpd.pppwn=uhttpd
106-
uci set uhttpd.pppwn.listen_http='81'
107-
uci set uhttpd.pppwn.home='/www/pppwn'
108-
uci set uhttpd.pppwn.cgi_prefix='/cgi-bin'
109-
uci set uhttpd.pppwn.script_timeout='90'
110-
uci set uhttpd.pppwn.network_timeout='60'
111-
uci set uhttpd.pppwn.tcp_keepalive='1'
112-
uci add_list uhttpd.pppwn.interpreter='.sh=/bin/sh'
113-
uci add_list uhttpd.pppwn.interpreter='.cgi=/bin/sh'
114-
uci commit uhttpd
115-
116107
uci del_list firewall.@zone[0].device='ppp+'
117108
uci add_list firewall.@zone[0].device='ppp+'
118109
uci set firewall.@zone[1].input='ACCEPT'
119110
uci commit firewall
120111

121-
/etc/init.d/uhttpd restart
122112
/etc/init.d/pppoe-server enable
123113
/etc/init.d/pppoe-server start
124-
114+
125115
else
126116

127117
mtype=$(uname -m)

www/assets/css/base.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ img, video, object, embed{
397397
}
398398

399399
.form .full{
400+
position: relative;
400401
display: block;
401402
width: 100%;
402403
}

www/assets/js/main.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ var Pwg = Backbone.Model.extend({
1818
stage2: {},
1919
theme: 'default',
2020
adapter: '',
21-
address: location.protocol+"//"+location.hostname+":8080"
21+
retry: 'no',
22+
sleep: 'no'
2223
}
2324
});
2425

@@ -86,7 +87,9 @@ var appView = Backbone.View.extend({
8687
timeout:this.inputTimeout.val(),
8788
adapter:this.inputAdapter.val(),
8889
version:this.inputVersion.val(),
89-
auto:this.selectAuto.val()
90+
auto:this.selectAuto.val(),
91+
retry: this.selectRetry.val(),
92+
sleep: this.selectSleep.val()
9093
}
9194
}).then(function(response){
9295

@@ -279,7 +282,9 @@ var appView = Backbone.View.extend({
279282
stage1:this.stage1[this.inputVersion.val()],
280283
stage2:this.stage2[this.inputVersion.val()],
281284
timeout:this.inputTimeout.val(),
282-
auto:this.selectAuto.val()
285+
auto:this.selectAuto.val(),
286+
retry: this.selectRetry.val(),
287+
sleep: this.selectSleep.val()
283288
}
284289
}).then(function(){
285290

@@ -471,6 +476,8 @@ var appView = Backbone.View.extend({
471476
this.textareaOut = this.$('#task-log .output');
472477
this.buttonAction = this.$('button#action_pw');
473478
this.selectAuto = this.$('select#switch_pw');
479+
this.selectRetry = this.$('select#retry_pw');
480+
this.selectSleep = this.$('select#sleep_pw');
474481
this.buttonUpdate = this.$('button#update_rep');
475482
this.buttonInstall = this.$('button#install_pw');
476483
this.inputPath = this.$('[name=path]');
@@ -508,6 +515,9 @@ var appView = Backbone.View.extend({
508515
this.selectAuto.val(0);
509516
}
510517

518+
this.selectRetry.val(this.model.get('retry'));
519+
this.selectSleep.val(this.model.get('sleep'));
520+
511521
$('a#credits').click(function(){
512522
$.modal(function(modal){
513523
modal.content(self.templates.msg({message: 'TheOfficialFloW / SiSTR0 / xfangfang', buttons:[]}));
@@ -539,7 +549,6 @@ var appView = Backbone.View.extend({
539549
}
540550
}).then(function(response){
541551
$.modal.close();
542-
response.address=self.model.get('address');
543552
self.$el.html(self.templates.pyd(response));
544553
}).catch(function(err){
545554
if(err.responseJSON){

www/cgi-bin/pw.cgi

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ stage2=$(echo $postData | sed -n 's/^.*stage2=\([^&]*\).*$/\1/p' | sed "s/%20/ /
2323
stage2=$(echo "$stage2" | sed 's/%2F/\//g')
2424
timeout=$(echo $postData | sed -n 's/^.*timeout=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
2525
auto=$(echo $postData | sed -n 's/^.*auto=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
26+
retry=$(echo $postData | sed -n 's/^.*retry=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
27+
sleep=$(echo $postData | sed -n 's/^.*sleep=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
2628
task=$(echo $postData | sed -n 's/^.*task=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
2729
option=$(echo $postData | sed -n 's/^.*option=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
2830
path=$(echo $postData | sed -n 's/^.*path=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
@@ -38,6 +40,8 @@ fi
3840
set_params(){
3941

4042
uci set pw.@params[0].path="$path"
43+
uci set pw.@params[0].retry="$retry"
44+
uci set pw.@params[0].sleep="$sleep"
4145
uci set pw.@params[0].interface="$adapter"
4246
uci set pw.@params[0].version="$version"
4347
uci set pw.@params[0].timeout="$timeout"
@@ -69,8 +73,8 @@ rm_files(){
6973

7074
rm -f /usr/sbin/pppwn /etc/init.d/pw /etc/config/pw && rm -rf /root/*
7175

72-
if [ -d /www/pppwn ]; then
73-
rm -rf /www/pppwn
76+
if [ -d /www/assets ]; then
77+
rm -rf /www/assets
7478
fi
7579
if [ -f /www/pppwn.html ]; then
7680
rm -f /www/pppwn.html
@@ -184,14 +188,11 @@ case "$task" in
184188
echo "\"chipname\":\"$(uname -m)\","
185189
echo "\"path\":\"$(uci get pw.@params[0].path)\","
186190

187-
if [ -z "$latest_version" ]; then
188-
echo "\"update\":false,"
191+
if [ "$latest_version" -gt "$current_version" ]; then
192+
"$(wget -O /tmp/updater.sh https://raw.githubusercontent.com/CodeInvers3/codeinvers3.github.io/refs/heads/master/files/updater.sh)"
193+
echo "\"update\":true,"
189194
else
190-
if [ "$latest_version" -gt "$current_version" ]; then
191-
echo "\"update\":true,"
192-
else
193-
echo "\"update\":false,"
194-
fi
195+
echo "\"update\":false,"
195196
fi
196197

197198
if pgrep pppoe-server > /dev/null; then
@@ -252,13 +253,11 @@ case "$task" in
252253
done
253254
echo "},"
254255

255-
interface=$(uci get pw.@params[0].interface)
256-
version=$(uci get pw.@params[0].version)
257-
timeout=$(uci get pw.@params[0].timeout)
258-
259-
echo "\"adapter\":\"$interface\","
260-
echo "\"version\":\"$version\","
261-
echo "\"timeout\":\"$timeout\","
256+
echo "\"retry\":\"$(uci get pw.@params[0].retry)\","
257+
echo "\"sleep\":\"$(uci get pw.@params[0].sleep)\","
258+
echo "\"adapter\":\"$(uci get pw.@params[0].interface)\","
259+
echo "\"version\":\"$(uci get pw.@params[0].version)\","
260+
echo "\"timeout\":\"$(uci get pw.@params[0].timeout)\","
262261

263262
else
264263
echo "\"pppwn\":false,"
@@ -310,6 +309,8 @@ case "$task" in
310309
/etc/init.d/pw stop
311310

312311
echo "{"
312+
echo "\"retry\":\"$retry\","
313+
echo "\"sleep\":\"$sleep\","
313314
echo "\"path\":\"$path\","
314315
echo "\"autorun\":$auto,"
315316
echo "\"adapter\":\"$adapter\","
@@ -335,6 +336,8 @@ case "$task" in
335336
fi
336337

337338
echo "{"
339+
echo "\"retry\":\"$retry\","
340+
echo "\"sleep\":\"$sleep\","
338341
echo "\"path\":\"$path\","
339342
echo "\"autorun\":$auto,"
340343
echo "\"adapter\":\"$adapter\","
@@ -350,45 +353,12 @@ case "$task" in
350353
echo "Content-Type: application/json"
351354
echo ""
352355

353-
rm_files
354-
355-
"$(opkg update && opkg install rp-pppoe-common rp-pppoe-server)"
356-
wait
357-
358-
mkdir /tmp/PPPwn_ow /www/pppwn
359-
"$(wget -O /tmp/pw.tar https://raw.githubusercontent.com/CodeInvers3/codeinvers3.github.io/refs/heads/master/files/PPPwn_ow.tar &)"
356+
/tmp/updater.sh
360357
wait
361358

362-
"$(tar -xvf /tmp/pw.tar -C /tmp/PPPwn_ow && rm /tmp/pw.tar)"
363-
mv -f /tmp/PPPwn_ow/etc/config/* /etc/config
364-
mv -f /tmp/PPPwn_ow/etc/init.d/* /etc/init.d
365-
mv -f /tmp/PPPwn_ow/etc/ppp/* /etc/ppp
366-
mv -f /tmp/PPPwn_ow/stage1 /root
367-
mv -f /tmp/PPPwn_ow/stage2 /root
368-
mv -f /tmp/PPPwn_ow/version /root
369-
mv -f /tmp/PPPwn_ow/www/* /www/pppwn &
370-
wait
371-
rm -r /tmp/PPPwn_ow
372-
chmod +x /etc/init.d/pw /etc/init.d/pppoe-server /www/pppwn/cgi-bin/pw.cgi
373-
374-
if uci get uhttpd.pppwn > /dev/null 2>&1; then
375-
if [ "$(uci get uhttpd.pppwn)" = "uhttpd" ]; then
376-
uci set uhttpd.pppwn=uhttpd
377-
uci set uhttpd.pppwn.listen_http='81'
378-
uci set uhttpd.pppwn.home='/www/pppwn'
379-
uci set uhttpd.pppwn.cgi_prefix='/cgi-bin'
380-
uci set uhttpd.pppwn.script_timeout='90'
381-
uci set uhttpd.pppwn.network_timeout='60'
382-
uci set uhttpd.pppwn.tcp_keepalive='1'
383-
uci add_list uhttpd.pppwn.interpreter='.sh=/bin/sh'
384-
uci add_list uhttpd.pppwn.interpreter='.cgi=/bin/sh'
385-
uci commit uhttpd
386-
/etc/init.d/uhttpd restart &
387-
wait
388-
fi
389-
fi
390-
391359
echo "{\"output\":\"Update completed\"}"
360+
361+
exit 0
392362

393363
;;
394364
"remove")
@@ -423,6 +393,8 @@ case "$task" in
423393
fi
424394
echo "}"
425395

396+
exit 0
397+
426398
;;
427399
"payloads")
428400

0 commit comments

Comments
 (0)