diff --git a/system/bin/energized b/system/bin/energized index ea6cd0a..1cf961e 100644 --- a/system/bin/energized +++ b/system/bin/energized @@ -1,4 +1,4 @@ - #!/system/bin/sh +#!/system/bin/sh # ====================================================================== # Module: Energized Protection # License: CC BY-NC-SA 4.0; https://energized.pro/license @@ -28,7 +28,7 @@ modPath="/sbin/.magisk/modules/energizedprotection/system/bin" # ---------------------------------------- config="$directory/ep.conf" getValue() { sed -n "s|^$1=||p" "$config"; } -getFileSize() {`ls -lah $1 | awk '{print $5}'` } +getFileSize() { ls -lah "$1" | awk '{print $5}'; } # ---------------------------------------- # ---------------------------------------- @@ -47,7 +47,7 @@ C='\e[01;96m' > /dev/null 2>&1; # Cyan LC='\033[1;36m' > /dev/null 2>&1; # printf Cyan W='\e[01;97m' > /dev/null 2>&1; # White LW='\033[1;37m' > /dev/null 2>&1; # printf White -N='\e[0m' > /dev/null 2>&1; # No color +N='\e[0m' > /dev/null 2>&1; # No color NC='\033[0m' > /dev/null 2>&1; # printf No color # ---------------------------------------- @@ -57,10 +57,10 @@ hitWeb() { curl -sf http://go.energized.pro/web > /dev/null 2>&1; } # Mount and unmount system # ---------------------------------------- mountSystem(){ - mount -o remount,rw '/system' 2>> "${Output[0]}" 1>> "${Output[0]}" + mount -o remount,rw '/system' 2>> "${Output[0]}" 1>> "${Output[0]}" } unmountSystem(){ - mount -o remount,ro '/system' 2>> "${Output[0]}" 1>> "${Output[0]}" + mount -o remount,ro '/system' 2>> "${Output[0]}" 1>> "${Output[0]}" } # ---------------------------------------- @@ -72,7 +72,7 @@ hostsGZ=$directory/hosts.gz versionInfo=$directory/cache/version.md versionBackup=$directory/cache/version.md.bck configBackup=$directory/cache/ep.conf.bck -filter=$directory/cache/filter +filter=$directory/cache/filter filterBackup=$directory/cache/filter.bck whitelist=$directory/whitelist blacklist=$directory/blacklist @@ -88,7 +88,7 @@ ptemp=$directory/cache/ptemp stemp=$directory/cache/stemp hostsBackup=$directory/hosts-backup.gz lastUpdated=$(grep "Version Code" $filter 2>/dev/null | sed "s/! Version Code: //") -currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/watchdog.energized.pro//') +currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/watchdog.energized.pro//') # ---------------------------------------- # ---------------------------------------- @@ -103,43 +103,43 @@ date=$(date "+%d.%m.%Y %H:%M:%S") # Check Directory # ---------------------------------------- checkDirectory() { - # Create directory - if [ ! -d $directory ]; then - mkdir -p $directory; + # Create directory + if [ ! -d $directory ]; then + mkdir -p $directory; fi # Create cache folder - if [ ! -d $directory/cache ]; then - mkdir -p $directory/cache; + if [ ! -d $directory/cache ]; then + mkdir -p $directory/cache; fi # Check Blacklist if [ ! -f $directory/blacklist ]; then - touch $directory/blacklist + touch $directory/blacklist fi # Check Whitelist if [ ! -f $directory/whitelist ]; then - touch $directory/whitelist - fi + touch $directory/whitelist + fi # Check Redirectlist if [ ! -f $directory/redirectlist ]; then - touch $directory/redirectlist + touch $directory/redirectlist fi # Check Temp if [ ! -f $directory/cache/temp ]; then - touch $directory/cache/temp + touch $directory/cache/temp fi # Check P Temp if [ ! -f $directory/cache/ptemp ]; then - touch $directory/cache/ptemp + touch $directory/cache/ptemp fi # Check S Temp if [ ! -f $directory/cache/stemp ]; then - touch $directory/cache/stemp + touch $directory/cache/stemp fi # Check Files if [ ! -f $directory/whitelist ] && [ ! -f $directory/redirectlist ] && [ ! -f $directory/blacklist ] && [ ! -f $directory/cache/temp ] && [ ! -f $directory/cache/ptemp ] && [ ! -f $directory/cache/stemp ]; then - return 0 + return 0 else - return 1 + return 1 fi } # ---------------------------------------- @@ -148,7 +148,7 @@ checkDirectory() { # Get file size from URL # ---------------------------------------- urlFileSize() { - curl -sI $1 | grep -i Content-Length | awk '{print $2/1024/1024}' + curl -sI "$1" | grep -i Content-Length | awk '{print $2/1024/1024}' } # ---------------------------------------- @@ -156,32 +156,32 @@ urlFileSize() { # Spin till pid dies # ---------------------------------------- spinPID() { - # Spin var - spin[0]="-" - spin[1]="\\" - spin[2]="|" - spin[3]="/" - # Check for process - while kill -0 $pid 2> /dev/null; do - for i in "${spin[@]}"; do - echo -ne $W"\r["; - echo -ne $Y"$i"; - echo -ne $W"]" $W"$1"; sleep 0.1; - done + # Spin var + spin[0]="-" + spin[1]="\\" + spin[2]="|" + spin[3]="/" + # Check for process + while kill -0 "$pid" 2> /dev/null; do + for i in "${spin[@]}"; do + echo -ne "$W""\r["; + echo -ne "$Y""$i"; + echo -ne "$W""]" "$W""$1"; sleep 0.1; + done done } # ---------------------------------------- # ---------------------------------------- -# Cleanup +# Cleanup # ---------------------------------------- cleanup () { - # Filter - rm -f $directory/filter + # Filter + rm -f $directory/filter } # Cleanup temp files cleanupTemp () { - rm -f $versionInfo $temp $atemp $btemp $ctemp $dtemp $etemp $ltemp $stemp $ptemp + rm -f $versionInfo $temp $atemp $btemp $ctemp $dtemp $etemp $ltemp $stemp $ptemp } # ---------------------------------------- @@ -189,11 +189,11 @@ cleanupTemp () { # Check for config file # ---------------------------------------- checkConfig() { - if [ ! -f $config ]; then - wget --no-check-certificate -q -O $config "https://block.energized.pro/magisk/ep.conf" - checkConfig=$G"✓"$N + if [ ! -f $config ]; then + wget --no-check-certificate -q -O $config "https://block.energized.pro/magisk/ep.conf" + checkConfig=$G"✓"$N else - checkConfig=$R"×"$N + checkConfig=$R"×"$N fi } # ---------------------------------------- @@ -202,29 +202,29 @@ checkConfig() { # Check root permission # ---------------------------------------- checkRoot() { - id="$(id)"; id="${id#*=}"; id="${id%%\(*}"; id="${id%% *}" - if [ "$id" != "0" ] && [ "$id" != "root" ]; then - root=$R"[×]"$N - return 0 - else - root=$G"[✓]"$N - return 1 + id="$(id)"; id="${id#*=}"; id="${id%%\(*}"; id="${id%% *}" + if [ "$id" != "0" ] && [ "$id" != "root" ]; then + root=$R"[×]"$N + return 0 + else + root=$G"[✓]"$N + return 1 fi -} +} # ---------------------------------------- # ---------------------------------------- # Check Other Adblocker # ---------------------------------------- checkAdblockerApp() { - if [ -d /data/data/org.adaway/ ] || [ -d /system/app/org.adaway/ ] || [ -d /system/priv-app/org.adaway/ ]; then - adblockAppName=AdAway - return 1 + if [ -d /data/data/org.adaway/ ] || [ -d /system/app/org.adaway/ ] || [ -d /system/priv-app/org.adaway/ ]; then + adblockAppName=AdAway + return 1 elif [ -d /data/data/ru.dixl0f0s.unifiedhostsmanager/ ] || [ -d /system/app/ru.dixl0f0s.unifiedhostsmanager/ ] || [ -d /system/priv-app/ru.dixl0f0s.unifiedhostsmanager/ ]; then - adblockAppName=UHM - return 1 + adblockAppName=UHM + return 1 else - return 0 + return 0 fi } # ---------------------------------------- @@ -233,61 +233,66 @@ checkAdblockerApp() { # Check internet # ---------------------------------------- checkInternetConnection(){ - wget --no-check-certificate -q --spider -T '2' https://block.energized.pro 2>/dev/null - if [ $? -eq 0 ]; then - return 1 + wget --no-check-certificate -q --spider -T '2' https://block.energized.pro 2>/dev/null + if [ $? -eq 0 ]; then + return 1 else - return 0 + return 0 fi -} +} # ---------------------------------------- # ---------------------------------------- # Check hosts update # ---------------------------------------- checkUpdate() { - checkShell; - checkEP; - #checkInternetConnection - #### Read Config 'checkHostsUpdate=true' - if [ "$(getValue checkHostsUpdate)" == "true" ]; then - #if [ "$checkInternet" == "online" ]; then - ### Check Energized Protection pack - if [ "$autoPack" != "null" ]; then - ## Download Version Info - wget --no-check-certificate -T 3 -q -O $versionInfo https://block.energized.pro/VERSION.md - #grep -q "Version Code" $versionInfo - cp $versionInfo $versionBackup - # Check Filter Info - if [ -f $filter ]; then 2>/dev/null - CURRENT=$(grep "Version Code" $versionInfo) - LAST_UPDATED=$(sed '1q;d' $filter) - if [ "$LAST_UPDATED" != "$CURRENT" ]; then - if [ "$(grep "watchdog.energized.pro" $hosts)" ]; then - eupdate=$G'[ϟ] UPDATE AVAILABLE!'$N - checkUpdatePrint=$G"\r[ϟ] Update: Available.\n"$N + checkShell; + checkEP; + #checkInternetConnection + #### Read Config 'checkHostsUpdate=true' + if [ "$(getValue checkHostsUpdate)" == "true" ]; then + #if [ "$checkInternet" == "online" ]; then + ### Check Energized Protection pack + if [ "$autoPack" != "null" ]; then + ## Download Version Info + wget --no-check-certificate -T 3 -q -O $versionInfo https://block.energized.pro/VERSION.md + #grep -q "Version Code" $versionInfo + cp $versionInfo $versionBackup + # Check Filter Info + if [ -f $filter ]; then 2>/dev/null + CURRENT=$(grep "Version Code" $versionInfo) + LAST_UPDATED=$(sed '1q;d' $filter) + if [ "$LAST_UPDATED" != "$CURRENT" ]; then + if [ "$(grep "watchdog.energized.pro" "$hosts")" ]; then + eupdate=$G'[ϟ] UPDATE AVAILABLE!'$N + checkUpdatePrint=$G"\r[ϟ] Update: Available.\n"$N + fi + else + eupdate=$W'[✓] UP-TO-DATE!'$N + checkUpdatePrint=$G"\r[✓] Update: Already latest.\n"$N fi - else - eupdate=$W'[✓] UP-TO-DATE!'$N - checkUpdatePrint=$G"\r[✓] Update: Already latest.\n"$N - fi - else - touch $filter - if [grep -q "EP0R9-P" $hosts] || [grep -q "EXR3G1094L-P" $hosts] || [grep -q "EX7R3M3-P" $hosts] || [grep -q "EXP0R9-P" $hosts] || [grep -q "EX50C14L-P" $hosts]; then - eupdate=$B'[*] Extension Applied'$N - checkUpdatePrint=$B"\r[+] Update: Extension applied.\n"$N - else - eupdate="[+] APPLY PACK FIRST!" - checkUpdatePrint=$Y"\r[+] Update: Apply pack first.\n"$N - fi - fi - else - eupdate="[+] APPLY PACK FIRST!" - checkUpdatePrint=$Y"\r[+] Update: Apply pack first.\n"$N - fi + else + touch $filter + for x in "EP0R9-P" "EXR3G1094L-P" "EX7R3M3-P" "EXP0R9-P" "EX50C14L-P"; do + if grep -q $x "$hosts" + then + eupdate=$B'[*] Extension Applied'$N + checkUpdatePrint=$B"\r[+] Update: Extension applied.\n"$N + break + + else + eupdate="[+] APPLY PACK FIRST!" + checkUpdatePrint=$Y"\r[+] Update: Apply pack first.\n"$N + fi + done + fi + else + eupdate="[+] APPLY PACK FIRST!" + checkUpdatePrint=$Y"\r[+] Update: Apply pack first.\n"$N + fi else - eupdate="" - checkUpdatePrint=$B"\r[*] Update: Disabled in config.\n"$N + eupdate="" + checkUpdatePrint=$B"\r[*] Update: Disabled in config.\n"$N fi } # ---------------------------------------- @@ -296,36 +301,36 @@ checkUpdate() { # Check Energized Protection pack # ---------------------------------------- checkEPPack() { - if [ -f $hosts ]; then - if grep -q "E84S1C-P" $hosts; then - epPack="Basic Protection" - autoPack="basic" - elif grep -q "E5P4RK-P" $hosts; then - epPack="Spark Protection" - autoPack="spark" - elif grep -q "E8LU-P" $hosts; then - epPack="Blu Protection" - autoPack="blu" - elif grep -q "E8LUG0-P" $hosts; then - epPack="BluGo Protection" - autoPack="bluGo" - elif grep -q "EP0R9-P" $hosts; then - epPack="Porn Protection" - autoPack="porn" - elif grep -q "EUL71M473-P" $hosts; then - epPack="Ultimate Protection" - autoPack="ultimate" - elif grep -q "EU91F13D-P" $hosts; then - epPack="Unified Protection" - autoPack="unified" - else - if grep -q "/extensions/" $hosts; then - epPack="Extension" - else - epPack="-" - autoPack="null" - fi - fi + if [ -f "$hosts" ]; then + if grep -q "E84S1C-P" "$hosts"; then + epPack="Basic Protection" + autoPack="basic" + elif grep -q "E5P4RK-P" "$hosts"; then + epPack="Spark Protection" + autoPack="spark" + elif grep -q "E8LU-P" "$hosts"; then + epPack="Blu Protection" + autoPack="blu" + elif grep -q "E8LUG0-P" "$hosts"; then + epPack="BluGo Protection" + autoPack="bluGo" + elif grep -q "EP0R9-P" "$hosts"; then + epPack="Porn Protection" + autoPack="porn" + elif grep -q "EUL71M473-P" "$hosts"; then + epPack="Ultimate Protection" + autoPack="ultimate" + elif grep -q "EU91F13D-P" "$hosts"; then + epPack="Unified Protection" + autoPack="unified" + else + if grep -q "/extensions/" "$hosts"; then + epPack="Extension" + else + epPack="-" + autoPack="null" + fi + fi fi } # ---------------------------------------- @@ -334,43 +339,43 @@ checkEPPack() { # Check Energized Protection extension # ---------------------------------------- checkEPExtensionPack() { - if [ -f $hosts ]; then - if grep -q "EP0R9-P" $hosts; then - ePCheck="✓" - epEPack="Porn" - autoExtension="porn" - else - ePCheck="" - fi - if grep -q "EXR3G1094L-P" $hosts; then - eRCheck="✓" - epEPack="Regional" - autoExtension="regional" - else - eRCheck="" - fi - if grep -q "EX7R3M3-P" $hosts; then - eXCheck="✓" - epEPack="Xtreme" - autoExtension="xtreme" - else - eXCheck="" - fi - if grep -q "EXP0R9-P" $hosts; then - ePLCheck="✓" - epEPack="Porn-lite" - autoExtension="porn-lite" - else - ePLCheck="" - fi - if grep -q "EX50C14L-P" $hosts; then - eSCheck="✓" - epEPack="Social" - autoExtension="social" - else - eSCheck="" - fi - fi + if [ -f "$hosts" ]; then + if grep -q "EP0R9-P" "$hosts"; then + ePCheck="✓" + epEPack="Porn" + autoExtension="porn" + else + ePCheck="" + fi + if grep -q "EXR3G1094L-P" "$hosts"; then + eRCheck="✓" + epEPack="Regional" + autoExtension="regional" + else + eRCheck="" + fi + if grep -q "EX7R3M3-P" "$hosts"; then + eXCheck="✓" + epEPack="Xtreme" + autoExtension="xtreme" + else + eXCheck="" + fi + if grep -q "EXP0R9-P" "$hosts"; then + ePLCheck="✓" + epEPack="Porn-lite" + autoExtension="porn-lite" + else + ePLCheck="" + fi + if grep -q "EX50C14L-P" "$hosts"; then + eSCheck="✓" + epEPack="Social" + autoExtension="social" + else + eSCheck="" + fi + fi } # ---------------------------------------- @@ -378,29 +383,29 @@ checkEPExtensionPack() { # Check Energized Protection service # ---------------------------------------- checkEP() { - # Check Magisk hosts - if [ -f $hosts ]; then - # Check Energized Protection domain - if grep -q watchdog.energized.pro $hosts; then - eonoff=$G"[✓]"$N - energizedCheck=$G"✓ "$N$W"Energized Protection activated."$N - else - # Check extension(s) - if grep -q "/extensions/" $hosts; then - eonoff=$B"[*]"$N - energizedCheck=$B"* "$N$W"Energized Protection partially activated."$N - else - eonoff=$R"[×]"$N - energizedCheck=$R"× "$N$W"Energized Protection not activated."$N - fi - # - fi - # + # Check Magisk hosts + if [ -f "$hosts" ]; then + # Check Energized Protection domain + if grep -q watchdog.energized.pro "$hosts"; then + eonoff=$G"[✓]"$N + energizedCheck=$G"✓ "$N$W"Energized Protection activated."$N + else + # Check extension(s) + if grep -q "/extensions/" "$hosts"; then + eonoff=$B"[*]"$N + energizedCheck=$B"* "$N$W"Energized Protection partially activated."$N + else + eonoff=$R"[×]"$N + energizedCheck=$R"× "$N$W"Energized Protection not activated."$N + fi + # + fi + # fi # Check Energized Protection packs - checkEPPack; - # Check Energized Protection extension packs - checkEPExtensionPack; + checkEPPack; + # Check Energized Protection extension packs + checkEPExtensionPack; } # ---------------------------------------- @@ -408,9 +413,9 @@ checkEP() { # Setup filter # ---------------------------------------- setFilter() { - wget --no-check-certificate -q -O $versionInfo "https://block.energized.pro/VERSION.md" - cp $versionInfo $versionBackup - grep "Version Code" $versionInfo > $filter 2>/dev/null + wget --no-check-certificate -q -O $versionInfo "https://block.energized.pro/VERSION.md" + cp $versionInfo $versionBackup + grep "Version Code" $versionInfo > $filter 2>/dev/null } # ---------------------------------------- @@ -418,19 +423,19 @@ setFilter() { # Setup minimum required stuffs # ---------------------------------------- setupFilesMin() { - # Cleanup cache filter - cleanup; - # Setup directory - checkDirectory; - # Check Magisk setup - checkMagisk; - # Check systemless hosts - checkSystemlessHosts; - # Check busybox setup - checkBusybox; - # Check Energized Protection - checkEP; - #echo $epPack; + # Cleanup cache filter + cleanup; + # Setup directory + checkDirectory; + # Check Magisk setup + checkMagisk; + # Check systemless hosts + checkSystemlessHosts; + # Check busybox setup + checkBusybox; + # Check Energized Protection + checkEP; + #echo $epPack; } # ---------------------------------------- @@ -438,32 +443,32 @@ setupFilesMin() { # Setup required stuffs for menu # ---------------------------------------- setupFiles() { - # Cleanup cache filter - cleanup; - # Setup directory - checkDirectory; - # Check systemless hosts - checkSystemlessHosts; - # Check config file - checkConfig; - # Check Magisk setup - checkMagisk; - # Check busybox setup - checkBusybox; - # Check Config - checkConfig; - # Check root - checkRoot; - # Check shell - checkShell; - # Check systemless hosts - checkSystemlessHosts; - # Check other adblocker App(s) - checkAdblockerApp; - # Check Energized Protection service - checkEP; - # Check hosts update - checkUpdate 2>/dev/null; + # Cleanup cache filter + cleanup; + # Setup directory + checkDirectory; + # Check systemless hosts + checkSystemlessHosts; + # Check config file + checkConfig; + # Check Magisk setup + checkMagisk; + # Check busybox setup + checkBusybox; + # Check Config + checkConfig; + # Check root + checkRoot; + # Check shell + checkShell; + # Check systemless hosts + checkSystemlessHosts; + # Check other adblocker App(s) + checkAdblockerApp; + # Check Energized Protection service + checkEP; + # Check hosts update + checkUpdate 2>/dev/null; } # ---------------------------------------- @@ -477,48 +482,48 @@ divider3="_________________________________________________" # ---------------------------------------- # Confirmation # ---------------------------------------- -areYouSure() { echo -n -e $W'\n[+] Sure? Type "y" or "n" to cancel: '$N; read -r 'userAnswer'; } +areYouSure() { echo -n -e "$W"'\n[+] Sure? Type "y" or "n" to cancel: '"$N"; read -r 'userAnswer'; } # ---------------------------------------- # ---------------------------------------- # Check Again? # ---------------------------------------- -checkAgain() { echo -n -e $W'[+] Check again? Type "y" or "n" to cancel: '$N; read -r 'userAnswer'; } +checkAgain() { echo -n -e "$W"'[+] Check again? Type "y" or "n" to cancel: '"$N"; read -r 'userAnswer'; } # ---------------------------------------- # ---------------------------------------- # Visit Telegram # ---------------------------------------- visitTelegram() { - am start -a android.intent.action.VIEW -d "http://go.energized.pro/telegram" 2>/dev/null; - clear + am start -a android.intent.action.VIEW -d "http://go.energized.pro/telegram" 2>/dev/null; + clear } # ---------------------------------------- # ---------------------------------------- # Change redirection IP # ---------------------------------------- -changeRedirectionIP() { sed -ie 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/'"$1"'/g' $hosts; } +changeRedirectionIP() { sed -ie 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/'"$1"'/g' "$hosts"; } # ---------------------------------------- # ---------------------------------------- # Ectract domain from URL # ---------------------------------------- getDomain() { - domainOnly=$(echo $1 | cut -d'/' -f3 | cut -d':' -f1 | cut -d'\@' -f2) - case $domainOnly in - (*[a-zA-Z]*) - for i in $domainOnly ; do - if [[ $i == *.* ]] ; then - echo $i - else - echo "0" - fi - done - ;; - (*) - echo "null" - ;; + domainOnly=$(echo "$1" | cut -d'/' -f3 | cut -d':' -f1 | cut -d'\@' -f2) + case $domainOnly in + (*[a-zA-Z]*) + for i in $domainOnly ; do + if [[ $i == *.* ]] ; then + echo "$i" + else + echo "0" + fi + done + ;; + (*) + echo "null" + ;; esac } # ---------------------------------------- @@ -527,20 +532,20 @@ getDomain() { # Porn extension download # ---------------------------------------- pornEDownload() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] P O R N E X T E N S I O N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Adds Porn Blocking Pack to current hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/porn/formats/hosts.gz" & pid=$! - spinPID "Extension: Downloading"; - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Extension: "$N$Y"Porn Extension\n"$N - rm -f $temp $stemp $hostsGZ + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'[+] P O R N E X T E N S I O N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Adds Porn Blocking Pack to current hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/porn/formats/hosts.gz" & pid=$! + spinPID "Extension: Downloading"; + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + checkEP; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Extension: ""$N""$Y""Porn Extension\n""$N" + rm -f $temp $stemp $hostsGZ } # ---------------------------------------- @@ -548,20 +553,20 @@ pornEDownload() { # Porn-lite extension download # ---------------------------------------- pornliteEDownload() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] P O R N - L I T E E X T E N S I O N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Adds Porn Lite Blocking Pack to current hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -O $hostsGZ "https://block.energized.pro/extensions/porn-lite/formats/hosts.gz" & pid=$! - spinPID "Extension: Downloading"; - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Extension: "$N$Y"Porn-lite Extension\n"$N - rm -f $temp $stemp $hostsGZ + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'[+] P O R N - L I T E E X T E N S I O N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Adds Porn Lite Blocking Pack to current hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -O $hostsGZ "https://block.energized.pro/extensions/porn-lite/formats/hosts.gz" & pid=$! + spinPID "Extension: Downloading"; + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + checkEP; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Extension: ""$N""$Y""Porn-lite Extension\n""$N" + rm -f $temp $stemp $hostsGZ } # ---------------------------------------- @@ -569,20 +574,20 @@ pornliteEDownload() { # Regional extension download # ---------------------------------------- regionalEDownload() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] R E G I O N A L E X T E N S I O N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Adds Regional Blocking Pack to current hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/extensions/regional/formats/hosts.gz" & pid=$! - spinPID "Extension: Downloading"; - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Extension: "$N$Y"Regional Extension\n"$N - rm -f $temp $stemp $hostsGZ + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'[+] R E G I O N A L E X T E N S I O N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Adds Regional Blocking Pack to current hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/extensions/regional/formats/hosts.gz" & pid=$! + spinPID "Extension: Downloading"; + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + checkEP; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Extension: ""$N""$Y""Regional Extension\n""$N" + rm -f $temp $stemp $hostsGZ } # ---------------------------------------- @@ -590,22 +595,22 @@ regionalEDownload() { # Social extension download # ---------------------------------------- socialEDownload() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] S O C I A L E X T E N S I O N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Adds Social Blocking Pack to current hosts."$N; sleep 0.05; - echo -e $Y' > Blocks all social apps. (ex. Snapchat)'$N; sleep 0.05; - echo -e $Y' > Blocks all social sites. (ex. facebook.com)'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/extensions/social/formats/hosts.gz" & pid=$! - spinPID "Extension: Downloading"; - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Extension: "$N$Y"Social Extension\n"$N - rm -f $temp $stemp $hostsGZ + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'[+] S O C I A L E X T E N S I O N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Adds Social Blocking Pack to current hosts.""$N"; sleep 0.05; + echo -e "$Y"' > Blocks all social apps. (ex. Snapchat)'"$N"; sleep 0.05; + echo -e "$Y"' > Blocks all social sites. (ex. facebook.com)'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/extensions/social/formats/hosts.gz" & pid=$! + spinPID "Extension: Downloading"; + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + checkEP; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Extension: ""$N""$Y""Social Extension\n""$N" + rm -f $temp $stemp $hostsGZ } # ---------------------------------------- @@ -616,23 +621,23 @@ xtremeEDownload() { printWarning; areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] X T R E M E E X T E N S I O N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Adds Xtreme Blocking Pack to current hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -O $hostsGZ "https://block.energized.pro/extensions/xtreme/formats/hosts.gz" & pid=$! - spinPID "Extension: Downloading"; - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Extension: "$N$Y"Xtreme Extension\n"$N - rm -f $temp $stemp $hostsGZ + clear + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'[+] X T R E M E E X T E N S I O N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Adds Xtreme Blocking Pack to current hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -O $hostsGZ "https://block.energized.pro/extensions/xtreme/formats/hosts.gz" & pid=$! + spinPID "Extension: Downloading"; + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + checkEP; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Extension: ""$N""$Y""Xtreme Extension\n""$N" + rm -f $temp $stemp $hostsGZ else - clear + clear fi } # ---------------------------------------- @@ -641,18 +646,18 @@ xtremeEDownload() { # Aut update extenstion # ---------------------------------------- autoUpdateExtension() { - cleanupTemp; - if [ "$1" == "porn" ]; then - hostsURL=https://block.energized.pro/porn/formats/hosts.gz - else - hostsURL=https://block.energized.pro/extensions/$1/formats/hosts.gz - fi - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "$hostsURL" - gzip -d -c $hostsGZ > $stemp - mv $hosts $temp - truncate -s 0 $hosts - cat $temp $stemp > $hosts - rm -f $temp $stemp $hostsGZ + cleanupTemp; + if [ "$1" == "porn" ]; then + hostsURL=https://block.energized.pro/porn/formats/hosts.gz + else + hostsURL=https://block.energized.pro/extensions/$1/formats/hosts.gz + fi + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "$hostsURL" + gzip -d -c $hostsGZ > $stemp + mv "$hosts" $temp + truncate -s 0 "$hosts" + cat $temp $stemp > "$hosts" + rm -f $temp $stemp $hostsGZ } # ---------------------------------------- @@ -660,75 +665,75 @@ autoUpdateExtension() { # Auto update hosts, whitelist, blacklist and extension(s) # ---------------------------------------- updateHWBE() { - checkEP; - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - if [ "$autoPack" == "null" ]; then - echo -e $R"$divider"$N; sleep 0.05; - echo -e $R"[-] No pack applied yet!"$N; sleep 0.05; - echo -e $R"$divider"$N; sleep 0.05; - sleep 3 - else - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"[+] Applying $epPack"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/$autoPack/formats/hosts.gz" & pid=$! - spinPID "Pack: Downloading"; - gzip -d -c $hostsGZ > $hosts - rm -f $hostsGZ - checkEPPack; - echo -en $W"\r["$N$Y"✓"$N$W"] Pack: "$N$Y"$epPack\n"$N - # Update cache filter - setFilter; - # Updating extension - if [ ! -z "$ePCheck" ]; then - autoUpdateExtension "porn" & pid=$! - spinPID "Porn Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - else - echo -e $Y'[~] No porn extension'$N; sleep 0.1; - fi - if [ ! -z "$ePLCheck" ]; then - autoUpdateExtension "porn-lite" & pid=$! - spinPID "Porn-Lite Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn-lite Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - else - echo -e $Y'[~] No porn-lite extension'$N; sleep 0.1; - fi - if [ ! -z "$eRCheck" ]; then - autoUpdateExtension "regional" & pid=$! - spinPID "Regional Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Regional Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - else - echo -e $Y'[~] No regional extension'$N; sleep 0.1; - fi - if [ ! -z "$eSCheck" ]; then - autoUpdateExtension "social" & pid=$! - spinPID "Social Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Social Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - else - echo -e $Y'[~] No social extension'$N; sleep 0.1; - fi - if [ ! -z "$eXCheck" ]; then - autoUpdateExtension "xtreme" & pid=$! - spinPID "Xtreme Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Xtreme Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - else - echo -e $Y'[~] No xtreme extension'$N; sleep 0.1; - fi - # Change redirection IP - if [ "$currentIP" != "0.0.0.0" ]; then - changeRedirectionIP "$currentIP" & pid=$! - spinPID "Redirection IP: Changing to $currentIP" - echo -en $W"\r["$N$Y"✓"$N$W"] Redirection IP: "$N$Y"Updated to $currentIP\n"$N; sleep 0.1; - fi - # Blacklisting - doBlacklist; - # Whitelisting - doWhitelist; - printDonate; + checkEP; + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + if [ "$autoPack" == "null" ]; then + echo -e "$R""$divider""$N"; sleep 0.05; + echo -e "$R""[-] No pack applied yet!""$N"; sleep 0.05; + echo -e "$R""$divider""$N"; sleep 0.05; + sleep 3 + else + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""[+] Applying $epPack""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ "https://block.energized.pro/$autoPack/formats/hosts.gz" & pid=$! + spinPID "Pack: Downloading"; + gzip -d -c $hostsGZ > "$hosts" + rm -f $hostsGZ + checkEPPack; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Pack: ""$N""$Y""$epPack\n""$N" + # Update cache filter + setFilter; + # Updating extension + if [ ! -z "$ePCheck" ]; then + autoUpdateExtension "porn" & pid=$! + spinPID "Porn Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + else + echo -e "$Y"'[~] No porn extension'"$N"; sleep 0.1; + fi + if [ ! -z "$ePLCheck" ]; then + autoUpdateExtension "porn-lite" & pid=$! + spinPID "Porn-Lite Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn-lite Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + else + echo -e "$Y"'[~] No porn-lite extension'"$N"; sleep 0.1; + fi + if [ ! -z "$eRCheck" ]; then + autoUpdateExtension "regional" & pid=$! + spinPID "Regional Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Regional Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + else + echo -e "$Y"'[~] No regional extension'"$N"; sleep 0.1; + fi + if [ ! -z "$eSCheck" ]; then + autoUpdateExtension "social" & pid=$! + spinPID "Social Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Social Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + else + echo -e "$Y"'[~] No social extension'"$N"; sleep 0.1; + fi + if [ ! -z "$eXCheck" ]; then + autoUpdateExtension "xtreme" & pid=$! + spinPID "Xtreme Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Xtreme Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + else + echo -e "$Y"'[~] No xtreme extension'"$N"; sleep 0.1; + fi + # Change redirection IP + if [ "$currentIP" != "0.0.0.0" ]; then + changeRedirectionIP "$currentIP" & pid=$! + spinPID "Redirection IP: Changing to $currentIP" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Redirection IP: ""$N""$Y""Updated to $currentIP\n""$N"; sleep 0.1; + fi + # Blacklisting + doBlacklist; + # Whitelisting + doWhitelist; + printDonate; fi } # ---------------------------------------- @@ -737,27 +742,27 @@ updateHWBE() { # Open config file # ---------------------------------------- openConfig() { - case "$2" in - show) clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ O P E N C O N F I G F I L E'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo "Open the config file."; sleep 0.05; - echo -e $Y"$divider"$N - echo ''; sleep 0.05; - head -n 30 $config - echo ''; sleep 0.05; - echo -n -e $W'[+] Open config file?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - am start -a android.intent.action.VIEW -d file://$config -t text/plain > /dev/null 2>&1; - fi - clear - ;; - edit) clear - am start -a android.intent.action.VIEW -d file://$config -t text/plain > /dev/null 2>&1; - ;; - esac + case "$2" in + show) clear + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ O P E N C O N F I G F I L E'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "Open the config file."; sleep 0.05; + echo -e "$Y""$divider""$N" + echo ''; sleep 0.05; + head -n 30 $config + echo ''; sleep 0.05; + echo -n -e "$W"'[+] Open config file?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + am start -a android.intent.action.VIEW -d file://$config -t text/plain > /dev/null 2>&1; + fi + clear + ;; + edit) clear + am start -a android.intent.action.VIEW -d file://$config -t text/plain > /dev/null 2>&1; + ;; + esac } # ---------------------------------------- @@ -765,14 +770,14 @@ openConfig() { # Warning # ---------------------------------------- printWarning() { - echo -e $R"$divider"$N; sleep 0.05; - echo -e $R"W A R N I N G"$N; sleep 0.05; - echo -e $R"$divider"$N; sleep 0.05; - echo -e $R"This may break your internet usage experience."$N; sleep 0.05; - echo -e $R"Because of its size or blocking pattern."$N; sleep 0.05; - echo -e $R"For more info, https://block.energized.pro"$N; sleep 0.05; - echo -e $R"\nYou may proceed if you know what you are doing!"$N; sleep 0.05; - echo -e $R"$divider"$N; sleep 0.05; + echo -e "$R""$divider""$N"; sleep 0.05; + echo -e "$R""W A R N I N G""$N"; sleep 0.05; + echo -e "$R""$divider""$N"; sleep 0.05; + echo -e "$R""This may break your internet usage experience.""$N"; sleep 0.05; + echo -e "$R""Because of its size or blocking pattern.""$N"; sleep 0.05; + echo -e "$R""For more info, https://block.energized.pro""$N"; sleep 0.05; + echo -e "$R""\nYou may proceed if you know what you are doing!""$N"; sleep 0.05; + echo -e "$R""$divider""$N"; sleep 0.05; } # ---------------------------------------- @@ -780,10 +785,10 @@ printWarning() { # Return # ---------------------------------------- printReturn() { - echo -en $W"[←] Returning "$N - echo -en $Y"•"$N; sleep 0.2; - echo -en $Y"•"$N; sleep 0.3; - echo -en $Y"•"$N; sleep 1; + echo -en "$W""[←] Returning ""$N" + echo -en "$Y""•""$N"; sleep 0.2; + echo -en "$Y""•""$N"; sleep 0.3; + echo -en "$Y""•""$N"; sleep 1; } # ---------------------------------------- @@ -791,13 +796,13 @@ printReturn() { # Donate # ---------------------------------------- printDonate() { - sleep 0.1 - echo -e $Y"$divider"$N; sleep 0.1 - echo -e $Y'[+] If you loved our work, consider donating.'$N; sleep 0.1 - echo -e $B' > PayPal: paypal.me/shadmansaleh'$N - echo -e $Y' > Support: energized.pro/support'$N - echo -e $Y"$divider"$N; sleep 0.1 - sleep 0.1 + sleep 0.1 + echo -e "$Y""$divider""$N"; sleep 0.1 + echo -e "$Y"'[+] If you loved our work, consider donating.'"$N"; sleep 0.1 + echo -e "$B"' > PayPal: paypal.me/shadmansaleh'"$N" + echo -e "$Y"' > Support: energized.pro/support'"$N" + echo -e "$Y""$divider""$N"; sleep 0.1 + sleep 0.1 } # ---------------------------------------- @@ -805,28 +810,28 @@ printDonate() { # Backup Hosts # ---------------------------------------- backupHosts() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ B A C K U P'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Make a backup of current hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - if [ -f "$hosts" ]; then - gzip -9 -c $hosts > $hostsBackup & pid=$! - spinPID "Storing Hosts" - cp $filter $filterBackup - echo -en $W"\r["$N$Y"✓"$N$W"] Storing Hosts: "$N$Y"Completed.\n"$N; sleep 0.1; - echo -e -n $W"[+] Backup Config file?"$N $Y"[Y/N]"$N $answer - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - cp $config $configBackup - else - echo -e $W"[×] Not backing up config."$N; sleep 0.1; - fi - else - echo -e $R"$divider"$N; sleep 0.05; - echo -e $R"[×] No hosts found."$N; sleep 0.05; - echo -e $R"$divider\n\n"$N; sleep 0.05; - fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ B A C K U P'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Make a backup of current hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + if [ -f "$hosts" ]; then + gzip -9 -c "$hosts" > $hostsBackup & pid=$! + spinPID "Storing Hosts" + cp $filter $filterBackup + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Storing Hosts: ""$N""$Y""Completed.\n""$N"; sleep 0.1; + echo -e -n "$W""[+] Backup Config file?""$N" "$Y""[Y/N]""$N" "$answer" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + cp $config $configBackup + else + echo -e "$W""[×] Not backing up config.""$N"; sleep 0.1; + fi + else + echo -e "$R""$divider""$N"; sleep 0.05; + echo -e "$R""[×] No hosts found.""$N"; sleep 0.05; + echo -e "$R""$divider\n\n""$N"; sleep 0.05; + fi } # ---------------------------------------- @@ -834,28 +839,28 @@ backupHosts() { # Clear Hosts # ---------------------------------------- clearHosts() { - checkBusybox; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ C L E A N H O S T S'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Revert back to stock hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo ""; sleep 0.05; - echo -n -e $W"[+] Cleaning "$N; sleep 0.05; - echo -n -e $G"•"$N; sleep 0.05; - truncate -s 0 $hosts - echo -n -e $Y"•"$N; sleep 0.05; - rm -f $filter - echo -n -e $C"•"$N; sleep 0.05; - touch $filter - echo -n -e $B"•"$N; sleep 0.05; - echo -e "# Energized Protection - https://energized.pro\n# Let's make an annoyance free better open internet, altogether!\n\n127.0.0.1 localhost\n::1" >> $hosts - echo -n -e $R"•\n"$N; sleep 0.05; - echo -e $W"[+] Done.\n"$N; sleep 0.05; - checkEP; - checkUpdate; - printCountedDomains; - printDonate; + checkBusybox; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ C L E A N H O S T S'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Revert back to stock hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo ""; sleep 0.05; + echo -n -e "$W""[+] Cleaning ""$N"; sleep 0.05; + echo -n -e "$G""•""$N"; sleep 0.05; + truncate -s 0 "$hosts" + echo -n -e "$Y""•""$N"; sleep 0.05; + rm -f $filter + echo -n -e "$C""•""$N"; sleep 0.05; + touch $filter + echo -n -e "$B""•""$N"; sleep 0.05; + echo -e "# Energized Protection - https://energized.pro\n# Let's make an annoyance free better open internet, altogether!\n\n127.0.0.1 localhost\n::1" >> "$hosts" + echo -n -e "$R""•\n""$N"; sleep 0.05; + echo -e "$W""[+] Done.\n""$N"; sleep 0.05; + checkEP; + checkUpdate; + printCountedDomains; + printDonate; } # ---------------------------------------- @@ -863,22 +868,22 @@ clearHosts() { # Restore Hosts # ---------------------------------------- restoreHosts() { - checkBusybox; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ R E S T O R E'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Restore the hosts backup."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - if [ -s $hostsBackup ]; then - gzip -d -c $hostsBackup > $hosts & pid=$! - spinPID "Restoring Hosts" - cp $filterBackup $filter - echo -en $W"\r["$N$Y"✓"$N$W"] Restoring Hosts: "$N$Y"Completed.\n\n"$N; sleep 0.1; - else - echo -e $R"$divider"$N; sleep 0.05; - echo -e $R"[×] No backup found."$N; sleep 0.05; - echo -e $R"$divider\n\n"$N; sleep 0.05; - fi + checkBusybox; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ R E S T O R E'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Restore the hosts backup.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + if [ -s $hostsBackup ]; then + gzip -d -c $hostsBackup > "$hosts" & pid=$! + spinPID "Restoring Hosts" + cp $filterBackup $filter + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Restoring Hosts: ""$N""$Y""Completed.\n\n""$N"; sleep 0.1; + else + echo -e "$R""$divider""$N"; sleep 0.05; + echo -e "$R""[×] No backup found.""$N"; sleep 0.05; + echo -e "$R""$divider\n\n""$N"; sleep 0.05; + fi } # ---------------------------------------- @@ -886,146 +891,146 @@ restoreHosts() { # Open Hosts File # ---------------------------------------- openHosts() { - clear - checkBusybox - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ O P E N H O S T S F I L E'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo "Open the hosts file."; sleep 0.05; - echo -e $Y"$divider"$N - echo ''; sleep 0.05; - head -n 30 $hosts - echo ''; sleep 0.05; - echo -n -e $W'[+] Open Hosts File?'$N $Y'[Y/N]:'$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - am start -a android.intent.action.VIEW -d file://$hosts -t text/plain > /dev/null 2>&1; - fi - clear + clear + checkBusybox + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ O P E N H O S T S F I L E'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "Open the hosts file."; sleep 0.05; + echo -e "$Y""$divider""$N" + echo ''; sleep 0.05; + head -n 30 "$hosts" + echo ''; sleep 0.05; + echo -n -e "$W"'[+] Open Hosts File?'"$N" "$Y"'[Y/N]:'"$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + am start -a android.intent.action.VIEW -d file://"$hosts" -t text/plain > /dev/null 2>&1; + fi + clear } # ---------------------------------------- - + # ---------------------------------------- # Download pack # ---------------------------------------- downloadPack() { - setupFilesMin; - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - case "$2" in - spark|Spark|SPARK|blugo|Blugo|bluGo|BLUGO|blu|Blu|BLU|basic|Basic|BASIC|porn|Porn|PORN|ultimate|Ultimate|ULTIMATE|unified|Unified|UNIFIED|porn-lite|pornlite|Porn-lite|PORN-LITE|xtreme|Xtreme|XTREME|regional|Regional|REGIONAL|social|Social|SOCIAL) - if [[ "$2" == "spark" || "$2" == "Spark" || "$2" == "SPARK" ]]; then - pack="spark" - epPack="Spark Protection" - elif [[ "$2" == "blu" || "$2" == "Blu" || "$2" == "BLU" ]]; then - pack="blu" - epPack="Blu Protection" - elif [[ "$2" == "blugo" || "$2" == "bluGo" || "$2" == "Blugo" || "$2" == "BluGo" || "$2" == "BLUGO" ]]; then - pack="bluGo" - epPack="BluGo Protection" - elif [[ "$2" == "basic" || "$2" == "Basic" || "$2" == "BASIC" ]]; then - pack="basic" - epPack="Basic Protection" - elif [[ "$2" == "porn" || "$2" == "Porn" || "$2" == "PORN" ]]; then - pack="porn" - epPack="Porn Protection" - elif [[ "$2" == "ultimate" || "$2" == "Ultimate" || "$2" == "ULTIMATE" ]]; then - pack="ultimate" - epPack="Ultimate Protection" - elif [[ "$2" == "unified" || "$2" == "Unified" || "$2" == "UNIFIED" ]]; then - pack="unified" - epPack="Unified Protection" - elif [[ "$2" == "xtreme" || "$2" == "Xtreme" || "$2" == "XTREME" ]]; then - pack="extensions/xtreme" - echo -e $R"\n[-] $2 - only extension can't be applied.\n"$N - exit - elif [[ "$2" == "porn-lite" || "$2" == "pornlite" || "$2" == "Porn-lite" || "$2" == "Pornlite" || "$2" == "PORN-LITE" || "$2" == "PORNLITE" ]]; then - pack="extensions/porn-lite" - echo -e $R"\n[-] $2 - only extension can't be applied.\n"$N - exit - elif [[ "$2" == "regional" || "$2" == "Regional" || "$2" == "REGIONAL" ]]; then - pack="extensions/regional" - echo -e $R"\n[-] $2 - only extension can't be applied.\n"$N - exit - elif [[ "$2" == "social" || "$2" == "Social" || "$2" == "SOCIAL" ]]; then - pack="extensions/social" - echo -e $R"\n[-] $2 - only extension can't be applied.\n"$N - exit - fi - hostsURL=https://block.energized.pro/$pack/formats/hosts.gz - wget --no-check-certificate -U "$userAgent" -q -T "3" -O $hostsGZ $hostsURL & pid=$! - if [ -f $hostsGZ ]; then - #if [ ! -s $hostsGZ ]; then - #truncate -s 0 $hosts - gzip -d -c $hostsGZ > $hosts - - #fi - else - echo -e $R"\n[-] Something went wrong. Try again.\n"$N - exit - fi - echo - rm -f $hostsGZ - echo ''; - size=`ls -lah $hosts | awk '{print $5}'` - spinPID "Pack: Downloading"; - echo -en $W"\r["$N$Y"✓"$N$W"] Pack: "$N$Y"$epPack\n"$N - echo -e $W"[+] Size: "$N$Y"$size"$N - case "$3" in - -e|--extension) shift - for i in $@ - do - # Applying extension - if [[ "$i" == "porn" || "$i" == "Porn" || "$i" == "PORN" ]]; then - autoUpdateExtension "porn" & pid=$! - spinPID "Porn Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "porn-lite" || "$i" == "pornlite" || "$i" == "Porn-lite" || "$i" == "Pornlite" || "$i" == "PORN-LITE" || "$i" == "PORNLITE" ]]; then - autoUpdateExtension "porn-lite" & pid=$! - spinPID "Porn-Lite Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn-lite Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "regional" || "$i" == "Regional" || "$i" == "REGIONAL" ]]; then - autoUpdateExtension "regional" & pid=$! - spinPID "Regional Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Regional Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "social" || "$i" == "Social" || "$i" == "SOCIAL" ]]; then - autoUpdateExtension "social" & pid=$! - spinPID "Social Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Social Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "xtreme" || "$i" == "Xtreme" || "$i" == "XTREME" ]]; then - autoUpdateExtension "xtreme" & pid=$! - spinPID "Xtreme Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Xtreme Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - - done - - # Change redirection IP - if [ "$currentIP" != "0.0.0.0" ]; then - changeRedirectionIP "$currentIP" & pid=$! - spinPID "Redirection IP: Changing to $currentIP" - echo -en $W"\r["$N$Y"✓"$N$W"] Redirection IP: "$N$Y"Updated to $currentIP\n"$N; sleep 0.1; - fi - ;; - - *) echo -e $W"[*] No extension applied."$N - ;; - esac - setFilter & pid=$! - cleanupTemp; - spinPID "Filter: Updating"; - echo -en $W"\r["$N$Y"✓"$N$W"] Filter: "$N$Y"Updated \n\n"$N - printDonate; - ;; - *) echo -e $R"\n[-] $2 invalid input.\n"$N - ;; - esac + setupFilesMin; + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + case "$2" in + spark|Spark|SPARK|blugo|Blugo|bluGo|BLUGO|blu|Blu|BLU|basic|Basic|BASIC|porn|Porn|PORN|ultimate|Ultimate|ULTIMATE|unified|Unified|UNIFIED|porn-lite|pornlite|Porn-lite|PORN-LITE|xtreme|Xtreme|XTREME|regional|Regional|REGIONAL|social|Social|SOCIAL) + if [[ "$2" == "spark" || "$2" == "Spark" || "$2" == "SPARK" ]]; then + pack="spark" + epPack="Spark Protection" + elif [[ "$2" == "blu" || "$2" == "Blu" || "$2" == "BLU" ]]; then + pack="blu" + epPack="Blu Protection" + elif [[ "$2" == "blugo" || "$2" == "bluGo" || "$2" == "Blugo" || "$2" == "BluGo" || "$2" == "BLUGO" ]]; then + pack="bluGo" + epPack="BluGo Protection" + elif [[ "$2" == "basic" || "$2" == "Basic" || "$2" == "BASIC" ]]; then + pack="basic" + epPack="Basic Protection" + elif [[ "$2" == "porn" || "$2" == "Porn" || "$2" == "PORN" ]]; then + pack="porn" + epPack="Porn Protection" + elif [[ "$2" == "ultimate" || "$2" == "Ultimate" || "$2" == "ULTIMATE" ]]; then + pack="ultimate" + epPack="Ultimate Protection" + elif [[ "$2" == "unified" || "$2" == "Unified" || "$2" == "UNIFIED" ]]; then + pack="unified" + epPack="Unified Protection" + elif [[ "$2" == "xtreme" || "$2" == "Xtreme" || "$2" == "XTREME" ]]; then + pack="extensions/xtreme" + echo -e "$R""\n[-] $2 - only extension can't be applied.\n""$N" + exit + elif [[ "$2" == "porn-lite" || "$2" == "pornlite" || "$2" == "Porn-lite" || "$2" == "Pornlite" || "$2" == "PORN-LITE" || "$2" == "PORNLITE" ]]; then + pack="extensions/porn-lite" + echo -e "$R""\n[-] $2 - only extension can't be applied.\n""$N" + exit + elif [[ "$2" == "regional" || "$2" == "Regional" || "$2" == "REGIONAL" ]]; then + pack="extensions/regional" + echo -e "$R""\n[-] $2 - only extension can't be applied.\n""$N" + exit + elif [[ "$2" == "social" || "$2" == "Social" || "$2" == "SOCIAL" ]]; then + pack="extensions/social" + echo -e "$R""\n[-] $2 - only extension can't be applied.\n""$N" + exit + fi + hostsURL=https://block.energized.pro/$pack/formats/hosts.gz + wget --no-check-certificate -U "$userAgent" -q -T "3" -O $hostsGZ $hostsURL & pid=$! + if [ -f $hostsGZ ]; then + #if [ ! -s $hostsGZ ]; then + #truncate -s 0 $hosts + gzip -d -c $hostsGZ > "$hosts" + + #fi + else + echo -e "$R""\n[-] Something went wrong. Try again.\n""$N" + exit + fi + echo + rm -f $hostsGZ + echo ''; + size=$(ls -lah "$hosts" | awk '{print $5}') + spinPID "Pack: Downloading"; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Pack: ""$N""$Y""$epPack\n""$N" + echo -e "$W""[+] Size: ""$N""$Y""$size""$N" + case "$3" in + -e|--extension) shift + for i in "$@" + do + # Applying extension + if [[ "$i" == "porn" || "$i" == "Porn" || "$i" == "PORN" ]]; then + autoUpdateExtension "porn" & pid=$! + spinPID "Porn Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "porn-lite" || "$i" == "pornlite" || "$i" == "Porn-lite" || "$i" == "Pornlite" || "$i" == "PORN-LITE" || "$i" == "PORNLITE" ]]; then + autoUpdateExtension "porn-lite" & pid=$! + spinPID "Porn-Lite Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn-lite Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "regional" || "$i" == "Regional" || "$i" == "REGIONAL" ]]; then + autoUpdateExtension "regional" & pid=$! + spinPID "Regional Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Regional Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "social" || "$i" == "Social" || "$i" == "SOCIAL" ]]; then + autoUpdateExtension "social" & pid=$! + spinPID "Social Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Social Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "xtreme" || "$i" == "Xtreme" || "$i" == "XTREME" ]]; then + autoUpdateExtension "xtreme" & pid=$! + spinPID "Xtreme Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Xtreme Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + + done + + # Change redirection IP + if [ "$currentIP" != "0.0.0.0" ]; then + changeRedirectionIP "$currentIP" & pid=$! + spinPID "Redirection IP: Changing to $currentIP" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Redirection IP: ""$N""$Y""Updated to $currentIP\n""$N"; sleep 0.1; + fi + ;; + + *) echo -e "$W""[*] No extension applied.""$N" + ;; + esac + setFilter & pid=$! + cleanupTemp; + spinPID "Filter: Updating"; + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Filter: ""$N""$Y""Updated \n\n""$N" + printDonate; + ;; + *) echo -e "$R""\n[-] $2 invalid input.\n""$N" + ;; + esac } # ---------------------------------------- @@ -1033,57 +1038,57 @@ downloadPack() { # Add extension to hosts # ---------------------------------------- addExtension() { - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo '' - case "$2" in - porn|Porn|PORN|ultimate|Ultimate|ULTIMATE|unified|Unified|UNIFIED|porn-lite|pornlite|Porn-lite|PORN-LITE|xtreme|Xtreme|XTREME|regional|Regional|REGIONAL|social|Social|SOCIAL) shift - for i in $@ - do - # Applying extension - if [[ "$i" == "porn" || "$i" == "Porn" || "$i" == "PORN" ]]; then - autoUpdateExtension "porn" & pid=$! - spinPID "Porn Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "porn-lite" || "$i" == "pornlite" || "$i" == "Porn-lite" || "$i" == "Pornlite" || "$i" == "PORN-LITE" || "$i" == "PORNLITE" ]]; then - autoUpdateExtension "porn-lite" & pid=$! - spinPID "Porn-Lite Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Porn-lite Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "regional" || "$i" == "Regional" || "$i" == "REGIONAL" ]]; then - autoUpdateExtension "regional" & pid=$! - spinPID "Regional Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Regional Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "social" || "$i" == "Social" || "$i" == "SOCIAL" ]]; then - autoUpdateExtension "social" & pid=$! - spinPID "Social Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Social Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - if [[ "$i" == "xtreme" || "$i" == "Xtreme" || "$i" == "XTREME" ]]; then - autoUpdateExtension "xtreme" & pid=$! - spinPID "Xtreme Extension: Downloading" - echo -en $W"\r["$N$Y"✓"$N$W"] Xtreme Extension: "$N$Y"Applied successfully.\n"$N; sleep 0.1; - fi - - done - - # Change redirection IP - if [ "$currentIP" != "0.0.0.0" ]; then - changeRedirectionIP "$currentIP" & pid=$! - spinPID "Redirection IP: Changing to $currentIP" - echo -en $W"\r["$N$Y"✓"$N$W"] Redirection IP: "$N$Y"Updated to $currentIP\n"$N; sleep 0.1; - fi - echo '' - printDonate; - ;; - - *) echo -e $R"[-] $2 invalid input.\n"$N - ;; - esac + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo '' + case "$2" in + porn|Porn|PORN|ultimate|Ultimate|ULTIMATE|unified|Unified|UNIFIED|porn-lite|pornlite|Porn-lite|PORN-LITE|xtreme|Xtreme|XTREME|regional|Regional|REGIONAL|social|Social|SOCIAL) shift + for i in "$@" + do + # Applying extension + if [[ "$i" == "porn" || "$i" == "Porn" || "$i" == "PORN" ]]; then + autoUpdateExtension "porn" & pid=$! + spinPID "Porn Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "porn-lite" || "$i" == "pornlite" || "$i" == "Porn-lite" || "$i" == "Pornlite" || "$i" == "PORN-LITE" || "$i" == "PORNLITE" ]]; then + autoUpdateExtension "porn-lite" & pid=$! + spinPID "Porn-Lite Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Porn-lite Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "regional" || "$i" == "Regional" || "$i" == "REGIONAL" ]]; then + autoUpdateExtension "regional" & pid=$! + spinPID "Regional Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Regional Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "social" || "$i" == "Social" || "$i" == "SOCIAL" ]]; then + autoUpdateExtension "social" & pid=$! + spinPID "Social Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Social Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + if [[ "$i" == "xtreme" || "$i" == "Xtreme" || "$i" == "XTREME" ]]; then + autoUpdateExtension "xtreme" & pid=$! + spinPID "Xtreme Extension: Downloading" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Xtreme Extension: ""$N""$Y""Applied successfully.\n""$N"; sleep 0.1; + fi + + done + + # Change redirection IP + if [ "$currentIP" != "0.0.0.0" ]; then + changeRedirectionIP "$currentIP" & pid=$! + spinPID "Redirection IP: Changing to $currentIP" + echo -en "$W""\r[""$N""$Y""✓""$N""$W""] Redirection IP: ""$N""$Y""Updated to $currentIP\n""$N"; sleep 0.1; + fi + echo '' + printDonate; + ;; + + *) echo -e "$R""[-] $2 invalid input.\n""$N" + ;; + esac } # ---------------------------------------- @@ -1091,54 +1096,54 @@ addExtension() { # Blacklist # ---------------------------------------- doBlacklist() { - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ B L A C K L I S T I N G'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - # Begins - if [ ! -f $blacklist ]; then - echo -e $R"\n[-] No Blacklist detected!"$N - echo -e $W"[+] Copy your blacklist to"$N $Y"$directory"$N - else - if [ -f "$hosts" ]; then - if [ -s $blacklist ]; then - echo -e $G'[✓] Blacklist Found!'$N; sleep 0.05; - echo -e $W'[+] Applying Blacklist:\n'$N; sleep 0.05; - echo -e $C'[+] Blacklist Log -'$N; sleep 0.05; - rm -f $temp $stemp $ptemp $ltemp - sed 's/^ *//; s/ *$//; /^$/d; /^#/ d' $blacklist > $ltemp - sort -u $ltemp > $temp - NEWFILTERS="$(cat $temp)" - echo -e "\n# Applied on - $date" >> $hosts - printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew - do - domain=$(getDomain $linenew); - # 1 - if [[ "$domain" == "null" ]]; then - echo $R"[×] Error: Wrong input."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e "$currentIP $domain" >> $hosts - echo -e $W" >"$N$Y" $domain "$N$W"- blacklisted."$N - else - echo -e $W" > "$N$R"$domain "$N$W"- already blacklisted."$N - fi - fi - done - rm -f $temp $stemp $ptemp $ltemp - echo -e $G'\n[✓] Done\n'$N; sleep 0.05; - else - echo -e $R'[-] Blacklist file is empty!'$N; sleep 0.05; - echo -e $R'[-] Nothing blacklisted!'$N; sleep 0.05; - fi - else - echo -e $R'\n[-] No hosts file detected!'$N; sleep 0.05; - echo -e $Y'[+] Apply a hosts file first\n'$N; sleep 0.05; - sleep 2 - fi + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ B L A C K L I S T I N G'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + # Begins + if [ ! -f $blacklist ]; then + echo -e "$R""\n[-] No Blacklist detected!""$N" + echo -e "$W""[+] Copy your blacklist to""$N" "$Y""$directory""$N" + else + if [ -f "$hosts" ]; then + if [ -s $blacklist ]; then + echo -e "$G"'[✓] Blacklist Found!'"$N"; sleep 0.05; + echo -e "$W"'[+] Applying Blacklist:\n'"$N"; sleep 0.05; + echo -e "$C"'[+] Blacklist Log -'"$N"; sleep 0.05; + rm -f $temp $stemp $ptemp $ltemp + sed 's/^ *//; s/ *$//; /^$/d; /^#/ d' $blacklist > $ltemp + sort -u $ltemp > $temp + NEWFILTERS="$(cat $temp)" + echo -e "\n# Applied on - $date" >> "$hosts" + printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew + do + domain=$(getDomain "$linenew"); + # 1 + if [[ "$domain" == "null" ]]; then + echo "$R""[×] Error: Wrong input.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$currentIP $domain" >> "$hosts" + echo -e "$W"" >""$N""$Y"" $domain ""$N""$W""- blacklisted.""$N" + else + echo -e "$W"" > ""$N""$R""$domain ""$N""$W""- already blacklisted.""$N" + fi + fi + done + rm -f $temp $stemp $ptemp $ltemp + echo -e "$G"'\n[✓] Done\n'"$N"; sleep 0.05; + else + echo -e "$R"'[-] Blacklist file is empty!'"$N"; sleep 0.05; + echo -e "$R"'[-] Nothing blacklisted!'"$N"; sleep 0.05; + fi + else + echo -e "$R"'\n[-] No hosts file detected!'"$N"; sleep 0.05; + echo -e "$Y"'[+] Apply a hosts file first\n'"$N"; sleep 0.05; + sleep 2 + fi fi } # ---------------------------------------- @@ -1147,60 +1152,60 @@ doBlacklist() { # Whitelist # ---------------------------------------- doWhitelist() { - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ W H I T E L I S T I N G'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - # Begins - if [ ! -f $whitelist ]; then - echo -e $R"[-] No Whitelist Detected!"$N; sleep 0.05; - echo -e $W'[+] Copy your whilelist to'$N $Y'$directory'$N; sleep 0.05; - else - if [ -f "$hosts" ]; then - if [ -s $whitelist ]; then - echo -e $G"[✓] Whitelist Found!"$N; sleep 0.05; - echo -e $W"[+] Applying Whitelist:\n"$N; sleep 0.05; - echo -e $C'[+] Whitelist Log -'$N; sleep 0.05; - rm -f $temp $stemp $ptemp $ltemp - sed 's/^ *//; s/ *$//; /^$/d; /^#/ d' $whitelist > $ltemp - sort -u $ltemp > $stemp - NEWFILTERS="$(cat $stemp)" - printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew - do - domain=$(getDomain $linenew); - # 1 - if [[ "$domain" == "null" ]]; then - echo $R"[×] Error: Wrong input."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e $W" >"$N$G" $domain "$N$W"- already whitelisted."$N - else - grep -Fvxf $stemp $hosts > $temp - rm -f $hosts - mv -f $temp $hosts - grep -Fvf $stemp $hosts > $temp - rm -f $hosts - mv -f $temp $hosts - grep -vxf $stemp $hosts > $temp - rm -f $hosts - mv -f $temp $hosts - echo -e $W" >"$N$Y" $domain "$N$W"- whitelisted."$N - fi - fi - done - rm -f $temp $stemp $ptemp $ltemp - echo -e $G'\n[✓] Done\n'$N; sleep 0.05; - else - echo -e $R'[-] Whitelist file is empty!'$N; sleep 0.05; - echo -e $R'[-] Nothing whitelisted!'$N; sleep 0.05; - fi - else - echo -e $R'\n[-] No hosts file detected!'$N; sleep 0.05; - echo -e $Y'[+] Apply a hosts file first\n'$N; sleep 0.05; - fi + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ W H I T E L I S T I N G'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + # Begins + if [ ! -f $whitelist ]; then + echo -e "$R""[-] No Whitelist Detected!""$N"; sleep 0.05; + echo -e "$W"'[+] Copy your whilelist to'"$N" "$Y"'$directory'"$N"; sleep 0.05; + else + if [ -f "$hosts" ]; then + if [ -s $whitelist ]; then + echo -e "$G""[✓] Whitelist Found!""$N"; sleep 0.05; + echo -e "$W""[+] Applying Whitelist:\n""$N"; sleep 0.05; + echo -e "$C"'[+] Whitelist Log -'"$N"; sleep 0.05; + rm -f $temp $stemp $ptemp $ltemp + sed 's/^ *//; s/ *$//; /^$/d; /^#/ d' $whitelist > $ltemp + sort -u $ltemp > $stemp + NEWFILTERS="$(cat $stemp)" + printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew + do + domain=$(getDomain "$linenew"); + # 1 + if [[ "$domain" == "null" ]]; then + echo "$R""[×] Error: Wrong input.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$W"" >""$N""$G"" $domain ""$N""$W""- already whitelisted.""$N" + else + grep -Fvxf $stemp "$hosts" > $temp + rm -f "$hosts" + mv -f $temp "$hosts" + grep -Fvf $stemp "$hosts" > $temp + rm -f "$hosts" + mv -f $temp "$hosts" + grep -vxf $stemp "$hosts" > $temp + rm -f "$hosts" + mv -f $temp "$hosts" + echo -e "$W"" >""$N""$Y"" $domain ""$N""$W""- whitelisted.""$N" + fi + fi + done + rm -f $temp $stemp $ptemp $ltemp + echo -e "$G"'\n[✓] Done\n'"$N"; sleep 0.05; + else + echo -e "$R"'[-] Whitelist file is empty!'"$N"; sleep 0.05; + echo -e "$R"'[-] Nothing whitelisted!'"$N"; sleep 0.05; + fi + else + echo -e "$R"'\n[-] No hosts file detected!'"$N"; sleep 0.05; + echo -e "$Y"'[+] Apply a hosts file first\n'"$N"; sleep 0.05; + fi fi } # ---------------------------------------- @@ -1209,101 +1214,101 @@ doWhitelist() { # Instant blacklist # ---------------------------------------- instantBlacklist() { - while true - do - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ I N S T A N T B L A C K L I S T'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $W"Adds a domain to hosts as blacklisted.\n > Domain name only. (ex. xyz.com)\n > Subdomain also works. (ex. a.xyz.com)"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo ""; sleep 0.05; - echo -en $W'[>] Domain: '$N - read ib - ## - domain=$(getDomain $ib); - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $ib not a domain."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -en $W'\n > blacklist '$N$Y"$domain "$N$W"?\n"$N - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - echo -e "\n# Instant Blacklist Applied on - $date" >> $hosts - echo -e "$currentIP $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $blacklist - echo "$domain" >> $blacklist - echo -e $W"\n > "$N$Y"$domain "$N$W"- blacklisted.\n"$N; sleep 0.05; - echo -n -e $W'[>] Blacklist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - clear - else - clear - echo -en $W'[+] Blacklist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - printReturn - fi - else - echo -e $G"\n[✓] "$N$Y"$domain"$N$G" - already blacklisted!\n"$N - sleep 1 - echo -en $W'[+] Blacklist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - fi - ## - fi - done + while true + do + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + clear + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ I N S T A N T B L A C K L I S T'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$W""Adds a domain to hosts as blacklisted.\n > Domain name only. (ex. xyz.com)\n > Subdomain also works. (ex. a.xyz.com)""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo ""; sleep 0.05; + echo -en "$W"'[>] Domain: '"$N" + read ib + ## + domain=$(getDomain "$ib"); + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $ib not a domain.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -en "$W"'\n > blacklist '"$N""$Y""$domain ""$N""$W""?\n""$N" + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + echo -e "\n# Instant Blacklist Applied on - $date" >> "$hosts" + echo -e "$currentIP $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $blacklist + echo "$domain" >> $blacklist + echo -e "$W""\n > ""$N""$Y""$domain ""$N""$W""- blacklisted.\n""$N"; sleep 0.05; + echo -n -e "$W"'[>] Blacklist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + clear + else + clear + echo -en "$W"'[+] Blacklist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + printReturn + fi + else + echo -e "$G""\n[✓] ""$N""$Y""$domain""$N""$G"" - already blacklisted!\n""$N" + sleep 1 + echo -en "$W"'[+] Blacklist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + fi + ## + fi + done } # ---------------------------------------- -# ---------------------------------------- +# ---------------------------------------- # Instant blacklist CLI # ---------------------------------------- instantBlacklistCli() { - echo '' - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - if [ -f "$hosts" ]; then - # - shift - for i in $@ - do - ## - domain=$(getDomain $i); - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $i not a domain."$N - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e $R"[×] "$N$Y"$domain"$N$R" - not blacklisted!"$N; sleep 0.05; - echo -e "\n# Instant Blacklist Applied on - $date" >> $hosts - echo -e "$currentIP $domain" >> $hosts - echo -e $Y"[+] "$N$Y"$domain"$N$Y" - blacklisted!"$N; sleep 0.05; - echo -e "\n# Applied on - $date" >> $blacklist - echo "$domain" >> $blacklist - else - echo -e $G"[✓] "$N$Y"$domain"$N$G" - already blacklisted!"$N - fi - fi - ## - done - # - fi - echo '' - printDonate; + echo '' + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + if [ -f "$hosts" ]; then + # + shift + for i in "$@" + do + ## + domain=$(getDomain "$i"); + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $i not a domain.""$N" + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$R""[×] ""$N""$Y""$domain""$N""$R"" - not blacklisted!""$N"; sleep 0.05; + echo -e "\n# Instant Blacklist Applied on - $date" >> "$hosts" + echo -e "$currentIP $domain" >> "$hosts" + echo -e "$Y""[+] ""$N""$Y""$domain""$N""$Y"" - blacklisted!""$N"; sleep 0.05; + echo -e "\n# Applied on - $date" >> $blacklist + echo "$domain" >> $blacklist + else + echo -e "$G""[✓] ""$N""$Y""$domain""$N""$G"" - already blacklisted!""$N" + fi + fi + ## + done + # + fi + echo '' + printDonate; } # ---------------------------------------- @@ -1311,61 +1316,61 @@ instantBlacklistCli() { # Instant whitelist # ---------------------------------------- instantWhitelist() { - while true - do - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ I N S T A N T W H I T E L I S T'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $W"Removes a domain from hosts as whitelisted.\n > Domain name only. (ex. xyz.com)\n > Subdomain also works. (ex. a.xyz.com)"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo ""; sleep 0.05; - echo -en $W'[>] Domain: '$N - read iw - ## - domain=$(getDomain $iw); - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $iw not a domain."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $iw" $hosts)" ]; then - echo -e $W"\n[✓] "$N$Y"$domain"$N$W" - not blacklisted!\n"$N; sleep 0.05; - sleep 1 - echo -n -e $W'[+] Whitelist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - else - echo -en $W'\n > whitelist '$N$Y"$domain "$N$W"?\n"$N - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - grep -Fvx "$currentIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo "$domain" >> $whitelist - echo -e $W"\n > "$N$Y"$domain "$N$W"- whitelisted.\n"$N; sleep 0.05; - echo -n -e $W'[+] Whitelist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - else - clear - echo -n -e $W'[+] Whitelist another domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - fi - fi - ## - fi - done - + while true + do + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + clear + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ I N S T A N T W H I T E L I S T'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$W""Removes a domain from hosts as whitelisted.\n > Domain name only. (ex. xyz.com)\n > Subdomain also works. (ex. a.xyz.com)""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo ""; sleep 0.05; + echo -en "$W"'[>] Domain: '"$N" + read iw + ## + domain=$(getDomain "$iw"); + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $iw not a domain.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $iw" "$hosts")" ]; then + echo -e "$W""\n[✓] ""$N""$Y""$domain""$N""$W"" - not blacklisted!\n""$N"; sleep 0.05; + sleep 1 + echo -n -e "$W"'[+] Whitelist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + else + echo -en "$W"'\n > whitelist '"$N""$Y""$domain ""$N""$W""?\n""$N" + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + grep -Fvx "$currentIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo "$domain" >> $whitelist + echo -e "$W""\n > ""$N""$Y""$domain ""$N""$W""- whitelisted.\n""$N"; sleep 0.05; + echo -n -e "$W"'[+] Whitelist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + else + clear + echo -n -e "$W"'[+] Whitelist another domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + fi + fi + ## + fi + done + } # ---------------------------------------- @@ -1373,36 +1378,36 @@ instantWhitelist() { # Instant whitelist CLI # ---------------------------------------- instantWhitelistCli() { - echo '' - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -f "$hosts" ]; then - # - shift - for i in $@ - do - ## - domain=$(getDomain $i); - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $i not a domain."$N - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e $G"[✓] "$N$Y"$domain"$N$G" - already whitelisted!"$N; sleep 0.05; - else - echo -e $R"[×] "$N$Y"$domain"$N$R" - not whitelisted!"$N; sleep 0.05; - grep -Fvx "$currentIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo -e $Y"[+] "$N$Y"$domain"$N$Y" - whitelisted!"$N; sleep 0.05; - echo -e "\n# Applied on - $date" >> $whitelist - echo "$domain" >> $whitelist - fi - fi - ## - done - # - fi - echo '' - printDonate; + echo '' + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -f "$hosts" ]; then + # + shift + for i in "$@" + do + ## + domain=$(getDomain "$i"); + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $i not a domain.""$N" + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$G""[✓] ""$N""$Y""$domain""$N""$G"" - already whitelisted!""$N"; sleep 0.05; + else + echo -e "$R""[×] ""$N""$Y""$domain""$N""$R"" - not whitelisted!""$N"; sleep 0.05; + grep -Fvx "$currentIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo -e "$Y""[+] ""$N""$Y""$domain""$N""$Y"" - whitelisted!""$N"; sleep 0.05; + echo -e "\n# Applied on - $date" >> $whitelist + echo "$domain" >> $whitelist + fi + fi + ## + done + # + fi + echo '' + printDonate; } # ---------------------------------------- @@ -1410,87 +1415,87 @@ instantWhitelistCli() { # Redirectlist # ---------------------------------------- doRedirect(){ - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ R E D I R E C T'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $W"Redirects the domains in the list to an IP."$N; sleep 0.05; - echo ''; sleep 0.05; - # Begins - if [ ! -f $REDIRECTLIST ]; then - echo -e $R'\n[-] No Redirectlist detected!'$N - echo -e $W'[+] Copy your redirect list to'$N $Y'$directory'$N - else - if [ -f "$hosts" ]; then - if [ -s $REDIRECTLIST ]; then - echo -e $G'[+] Redirectlist Found!'$N - echo -e -n $W"[+] Select IP Type -\n\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -"$N "$ipType" - read ipType - if [[ "$ipType" == "1" ]]; then - while true - do - echo -n -e $W'[+] Enter Redirection IPV4:'$N "$ipInput" - read ipInput - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") - if [ -z "$ip" ]; then - echo -e $R"\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n"$N - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - else - break - fi - done - else - echo -n -e $W'[+] Enter Redirection IPV6:'$N "$ip" - read ip - fi - echo -e $W'[+] Your IP:'$N $Y"$ip"$N - echo -n -e $W'[+] Are you sure?'$N $Y'[Y/N]:'$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $W'[+] Redirecting...'$N; sleep 0.05; - echo -e $C"[>] Redirect Log -"$N - rm -f $stemp - echo nais1 - cp $REDIRECTLIST $stemp - echo -e "\n# Applied on - $date" >> $hosts - sed 's/^ *//; s/ *$//; /^$/d; /^#/d' $stemp > $temp - echo nais2 - #truncate -s 0 $hosts - NEWFILTERS="$(cat $temp)" - printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew - do - echo nais3 - truncate -s 0 $stemp - grep -Fvx "$currentIP $linenew" $hosts > $stemp - echo nais4 - truncate -s 0 $hosts - echo nais5 - mv -f $stemp $hosts - #cat $temp >> $hosts - echo nais6 - if [ ! "$(grep -Fx "$currentIP $linenew" $hosts)" ]; then - echo -e "$ip $linenew" >> $hosts - echo nais7 - echo -e $Y"$linenew "$N$W"- redirected to "$N$G"$ip"$N - fi - done - else - echo -e $W'[+] Returning...'$N - fi - else - echo -e $R'\n[-] Redirectlist file is empty!'$N - echo -e $R'[-] Nothing redirected!'$N - fi - else - echo -e $R'\[-] No hosts file detected!'$N - echo -e $Y'[+] Apply a hosts file first'$N - fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ R E D I R E C T'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$W""Redirects the domains in the list to an IP.""$N"; sleep 0.05; + echo ''; sleep 0.05; + # Begins + if [ ! -f $REDIRECTLIST ]; then + echo -e "$R"'\n[-] No Redirectlist detected!'"$N" + echo -e "$W"'[+] Copy your redirect list to'"$N" "$Y"'$directory'"$N" + else + if [ -f "$hosts" ]; then + if [ -s $REDIRECTLIST ]; then + echo -e "$G"'[+] Redirectlist Found!'"$N" + echo -e -n "$W""[+] Select IP Type -\n\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -""$N" "$ipType" + read ipType + if [[ "$ipType" == "1" ]]; then + while true + do + echo -n -e "$W"'[+] Enter Redirection IPV4:'"$N" "$ipInput" + read ipInput + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") + if [ -z "$ip" ]; then + echo -e "$R""\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n""$N" + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + else + break + fi + done + else + echo -n -e "$W"'[+] Enter Redirection IPV6:'"$N" "$ip" + read ip + fi + echo -e "$W"'[+] Your IP:'"$N" "$Y""$ip""$N" + echo -n -e "$W"'[+] Are you sure?'"$N" "$Y"'[Y/N]:'"$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo -e "$W"'[+] Redirecting...'"$N"; sleep 0.05; + echo -e "$C""[>] Redirect Log -""$N" + rm -f $stemp + echo nais1 + cp $REDIRECTLIST $stemp + echo -e "\n# Applied on - $date" >> "$hosts" + sed 's/^ *//; s/ *$//; /^$/d; /^#/d' $stemp > $temp + echo nais2 + #truncate -s 0 $hosts + NEWFILTERS="$(cat $temp)" + printf '%s\n' "$NEWFILTERS" | while IFS= read -r linenew + do + echo nais3 + truncate -s 0 $stemp + grep -Fvx "$currentIP $linenew" "$hosts" > $stemp + echo nais4 + truncate -s 0 "$hosts" + echo nais5 + mv -f $stemp "$hosts" + #cat $temp >> $hosts + echo nais6 + if [ ! "$(grep -Fx "$currentIP $linenew" "$hosts")" ]; then + echo -e "$ip $linenew" >> "$hosts" + echo nais7 + echo -e "$Y""$linenew ""$N""$W""- redirected to ""$N""$G""$ip""$N" + fi + done + else + echo -e "$W"'[+] Returning...'"$N" + fi + else + echo -e "$R"'\n[-] Redirectlist file is empty!'"$N" + echo -e "$R"'[-] Nothing redirected!'"$N" + fi + else + echo -e "$R"'\[-] No hosts file detected!'"$N" + echo -e "$Y"'[+] Apply a hosts file first'"$N" + fi fi } # ---------------------------------------- @@ -1499,86 +1504,86 @@ doRedirect(){ # Instant reditect domain # ---------------------------------------- instantRedirect() { - while true - do - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ I N S T A N T R E D I R E C T'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $W"Instant redirect helps to redirect any specific\n domain to any IP."$N - echo -e $Y"$divider"$N; sleep 0.05; - echo "" - echo -n -e $W'[>] Enter Domain: '$N - read irD - domain=$(getDomain $irD); - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $irD not a domain."$N; sleep 1; - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - else - echo -e $W'[+] Domain:'$N $Y"$domain"$N - fi - echo -n -e $W'[+] Are you sure?'$N $Y'[Y/N]:'$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - currentDomainIP=$(grep " $domain" $hosts | sed "s/ $domain//") - grep -Fvx "$currentDomainIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo -e -n $W"[+] Select IP Type -\n\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -"$N "$ipType" - read ipType - if [[ "$ipType" == "1" ]]; then - while true - do - echo -n -e $W'[+] Enter Redirection IPV4:'$N "$ipInput" - read ipInput - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") - if [ -z "$ip" ]; then - echo -e $R"\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n"$N - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - else - break - fi - done - else - echo -n -e $W'[+] Enter Redirection IPV6:'$N "$ip" - read ip - fi - echo -e $W'[+] IP: '$N $Y"$ip"$N - echo -e $W"\n > Redirect "$N$Y"$domain"$N$W" to IP "$N$Y"$ip"$N$W"?"$N - echo -n -e $W"[+] Are you sure?"$N $Y"[Y/N]:"$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - echo -e "\n$ip $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $REDIRECTLIST - echo "$domain" >> $REDIRECTLIST - echo -e $W"\n > "$N$Y"$domain"$N$W" redirected to IP "$N$Y"$ip\n"$N - else - echo -e "\n$currentIP $domain" >> $hosts - fi - sleep 1 - echo -n -e $W'[+] Redirect Another Domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - clear - else - - echo -n -e $W'[+] Redirect Another Domain?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi - fi + while true + do + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ I N S T A N T R E D I R E C T'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$W""Instant redirect helps to redirect any specific\n domain to any IP.""$N" + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "" + echo -n -e "$W"'[>] Enter Domain: '"$N" + read irD + domain=$(getDomain "$irD"); + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $irD not a domain.""$N"; sleep 1; + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + else + echo -e "$W"'[+] Domain:'"$N" "$Y""$domain""$N" + fi + echo -n -e "$W"'[+] Are you sure?'"$N" "$Y"'[Y/N]:'"$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo -e -n "$W""[+] Select IP Type -\n\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -""$N" "$ipType" + read ipType + if [[ "$ipType" == "1" ]]; then + while true + do + echo -n -e "$W"'[+] Enter Redirection IPV4:'"$N" "$ipInput" + read ipInput + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") + if [ -z "$ip" ]; then + echo -e "$R""\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n""$N" + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + else + break + fi + done + else + echo -n -e "$W"'[+] Enter Redirection IPV6:'"$N" "$ip" + read ip + fi + echo -e "$W"'[+] IP: '"$N" "$Y""$ip""$N" + echo -e "$W""\n > Redirect ""$N""$Y""$domain""$N""$W"" to IP ""$N""$Y""$ip""$N""$W""?""$N" + echo -n -e "$W""[+] Are you sure?""$N" "$Y""[Y/N]:""$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + echo -e "\n$ip $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $REDIRECTLIST + echo "$domain" >> $REDIRECTLIST + echo -e "$W""\n > ""$N""$Y""$domain""$N""$W"" redirected to IP ""$N""$Y""$ip\n""$N" + else + echo -e "\n$currentIP $domain" >> "$hosts" + fi + sleep 1 + echo -n -e "$W"'[+] Redirect Another Domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + clear + else + + echo -n -e "$W"'[+] Redirect Another Domain?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + fi done } # ---------------------------------------- @@ -1587,75 +1592,75 @@ instantRedirect() { # Instant redirect CLI # ---------------------------------------- instantRedirectCli() { - echo '' - currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - case "$2" in - -4|-v4|--ipv4|--ip4) - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") - if [ -z "$ip" ]; then - echo -e $R"\n[×] Error: $3 not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n"$N - exit - else - echo -e $W"\n[+] Your Redirection IP"$N $Y"$ip"$N - fi - shift - for i in $@ - do - ## - domain=$(getDomain $i); - if [[ "$domain" == "0" ]]; then - echo $R"\n[×] Error: $i not a domain.\n"$N - exit - else - currentDomainIP=$(grep " $domain" $hosts | sed "s/ $domain//") - grep -Fvx "$currentDomainIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo -e "\n$ip $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $REDIRECTLIST - echo "$domain" >> $REDIRECTLIST - echo -e $W"\n > "$N$Y"$domain"$N$W" redirected to IP "$N$Y"$ip"$N - fi - done - echo '' - printDonate; - ;; - -6|-v6|--ipv6|--ip6) - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") - if [ ! -z "$ip" ]; then - echo -e $R"\n[×] Error: $3 not an IPV6.\n > Must be an IPV6. (Ex. ::1)\n"$N - exit - else - echo -e $W"\n[+] Your Redirection IP"$N $Y"$ip"$N - fi - shift - for i in $@ - do - ## - domain=$(getDomain $i); - if [[ "$domain" == "0" ]]; then - echo $R"\n[×] Error: $i not a domain.\n"$N - exit - else - currentDomainIP=$(grep " $domain" $hosts | sed "s/ $domain//") - grep -Fvx "$currentDomainIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo -e "\n$ip $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $REDIRECTLIST - echo "$domain" >> $REDIRECTLIST - echo -e $W"\n > "$N$Y"$domain"$N$W" redirected to IP "$N$Y"$ip"$N - fi - done - echo '' - printDonate; - ;; - *) echo -e $R"\n[-] $2 invalid input.\n"$N - ;; - esac + echo '' + currentIP=$(grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + case "$2" in + -4|-v4|--ipv4|--ip4) + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") + if [ -z "$ip" ]; then + echo -e "$R""\n[×] Error: $3 not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n""$N" + exit + else + echo -e "$W""\n[+] Your Redirection IP""$N" "$Y""$ip""$N" + fi + shift + for i in "$@" + do + ## + domain=$(getDomain "$i"); + if [[ "$domain" == "0" ]]; then + echo "$R""\n[×] Error: $i not a domain.\n""$N" + exit + else + currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo -e "\n$ip $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $REDIRECTLIST + echo "$domain" >> $REDIRECTLIST + echo -e "$W""\n > ""$N""$Y""$domain""$N""$W"" redirected to IP ""$N""$Y""$ip""$N" + fi + done + echo '' + printDonate; + ;; + -6|-v6|--ipv6|--ip6) + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") + if [ ! -z "$ip" ]; then + echo -e "$R""\n[×] Error: $3 not an IPV6.\n > Must be an IPV6. (Ex. ::1)\n""$N" + exit + else + echo -e "$W""\n[+] Your Redirection IP""$N" "$Y""$ip""$N" + fi + shift + for i in "$@" + do + ## + domain=$(getDomain "$i"); + if [[ "$domain" == "0" ]]; then + echo "$R""\n[×] Error: $i not a domain.\n""$N" + exit + else + currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo -e "\n$ip $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $REDIRECTLIST + echo "$domain" >> $REDIRECTLIST + echo -e "$W""\n > ""$N""$Y""$domain""$N""$W"" redirected to IP ""$N""$Y""$ip""$N" + fi + done + echo '' + printDonate; + ;; + *) echo -e "$R""\n[-] $2 invalid input.\n""$N" + ;; + esac } # ---------------------------------------- @@ -1663,60 +1668,60 @@ instantRedirectCli() { # Redirection IP # ---------------------------------------- redirectIP() { - while true + while true do - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ R E D I R E C T I O N I P'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $W"Add custom Redirection IP. It must be an IP.\nUsing anything else than IP, may cause issue with\nyour hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo "" - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - echo -e $W"[+] Current IPV6: "$N$Y"$currentIP"$N - else - echo -e $W"[+] Current IPV4: $currentIP"$N - fi - echo -e -n $W"[+] Select IP Type -\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -"$N "$ipType" - read ipType - if [[ "$ipType" == "1" ]]; then - while true - do - echo -n -e $W'[+] Enter Redirection IPV4:'$N "$ipInput" - read ipInput - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") - if [ -z "$ip" ]; then - echo -e $R"\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n"$N - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - else - break - fi - done - else - echo -n -e $W'[+] Enter Redirection IPV6:'$N "$ip" - read ip - fi - echo -e $W"[+] Your Redirection IP"$N $Y"$ip"$N - echo -n -e $W"[+] Are you sure?"$N $Y"[Y/N]:"$N - read answer - if [[ "$answer" == "Y" || "$answer" == "y" ]]; then - echo $W"[+] Adding "$N$Y"$ip"$N$W" as redirection IP..."$N - rm -f $temp $stemp $ptemp - #sed -ie 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/'"${ip}"'/g' $hosts - sed -i "s/$currentIP/$ip/g" $hosts - rm -f $temp $stemp $ptemp $ltemp - else - clear - fi - echo -n -e $W'[+] Change to another IP?'$N $Y'[y/n]:'$N - read answer - if [[ "$answer" == "N" || "$answer" == "n" ]]; then - break - fi + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ R E D I R E C T I O N I P'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$W""Add custom Redirection IP. It must be an IP.\nUsing anything else than IP, may cause issue with\nyour hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "" + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + echo -e "$W""[+] Current IPV6: ""$N""$Y""$currentIP""$N" + else + echo -e "$W""[+] Current IPV4: $currentIP""$N" + fi + echo -e -n "$W""[+] Select IP Type -\n > 1. IPV4\n > 2. IPV6\n\n[+] Your choice -""$N" "$ipType" + read ipType + if [[ "$ipType" == "1" ]]; then + while true + do + echo -n -e "$W"'[+] Enter Redirection IPV4:'"$N" "$ipInput" + read ipInput + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$ipInput") + if [ -z "$ip" ]; then + echo -e "$R""\n[×] Error: $ipInput not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n""$N" + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + else + break + fi + done + else + echo -n -e "$W"'[+] Enter Redirection IPV6:'"$N" "$ip" + read ip + fi + echo -e "$W""[+] Your Redirection IP""$N" "$Y""$ip""$N" + echo -n -e "$W""[+] Are you sure?""$N" "$Y""[Y/N]:""$N" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + echo "$W""[+] Adding ""$N""$Y""$ip""$N""$W"" as redirection IP...""$N" + rm -f $temp $stemp $ptemp + #sed -ie 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/'"${ip}"'/g' $hosts + sed -i "s/$currentIP/$ip/g" "$hosts" + rm -f $temp $stemp $ptemp $ltemp + else + clear + fi + echo -n -e "$W"'[+] Change to another IP?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi done } # ---------------------------------------- @@ -1725,213 +1730,213 @@ redirectIP() { # Redirection IP CLI # ---------------------------------------- redirectIPCli() { - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - case "$2" in - -4|-v4|--ipv4|--ip4) - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") - if [ -z "$ip" ]; then - echo -e $R"\n[×] Error: $3 not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n"$N - exit - else - echo -e $W"\n[+] Your Redirection IP"$N $Y"$ip"$N - echo $W"[+] Adding "$N$Y"$ip"$N$W" as redirection IP..."$N - sed -i "s/$currentIP/$ip/g" $hosts - fi - echo '' - printDonate; - ;; - -6|-v6|--ipv6|--ip6) - ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") - if [ ! -z "$ip" ]; then - echo -e $R"\n[×] Error: $3 not an IPV6.\n > Must be an IPV6. (Ex. ::1)\n"$N - exit - else - echo -e $W"\n[+] Your Redirection IP"$N $Y"$ip"$N - echo $W"[+] Adding "$N$Y"$ip"$N$W" as redirection IP..."$N - sed -i "s/$currentIP/$ip/g" $hosts - fi - echo '' - printDonate; - ;; - *) echo -e $R"\n[-] $2 invalid input.\n"$N - ;; - esac - + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + case "$2" in + -4|-v4|--ipv4|--ip4) + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") + if [ -z "$ip" ]; then + echo -e "$R""\n[×] Error: $3 not an IPV4.\n > Must be an IP. (Ex. 0.0.0.0)\n > No non-numeric character.\n""$N" + exit + else + echo -e "$W""\n[+] Your Redirection IP""$N" "$Y""$ip""$N" + echo "$W""[+] Adding ""$N""$Y""$ip""$N""$W"" as redirection IP...""$N" + sed -i "s/$currentIP/$ip/g" "$hosts" + fi + echo '' + printDonate; + ;; + -6|-v6|--ipv6|--ip6) + ip=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$3") + if [ ! -z "$ip" ]; then + echo -e "$R""\n[×] Error: $3 not an IPV6.\n > Must be an IPV6. (Ex. ::1)\n""$N" + exit + else + echo -e "$W""\n[+] Your Redirection IP""$N" "$Y""$ip""$N" + echo "$W""[+] Adding ""$N""$Y""$ip""$N""$W"" as redirection IP...""$N" + sed -i "s/$currentIP/$ip/g" "$hosts" + fi + echo '' + printDonate; + ;; + *) echo -e "$R""\n[-] $2 invalid input.\n""$N" + ;; + esac + } # ---------------------------------------- # ---------------------------------------- -# Check for blocked domain +# Check for blocked domain # ---------------------------------------- checkBlacklistDomain () { - while true - do - clear - # Get current IP - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ C H E C K D O M A I N'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"Check any specific domain availability in hosts."$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo ""; sleep 0.05; - echo -en $W"[>] Domain: "$N - read dom - domain=$(getDomain $dom); - # 1 - if [[ "$domain" == "null" ]]; then - echo $R"[×] Error: Wrong input."$N; sleep 2; - else - # - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $dom not a domain."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e $R"[×] $domain "$N$W"- is not in the list!"$N; sleep 0.05; - echo -e $Y"[+] Want to blacklist?"$N; sleep 0.05; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - echo -e $W"[+] Applying $domain as blacklist..."$N; sleep 0.05; - echo -e "\n# Instant Blacklist Applied on - $date" >> $hosts - echo -e "$currentIP $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $blacklist - echo "$domain" >> $blacklist - echo -e $W"[✓] "$N$Y"$domain "$N$W"- blacklisted."$N && sleep 0.5 - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - exit - fi - else - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - fi - else - echo -e $G"[✓] $domain "$N$W"- already blacklisted!"$N - sleep 1 - echo -e $W"[+] Want to whitelist?"$N - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - echo $W"[+] Applying $domain as whitelist..."$N; sleep 0.05; - grep -Fvx "$currentIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo "$domain" >> $whitelist - echo -e $W"[✓] "$N$Y"$domain "$N$W"- whitelisted."$N; sleep 0.05; - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - clear - else - checkAgain; - if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then - break - fi - fi - fi - #fi - fi #2 - fi #1 + while true + do + clear + # Get current IP + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ C H E C K D O M A I N'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y""Check any specific domain availability in hosts.""$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo ""; sleep 0.05; + echo -en "$W""[>] Domain: ""$N" + read dom + domain=$(getDomain "$dom"); + # 1 + if [[ "$domain" == "null" ]]; then + echo "$R""[×] Error: Wrong input.""$N"; sleep 2; + else + # + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $dom not a domain.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$R""[×] $domain ""$N""$W""- is not in the list!""$N"; sleep 0.05; + echo -e "$Y""[+] Want to blacklist?""$N"; sleep 0.05; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + echo -e "$W""[+] Applying $domain as blacklist...""$N"; sleep 0.05; + echo -e "\n# Instant Blacklist Applied on - $date" >> "$hosts" + echo -e "$currentIP $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $blacklist + echo "$domain" >> $blacklist + echo -e "$W""[✓] ""$N""$Y""$domain ""$N""$W""- blacklisted.""$N" && sleep 0.5 + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + exit + fi + else + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + fi + else + echo -e "$G""[✓] $domain ""$N""$W""- already blacklisted!""$N" + sleep 1 + echo -e "$W""[+] Want to whitelist?""$N" + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + echo "$W""[+] Applying $domain as whitelist...""$N"; sleep 0.05; + grep -Fvx "$currentIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo "$domain" >> $whitelist + echo -e "$W""[✓] ""$N""$Y""$domain ""$N""$W""- whitelisted.""$N"; sleep 0.05; + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + clear + else + checkAgain; + if [[ "$userAnswer" == "N" || "$userAnswer" == "n" ]]; then + break + fi + fi + fi + #fi + fi #2 + fi #1 done -} +} # ---------------------------------------- # ---------------------------------------- # Check for blocked domain CLI # ---------------------------------------- checkBlacklistDomainCli () { - while true - do - echo '' - # Get current IP - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - domain=$(getDomain $2); - # 1 - if [[ "$domain" == "null" ]]; then - echo $R"[×] Error: Wrong input."$N; sleep 2; - else - # - if [[ "$domain" == "0" ]]; then - echo $R"[×] Error: $2 not a domain."$N; sleep 2; - else - if [ ! "$(grep -x "$currentIP $domain" $hosts)" ]; then - echo -e $R"[×] $domain "$N$W"- is not in the list!"$N; sleep 0.05; - echo -e $Y"[+] Want to blacklist?"$N; sleep 0.05; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - echo -e $W"[+] Applying $domain as blacklist..."$N; sleep 0.05; - echo -e "\n# Instant Blacklist Applied on - $date" >> $hosts - echo -e "$currentIP $domain" >> $hosts - echo -e "\n# Applied on - $date" >> $blacklist - echo "$domain" >> $blacklist - echo -e $W"[✓] "$N$Y"$domain "$N$W"- blacklisted."$N && sleep 0.5 - echo '' - printDonate; - else - exit - echo '' - fi - exit - else - echo -e $G"[✓] $domain "$N$W"- already blacklisted!"$N - sleep 1 - echo -e $W"[+] Want to whitelist?"$N - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - echo $W"[+] Applying $domain as whitelist..."$N; sleep 0.05; - grep -Fvx "$currentIP $domain" $hosts > $temp - truncate -s 0 $hosts - mv -f $temp $hosts - echo "$domain" >> $whitelist - echo -e $W"[✓] "$N$Y"$domain "$N$W"- whitelisted."$N; sleep 0.05; - echo '' - printDonate; - else - exit - echo '' - fi - exit - fi - fi #2 - fi #1 + while true + do + echo '' + # Get current IP + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') + fi + domain=$(getDomain "$2"); + # 1 + if [[ "$domain" == "null" ]]; then + echo "$R""[×] Error: Wrong input.""$N"; sleep 2; + else + # + if [[ "$domain" == "0" ]]; then + echo "$R""[×] Error: $2 not a domain.""$N"; sleep 2; + else + if [ ! "$(grep -x "$currentIP $domain" "$hosts")" ]; then + echo -e "$R""[×] $domain ""$N""$W""- is not in the list!""$N"; sleep 0.05; + echo -e "$Y""[+] Want to blacklist?""$N"; sleep 0.05; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + echo -e "$W""[+] Applying $domain as blacklist...""$N"; sleep 0.05; + echo -e "\n# Instant Blacklist Applied on - $date" >> "$hosts" + echo -e "$currentIP $domain" >> "$hosts" + echo -e "\n# Applied on - $date" >> $blacklist + echo "$domain" >> $blacklist + echo -e "$W""[✓] ""$N""$Y""$domain ""$N""$W""- blacklisted.""$N" && sleep 0.5 + echo '' + printDonate; + else + exit + echo '' + fi + exit + else + echo -e "$G""[✓] $domain ""$N""$W""- already blacklisted!""$N" + sleep 1 + echo -e "$W""[+] Want to whitelist?""$N" + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + echo "$W""[+] Applying $domain as whitelist...""$N"; sleep 0.05; + grep -Fvx "$currentIP $domain" "$hosts" > $temp + truncate -s 0 "$hosts" + mv -f $temp "$hosts" + echo "$domain" >> $whitelist + echo -e "$W""[✓] ""$N""$Y""$domain ""$N""$W""- whitelisted.""$N"; sleep 0.05; + echo '' + printDonate; + else + exit + echo '' + fi + exit + fi + fi #2 + fi #1 done - echo '' -} + echo '' +} # ---------------------------------------- # ---------------------------------------- # Submit issue # ---------------------------------------- submitIssue() { - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ S U B M I T I S S U E'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo $W"Got any whitelist/blacklist issue? or anything\nelse? No worry! Just Submit via Web App or Git Issue."$N - echo -e $Y"$divider"$N - echo "" - echo -e $W"[+] Choose where to submit -\n"$N - echo -e $W" > 1. Web App - app.energized.pro\n > 2. Git Issue\n"$N - echo -n -e $W"[+] Your option -"$N $answer - read answer - if [[ "$answer" == "2" || "$answer" == "2" ]]; then - echo -e $B'You will be redirected Github Issues...'$N - am start -a android.intent.action.VIEW -d "https://github.com/EnergizedProtection/block/issues" - else - echo -e $B'You will be redirected Web App...'$N - am start -a android.intent.action.VIEW -d "https://app.energized.pro" - fi + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ S U B M I T I S S U E'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "$W""Got any whitelist/blacklist issue? or anything\nelse? No worry! Just Submit via Web App or Git Issue.""$N" + echo -e "$Y""$divider""$N" + echo "" + echo -e "$W""[+] Choose where to submit -\n""$N" + echo -e "$W"" > 1. Web App - app.energized.pro\n > 2. Git Issue\n""$N" + echo -n -e "$W""[+] Your option -""$N" "$answer" + read answer + if [[ "$answer" == "2" || "$answer" == "2" ]]; then + echo -e "$B"'You will be redirected Github Issues...'"$N" + am start -a android.intent.action.VIEW -d "https://github.com/EnergizedProtection/block/issues" + else + echo -e "$B"'You will be redirected Web App...'"$N" + am start -a android.intent.action.VIEW -d "https://app.energized.pro" + fi } # ---------------------------------------- @@ -1939,11 +1944,11 @@ submitIssue() { # Restore stock settings # ---------------------------------------- restoreStockSettings() { - checkBusybox; - # Mount system if needed - mountSystem; - # Stock Hosts - echo -e "# Energized Protection - https://energized.pro\n# Let's make an annoyance free better open internet, altogether!\n\n127.0.0.1 localhost\n::1" > '/data/adb/modules/hosts/system/etc/hosts' > '/system/etc/hosts'; chmod '644' '/data/adb/modules/hosts/system/etc/hosts' '/system/etc/hosts'; chown 'root:root' '/data/adb/modules/hosts/system/etc/hosts' '/system/etc/hosts' + checkBusybox; + # Mount system if needed + mountSystem; + # Stock Hosts + echo -e "# Energized Protection - https://energized.pro\n# Let's make an annoyance free better open internet, altogether!\n\n127.0.0.1 localhost\n::1" > '/data/adb/modules/hosts/system/etc/hosts' > '/system/etc/hosts'; chmod '644' '/data/adb/modules/hosts/system/etc/hosts' '/system/etc/hosts'; chown 'root:root' '/data/adb/modules/hosts/system/etc/hosts' '/system/etc/hosts' # Unmount system unmountSystem; } @@ -1953,11 +1958,11 @@ restoreStockSettings() { # Remove files and restore stock settings # ---------------------------------------- uninstall(){ - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ U N I N S T A L L'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - echo $W"Uninstall module and remove files."$N - echo -e $Y"$divider"$N + echo -e "$Y""$divider""$N"; sleep 0.05; + echo -e "$Y"'ϟ U N I N S T A L L'"$N"; sleep 0.05; + echo -e "$Y""$divider""$N"; sleep 0.05; + echo "$W""Uninstall module and remove files.""$N" + echo -e "$Y""$divider""$N" echo "" areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then @@ -1966,12 +1971,12 @@ uninstall(){ # Uninstall rm -rf '/system/bin/energized' '/system/bin/ENERGIZED' '/data/adb/modules/energizedprotection' '/sbin/.magisk/modules/energizedprotection' '/sdcard/EnergizedProtection' > /dev/null 2>&1; clear - echo -e $W"\nIt's sad to see you go!"$N - echo -e $W"But "$N$Y"https://energized.pro"$N$W" is alwyas there for you!"$N - echo -e $W"Reboot once to remove stales."$N + echo -e "$W""\nIt's sad to see you go!""$N" + echo -e "$W""But ""$N""$Y""https://energized.pro""$N""$W"" is alwyas there for you!""$N" + echo -e "$W""Reboot once to remove stales.""$N" else - echo -e $Y"\nGlad you didn't go! Thank you! :)\n"$N - break + echo -e "$Y""\nGlad you didn't go! Thank you! :)\n""$N" + return fi } # ---------------------------------------- @@ -1980,20 +1985,20 @@ uninstall(){ # Print counted domains # ---------------------------------------- printCountedDomains() { - if [ -f $hosts ]; then - if [ "$(grep "watchdog.energized.pro" $hosts)" ]; then + if [ -f "$hosts" ]; then + if [ "$(grep "watchdog.energized.pro" "$hosts")" ]; then countDomains; - if [ $totalDomainsNum -gt 10000 ]; then + if [ "$totalDomainsNum" -gt 10000 ]; then totalDomains="$totalDomains " - elif [ $totalDomainsNum -gt 100000 ]; then + elif [ "$totalDomainsNum" -gt 100000 ]; then totalDomains="$totalDomains" - elif [ $totalDomainsNum -lt 100 ]; then - if [ $totalDomainsNum == "2" ]; then + elif [ "$totalDomainsNum" -lt 100 ]; then + if [ "$totalDomainsNum" == "2" ]; then totalDomains="- " else totalDomains="$totalDomains " fi - fi + fi else totalDomains="- " fi @@ -2008,11 +2013,11 @@ printCountedDomains() { # ---------------------------------------- countDomains() { cleanupTemp; - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') + currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') fi - grep "$currentIP" $hosts > $atemp + grep "$currentIP" "$hosts" > $atemp sed -i "s/$currentIP $currentIP//g" $atemp awk '!visited[$0]++' $atemp > $btemp totalDomainsNum=$(awk 'END{print NR}' $btemp) @@ -2026,35 +2031,35 @@ countDomains() { # ---------------------------------------- removeDuplicates() { cleanupTemp; - mv $hosts $temp + mv "$hosts" $temp awk '!visited[$0]++' $temp > $atemp - truncate -s 0 $hosts - cat $atemp > $hosts + truncate -s 0 "$hosts" + cat $atemp > "$hosts" cleanupTemp; } # ---------------------------------------- case ${1:-} in - -b|--black) instantBlacklistCli $@;; + -b|--black) instantBlacklistCli "$@";; -B|--blacklist) doBlacklist;; -c|--clear) clearHosts;; - -C|--config-file) openConfig $@;; - -e|--extension) addExtension $@;; + -C|--config-file) openConfig "$@";; + -e|--extension) addExtension "$@";; -h|--help) printHelp;; -i|--info) showInfo;; -m|--menu) showMenu;; -o|--open) openHosts;; - -p|--pack) downloadPack $@;; + -p|--pack) downloadPack "$@";; -r|--redirect) doRedirect;; - -u|--update) updateHWBE;; - -w|--white) instantWhitelistCli $@;; + -u|--update) updateHWBE;; + -w|--white) instantWhitelistCli "$@";; -W|--whitelist) doWhitelist;; -bp|--backup) backupHosts;; - -ck|--check) checkBlacklistDomainCli $@;; - -ip|--redirect-ip) redirectIPCli $@;; - -ir|--instant-redirect) instantRedirectCli $@;; + -ck|--check) checkBlacklistDomainCli "$@";; + -ip|--redirect-ip) redirectIPCli "$@";; + -ir|--instant-redirect) instantRedirectCli "$@";; -re|--restore) restoreHosts;; -tg|--telegram) visitTelegram;; -un|--uninstall) uninstall;; *) printHelp;; -esac \ No newline at end of file +esac diff --git a/system/bin/mainMenu.sh b/system/bin/mainMenu.sh index 478fc83..d630c7a 100644 --- a/system/bin/mainMenu.sh +++ b/system/bin/mainMenu.sh @@ -1,15 +1,15 @@ showInfo() { - setupFiles; - checkEP; - echo '' - echo -e $Y"[>] Compatibility Info -"$N - # Check shell + setupFiles; + checkEP; + echo '' + echo -e $Y"[>] Compatibility Info -"$N + # Check shell checkShell & pid=$! spinPID "Shell: Checking" if [[ checkShell != 0 ]]; then - echo -en $G"\r[✓] Shell: $currentShell supported.\n"$N + echo -en $G"\r[✓] Shell: $currentShell supported.\n"$N else - echo -en $R"\r[×] Shell: $currentShell not supported.\n"$N + echo -en $R"\r[×] Shell: $currentShell not supported.\n"$N fi # sleep 0.1 @@ -17,9 +17,9 @@ showInfo() { checkMagisk & pid=$! spinPID "Magisk: Checking" if [[ checkMagisk != 0 ]]; then - echo -en $G"\r[✓] Magisk: $printMagiskVersion supported.\n"$N + echo -en $G"\r[✓] Magisk: $printMagiskVersion supported.\n"$N else - echo -en $R"\r[×] Magisk: $printMagiskVersion not supported.\n"$N + echo -en $R"\r[×] Magisk: $printMagiskVersion not supported.\n"$N fi # sleep 0.1 @@ -27,9 +27,9 @@ showInfo() { checkRoot & pid=$! spinPID "Root: Checking" if [[ checkRoot != 0 ]]; then - echo -en $G"\r[✓] Root: Permission granted.\n"$N + echo -en $G"\r[✓] Root: Permission granted.\n"$N else - echo -en $R"\r[×] Root: Permission not granted.\n"$N + echo -en $R"\r[×] Root: Permission not granted.\n"$N fi # sleep 0.1 @@ -37,10 +37,10 @@ showInfo() { checkBusybox & pid=$! spinPID "Busybox: Checking" if [[ checkBusybox != 0 ]]; then - echo -en $G"\r[✓] Busybox: $busyboxName supported.\n"$N + echo -en $G"\r[✓] Busybox: $busyboxName supported.\n"$N else - echo -en $R"\r[×] Root: $busyboxName not supported.\n"$N - exit + echo -en $R"\r[×] Root: $busyboxName not supported.\n"$N + exit fi # sleep 0.1 @@ -48,9 +48,9 @@ showInfo() { checkAdblockerApp & pid=$! spinPID "Adblocker App: Checking" if [[ checkAdblockerApp == 0 ]]; then - echo -en $G"\r[✓] Adblocker App: No confliction.\n"$N + echo -en $G"\r[✓] Adblocker App: No confliction.\n"$N else - echo -en $R"\r[×] Adblocker App: $adblockAppName detected.\n - Disable to avoid conflict.\n"$N + echo -en $R"\r[×] Adblocker App: $adblockAppName detected.\n - Disable to avoid conflict.\n"$N fi # sleep 0.1 @@ -58,10 +58,10 @@ showInfo() { checkDirectory & pid=$! spinPID "Directory: Checking" if [[ checkDirectory != 0 ]]; then - echo -en $G"\r[✓] Directory: Setup properly.\n"$N + echo -en $G"\r[✓] Directory: Setup properly.\n"$N else - echo -en $R"\r[×] Directory: Check again!\n"$N - exit + echo -en $R"\r[×] Directory: Check again!\n"$N + exit fi # sleep 0.1 @@ -69,54 +69,54 @@ showInfo() { checkUpdate & pid=$! spinPID "Update: Checking"; echo -en "$checkUpdatePrint" - # + # sleep 0.1 if [ -f $hosts ]; then - echo -e $Y"\n[>] Pack Info -"$N - # ---------------------------------------- - printCountedDomains; - # ---------------------------------------- - echo -e $W"[+] Pack: "$N$Y"$epPack"$N; sleep 0.1; - if [ ! -z "$ePCheck" ]; then - echo -e $W"[+] Extension: "$N$Y"Porn"$N; sleep 0.1; - fi - if [ ! -z "$ePLCheck" ]; then - echo -e $W"[+] Extension: "$N$Y"Porn-Lite"$N; sleep 0.1; - fi - if [ ! -z "$eRCheck" ]; then - echo -e $W"[+] Extension: "$N$Y"Regional"$N; sleep 0.1; - fi - if [ ! -z "$eSCheck" ]; then - echo -e $W"[+] Extension: "$N$Y"Social"$N; sleep 0.1; - fi - if [ ! -z "$eXCheck" ]; then - echo -e $W"[+] Extension: "$N$Y"Xtreme"$N; sleep 0.1; - fi - echo -e $W"[+] Domains: "$N$Y"$totalDomains"$N; sleep 0.1; - size=$P"`ls -lah $hosts | awk '{print $5}'`"$N - echo -e $W"[+] Size: "$N$Y"$size"$N; sleep 0.1; - currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - if [ -z "$currentIP" ]; then - currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') - fi - echo -e $W"[+] Current IP: "$N$Y"$currentIP"$N; sleep 0.1; - fi - echo '' - printDonate; + echo -e $Y"\n[>] Pack Info -"$N + # ---------------------------------------- + printCountedDomains; + # ---------------------------------------- + echo -e $W"[+] Pack: "$N$Y"$epPack"$N; sleep 0.1; + if [ ! -z "$ePCheck" ]; then + echo -e $W"[+] Extension: "$N$Y"Porn"$N; sleep 0.1; + fi + if [ ! -z "$ePLCheck" ]; then + echo -e $W"[+] Extension: "$N$Y"Porn-Lite"$N; sleep 0.1; + fi + if [ ! -z "$eRCheck" ]; then + echo -e $W"[+] Extension: "$N$Y"Regional"$N; sleep 0.1; + fi + if [ ! -z "$eSCheck" ]; then + echo -e $W"[+] Extension: "$N$Y"Social"$N; sleep 0.1; + fi + if [ ! -z "$eXCheck" ]; then + echo -e $W"[+] Extension: "$N$Y"Xtreme"$N; sleep 0.1; + fi + echo -e $W"[+] Domains: "$N$Y"$totalDomains"$N; sleep 0.1; + size=$P"`ls -lah $hosts | awk '{print $5}'`"$N + echo -e $W"[+] Size: "$N$Y"$size"$N; sleep 0.1; + currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') + if [ -z "$currentIP" ]; then + currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') + fi + echo -e $W"[+] Current IP: "$N$Y"$currentIP"$N; sleep 0.1; + fi + echo '' + printDonate; } compatibilityInfo() { - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'ϟ C O M P A T I B I L I T Y I N F O -'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - # Check shell + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y'ϟ C O M P A T I B I L I T Y I N F O -'$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + # Check shell checkShell & pid=$! spinPID "Shell: Checking" if [[ checkShell != 0 ]]; then - echo -en $G"\r[✓] Shell: $currentShell supported.\n"$N + echo -en $G"\r[✓] Shell: $currentShell supported.\n"$N else - echo -en $R"\r[×] Shell: $currentShell not supported.\n"$N + echo -en $R"\r[×] Shell: $currentShell not supported.\n"$N fi # sleep 0.1 @@ -124,9 +124,9 @@ compatibilityInfo() { checkMagisk & pid=$! spinPID "Magisk: Checking" if [[ checkMagisk != 0 ]]; then - echo -en $G"\r[✓] Magisk: $printMagiskVersion supported.\n"$N + echo -en $G"\r[✓] Magisk: $printMagiskVersion supported.\n"$N else - echo -en $R"\r[×] Magisk: $printMagiskVersion not supported.\n"$N + echo -en $R"\r[×] Magisk: $printMagiskVersion not supported.\n"$N fi # sleep 0.1 @@ -134,9 +134,9 @@ compatibilityInfo() { checkRoot & pid=$! spinPID "Root: Checking" if [[ checkRoot != 0 ]]; then - echo -en $G"\r[✓] Root: Permission granted.\n"$N + echo -en $G"\r[✓] Root: Permission granted.\n"$N else - echo -en $R"\r[×] Root: Permission not granted.\n"$N + echo -en $R"\r[×] Root: Permission not granted.\n"$N fi # sleep 0.1 @@ -144,10 +144,10 @@ compatibilityInfo() { checkBusybox & pid=$! spinPID "Busybox: Checking" if [[ checkBusybox != 0 ]]; then - echo -en $G"\r[✓] Busybox: $busyboxName supported.\n"$N + echo -en $G"\r[✓] Busybox: $busyboxName supported.\n"$N else - echo -en $R"\r[×] Root: $busyboxName not supported.\n"$N - exit + echo -en $R"\r[×] Root: $busyboxName not supported.\n"$N + exit fi # sleep 0.1 @@ -155,9 +155,9 @@ compatibilityInfo() { checkAdblockerApp & pid=$! spinPID "Adblocker App: Checking" if [[ checkAdblockerApp == 0 ]]; then - echo -en $G"\r[✓] Adblocker App: No confliction.\n"$N + echo -en $G"\r[✓] Adblocker App: No confliction.\n"$N else - echo -en $R"\r[×] Adblocker App: $adblockAppName detected.\n - Disable to avoid conflict.\n"$N + echo -en $R"\r[×] Adblocker App: $adblockAppName detected.\n - Disable to avoid conflict.\n"$N fi # sleep 0.1 @@ -165,10 +165,10 @@ compatibilityInfo() { checkDirectory & pid=$! spinPID "Directory: Checking" if [[ checkDirectory != 0 ]]; then - echo -en $G"\r[✓] Directory: Setup properly.\n"$N + echo -en $G"\r[✓] Directory: Setup properly.\n"$N else - echo -en $R"\r[×] Directory: Check again!\n"$N - exit + echo -en $R"\r[×] Directory: Check again!\n"$N + exit fi # sleep 0.1 @@ -176,7 +176,7 @@ compatibilityInfo() { checkUpdate & pid=$! spinPID "Update: Checking"; echo -en "$checkUpdatePrint" - # + # sleep 0.1 # ---------------------------------------- printCountedDomains; @@ -189,19 +189,19 @@ compatibilityInfo() { } showMenu() { - # Start Echos - # ---------------------------------------- - clear - echo '' - echo -e $Y" _____ _________ _____________ _______ "$N - echo -e $Y" / __/ |/ / __/ _ \/ ___/ _/_ / / __/ _ \ "$N - echo -e $Y" / _// / _// , _/ (_ // / / /_/ _// // / "$N - echo -e $Y" /___/_/|_/___/_/|_|\___/___/ /___/___/____/ "$N - echo '' - echo -e $Y" P R O T E C T I O N"$N; sleep 0.05; - echo -e $W"$divider"$N; sleep 0.05; - echo " Version: $version | Updated: $releaseDate"; sleep 0.05; - echo -e $W"$divider"$N; sleep 0.05; + # Start Echos + # ---------------------------------------- + clear + echo '' + echo -e $Y" _____ _________ _____________ _______ "$N + echo -e $Y" / __/ |/ / __/ _ \/ ___/ _/_ / / __/ _ \ "$N + echo -e $Y" / _// / _// , _/ (_ // / / /_/ _// // / "$N + echo -e $Y" /___/_/|_/___/_/|_|\___/___/ /___/___/____/ "$N + echo '' + echo -e $Y" P R O T E C T I O N"$N; sleep 0.05; + echo -e $W"$divider"$N; sleep 0.05; + echo " Version: $version | Updated: $releaseDate"; sleep 0.05; + echo -e $W"$divider"$N; sleep 0.05; echo ""; sleep 0.05; echo -e $Y' energized.pro'$N; sleep 0.05; echo ""; sleep 0.05; @@ -210,14 +210,14 @@ showMenu() { echo -n -e $Y' •'$N; sleep 0.09; echo -n -e $Y'•'$N; sleep 0.2; echo -n -e $Y'•'$N; sleep 0.09; - + # Setting up required files setupFiles; clear # ---------------------------------------- - - # New UI - compatibilityInfo; + + # New UI + compatibilityInfo; echo '' # Disclaimer & counter # ---------------------------------------- @@ -232,380 +232,380 @@ showMenu() { echo '' printDonate; # Just hit a count to Energized Protection Web - + # # Features & Main Parts # ---------------------------------------- COUNT=1 # ---------------------------------------- - + # Begin loop while true do - # Check Energized Protection pack and update - checkEP; - checkUpdate; + # Check Energized Protection pack and update + checkEP; + checkUpdate; - # Variables - # ---------------------------------------- - update=$C"`date -r $hosts "+%a, %d %b %y %H:%M:%S"`"$N - size=$P"`ls -lah $hosts | awk '{print $5}'`"$N - # ---------------------------------------- + # Variables + # ---------------------------------------- + update=$C"`date -r $hosts "+%a, %d %b %y %H:%M:%S"`"$N + size=$P"`ls -lah $hosts | awk '{print $5}'`"$N + # ---------------------------------------- - # Check Adblocker - # ---------------------------------------- - if [ -f $hosts ]; then - if grep -q ads $hosts; then - adblocker=$G"[✓]"$N - else - adblocker=$R"[×]"$N - fi - fi - - # --------- - + # Check Adblocker + # ---------------------------------------- + if [ -f $hosts ]; then + if grep -q ads $hosts; then + adblocker=$G"[✓]"$N + else + adblocker=$R"[×]"$N + fi + fi - # Input - # ---------------------------------------- - INPUT=$(eval "echo \$$COUNT") - if [ ! "$INPUT" ]; then - if [ "$1" ]; then - rm -f $versionInfo - exit 0 - fi - # Starts Screen Echos - # ---------------------------------------- - clear; - echo '' && sleep 0.05 - echo -e $Y" _____ _________ _____________ _______ "$N; sleep 0.05; - echo -e $Y" / __/ |/ / __/ _ \/ ___/ _/_ / / __/ _ \ "$N; sleep 0.05; - echo -e $Y" / _// / _// , _/ (_ // / / /_/ _// // / "$N; sleep 0.05; - echo -e $Y" /___/_/|_/___/_/|_|\___/___/ /___/___/____/ "$N; sleep 0.05; - echo '' && sleep 0.05 - echo -e $Y' P R O T E C T I O N'$N && sleep 0.05 - echo -e $W" v.$version"$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $Y'ϟ B A S I C I N F O -'$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $root$W" Magisk "$N$W"[+] Busybox: "$N$C"$busyboxName"$N && sleep 0.05 - echo -e $eonoff$W" Secure "$N$W"[+] Pack: "$N$B"$epPack"$N && sleep 0.05 - echo -e $W"[+] Domains: "$N$Y"$totalDomains"$N$W"[+] Size: $size"$N && sleep 0.05 - echo -e $W"[+] Updated: $update"$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05; - # Packs - # ---------------------------------------- - echo -e $Y"ϟ P A C K s - $eupdate"$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $W"[1] Spark [3] Blu [5] Ultimate"$N && sleep 0.05 - echo -e $W"[2] Blu Go [4] Basic [6] Unified"$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $Y"ϟ E X T E N S I O N s -"$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $G"$ePCheck"$N$W"[p] Porn "$N$G"$eRCheck"$N$W"[rl] Regional "$N$G"$eXCheck"$N$W"[x] Xtreme"$N && sleep 0.05 - echo -e $G"$ePLCheck"$N$W"[pl] Porn Lite "$N$G"$eSCheck"$N$W"[s] Social"$N && sleep 0.05 - - # Options - # ---------------------------------------- - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $Y'ϟ O P T I O N s -'$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $W'[o] Open Hosts File [ip] Redirection IP'$N && sleep 0.05 - echo -e $W'[w] Apply Whitelist [iw] Instant Whitelist'$N && sleep 0.05 - echo -e $W'[b] Apply Blacklist [ib] Instant Blacklist'$N && sleep 0.05 - echo -e $W'[r] Redirect Domains [ir] Instant Redirect'$N && sleep 0.05 - - # Misc - # ---------------------------------------- - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $Y'ϟ M I S C -'$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $W'[bp] Backup [rs] Restore [ck] Check'$N && sleep 0.05 - echo -e $W'[u] Update H&WBE [in] Instructions [i] Info'$N && sleep 0.05 - echo -e $R'[c] Clear Hosts '$N$G'[si] Submit Issue '$N$R'[q] Quit.'$N && sleep 0.05 - echo -e $Y"$divider"$N && sleep 0.05 - - # Read Input - # ---------------------------------------- - echo -n $Y"[+] Your Input - "$N - read -r INPUT - if [ "$INPUT" != "m" ]; then - INPUT="$(echo "$INPUT" | sed 's/m//g')" - clear - fi - # Define directory of hosts.gz - DIR="" - fi - case "$INPUT" in - # Spark Protection - # ---------------------------------------- - 1|spark|Spark|SPARK) DIR="spark/formats/hosts.gz" - clear - echo -e $Y"$divider"$N && sleep 0.05 - echo -e $Y'[+] Applying Energized Spark Protection'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - ;; - # Blu Go Protection - # ---------------------------------------- - 2|blugo|BluGo|bluGo|BLUGO) DIR="/bluGo/formats/hosts.gz" - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] Applying Energized Blu Go Protection'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - ;; - # Blu Protection - # ---------------------------------------- - 3|blu|Blu|BLU) DIR="/blu/formats/hosts.gz" - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y'[+] Applying Energized Blu Protection'$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - ;; - # Basic Protection - # ---------------------------------------- - 4|basic|Basic|BASIC) clear - printWarning; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - DIR="/basic/formats/hosts.gz" - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"[+] Applying Energized Basic Protection"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - else - clear - printReturn - fi - ;; - # Ultimate Protection - # ---------------------------------------- - 5|ultimate|Ultimate|ULTIMATE) clear - printWarning; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - DIR="/ultimate/formats/hosts.gz" - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"[+] Applying Energized Ultimate Protection"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - else - clear - printReturn - fi - ;; - # Unified Protection - # ---------------------------------------- - 6|unified|Unified|UNIFIED) clear - printWarning; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - DIR="/unified/formats/hosts.gz" - clear - echo -e $Y"$divider"$N; sleep 0.05; - echo -e $Y"[+] Applying Energized Unified Protection"$N; sleep 0.05; - echo -e $Y"$divider"$N; sleep 0.05; - else - clear - printReturn - fi - ;; - # Porn Protection - # ---------------------------------------- - p|porn|Porn|PORN) clear - printWarning; - areYouSure; - if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then - pornEDownload; - printDonate; - removeDuplicates; - printCountedDomains; - printReturn; - else - clear - printReturn; - fi - ;; - # Porn Lite Extension - # ---------------------------------------- - pl) clear - cleanupTemp; - pornliteEDownload; - printDonate; - removeDuplicates; - printCountedDomains; - printReturn; - ;; - # Regional Extension - # ---------------------------------------- - rl|rg|regional|Regional|REGIONAL|REG|reg) clear - cleanupTemp; - regionalEDownload; - printDonate; - removeDuplicates; - printCountedDomains; - printReturn; - ;; - # Social Extension - # ---------------------------------------- - s|social|Social|SOCIAL) clear - cleanupTemp; - socialEDownload; - printDonate; - removeDuplicates; - printCountedDomains; - printReturn; - ;; - # Xtreme Extension - # ---------------------------------------- - x|X|xtreme|XTRM|xtrm|Xtrm|Xtreme) clear - cleanupTemp; - xtremeEDownload; - printDonate; - removeDuplicates; - printCountedDomains; - printReturn; - ;; - # Update - hosts, whitelist, blacklist s extension(s) - # ---------------------------------------- - u) clear - checkEP; - updateHWBE; - removeDuplicates; - printCountedDomains; - printReturn; - ;; - # Whitelist - # ---------------------------------------- - w) clear - doWhitelist; - printCountedDomains; - printReturn; - ;; - # Instant Whitelist - # ---------------------------------------- - iw) clear - instantWhitelist; - printCountedDomains; - printReturn; - ;; - # Blacklist - # ---------------------------------------- - b) clear - doBlacklist; - printCountedDomains; - printReturn; - ;; - # Instant Blacklist - # ---------------------------------------- - ib) clear - instantBlacklist; - printCountedDomains; - printReturn; - ;; - # Redirect - # ---------------------------------------- - r) clear - doRedirect; - printCountedDomains; - printReturn; - ;; - # Instant Redirect - # ---------------------------------------- - ir) clear - instantRedirect; - printCountedDomains; - printReturn; - ;; - # Systemless Hosts - # ---------------------------------------- - mg|magisk|Magisk|MAGISK) am start -n com.topjohnwu.magisk/a.c - ;; - # Read Hosts File - # ---------------------------------------- - o|O|oh|OH|openhosts|OpenHosts|hosts) openHosts; - ;; - # Info - # ---------------------------------------- - i|info|Info|INFO) am start -a android.intent.action.VIEW -d "https://energized.pro" - ;; - # Instructions - # ---------------------------------------- - Guide|guide|in|instructions|instruction|IN|INSTRUCTION|INSTRUCTIONS) am start -a android.intent.action.VIEW -d "http://link.nayemador.com/epmagiskusage" - ;; - # Submit Issue - # ---------------------------------------- - si|SI|webapp|WEBAPP|WebApp|app|submit|Submit|issue|Submit|is|SUBMIT|ISSUE|IS) clear - submitIssue; - printReturn; - ;; - # Telegram - # ---------------------------------------- - tg|telegram|Telegram|TELEGRAM) visitTelegram; - ;; - # Backup Hosts - # ---------------------------------------- - bp) clear - backupHosts; - printReturn; - ;; - # Restore Hosts - # ---------------------------------------- - rs|restore|Restore|RESTORE) clear - restoreHosts; - printReturn; - ;; - # Clear Hosts - # ---------------------------------------- - c|clear|Clear|CLEAR) clear - clearHosts; - printReturn; - ;; - # Redirection IP - # ---------------------------------------- - ip) clear - redirectIP; - printReturn - ;; - # Check Domain In Hosts - # ---------------------------------------- - chk|check|Check|CHECK|ck) clear - checkBlacklistDomain; - printCountedDomains; - printReturn; - ;; - # Quit - # ---------------------------------------- - q) break - clear - reset - ;; - *) echo -e $R"$divider"$N - echo -e $R"----------- I N V A L I D I N P U T ! ----------"$N - echo -e $R"$divider"$N - sleep 1 - ;; - esac - if [ "$DIR" ]; then - sleep 0.1 - hostsURL="https://block.energized.pro/$DIR" - wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ $hostsURL & pid=$! - spinPID "Pack: Downloading"; - gzip -d -c $hostsGZ > $hosts - rm -f $hostsGZ - checkEP; - echo -en $W"\r["$N$Y"✓"$N$W"] Pack: "$N$Y"$epPack\n"$N - printDonate; - printCountedDomains; - # Update cache filter - setFilter; - printReturn; - sleep 0.1 - clear - fi - DIR="" - COUNT=$((COUNT+1)) - clear - reset + # --------- + + + # Input + # ---------------------------------------- + INPUT=$(eval "echo \$$COUNT") + if [ ! "$INPUT" ]; then + if [ "$1" ]; then + rm -f $versionInfo + exit 0 + fi + # Starts Screen Echos + # ---------------------------------------- + clear; + echo '' && sleep 0.05 + echo -e $Y" _____ _________ _____________ _______ "$N; sleep 0.05; + echo -e $Y" / __/ |/ / __/ _ \/ ___/ _/_ / / __/ _ \ "$N; sleep 0.05; + echo -e $Y" / _// / _// , _/ (_ // / / /_/ _// // / "$N; sleep 0.05; + echo -e $Y" /___/_/|_/___/_/|_|\___/___/ /___/___/____/ "$N; sleep 0.05; + echo '' && sleep 0.05 + echo -e $Y' P R O T E C T I O N'$N && sleep 0.05 + echo -e $W" v.$version"$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $Y'ϟ B A S I C I N F O -'$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $root$W" Magisk "$N$W"[+] Busybox: "$N$C"$busyboxName"$N && sleep 0.05 + echo -e $eonoff$W" Secure "$N$W"[+] Pack: "$N$B"$epPack"$N && sleep 0.05 + echo -e $W"[+] Domains: "$N$Y"$totalDomains"$N$W"[+] Size: $size"$N && sleep 0.05 + echo -e $W"[+] Updated: $update"$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05; + # Packs + # ---------------------------------------- + echo -e $Y"ϟ P A C K s - $eupdate"$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $W"[1] Spark [3] Blu [5] Ultimate"$N && sleep 0.05 + echo -e $W"[2] Blu Go [4] Basic [6] Unified"$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $Y"ϟ E X T E N S I O N s -"$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $G"$ePCheck"$N$W"[p] Porn "$N$G"$eRCheck"$N$W"[rl] Regional "$N$G"$eXCheck"$N$W"[x] Xtreme"$N && sleep 0.05 + echo -e $G"$ePLCheck"$N$W"[pl] Porn Lite "$N$G"$eSCheck"$N$W"[s] Social"$N && sleep 0.05 + + # Options + # ---------------------------------------- + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $Y'ϟ O P T I O N s -'$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $W'[o] Open Hosts File [ip] Redirection IP'$N && sleep 0.05 + echo -e $W'[w] Apply Whitelist [iw] Instant Whitelist'$N && sleep 0.05 + echo -e $W'[b] Apply Blacklist [ib] Instant Blacklist'$N && sleep 0.05 + echo -e $W'[r] Redirect Domains [ir] Instant Redirect'$N && sleep 0.05 + + # Misc + # ---------------------------------------- + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $Y'ϟ M I S C -'$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $W'[bp] Backup [rs] Restore [ck] Check'$N && sleep 0.05 + echo -e $W'[u] Update H&WBE [in] Instructions [i] Info'$N && sleep 0.05 + echo -e $R'[c] Clear Hosts '$N$G'[si] Submit Issue '$N$R'[q] Quit.'$N && sleep 0.05 + echo -e $Y"$divider"$N && sleep 0.05 + + # Read Input + # ---------------------------------------- + echo -n $Y"[+] Your Input - "$N + read -r INPUT + if [ "$INPUT" != "m" ]; then + INPUT="$(echo "$INPUT" | sed 's/m//g')" + clear + fi + # Define directory of hosts.gz + DIR="" + fi + case "$INPUT" in + # Spark Protection + # ---------------------------------------- + 1|spark|Spark|SPARK) DIR="spark/formats/hosts.gz" + clear + echo -e $Y"$divider"$N && sleep 0.05 + echo -e $Y'[+] Applying Energized Spark Protection'$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + ;; + # Blu Go Protection + # ---------------------------------------- + 2|blugo|BluGo|bluGo|BLUGO) DIR="/bluGo/formats/hosts.gz" + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y'[+] Applying Energized Blu Go Protection'$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + ;; + # Blu Protection + # ---------------------------------------- + 3|blu|Blu|BLU) DIR="/blu/formats/hosts.gz" + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y'[+] Applying Energized Blu Protection'$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + ;; + # Basic Protection + # ---------------------------------------- + 4|basic|Basic|BASIC) clear + printWarning; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + DIR="/basic/formats/hosts.gz" + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y"[+] Applying Energized Basic Protection"$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + else + clear + printReturn + fi + ;; + # Ultimate Protection + # ---------------------------------------- + 5|ultimate|Ultimate|ULTIMATE) clear + printWarning; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + DIR="/ultimate/formats/hosts.gz" + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y"[+] Applying Energized Ultimate Protection"$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + else + clear + printReturn + fi + ;; + # Unified Protection + # ---------------------------------------- + 6|unified|Unified|UNIFIED) clear + printWarning; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + DIR="/unified/formats/hosts.gz" + clear + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y"[+] Applying Energized Unified Protection"$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; + else + clear + printReturn + fi + ;; + # Porn Protection + # ---------------------------------------- + p|porn|Porn|PORN) clear + printWarning; + areYouSure; + if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then + pornEDownload; + printDonate; + removeDuplicates; + printCountedDomains; + printReturn; + else + clear + printReturn; + fi + ;; + # Porn Lite Extension + # ---------------------------------------- + pl) clear + cleanupTemp; + pornliteEDownload; + printDonate; + removeDuplicates; + printCountedDomains; + printReturn; + ;; + # Regional Extension + # ---------------------------------------- + rl|rg|regional|Regional|REGIONAL|REG|reg) clear + cleanupTemp; + regionalEDownload; + printDonate; + removeDuplicates; + printCountedDomains; + printReturn; + ;; + # Social Extension + # ---------------------------------------- + s|social|Social|SOCIAL) clear + cleanupTemp; + socialEDownload; + printDonate; + removeDuplicates; + printCountedDomains; + printReturn; + ;; + # Xtreme Extension + # ---------------------------------------- + x|X|xtreme|XTRM|xtrm|Xtrm|Xtreme) clear + cleanupTemp; + xtremeEDownload; + printDonate; + removeDuplicates; + printCountedDomains; + printReturn; + ;; + # Update - hosts, whitelist, blacklist s extension(s) + # ---------------------------------------- + u) clear + checkEP; + updateHWBE; + removeDuplicates; + printCountedDomains; + printReturn; + ;; + # Whitelist + # ---------------------------------------- + w) clear + doWhitelist; + printCountedDomains; + printReturn; + ;; + # Instant Whitelist + # ---------------------------------------- + iw) clear + instantWhitelist; + printCountedDomains; + printReturn; + ;; + # Blacklist + # ---------------------------------------- + b) clear + doBlacklist; + printCountedDomains; + printReturn; + ;; + # Instant Blacklist + # ---------------------------------------- + ib) clear + instantBlacklist; + printCountedDomains; + printReturn; + ;; + # Redirect + # ---------------------------------------- + r) clear + doRedirect; + printCountedDomains; + printReturn; + ;; + # Instant Redirect + # ---------------------------------------- + ir) clear + instantRedirect; + printCountedDomains; + printReturn; + ;; + # Systemless Hosts + # ---------------------------------------- + mg|magisk|Magisk|MAGISK) am start -n com.topjohnwu.magisk/a.c + ;; + # Read Hosts File + # ---------------------------------------- + o|O|oh|OH|openhosts|OpenHosts|hosts) openHosts; + ;; + # Info + # ---------------------------------------- + i|info|Info|INFO) am start -a android.intent.action.VIEW -d "https://energized.pro" + ;; + # Instructions + # ---------------------------------------- + Guide|guide|in|instructions|instruction|IN|INSTRUCTION|INSTRUCTIONS) am start -a android.intent.action.VIEW -d "http://link.nayemador.com/epmagiskusage" + ;; + # Submit Issue + # ---------------------------------------- + si|SI|webapp|WEBAPP|WebApp|app|submit|Submit|issue|Submit|is|SUBMIT|ISSUE|IS) clear + submitIssue; + printReturn; + ;; + # Telegram + # ---------------------------------------- + tg|telegram|Telegram|TELEGRAM) visitTelegram; + ;; + # Backup Hosts + # ---------------------------------------- + bp) clear + backupHosts; + printReturn; + ;; + # Restore Hosts + # ---------------------------------------- + rs|restore|Restore|RESTORE) clear + restoreHosts; + printReturn; + ;; + # Clear Hosts + # ---------------------------------------- + c|clear|Clear|CLEAR) clear + clearHosts; + printReturn; + ;; + # Redirection IP + # ---------------------------------------- + ip) clear + redirectIP; + printReturn + ;; + # Check Domain In Hosts + # ---------------------------------------- + chk|check|Check|CHECK|ck) clear + checkBlacklistDomain; + printCountedDomains; + printReturn; + ;; + # Quit + # ---------------------------------------- + q) break + clear + reset + ;; + *) echo -e $R"$divider"$N + echo -e $R"----------- I N V A L I D I N P U T ! ----------"$N + echo -e $R"$divider"$N + sleep 1 + ;; + esac + if [ "$DIR" ]; then + sleep 0.1 + hostsURL="https://block.energized.pro/$DIR" + wget --no-check-certificate -q -U "$userAgent" -O $hostsGZ $hostsURL & pid=$! + spinPID "Pack: Downloading"; + gzip -d -c $hostsGZ > $hosts + rm -f $hostsGZ + checkEP; + echo -en $W"\r["$N$Y"✓"$N$W"] Pack: "$N$Y"$epPack\n"$N + printDonate; + printCountedDomains; + # Update cache filter + setFilter; + printReturn; + sleep 0.1 + clear + fi + DIR="" + COUNT=$((COUNT+1)) + clear + reset done rm -f $versionInfo echo "[+] Done!" @@ -639,4 +639,4 @@ showMenu() { echo -n -e $Y'ϟ '$N; sleep 0.05; echo -e $Y'---------'$N; sleep 0.05; echo -e $Y"$divider\n"$N; sleep 0.05; -} \ No newline at end of file +} diff --git a/system/bin/setupFiles.sh b/system/bin/setupFiles.sh index 2cfdb2f..bfea17e 100644 --- a/system/bin/setupFiles.sh +++ b/system/bin/setupFiles.sh @@ -2,77 +2,77 @@ # Check Magisk support # ---------------------------------------- checkMagisk() { - #magisk=$(ls /data/adb/magisk/magisk || ls /sbin/magisk) 2>/dev/null; - #magiskVersion=$($magisk -c | sed 's/-.*//') - printMagiskVersion=$(magisk -c | cut -d':' -f1) - magiskVersion=$(magisk -V) - case "$magiskVersion" in - '15.'[1-9]*) # Version 15.1 - 15.9 - hosts=/sbin/.core/img/.core/hosts - busyboxPath=/sbin/.core/img/busybox-ndk - return 1 - ;; - '16.'[1-9]*) # Version 16.1 - 16.9 - hosts=/sbin/.core/img/.core/hosts - busyboxPath=/sbin/.core/img/busybox-ndk - return 1 - ;; - '17.'[1-3]*) # Version 17.1 - 17.3 - hosts=/sbin/.core/img/.core/hosts - busyboxPath=/sbin/.core/img/busybox-ndk - return 1 - ;; - '17.'[4-9]*) # Version 17.4 - 17.9 - hosts=/sbin/.magisk/img/hosts/system/etc/hosts - busyboxPath=/sbin/.magisk/img/busybox-ndk - return 1 - ;; - '18'[0-9]*) # Version 18.x - hosts=/sbin/.magisk/img/hosts/system/etc/hosts - busyboxPath=/sbin/.magisk/img/busybox-ndk - return 1 - ;; - '19'[0-9a-zA-Z]*) # Version 19.x - hosts=/data/adb/modules/hosts/system/etc/hosts - busyboxPath=/data/adb/modules/busybox-ndk - return 1 - ;; - '20'[0-9a-zA-Z]*) # Version 20.x - hosts=/data/adb/modules/hosts/system/etc/hosts - busyboxPath=/data/adb/modules/busybox-ndk - return 1 - ;; - *) - echo -e $R"Unknown Version: $printMagiskVersion"$N; sleep 5; - return 0 - ;; + #magisk=$(ls /data/adb/magisk/magisk || ls /sbin/magisk) 2>/dev/null; + #magiskVersion=$($magisk -c | sed 's/-.*//') + printMagiskVersion=$(magisk -c | cut -d':' -f1) + magiskVersion=$(magisk -V) + case "$magiskVersion" in + '15.'[1-9]*) # Version 15.1 - 15.9 + hosts=/sbin/.core/img/.core/hosts + busyboxPath=/sbin/.core/img/busybox-ndk + return 1 + ;; + '16.'[1-9]*) # Version 16.1 - 16.9 + hosts=/sbin/.core/img/.core/hosts + busyboxPath=/sbin/.core/img/busybox-ndk + return 1 + ;; + '17.'[1-3]*) # Version 17.1 - 17.3 + hosts=/sbin/.core/img/.core/hosts + busyboxPath=/sbin/.core/img/busybox-ndk + return 1 + ;; + '17.'[4-9]*) # Version 17.4 - 17.9 + hosts=/sbin/.magisk/img/hosts/system/etc/hosts + busyboxPath=/sbin/.magisk/img/busybox-ndk + return 1 + ;; + '18'[0-9]*) # Version 18.x + hosts=/sbin/.magisk/img/hosts/system/etc/hosts + busyboxPath=/sbin/.magisk/img/busybox-ndk + return 1 + ;; + '19'[0-9a-zA-Z]*) # Version 19.x + hosts=/data/adb/modules/hosts/system/etc/hosts + busyboxPath=/data/adb/modules/busybox-ndk + return 1 + ;; + '20'[0-9a-zA-Z]*) # Version 20.x + hosts=/data/adb/modules/hosts/system/etc/hosts + busyboxPath=/data/adb/modules/busybox-ndk + return 1 + ;; + *) + echo -e $R"Unknown Version: $printMagiskVersion"$N; sleep 5; + return 0 + ;; esac } # ---------------------------------------- # ---------------------------------------- -# Check busybox +# Check busybox # ---------------------------------------- checkBusybox() { - busybox=$(ls "$busyboxPath/system/bin/busybox" || ls "$busyboxPath/system/xbin/busybox") 2>/dev/null - busyboxAuto=$(ls /system/bin/busybox || ls /system/sbin/busybox || ls /system/xbin/busybox || ls /sbin/busybox) 2>/dev/null - busyboxManualGzip=$(ls /system/bin/gzip || ls /system/sbin/gzip || ls /system/xbin/gzip || ls /sbin/gzip) 2>/dev/null - busyboxManualWget=$(ls /system/bin/wget || ls /system/sbin/wget || ls /system/xbin/wget || ls /sbin/wget) 2>/dev/null - busyboxManualAwk=$(ls /system/bin/awk || ls /system/sbin/awk || ls /system/xbin/awk || ls /sbin/awk) 2>/dev/null - busyboxManualSort=$(ls /system/bin/sort || ls /system/sbin/sort || ls /system/xbin/sort || ls /sbin/sort) 2>/dev/null - busyboxManualTruncate=$(ls /system/bin/truncate || ls /system/sbin/truncate || ls /system/xbin/truncate || ls /sbin/truncate) 2>/dev/null - if [ -n "$busybox" ]; then - busyboxName=$("$busybox" | head -1 | cut -f 2 -d ' ') - return 1 + busybox=$(ls "$busyboxPath/system/bin/busybox" || ls "$busyboxPath/system/xbin/busybox") 2>/dev/null + busyboxAuto=$(ls /system/bin/busybox || ls /system/sbin/busybox || ls /system/xbin/busybox || ls /sbin/busybox) 2>/dev/null + busyboxManualGzip=$(ls /system/bin/gzip || ls /system/sbin/gzip || ls /system/xbin/gzip || ls /sbin/gzip) 2>/dev/null + busyboxManualWget=$(ls /system/bin/wget || ls /system/sbin/wget || ls /system/xbin/wget || ls /sbin/wget) 2>/dev/null + busyboxManualAwk=$(ls /system/bin/awk || ls /system/sbin/awk || ls /system/xbin/awk || ls /sbin/awk) 2>/dev/null + busyboxManualSort=$(ls /system/bin/sort || ls /system/sbin/sort || ls /system/xbin/sort || ls /sbin/sort) 2>/dev/null + busyboxManualTruncate=$(ls /system/bin/truncate || ls /system/sbin/truncate || ls /system/xbin/truncate || ls /sbin/truncate) 2>/dev/null + if [ -n "$busybox" ]; then + busyboxName=$("$busybox" | head -1 | cut -f 2 -d ' ') + return 1 elif [ -n "$busyboxAuto" ]; then - busyboxName=$(echo $("$busyboxAuto" | head -1 | cut -f 2 -d ' ')) - return 1 + busyboxName=$(echo "$("$busyboxAuto" | head -1 | cut -f 2 -d ' ')") + return 1 elif [ -n "$busyboxManualGzip" ] && [ -n "$busyboxManualWget" ] && [ -n "$busyboxManualAwk" ] && [ -n "$busyboxManualSort" ] && [ -n "$busyboxManualTruncate" ]; then - busyboxName=$(echo 'Busybox Applets') - return 2 + busyboxName=$(echo 'Busybox Applets') + return 2 elif [ -z "$busybox" ] || [ -z "$busyboxAuto" ] || [ -z "$busyboxManualGzip" ] || [ -z "$busyboxManualWget" ] || [ -z "$busyboxManualAwk" ] || [ -z "$busyboxManualSort" ] || [ -z "$busyboxManualTruncate" ]; then - busyboxName=$(echo $R'Not Found!'$N) - return 0 + busyboxName=$(echo $R'Not Found!'$N) + return 0 fi } # ---------------------------------------- @@ -81,12 +81,12 @@ checkBusybox() { # Check systemless hosts # ---------------------------------------- checkSystemlessHosts() { - if [ ! -f $hosts ]; then - checkSystemlessHostsPrint=$R" × "$N$W"Systemless Hosts is disabled."$N$R"\n - Enable in 'Magisk Manager>Settings'.\n - Reboot and re-run the script.\n - Quitting Script..."$N - sleep 3 - exit 0 + if [ ! -f $hosts ]; then + checkSystemlessHostsPrint=$R" × "$N$W"Systemless Hosts is disabled."$N$R"\n - Enable in 'Magisk Manager>Settings'.\n - Reboot and re-run the script.\n - Quitting Script..."$N + sleep 3 + exit 0 else - checkSystemlessHostsPrint=$G" ✓ "$N$W"Systemless Hosts is enabled."$N + checkSystemlessHostsPrint=$G" ✓ "$N$W"Systemless Hosts is enabled."$N fi } # ---------------------------------------- @@ -95,59 +95,59 @@ checkSystemlessHosts() { # Check shell format # ---------------------------------------- checkShell() { - currentShell=$(ps $$ | tail -1 | awk '{print $NF}') - if [ $(echo "$currentShell" | grep 'NAME') ]; then - currentShell=$(ps $$ | tail -1 | awk '{print $NF}' | sed 's/NAME //' | sed ':a;N;$!ba;s/\n//' | sed 's/NAME//') 2>/dev/null; - fi - - case $currentShell in - /system/bin/bash|bash) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # Not in bash - return 0 - ;; - /system/bin/ksh|ksh) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # Not in ksh - return 0 - ;; - /system/bin/csh|csh) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # Not in csh - return 0 - ;; - /system/bin/zsh|zsh) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # Not in zsh - return 0 - ;; - /system/bin/ash|ash) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # Not in ash - return 0 - ;; - /system/bin/sh|sh) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $G" ✓ "$N$W"Script running in $currentShell mode. Great!"$N) - #Success - return 1 - ;; - *) - currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; - shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) - # not in zsh or another.. - return 0 - ;; + currentShell=$(ps $$ | tail -1 | awk '{print $NF}') + if [ "$(echo "$currentShell" | grep 'NAME')" ]; then + currentShell=$(ps $$ | tail -1 | awk '{print $NF}' | sed 's/NAME //' | sed ':a;N;$!ba;s/\n//' | sed 's/NAME//') 2>/dev/null; + fi + + case $currentShell in + /system/bin/bash|bash) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # Not in bash + return 0 + ;; + /system/bin/ksh|ksh) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # Not in ksh + return 0 + ;; + /system/bin/csh|csh) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # Not in csh + return 0 + ;; + /system/bin/zsh|zsh) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # Not in zsh + return 0 + ;; + /system/bin/ash|ash) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # Not in ash + return 0 + ;; + /system/bin/sh|sh) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $G" ✓ "$N$W"Script running in $currentShell mode. Great!"$N) + #Success + return 1 + ;; + *) + currentShell=$(echo "$currentShell" | sed 's/\/system\/bin\///' | sed 's/\/system\/sbin\///' | sed 's/\/bin\///' | sed 's/\/system\/xbin\///') 2>/dev/null; + shellType=$(echo -e $R" × "$N$W"Not compatible with $currentShell mode."$N$R"\n - Only compatible with sh."$N) + # not in zsh or another.. + return 0 + ;; esac -} +} # ---------------------------------------- checkMagisk; checkBusybox; checkSystemlessHosts; -checkShell; \ No newline at end of file +checkShell; diff --git a/system/bin/strings.sh b/system/bin/strings.sh index c452937..0b246d6 100644 --- a/system/bin/strings.sh +++ b/system/bin/strings.sh @@ -2,8 +2,8 @@ # Print help # ---------------------------------------- printHelp() { - cat << HELP - + cat << HELP + ENERGIZED PROTECTION - ad.porn.malware blocking. Website: https://energized.pro Github: https://github.com/EnergizedProtection/block @@ -13,60 +13,60 @@ Version: 1.0.0 Symlinks: >> Use any of the symlinks to run Energized Protection module. - + Usage: ep [options...] - -b, --black + -b, --black >> Instantly add the domain(s) to hosts. > e.g., ep -b example.com new.example.com www.example.com - -B, --blacklist + -B, --blacklist >> Add the domains in blacklist file to hosts. >> blacklist file in /sdcard/EnergizedProtection directory. > e.g., ep -B - -c, --clear - >> Clear the hosts file and revert back to stock. + -c, --clear + >> Clear the hosts file and revert back to stock. > e.g., ep -c - -C, --config-file + -C, --config-file >> Open and edit the config file. - > e.g., ep -C - -e, --extension + > e.g., ep -C + -e, --extension >> Add extension pack(s) to the hosts. - > e.g., + > e.g., ep -e ep -e porn ep -e regional ep -e xtreme ep -e social - -h, --help - >> Print help. + -h, --help + >> Print help. -i, --info >> Print all the information. - -m, --menu + -m, --menu >> Show the full menu with more information. - > e.g., ep -m - -o, --open + > e.g., ep -m + -o, --open >> Open the hosts file. > e.g., ep -o - -p, --pack [-e|--extension] + -p, --pack [-e|--extension] >> Download the pack and extension of your choice. - > e.g., + > e.g., ep -p spark ep -p blugo -e xtreme - ep -p blu -e regional social + ep -p blu -e regional social -r, --redirect >> Redirect the domains in redirectlist file to specific IPV4/V6. >> redirectlist file in /sdcard/EnergizedProtection directory. > e.g., ep -r -u, --update - >> Update currently applied hosts. + >> Update currently applied hosts. >> Also whitelist, blacklist and redirect domains to current IP. > e.g., ep -u - -w, --white + -w, --white >> Instantly whitelist the domain(s) from hosts. > e.g., ep -w example.com new.example.com www.example.com - -W, --whitelist + -W, --whitelist >> Whitelist the domains in whitelist file to hosts. >> whitelist file in /sdcard/EnergizedProtection directory. - > e.g., ep -W + > e.g., ep -W -bp, --backup >> Backup the current hosts setup. > e.g., ep -bp @@ -75,12 +75,12 @@ Usage: ep [options...] > e.g., ep -ck example.com -ip, --redirect-ip [-4|-v4|-6|-v6] >> Change current redirection IP. - > e.g., + > e.g., ep -ip -4 127.0.0.1 - ep -ip -6 ::1 + ep -ip -6 ::1 -ir, --instant-redirect [-4|-v4|-6|-v6] >> Instantly redirect the domain(s) to specific IPV4/V6. - > e.g., + > e.g., ep -ir -4 127.0.0.1 example.com new.example.com ep -ir -6 ::1 example.com new.example.com -re, --restore @@ -93,7 +93,7 @@ Usage: ep [options...] [+] For further assistance, head to https://t.me/EnergizedProtection Stay Safe, Stay Energized! - + HELP } # ---------------------------------------- \ No newline at end of file