Skip to content

Commit be7588c

Browse files
committed
update
1 parent 6fbd525 commit be7588c

File tree

1 file changed

+49
-85
lines changed

1 file changed

+49
-85
lines changed

customize_firmware.sh

+49-85
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/bin/sh
22
clear
3-
release=$(cat /etc/openwrt_release | grep "DISTRIB_RELEASE" | cut -f2 -d '=')
4-
revision=$(cat /etc/openwrt_release | grep "DISTRIB_REVISION" | cut -f2 -d '=')
3+
mv /www/index.html /www/index.old
4+
release=$(grep "DISTRIB_RELEASE" /etc/openwrt_release | cut -f2 -d '=')
5+
revision=$(grep "DISTRIB_REVISION" /etc/openwrt_release | cut -f2 -d '=')
56
revision=${revision::-1}
67
release=${release::-1}
78
revision=${revision:1}
89
release=${release:1}
9-
main_release=$(cat /etc/openwrt_release | grep "DISTRIB_RELEASE" | cut -f2 -d '=' | cut -f1 -d '.' | cut -c 2-)
10-
architecture=$(cat /etc/openwrt_release | grep "ARCH" | cut -f2 -d '=')
11-
target=$(cat /etc/openwrt_release | grep "TARGET" | cut -f2 -d '=')
10+
main_release=$(grep "DISTRIB_RELEASE" /etc/openwrt_release | cut -f2 -d '=' | cut -f1 -d '.' | cut -c 2-)
11+
architecture=$(grep "ARCH" /etc/openwrt_release | cut -f2 -d '=')
12+
target=$(grep "TARGET" /etc/openwrt_release | cut -f2 -d '=')
1213
architecture=${architecture::-1}
1314
target=${target::-1}
1415
architecture=${architecture:1}
1516
target=${target:1}
1617

18+
1719
LOCALADDRESS="127.192.0.1/10"
1820

1921
actLoop=$(ifconfig | grep '^l\w*' -m 1 | cut -f1 -d ' ')
@@ -29,7 +31,7 @@ if [ ! -z "$1" ]
2931
fi
3032
INET_GW_org=$INET_GW
3133
echo
32-
read -p 'Please give me the WAN-IP (Gateway/Router): ['$INET_GW'] ' INET_GW
34+
#read -p 'Please give me the WAN-IP (Gateway/Router): ['$INET_GW'] ' INET_GW
3335
echo
3436
if [ "$INET_GW" = "" ]
3537
then
@@ -90,39 +92,21 @@ fi
9092

9193
LAN_org=$LAN
9294

93-
read -p 'Type the LAN-IP (Internal Network): ['$( echo $LAN )'] ' LAN
95+
#read -p 'Type the LAN-IP (Internal Network): ['$( echo $LAN )'] ' LAN
9496
if [ "$LAN" = "" ]
9597
then
9698
LAN=$LAN_org
9799
fi
98100

101+
99102
check_hash() {
100103
local file=$1
101104
echo "$EXPECTED_HASH $file" | sha256sum -c
102105
}
103106

104-
check_download() {
105-
local URL=$1
106-
local EXPECTED_HASH=$2
107-
local OUTPUT_FILE=$3
108-
109-
wget --waitretry=10 -t 5 -O "/root/$OUTPUT_FILE" "$URL"
110-
111-
if [[ $? -eq 0 ]]; then
112-
if check_hash "$OUTPUT_FILE"; then
113-
echo "Hash is okay"
114-
break
115-
else
116-
# echo "Hash-Error"
117-
rm -f "$OUTPUT_FILE"
118-
fi
119-
fi
120-
121-
}
122-
123107
customize_firmware() {
124-
FILE=/www/luci-static/resources/view/dashboard/css/c*.css
125-
if [ ! -f "$FILE" ]
108+
FILE1=/www/luci-static/resources/view/dashboard/css/c*.css
109+
if [ ! -f "$FILE1" ]
126110

127111
then
128112
customize_firmware_sub
@@ -166,7 +150,6 @@ uci set luci.diag.route='brave.com'
166150
uci set luci.diag.dns='bible4u2lvhacg4b3to2e2veqpwmrc2c3tjf2wuuqiz332vlwmr4xbad.onion'
167151
uci set network.wan6.disabled='1'
168152
uci set wireless.default_radio0.ssid='CyberSec-Box'
169-
uci set wireless.default_radio1.ssid='CyberSec-Box'
170153
uci set uhttpd.main.index_page='index.php'
171154
uci set uhttpd.main.interpreter='.php=/usr/bin/php-cgi'
172155
processes=$(uci commit && reload_config)
@@ -219,7 +202,6 @@ DEVICE_MANUFACTURER='@CyberAndi'
219202
DEVICE_MANUFACTURER_URL='https://cyberandi.tumblr.com/'
220203
DEVICE_PRODUCT='CyberSecurity-Box'
221204
DEVICE_REVISION='v0.95'
222-
223205
EOF
224206

225207
cat << EOF > /etc/sysupgrade.conf
@@ -236,9 +218,9 @@ EOF
236218

237219
datum=$(date +"%y%d%m%H%M")
238220
echo $datum
239-
sleep 30
240-
FILE=/www/luci-static/bootstrap/OCR-A.ttf
241-
if [ ! -f "$FILE" ]
221+
sleep 20
222+
FILE2=/www/luci-static/bootstrap/OCR-A.ttf
223+
if [ ! -f "$FILE2" ]
242224
then
243225
if [ "$(ls /www/luci-static/bootstrap/c*.css)" != "" ]
244226
then
@@ -251,43 +233,29 @@ if [ ! -f "$FILE" ]
251233
processes=$(rm /www/luci-static/resources/view/dashboard/css/c*.css)
252234
wait $processes
253235
fi
254-
#process=$(wget --waitretry=10 -t 5 -O /root/openWRT23_install.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh)
255-
#wait $process
236+
process0=$(wget --waitretry=10 -t 5 -O /root/openWRT23_install.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh)
237+
wait $process0
238+
processes2=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/index.php -P /www/)
239+
wait $processes2
240+
processes3=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/output.php -P /www/)
241+
wait $processes3
242+
processes4=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberSecurity-Box.png -P /www/luci-static/bootstrap/)
243+
wait $processes4
244+
processes5=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberSecurity-Box.svg -P /www/luci-static/bootstrap/)
245+
wait $processes5
246+
processes6=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberAndi.svg -P /www/luci-static/bootstrap/)
247+
wait $processes6
248+
processes7=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/cascade.css -P /www/luci-static/bootstrap/)
249+
wait $processes7
250+
processes8=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/OCR-A.ttf -P /www/luci-static/bootstrap/)
251+
wait $processes8
252+
processes9=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/OCR-A.woff -P /www/luci-static/bootstrap/)
253+
wait $processes9
256254

257-
if [ "$(ls /www/luci-static/bootstrap/logo.svg)" != "" ]
258-
then
259-
processes=$(rm /www/luci-static/bootstrap/logo*.*)
260-
wait $processes
261-
fi
262-
263-
process=$(check_download "https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh" "f9a60bb40fe8cc535e3d1a321b52cb2c76eaa80ffbf4884e43eeb0f7b910a2d2" "openWRT23_install.sh")
264-
wait $process
265-
process1=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/logo.svg -P /www/)
266-
wait $process1
267-
process2=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/index.php -P /www/)
268-
wait $process2
269-
process3=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/output.php -P /www/)
270-
wait $process3
271-
process4=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberSecurity-Box.png -P /www/luci-static/bootstrap/)
272-
wait $process4
273-
process5=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberSecurity-Box.svg -P /www/luci-static/bootstrap/)
274-
wait $process5
275-
process6=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/CyberAndi.svg -P /www/luci-static/bootstrap/)
276-
wait $process6
277-
process7=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/cascade.css -P /www/luci-static/bootstrap/)
278-
wait $process7
279-
process8=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/OCR-A.ttf -P /www/luci-static/bootstrap/)
280-
wait $process8
281-
process9=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/OCR-A.woff -P /www/luci-static/bootstrap/)
282-
wait $process9
283-
process10=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/logo.svg -P /www/luci-static/bootstrap/)
284-
wait $process10
285-
process11=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/luci-static/bootstrap/logo_48.png -P /www/luci-static/bootstrap/)
286-
wait $process11
287255
fi
288256

289-
FILE1=/www/luci-static/resources/view/dashboard/css/c*.css
290-
if [ ! -f "$FILE" ]
257+
FILE3=/www/luci-static/resources/view/dashboard/css/c*.css
258+
if [ ! -f "$FILE3" ]
291259
then
292260
mv /www/luci-static/resources/view/status/include/*_dsl.js /www/luci-static/resources/view/status/include/10_dsl.js
293261
mv /www/luci-static/resources/view/status/include/*_ports.js /www/luci-static/resources/view/status/include/11_ports.js
@@ -308,18 +276,18 @@ echo
308276
}
309277

310278
create_hotspot(){
311-
FILE=/www/CaptivePortal/pic
312-
uci set wireless.radio0=wifi-device
279+
FILE4=/www/CaptivePortal/pic
280+
uci set wireless.radio0=wifi-device
313281
uci set wireless.radio0.type='mac80211'
314282
uci set wireless.radio0.path='platform/soc/a000000.wifi'
315283
uci set wireless.radio0.htmode='HT20'
316284
uci set wireless.radio0.country='DE'
317285
uci set wireless.radio0.channel='auto'
318286
uci set wireless.radio0.hwmode='11n'
319-
uci delete wireless.radio0.disabled >> install.log
320-
processes=$(uci commit && reload_config)
287+
uci delete wireless.radio0.disabled >> install.log
288+
processes=$(uci commit && reload_config)
321289
wait $processes >> install.log
322-
if [ ! -d "$FILE" ]
290+
if [ ! -d "$FILE4" ]
323291
then
324292
create_hotspot_sub
325293
fi
@@ -336,8 +304,8 @@ mkdir -p /www/CaptivePortal
336304
mkdir -p /www/generate_204
337305
mkdir -p /www/CaptivePortal/pic
338306

339-
processe=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/index.htm -P /www/)
340-
wait $processe
307+
processes0=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/index.htm -P /www/)
308+
wait $processes0
341309
processes1=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/captiveportal.htm -O /www/CaptivePortal/index.htm)
342310
wait $processes1
343311
processes2=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/mobile.css -P /www/CaptivePortal/)
@@ -347,8 +315,8 @@ wait $processes3
347315
processes4=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/theme_variable.css -P /www/CaptivePortal/)
348316
wait $processes4
349317
processes5=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/prophetie.htm -P /www/CaptivePortal/)
350-
wait $processes5
351-
processes6=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/OCR-A.ttf -P /www/CaptivePortal/)
318+
#wait $processes5
319+
#processes6=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/OCR-A.ttf -P /www/CaptivePortal/)
352320
wait $processes6
353321
processes7=$(wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/CaptivePortal/OCRAStd.woff -P /www/CaptivePortal/)
354322
wait $processes7
@@ -456,25 +424,21 @@ echo $(date +%d'.'%m'.'%y' '%H':'%M':'%S)' Set uhttpd' >> install.log
456424
set_uhttpd >> install.log
457425

458426
cat << EOF > /etc/rc.local
459-
if [ ! -f /root/openWRT23_install.sh ] && [ ! -f www/luci-static/bootstrap/cascade.css ]
427+
if [ ! -f /root/openWRT23_install.sh ]
460428
then
461429
rm /www/index.html && sleep 20
462-
if [ ! -f /root/customize_firmware.sh ]
463-
then
464-
wget --waitretry=10 -t 5 -O /root/customize_firmware.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/customize_firmware.sh && sh /root/customize_firmware.sh & wait
465-
fi
430+
# wget --waitretry=10 -t 5 -O /root/customize_firmware.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/customize_firmware.sh && sh /root/customize_firmware.sh & wait
466431
wget --waitretry=10 -t 5 -O /root/openWRT23_install.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh
467432
wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/index.php -P /www/
468433
wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/output.php -P /www/
434+
wait
469435
else
470436
rm /root/*.sh
471-
rm /root/*.sh.*
472437
fi
473438
if [ ! -f /root/run ]
474439
then
475-
echo $(date) > /root/run
476-
rm /root/customize_firmware.sh
477-
exit 0
440+
echo "'"$(date)"'" > /root/run
441+
exit 0
478442
fi
479443
rm /etc/rc.local
480444
echo "" > /www/phpinfo.php

0 commit comments

Comments
 (0)