Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ################################################################################################################################################
- #
- # Title: DroidXTools
- # Author: Wolf Syntax (Jayson D. Alpe)
- # Desription: A tools for modifying MAC Address and DNS, a tool also for viewing WiFi saved password and creating backup of build.prop file
- # Instruction:
- #
- # Download Terminal Emulator and DroidEdit
- # To execute this file: sh DroidXTools
- #
- #
- # (c) Wolf Syntax 2016. All rights reserved.
- #
- #
- ################################################################################################################################################
- v=$1
- root_dir=""
- root_level=-1;
- cur_dir=`pwd`
- flag=0
- #WiFi
- wifi_mac=""
- prod_info="productinfo/wifimac.txt"
- nstat="data/system/netstats/"
- #LoginDetails
- usrname=""
- passwrd=""
- session_id=0
- #Module for restarting device
- shutdown()
- {
- reboot;
- }
- #Module for checking if system directory exist
- checkDir()
- {
- if [[ -d "system" ]]; then
- flag=1;
- fi
- }
- #Module for getting Root level directory (Depth)
- getRLevel()
- {
- until [[ $flag -eq 1 ]]; do #while flag is 0
- checkDir;
- cd ..
- let root_level++; #increment while system dir not found
- done
- ctr=0
- while [[ $ctr -lt $root_level ]]; do
- root_dir="$root_dir../"
- let ctr++;
- done
- }
- #Module for Setting up DNS
- setDNS()
- {
- echo "======================================"
- echo "======== < DNS Changer Tool > ========"
- echo "======================================"
- echo -e "\nList of available DNS:"
- echo -e " \n1\tGoogle DNS\n2\tOpenDNS\n3\tLevel 3\n4\tComodo\n5\tNorton Connect Safe\n6\tSmartViper\n7\tFreeDNS\n8\tYandex\n9\tHurricane Electric\nC\tCustom DNS\n"
- options=0
- wlan_dns1=""
- wlan_dn2=""
- dns_type="";
- confirm="";
- echo -ne "Choose from the option: "
- read options
- bool=0;
- case $options in
- "1" ) wlan_dns1="8.8.8.8"; wlan_dns2="8.8.4.4";dns_type="Google DNS";;
- "2" ) wlan_dns1="208.67.222.222"; wlan_dns2="208.67.220.220";dns_type="OpenDNS";;
- "3" ) wlan_dns1="209.244."; wlan_dns2=""dns_type="Level 3";;
- "4" ) wlan_dns1="8.26.56.26"; wlan_dns2="8.20.247.20"; dns_type="Comodo";;
- "5" ) wlan_dns1="199.85.126.10"; wlan_dns2="199.85.127.10";dns_type="Norton Connect Safe";;
- "6" ) wlan_dns1="208.76.50.50"; wlan_dns2="208.76.51.51";dns_type="SmartViper";;
- "7" ) wlan_dns1="37.235.1.174"; wlan_dns2="37.235.1.177";dns_type="FreeDNS";;
- "8" ) wlan_dns1="77.88.8.8"; wlan_dns2="77.88.8.1";dns_type="Yandex";;
- "9" ) wlan_dns1="74.82.42.42"; wlan_dns2="74.82.42.42";dns_type="Hurricane Electric";;
- "C" ) checkCustomIP; dns_type="Custom DNS" bool=1;;
- *) echo "Invalid option!"; bool=1;;
- esac
- if [[ $bool -eq 0 ]]; then
- setprop dhcp.wlan0.dns1 $wlan_dns1;
- setprop dhcp.wlan0.dns2 $wlan_dns2;
- setprop net.dns1 $wlan_dns1;
- setprop net.dns2 $wlan_dns2;
- echo "Applying $dns_type successfully!";
- fi
- }
- #Set custom IP for DNS
- checkCustomIP()
- {
- dns_1=""
- dns_2=""
- echo -ne "Primary DNS: "
- read dns_1;
- echo -ne "Secondary DNS: "
- read dns_2;
- if [[ $dns_1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ && $dns_2 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
- OIFS=$IFS
- IFS='.'
- dns_1=($dns_1)
- IFS=$OIFS
- checker=0;
- if [[ ${dns_1[0]} -le 255 && ${dns_1[1]} -le 255 && ${dns_1[2]} -le 255 && ${dns_1[3]} -le 255 ]]; then
- echo "Applying Primary Custom DNS";
- setprop dhcp.wlan0.dns1 $wlan_dns1;
- setprop net.dns1 $wlan_dns1;
- else
- echo "Primary DNS Invalid! i.e. 255.255.255.255"
- fi
- OIFS=$IFS
- IFS='.'
- dns_2=($dns_2)
- IFS=$OIFS
- if [[ ${dns_2[0]} -le 255 && ${dns_2[1]} -le 255 && ${dns_2[2]} -le 255 && ${dns_2[3]} -le 255 ]]; then
- echo "Applying Secondary Custom DNS";
- setprop dhcp.wlan0.dns2 $wlan_dns2;
- setprop net.dns2 $wlan_dns2;
- else
- echo "Invalid format! i.e. 255.255.255.255"
- fi
- else
- if [[ $dns_1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
- echo -ne ""
- else
- echo "Invalid Primary DNS"
- fi
- if [[ $dns_2 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
- echo -ne ""
- else
- echo "Invalid Secondary DNS"
- fi
- fi
- }
- #MAC Changer Module
- setMAC()
- {
- wifi_mac="$root_dir$prod_info"
- new_mac="00:00:00:00:00:00";
- cd $cur_dir
- echo "Current Directory: $cur_dir"
- #echo "Root DIR $root_dir"
- echo -ne "Enter custom MAC Address (BSSID) : "
- read new_mac
- if [[ $new_mac =~ ^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$ ]]; then
- cd $root_dir
- echo "Creating backup of wifimac.txt"
- cp "productinfo/wifimac.txt" "$cur_dir/wifimac.txt"
- echo "$new_mac" > "productinfo/wifimac.txt"
- echo "MAC Address modified!"
- fi
- }
- #Create a backup of build.prop
- cloneProp()
- {
- cd $cur_dir
- cd $root_dir
- cd system
- echo "Cloning Build.prop to $cur_dir"
- cp build.prop $cur_dir
- }
- #Clear data usage module : Settings > Data Usage
- clearData()
- {
- cd $cur_dir
- echo -ne "Clearing Data Usage"
- cd $root_dir
- cd data/system/netstats/
- if [[ `ls -A` ]]; then
- rm *
- fi
- echo -ne " Successfully!\n"
- }
- #Module for displaying saved WiFi password
- sniff()
- {
- cd $cur_dir
- cd $root_dir
- cd data/misc/wifi
- echo "WiFi Password(s) "
- if [[ -f wpa_supplicant.conf ]]; then
- echo "WPA Security"
- cat wpa_supplicant.conf | grep psk
- fi
- if [[ -f wep_supplicant.conf ]]; then
- echo "WEP Security"
- cat wep_supplicant.conf | grep psk
- fi
- }
- #Login module
- verify()
- {
- echo -ne "Username: "
- read usrname
- echo -ne "Password: "
- read passwrd
- curr_dir=`pwd`
- if [[ $usrname == "root" && $passwrd == "toor" ]]; then
- echo "Login successful!"
- session_id=1
- if [[ $session_id -eq 1 ]]; then
- main;
- fi
- echo "$session_id" > session.log
- else
- echo "Invalid credentials"
- session_id=0
- echo "0" > session.log
- fi
- }
- #Module for displaying script version
- version()
- {
- echo "DroidXTools v1.0.3"
- echo "Developed by Wolf Syntax"
- }
- main()
- {
- # echo "Main module"
- cur_dir=`pwd`
- clear
- getRLevel;
- echo -ne "\t\t DroidXTools\n\t\tversion 1.0.3\n\t Developed by Wolf Syntax\n"
- echo -ne "================================================\n"
- echo -e "-build\tClone Build.prop\n-clear\tClear Data Usage\n-mac\tMAC Changer\n-wifi\tView WiFi Password\n-r\tReboot Device\n-v\tCheck Version\nexit\tClose session\n"
- proc="";
- echo -ne "================================================\n"
- echo "Note: Please grant as super user. command: su"
- echo -ne "Choose process: "
- read proc;
- case $proc in
- "-build" ) cloneProp;;
- "-clear" ) clearData;;
- "-mac" ) setMAC;;
- "-wifi" ) sniff;;
- "-r" ) shutdown;;
- "-v" ) version;;
- "exit" ) cd $cur_dir; echo "0" > session.log; exit;;
- * ) echo "Invalid option!";;
- esac
- cd $cur_dir
- # clearData
- # cloneProp;
- # setMAC;
- # setDNS;
- }
- if [[ -f session.log ]]; then
- session_id=$(< session.log);
- if [[ session_id -eq 0 ]]; then
- verify;
- else
- main;
- fi
- else
- verify;
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement