Skip to content

Commit 6fbd525

Browse files
committed
add network config
1 parent 2700d5c commit 6fbd525

File tree

1 file changed

+87
-4
lines changed

1 file changed

+87
-4
lines changed

Install/customize_firmware.sh

+87-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,89 @@ architecture=${architecture:1}
1616
target=${target:1}
1717

1818

19+
LOCALADDRESS="127.192.0.1/10"
20+
21+
actLoop=$(ifconfig | grep '^l\w*' -m 1 | cut -f1 -d ' ')
22+
actEth=$(ifconfig | grep '^e\w*' -m 1 | cut -f1 -d ' ')
23+
actWlan=$(ifconfig | grep '^w\w*' -m 1 | cut -f1 -d ' ')
24+
25+
#Internet Gateway
26+
if [ ! -z "$1" ]
27+
then
28+
INET_GW=$1
29+
else
30+
INET_GW=$(ip route | grep default | cut -f3 -d ' ')
31+
fi
32+
INET_GW_org=$INET_GW
33+
echo
34+
#read -p 'Please give me the WAN-IP (Gateway/Router): ['$INET_GW'] ' INET_GW
35+
echo
36+
if [ "$INET_GW" = "" ]
37+
then
38+
INET_GW=$INET_GW_org
39+
fi
40+
41+
WAN_ip=$(echo $INET_GW | cut -f1 -d '.')
42+
WAN_ip=$WAN_ip'.'$(echo $INET_GW | cut -f2 -d '.')
43+
WAN_ip=$WAN_ip'.'$(echo $INET_GW | cut -f3 -d '.')'.250'
44+
45+
WAN_broadcast=$(echo $INET_GW | cut -f1 -d '.')
46+
WAN_broadcast=$WAN_broadcast'.'$(echo $INET_GW | cut -f2 -d '.')
47+
WAN_broadcast=$WAN_broadcast'.'$(echo $INET_GW | cut -f3 -d '.')'.255'
48+
49+
WAN_MOBILE_ip=$(echo $INET_GW | cut -f1 -d '.')
50+
WAN_MOBILE_ip=$WAN_ip'.'$(echo $INET_GW | cut -f2 -d '.')
51+
WAN_MOBILE_ip=$WAN_ip'.'$(echo $INET_GW | cut -f3 -d '.')'.251'
52+
53+
WAN_MOBILE_broadcast=$(echo $INET_GW | cut -f1 -d '.')
54+
WAN_MOBILE_broadcast=$WAN_broadcast'.'$(echo $INET_GW | cut -f2 -d '.')
55+
WAN_MOBILE_broadcast=$WAN_broadcast'.'$(echo $INET_GW | cut -f3 -d '.')'.255'
56+
57+
WAN_MOBILE_GW=$(echo $INET_GW | cut -f1 -d '.')
58+
WAN_MOBILE_GW=$WAN_ip'.'$(echo $INET_GW | cut -f2 -d '.')
59+
WAN_MOBILE_GW=$WAN_ip'.'$(echo $INET_GW | cut -f3 -d '.')'.253'
60+
61+
62+
#complet Internet
63+
Internet="0.0.0.0/0"
64+
65+
#all Adresses
66+
all_IP="0.0.0.0"
67+
all_IP6="[::]"
68+
69+
#Access to Server
70+
ACCESS_SERVER=$(echo $($(echo ip addr show dev $(echo $actEth | cut -f1 -d' ')) | grep inet | cut -f6 -d ' ' ) | cut -f1 -d ' ' )
71+
72+
#Lokal LAN
73+
if [ ! -z "$2" ]
74+
then
75+
LAN=$2
76+
else
77+
LAN=$(echo $($(echo ip addr show dev $(echo $actEth | cut -f1 -d' ')) | grep 'inet ' | cut -f6 -d ' ' ) | cut -f1 -d ' ' | cut -f1 -d'/' )
78+
fi
79+
80+
IPv6=""
81+
IPv6=$(echo $(echo $($(echo ip addr show dev $(echo $actEth | cut -f1 -d' ')) | grep inet | cut -f6 -d ' ' ) | cut -f1 -d ' ' ) | cut -c 5-6)
82+
83+
if [ "$IPv6" = "::" ]
84+
then
85+
LAN=''
86+
fi
87+
88+
if [ "$LAN" = "" ]
89+
then
90+
LAN='192.168.1.1'
91+
fi
92+
93+
LAN_org=$LAN
94+
95+
#read -p 'Type the LAN-IP (Internal Network): ['$( echo $LAN )'] ' LAN
96+
if [ "$LAN" = "" ]
97+
then
98+
LAN=$LAN_org
99+
fi
100+
101+
19102
check_hash() {
20103
local file=$1
21104
echo "$EXPECTED_HASH $file" | sha256sum -c
@@ -142,13 +225,13 @@ if [ ! -f "$FILE2" ]
142225
if [ "$(ls /www/luci-static/bootstrap/c*.css)" != "" ]
143226
then
144227
processes=$(rm /www/luci-static/bootstrap/c*.css)
145-
wait $processes
228+
wait $processes
146229
fi
147230

148231
if [ "$(ls /www/luci-static/resources/view/dashboard/css/c*.css)" != "" ]
149232
then
150233
processes=$(rm /www/luci-static/resources/view/dashboard/css/c*.css)
151-
wait $processes
234+
wait $processes
152235
fi
153236
process0=$(wget --waitretry=10 -t 5 -O /root/openWRT23_install.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh)
154237
wait $process0
@@ -341,9 +424,9 @@ echo $(date +%d'.'%m'.'%y' '%H':'%M':'%S)' Set uhttpd' >> install.log
341424
set_uhttpd >> install.log
342425

343426
cat << EOF > /etc/rc.local
344-
if [ ! -f /root/openWRT23_install.sh ]
427+
if [ ! -f /root/openWRT23_install.sh ]
345428
then
346-
rm /www/index.html && sleep 20
429+
rm /www/index.html && sleep 20
347430
# 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
348431
wget --waitretry=10 -t 5 -O /root/openWRT23_install.sh https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Install/openWRT23_install.sh
349432
wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/www/index.php -P /www/

0 commit comments

Comments
 (0)