Created
December 24, 2022 04:42
-
-
Save Geofferey/bcb4c96ed24e72cfdc65f84dfb41d79a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Designed by: | |
# Geofferey for OmniHax0r ROM | |
# Run in chroot to bypass carrier + androids builtin resolver | |
SCRIPTDIR=${0%/*} | |
CONF=/reserve/.conf/dnsmasq/dnsmasq.conf | |
DNSMASQ_CONF=/etc/dnsmasq.conf | |
INSTALLED=/opt/.bootdebi/.dnsmasq | |
RESOLV_CONF=/etc/real_resolv.conf | |
if ! [ -d /opt/.bootdebi ]; then | |
mkdir -p /opt/.bootdebi | |
fi | |
if ! [ -e ${INSTALLED} ]; then | |
cp ${CONF} ${DNSMASQ_CONF} | |
echo "## DO NOT DELETE!!!" > ${INSTALLED} | |
echo "# or "${DNSMASQ_CONF}" will be overwritten!" >> ${INSTALLED} | |
chmod 000 ${INSTALLED} | |
fi | |
if ! [ -e ${RESOLV_CONF} ]; then | |
echo "# Created by: " > ${RESOLV_CONF} | |
echo "# ${SCRIPTDIR}/00dnsmasq" >> ${RESOLV_CONF} | |
echo "search netlabwork.us" >> ${RESOLV_CONF} | |
echo "nameserver 127.0.0.1" >> ${RESOLV_CONF} | |
chmod 0644 ${RESOLV_CONF} | |
ln -sf ${RESOLV_CONF} /etc/resolv.conf | |
fi | |
## Space delimited list of IPs/NETs to redirect to local dnsmasq fpr resolution | |
IPV4_DNS_OVERRIDES="127.0.0.1 192.0.0.1 192.0.0.2 192.168.1.254 192.168.1.1 192.168.0.0/16 10.1.2.1/24 10.177.0.34 10.177.0.210 208.54.144.202 208.54.144.217" | |
IPV6_DNS_OVERRIDES="::1 fd00:976a::9 fd00:976a::10 2600:6c50::/32" | |
## Kill bootdebis in-built resolv.conf updater | |
killall bootdebi_resolv | |
## Start the service | |
service dnsmasq restart | |
## Override Some DNS for Android | |
# Fix for broken resolution on VPN | |
# Stops Leaks if desired | |
for ADDR in ${IPV4_DNS_OVERRIDES}; do | |
iptables -t nat -I OUTPUT -p udp -d ${ADDR} --dport 53 -j DNAT --to-destination 127.0.0.1:5353 | |
iptables -t nat -I OUTPUT -p tcp -d ${ADDR} --dport 53 -j DNAT --to-destination 127.0.0.1:5353 | |
done | |
unset ADDR | |
for ADDR in ${IPV6_DNS_OVERRIDES}; do | |
ip6tables -t nat -I OUTPUT -p udp -d ${ADDR} --dport 53 -j DNAT --to-destination [::1]:5353 | |
ip6tables -t nat -I OUTPUT -p tcp -d ${ADDR} --dport 53 -j DNAT --to-destination [::1]:5353 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment