Routing restoration relocation & language auto fix.
Moved the routes restoring code & forwarding to the proper unset function. Refactored some code in set_lang. that should only happen when auto is off.
This commit is contained in:
parent
2602de8738
commit
f4ad6b8531
|
@ -753,6 +753,24 @@ function captive_portal_generic() {
|
|||
</html>" > "$FLUXIONWorkspacePath/captive_portal/index.html"
|
||||
}
|
||||
|
||||
function captive_portal_unset_routes() {
|
||||
if [ -f "$FLUXIONWorkspacePath/iptables-rules" ];then
|
||||
iptables-restore < "$FLUXIONWorkspacePath/iptables-rules" &> $FLUXIONOutputDevice
|
||||
sandbox_remove_workfile "$FLUXIONWorkspacePath/iptables-rules"
|
||||
else
|
||||
iptables --flush
|
||||
iptables --table nat --flush
|
||||
iptables --delete-chain
|
||||
iptables --table nat --delete-chain
|
||||
fi
|
||||
|
||||
# Restore system's original forwarding state
|
||||
if [ -f "$FLUXIONWorkspacePath/ip_forward" ]; then
|
||||
sysctl -w net.ipv4.ip_forward=$(cat "$FLUXIONWorkspacePath/ip_forward") &> $FLUXIONOutputDevice
|
||||
sandbox_remove_workfile "$FLUXIONWorkspacePath/ip_forward"
|
||||
fi
|
||||
}
|
||||
|
||||
# Set up DHCP / WEB server
|
||||
# Set up DHCP / WEB server
|
||||
function captive_portal_set_routes() {
|
||||
|
@ -762,9 +780,14 @@ function captive_portal_set_routes() {
|
|||
# Add a route to the virtual gateway interface.
|
||||
route add -net $VIGWNetwork.0 netmask 255.255.255.0 gw $VIGWAddress
|
||||
|
||||
# Save the system's routing state to restore later.
|
||||
cp "/proc/sys/net/ipv4/ip_forward" "$FLUXIONWorkspacePath/ip_forward"
|
||||
|
||||
# Activate system IPV4 packet routing/forwarding.
|
||||
sysctl -w net.ipv4.ip_forward=1 &>$FLUXIONOutputDevice
|
||||
|
||||
iptables-save > "$FLUXIONWorkspacePath/iptables-rules"
|
||||
|
||||
iptables --flush
|
||||
iptables --table nat --flush
|
||||
iptables --delete-chain
|
||||
|
@ -836,6 +859,8 @@ function stop_attack() {
|
|||
kill $FLUXIONDHCP &> $FLUXIONOutputDevice
|
||||
fi
|
||||
|
||||
captive_portal_unset_routes
|
||||
|
||||
ap_stop
|
||||
}
|
||||
|
||||
|
|
40
fluxion.sh
40
fluxion.sh
|
@ -99,20 +99,20 @@ function exitmode() {
|
|||
airmon-ng stop $WIMonitor &> $FLUXIONOutputDevice
|
||||
fi
|
||||
|
||||
if [ "`cat /proc/sys/net/ipv4/ip_forward`" != "0" ]; then
|
||||
echo -e "$CWht[$CRed-$CWht] $FLUXIONDisablingPacketForwardingNotice$CClr"
|
||||
sysctl -w net.ipv4.ip_forward=0 &> $FLUXIONOutputDevice
|
||||
fi
|
||||
#if [ "`cat /proc/sys/net/ipv4/ip_forward`" != "0" ]; then
|
||||
# echo -e "$CWht[$CRed-$CWht] $FLUXIONDisablingPacketForwardingNotice$CClr"
|
||||
# sysctl -w net.ipv4.ip_forward=0 &> $FLUXIONOutputDevice
|
||||
#fi
|
||||
|
||||
echo -e "$CWht[$CRed-$CWht] $FLUXIONDisablingCleaningIPTablesNotice$CClr"
|
||||
if [ ! -f "$FLUXIONWorkspacePath/iptables-rules" ];then
|
||||
iptables --flush
|
||||
iptables --table nat --flush
|
||||
iptables --delete-chain
|
||||
iptables --table nat --delete-chain
|
||||
else
|
||||
iptables-restore < "$FLUXIONWorkspacePath/iptables-rules"
|
||||
fi
|
||||
#echo -e "$CWht[$CRed-$CWht] $FLUXIONDisablingCleaningIPTablesNotice$CClr"
|
||||
#if [ ! -f "$FLUXIONWorkspacePath/iptables-rules" ];then
|
||||
# iptables --flush
|
||||
# iptables --table nat --flush
|
||||
# iptables --delete-chain
|
||||
# iptables --table nat --delete-chain
|
||||
#else
|
||||
# iptables-restore < "$FLUXIONWorkspacePath/iptables-rules"
|
||||
#fi
|
||||
|
||||
echo -e "$CWht[$CRed-$CWht] $FLUXIONRestoringTputNotice$CClr"
|
||||
tput cnorm
|
||||
|
@ -413,19 +413,17 @@ function set_resolution() {
|
|||
}
|
||||
|
||||
function set_language() {
|
||||
iptables-save > "$FLUXIONWorkspacePath/iptables-rules"
|
||||
|
||||
local languages=(language/*.lang)
|
||||
languages=(${languages[@]/language\//})
|
||||
languages=(${languages[@]/.lang/})
|
||||
|
||||
if [ ! $FLUXIONAuto ]; then
|
||||
local languages=(language/*.lang)
|
||||
languages=(${languages[@]/language\//})
|
||||
languages=(${languages[@]/.lang/})
|
||||
|
||||
io_query_choice "Select your language" languages[@]
|
||||
|
||||
source "$FLUXIONPath/language/$IOQueryChoice.lang"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue