Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # mv /system/bin/dnsmasq /system/bin/dnsmasq.bin
- #!/system/bin/sh
- OLD_SUBNET='192.168.43'
- NEW_SUBNET='192.168.1'
- WIFI_INTERFACE='wlan0'
- LOCAL_TABLE='97'
- export PATH=/system/bin
- # delete old route, add new
- ip route del ${OLD_SUBNET}.0/24 dev ${WIFI_INTERFACE} table $LOCAL_TABLE
- ip route add ${NEW_SUBNET}.0/24 dev ${WIFI_INTERFACE} table $LOCAL_TABLE
- # set new IP address on Wi-Fi interface
- ip address add ${NEW_SUBNET}.1/24 dev $WIFI_INTERFACE
- # inject new subnet in hard-coded arguments received from netd
- set -- $(printf '%s' "$*" | sed 's/'${OLD_SUBNET}'/'${NEW_SUBNET}'/g')
- unset OLD_SUBNET NEW_SUBNET
- # execute original binary with new arguments
- exec dnsmasq.bin $*
- ~# RULES="$(ip rule | grep -vE 'unreachable|local')"
- ~# echo "$RULES"
- ~# for t in $(echo "$RULES" | awk '{print $NF}' | uniq); do ip r s table $t; done
- # execute binaries from /system/bin
- allow netd system_file dir { read open getattr search }
- allow netd system_file file { read gettattr open execute execute_no_trans }
- # execute /system/bin/sh
- allow netd shell_exec file { read getattr open execute execute_no_trans }
- # execute /system/bin/toolbox and its applets
- allow netd toolbox_exec file { read gettattr open execute execute_no_trans }
- # configure RPDB rules / routing tables
- allow netd netd capability { sys_admin }
- ~# chown 0.0 /system/bin/dnsmasq*
- ~# chmod 0755 /system/bin/dnsmasq*
- ~# chcon u:object_r:dnsmasq_exec:s0 /system/bin/dnsmasq*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement