diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 3e47698..b4bc4fb 100644 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -10,6 +10,7 @@ umask 022 ui_print() { echo "$1"; } require_new_magisk() { + ui_print " Supports only Magisk v20.0+" ui_print "*******************************" ui_print " Please install Magisk v20.0+! " ui_print "*******************************" diff --git a/README.md b/README.md index 911b651..3a9b752 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@
- Version - _time_stamp_ > Uninstall the module setup. > e.g., ep -un + -v, --version + >> Print version. ``` @@ -182,6 +184,16 @@ Uninstall Changelog ------ +v.1.2.0β +- No more separate busybox required. Magisk Busybox will be used by default. +- Updated Magisk Template to v20.0+. No more support for Magisk `) diff --git a/install.sh b/install.sh index 58c8a41..39b3084 100644 --- a/install.sh +++ b/install.sh @@ -134,10 +134,6 @@ print_modname() { ui_print " - Type ep -h & tap enter " ui_print " - Follow on screen options. " ui_print "----------------------------------" - ui_print "" - ui_print " >> Recommended Busybox: " - ui_print " > Busybox for Android NDK" - ui_print "" ui_print " *For further assistance > ep -tg" ui_print "==================================" } diff --git a/module.prop b/module.prop index e0b86bd..60cd9eb 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=energizedprotection name=Energized Protection -version=1.0.8β -versionCode=200522108 +version=1.2.0β +versionCode=200523120 author=AdroitAdorKhan description=Let's make an annoyance free better open internet, altogether! https://energized.pro diff --git a/system/bin/energized b/system/bin/energized index c60d89f..9c64183 100644 --- a/system/bin/energized +++ b/system/bin/energized @@ -22,7 +22,7 @@ modPath="/sbin/.magisk/modules/energizedprotection/system/bin" . $modPath/setupFiles.sh . $modPath/mainMenu.sh . $modPath/strings.sh - +alias wget="$busybox wget" # ---------------------------------------- # Config # ---------------------------------------- @@ -94,8 +94,8 @@ currentIP=$(grep -o -m 1 '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} # ---------------------------------------- # Versioning & Date # ---------------------------------------- -version=$Y'1.0.7β'$N > /dev/null 2>&1 -releaseDate=$G'May 22, 2020'$N > /dev/null 2>&1 +version=$Y'1.2.0β'$N > /dev/null 2>&1 +releaseDate=$G'May 23, 2020'$N > /dev/null 2>&1 date=$(date "+%d.%m.%Y %H:%M:%S") # ---------------------------------------- @@ -256,7 +256,7 @@ checkUpdate() { ### 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 + 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 @@ -532,11 +532,11 @@ getDomain() { # Porn extension download # ---------------------------------------- pornEDownload() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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 @@ -553,11 +553,11 @@ pornEDownload() { # Porn-lite extension download # ---------------------------------------- pornliteEDownload() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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 @@ -574,11 +574,11 @@ pornliteEDownload() { # Regional extension download # ---------------------------------------- regionalEDownload() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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 @@ -595,13 +595,13 @@ regionalEDownload() { # Social extension download # ---------------------------------------- socialEDownload() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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 @@ -622,11 +622,11 @@ xtremeEDownload() { areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then clear - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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 @@ -676,9 +676,9 @@ updateHWBE() { echo -e "$R""$divider""$N"; sleep 0.05; sleep 3 else - echo -e "$Y""$divider""$N"; sleep 0.05; + 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; + 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" @@ -744,9 +744,9 @@ updateHWBE() { openConfig() { case "$2" in show) clear - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 -e $Y"$divider"$N; sleep 0.05; echo "Open the config file."; sleep 0.05; echo -e "$Y""$divider""$N" echo ''; sleep 0.05; @@ -810,23 +810,27 @@ printDonate() { # Backup Hosts # ---------------------------------------- backupHosts() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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; + 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" + echo -en $W"\r["$N$Y"✓"$N$W"] Storing Hosts: "$N$Y"Completed."$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 + spinPID "Storing Config" cp $config $configBackup + echo -en $W"\r["$N$Y"✓"$N$W"] Storing Config: "$N$Y"Completed."$N; sleep 0.1; else echo -e "$W""[×] Not backing up config.""$N"; sleep 0.1; fi + echo '' + printDonate; else echo -e "$R""$divider""$N"; sleep 0.05; echo -e "$R""[×] No hosts found.""$N"; sleep 0.05; @@ -840,11 +844,11 @@ backupHosts() { # ---------------------------------------- clearHosts() { checkBusybox; - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$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 -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; @@ -869,18 +873,32 @@ clearHosts() { # ---------------------------------------- restoreHosts() { checkBusybox; - echo -e "$Y""$divider""$N"; sleep 0.05; + 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"$divider"$N; sleep 0.05; echo -e "$Y""Restore the hosts backup.""$N"; sleep 0.05; - echo -e "$Y""$divider""$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; + echo -en $W"\r["$N$Y"✓"$N$W"] Restoring Hosts: "$N$Y"Completed.\n"$N; sleep 0.1; + if [ -s $configBackup ]; then + echo -e -n $W"[+] Restore Config file?"$N $Y"[Y/N]"$N "$answer" + read answer + if [[ "$answer" == "Y" || "$answer" == "y" ]]; then + spinPID "Restoring Config" + cp $configBackup $config + echo -en $W"\r["$N$Y"✓"$N$W"] Restoring Config: "$N$Y"Completed."$N; sleep 0.1; + echo '' + else + echo -e $W"[×] Not restoring config.\n"$N; sleep 0.1; + fi + fi + + printDonate; else - echo -e "$R""$divider""$N"; sleep 0.05; + 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 @@ -893,9 +911,9 @@ restoreHosts() { openHosts() { clear checkBusybox - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 -e $Y"$divider"$N; sleep 0.05; echo "Open the hosts file."; sleep 0.05; echo -e "$Y""$divider""$N" echo ''; sleep 0.05; @@ -1125,9 +1143,9 @@ doBlacklist() { 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"$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; + echo -e $Y"$divider"$N; sleep 0.05; # Begins if [ ! -f $blacklist ]; then echo -e "$R""\n[-] No Blacklist detected!""$N" @@ -1181,9 +1199,9 @@ doWhitelist() { 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"$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; + echo -e $Y"$divider"$N; sleep 0.05; # Begins if [ ! -f $whitelist ]; then echo -e "$R""[-] No Whitelist Detected!""$N"; sleep 0.05; @@ -1246,11 +1264,11 @@ instantBlacklist() { currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') fi clear - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 $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 -e $Y"$divider"$N; sleep 0.05; echo ""; sleep 0.05; echo -en "$W"'[>] Domain: '"$N" read ib @@ -1348,11 +1366,11 @@ instantWhitelist() { currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') fi clear - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 $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 -e $Y"$divider"$N; sleep 0.05; echo ""; sleep 0.05; echo -en "$W"'[>] Domain: '"$N" read iw @@ -1440,9 +1458,9 @@ instantWhitelistCli() { # Redirectlist # ---------------------------------------- doRedirect(){ - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 $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 @@ -1535,11 +1553,11 @@ instantRedirect() { 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"$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 $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 -e $Y"$divider"$N; sleep 0.05; echo "" echo -n -e "$W"'[>] Enter Domain: '"$N" read irD @@ -1557,6 +1575,9 @@ instantRedirect() { read answer if [[ "$answer" == "Y" || "$answer" == "y" ]]; then currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + if [[ ! -z "$currentDomainIP" ]]; then + echo -e $W"\n > "$N$Y"$domain"$N$W" - already redirected to "$N$Y"$currentDomainIP\n"$N + fi grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp truncate -s 0 "$hosts" mv -f $temp "$hosts" @@ -1641,6 +1662,9 @@ instantRedirectCli() { exit else currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + if [[ ! -z "$currentDomainIP" ]]; then + echo -e $W"\n > "$N$Y"$domain"$N$W" - already redirected to "$N$Y"$currentDomainIP\n"$N + fi grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp truncate -s 0 "$hosts" mv -f $temp "$hosts" @@ -1671,6 +1695,9 @@ instantRedirectCli() { exit else currentDomainIP=$(grep " $domain" "$hosts" | sed "s/ $domain//") + if [[ ! -z "$currentDomainIP" ]]; then + echo -e $W"\n > "$N$Y"$domain"$N$W" - already redirected to "$N$Y"$currentDomainIP\n"$N + fi grep -Fvx "$currentDomainIP $domain" "$hosts" > $temp truncate -s 0 "$hosts" mv -f $temp "$hosts" @@ -1696,11 +1723,11 @@ redirectIP() { 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"$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 $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 -e $Y"$divider"$N; sleep 0.05; echo "" if [ -z "$currentIP" ]; then currentIP=$(grep ' watchdog.energized.pro' "$hosts" | sed 's/ watchdog.energized.pro//') @@ -1805,11 +1832,11 @@ checkBlacklistDomain () { 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"$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"$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 -e $Y"$divider"$N; sleep 0.05; echo ""; sleep 0.05; echo -en "$W""[>] Domain: ""$N" read dom @@ -1945,9 +1972,9 @@ checkBlacklistDomainCli () { # Submit issue # ---------------------------------------- submitIssue() { - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 -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 "" @@ -1983,9 +2010,9 @@ restoreStockSettings() { # Remove files and restore stock settings # ---------------------------------------- uninstall(){ - echo -e "$Y""$divider""$N"; sleep 0.05; + 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 -e $Y"$divider"$N; sleep 0.05; echo "$W""Uninstall module and remove files.""$N" echo -e "$Y""$divider""$N" echo "" @@ -2064,6 +2091,20 @@ removeDuplicates() { } # ---------------------------------------- +# ---------------------------------------- +# Print version +# ---------------------------------------- +printVersion() { + echo -e $W"\n> Module Version : "$N$Y"$version"$N + hostsVersion=$(grep "# Version: " $hosts | sed 's/# Version: //') + if [ ! -z "$hostsVersion" ]; then + echo -e $W"> Hosts Version : "$N$Y"$hostsVersion\n"$N + else + echo '' + fi +} +# ---------------------------------------- + case ${1:-} in -b|--black) instantBlacklistCli "$@";; -B|--blacklist) doBlacklist;; @@ -2086,5 +2127,6 @@ case ${1:-} in -re|--restore) restoreHosts;; -tg|--telegram) visitTelegram;; -un|--uninstall) uninstall;; - *) printHelp;; + -v|--version) printVersion;; + *) printUnknown $@;; esac diff --git a/system/bin/mainMenu.sh b/system/bin/mainMenu.sh index 399937b..20b2d0a 100644 --- a/system/bin/mainMenu.sh +++ b/system/bin/mainMenu.sh @@ -1,8 +1,9 @@ showInfo() { setupFiles; checkEP; - echo '' - echo -e $Y"[>] Compatibility Info -"$N + 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" @@ -68,11 +69,13 @@ showInfo() { # Check Energized Protection checkUpdate & pid=$! spinPID "Update: Checking"; - echo -en "$checkUpdatePrint" + echo -en "$checkUpdatePrint\n" # sleep 0.1 if [ -f $hosts ]; then - echo -e $Y"\n[>] Pack Info -"$N + echo -e $Y"$divider"$N; sleep 0.05; + echo -e $Y'ϟ P A C K I N F O -'$N; sleep 0.05; + echo -e $Y"$divider"$N; sleep 0.05; # ---------------------------------------- printCountedDomains; # ---------------------------------------- @@ -100,6 +103,8 @@ showInfo() { currentIP=$(grep ' watchdog.energized.pro' $hosts | sed 's/ watchdog.energized.pro//') fi echo -e $W"[+] Current IP: "$N$Y"$currentIP"$N; sleep 0.1; + update=$C"`date -r $hosts "+%a, %d %b %y %H:%M:%S"`"$N + echo -e $W"[+] Updated: "$N$Y"$update"$N; sleep 0.1; fi echo '' printDonate; @@ -339,7 +344,7 @@ showMenu() { case "$INPUT" in # Spark Protection # ---------------------------------------- - 1|spark|Spark|SPARK) DIR="spark/formats/hosts.gz" + 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; @@ -347,7 +352,7 @@ showMenu() { ;; # Blu Go Protection # ---------------------------------------- - 2|blugo|BluGo|bluGo|BLUGO) DIR="/bluGo/formats/hosts.gz" + 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; @@ -355,7 +360,7 @@ showMenu() { ;; # Blu Protection # ---------------------------------------- - 3|blu|Blu|BLU) DIR="/blu/formats/hosts.gz" + 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; @@ -363,7 +368,7 @@ showMenu() { ;; # Basic Protection # ---------------------------------------- - 4|basic|Basic|BASIC) clear + 4|basic|Basic|BASIC) clear printWarning; areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then @@ -379,7 +384,7 @@ showMenu() { ;; # Ultimate Protection # ---------------------------------------- - 5|ultimate|Ultimate|ULTIMATE) clear + 5|ultimate|Ultimate|ULTIMATE) clear printWarning; areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then @@ -395,7 +400,7 @@ showMenu() { ;; # Unified Protection # ---------------------------------------- - 6|unified|Unified|UNIFIED) clear + 6|unified|Unified|UNIFIED) clear printWarning; areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then @@ -411,7 +416,7 @@ showMenu() { ;; # Porn Protection # ---------------------------------------- - p|porn|Porn|PORN) clear + p|porn|Porn|PORN) clear printWarning; areYouSure; if [[ "$userAnswer" == "Y" || "$userAnswer" == "y" ]]; then @@ -427,7 +432,7 @@ showMenu() { ;; # Porn Lite Extension # ---------------------------------------- - pl) clear + pl) clear cleanupTemp; pornliteEDownload; printDonate; @@ -437,7 +442,7 @@ showMenu() { ;; # Regional Extension # ---------------------------------------- - rl|rg|regional|Regional|REGIONAL|REG|reg) clear + rl|rg|regional|Regional|REGIONAL|REG|reg) clear cleanupTemp; regionalEDownload; printDonate; @@ -447,7 +452,7 @@ showMenu() { ;; # Social Extension # ---------------------------------------- - s|social|Social|SOCIAL) clear + s|social|Social|SOCIAL) clear cleanupTemp; socialEDownload; printDonate; @@ -457,7 +462,7 @@ showMenu() { ;; # Xtreme Extension # ---------------------------------------- - x|X|xtreme|XTRM|xtrm|Xtrm|Xtreme) clear + x|X|xtreme|XTRM|xtrm|Xtrm|Xtreme) clear cleanupTemp; xtremeEDownload; printDonate; @@ -467,7 +472,7 @@ showMenu() { ;; # Update - hosts, whitelist, blacklist s extension(s) # ---------------------------------------- - u) clear + u) clear checkEP; updateHWBE; removeDuplicates; @@ -476,110 +481,117 @@ showMenu() { ;; # Whitelist # ---------------------------------------- - w) clear + w) clear doWhitelist; printCountedDomains; printReturn; ;; # Instant Whitelist # ---------------------------------------- - iw) clear + iw) clear instantWhitelist; printCountedDomains; printReturn; ;; # Blacklist # ---------------------------------------- - b) clear + b) clear doBlacklist; printCountedDomains; printReturn; ;; # Instant Blacklist # ---------------------------------------- - ib) clear + ib) clear instantBlacklist; printCountedDomains; printReturn; ;; # Redirect # ---------------------------------------- - r) clear + r) clear doRedirect; printCountedDomains; printReturn; ;; # Instant Redirect # ---------------------------------------- - ir) clear + ir) clear instantRedirect; printCountedDomains; printReturn; ;; # Systemless Hosts # ---------------------------------------- - mg|magisk|Magisk|MAGISK) am start -n com.topjohnwu.magisk/a.c + mg|magisk|Magisk|MAGISK) am start -n com.topjohnwu.magisk/a.c ;; # Read Hosts File # ---------------------------------------- - o|O|oh|OH|openhosts|OpenHosts|hosts) openHosts; + o|O|oh|OH|openhosts|OpenHosts|hosts) openHosts; ;; # Info # ---------------------------------------- - i|info|Info|INFO) am start -a android.intent.action.VIEW -d "https://energized.pro" + i|info|Info|INFO) clear + showInfo; + echo -n -e "$W"'[+] Return?'"$N" "$Y"'[y/n]:'"$N" + read answer + if [[ "$answer" == "N" || "$answer" == "n" ]]; then + break + fi + printReturn; ;; # Instructions # ---------------------------------------- - Guide|guide|in|instructions|instruction|IN|INSTRUCTION|INSTRUCTIONS) am start -a android.intent.action.VIEW -d "http://link.nayemador.com/epmagiskusage" + guide|Guide|in|instructions|IN) 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 + si|SI|webapp|WEBAPP|WebApp|app|submit|Submit|issue|Submit|is|SUBMIT|ISSUE|IS) clear submitIssue; printReturn; ;; # Telegram # ---------------------------------------- - tg|telegram|Telegram|TELEGRAM) visitTelegram; + tg|telegram|Telegram|TELEGRAM) visitTelegram; ;; # Backup Hosts # ---------------------------------------- - bp) clear + bp) clear backupHosts; printReturn; ;; # Restore Hosts # ---------------------------------------- - rs|restore|Restore|RESTORE) clear + rs|restore|Restore|RESTORE) clear restoreHosts; printReturn; ;; # Clear Hosts # ---------------------------------------- - c|clear|Clear|CLEAR) clear + c|clear|Clear|CLEAR) clear clearHosts; printReturn; ;; # Redirection IP # ---------------------------------------- - ip) clear + ip) clear redirectIP; printReturn ;; # Check Domain In Hosts # ---------------------------------------- - chk|check|Check|CHECK|ck) clear + chk|check|Check|CHECK|ck) clear checkBlacklistDomain; printCountedDomains; printReturn; ;; # Quit # ---------------------------------------- - q) break + q) break clear - reset ;; - *) echo -e $R"$divider"$N + *) + 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 @@ -605,7 +617,6 @@ showMenu() { DIR="" COUNT=$((COUNT+1)) clear - reset done rm -f $versionInfo echo "[+] Done!" diff --git a/system/bin/setupFiles.sh b/system/bin/setupFiles.sh index bfea17e..87fcd5f 100644 --- a/system/bin/setupFiles.sh +++ b/system/bin/setupFiles.sh @@ -7,43 +7,14 @@ checkMagisk() { 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 + busyboxPath=/data/adb/magisk return 1 ;; *) echo -e $R"Unknown Version: $printMagiskVersion"$N; sleep 5; + exit return 0 ;; esac @@ -54,7 +25,8 @@ checkMagisk() { # Check busybox # ---------------------------------------- checkBusybox() { - busybox=$(ls "$busyboxPath/system/bin/busybox" || ls "$busyboxPath/system/xbin/busybox") 2>/dev/null + #busybox=$(ls "$busyboxPath/system/bin/busybox" || ls "$busyboxPath/system/xbin/busybox" || ls "$busyboxPath/busybox") 2>/dev/null + busybox=$(ls "$busyboxPath/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 @@ -68,15 +40,39 @@ checkBusybox() { 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') + 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) + echo -e $R"[+] Busybox not found.\n[×] Exiting..."$N + exit return 0 fi } # ---------------------------------------- - +alias date="$busybox date" +alias echo="$busybox echo" +alias cat="$busybox cat" +alias clear="$busybox clear" +alias cp="$busybox cp" +alias grep="$busybox grep" +alias gunzip="$busybox gunzip" +alias gzip="$busybox gzip" +alias head="$busybox head" +alias ls="$busybox ls" +alias mkdir="$busybox mkdir" +alias mv="$busybox mv" +alias printf="$busybox printf" +alias ps="$busybox ps" +alias pwd="$busybox pwd" +alias reset="$busybox reset" +alias rm="$busybox rm" +alias sed="$busybox sed" +alias sleep="$busybox sleep" +alias sort="$busybox sort" +alias touch="$busybox touch" +alias truncate="$busybox truncate" +alias wget="$busybox wget" # ---------------------------------------- # Check systemless hosts # ---------------------------------------- diff --git a/system/bin/strings.sh b/system/bin/strings.sh index a001772..858148e 100644 --- a/system/bin/strings.sh +++ b/system/bin/strings.sh @@ -1,99 +1,121 @@ # ---------------------------------------- +# Print Unknown +# ---------------------------------------- +printUnknown() { + sym=$(echo "$0" | sed 's/\/system\/bin\///') + if [ ! -z "$1" ]; then + echo -e $W"\n >> Flag: "$N$R"$1"$N$W" not found."$N + else + echo "" + fi + echo -e $W" >> Use "$N$Y"$sym -h "$N$W"for more info about CLI.\n >> Use "$N$Y"$sym -m"$N$W" for accessing menu.\n"$N +} +# ---------------------------------------- +# ---------------------------------------- # Print help # ---------------------------------------- printHelp() { - cat << HELP - -ENERGIZED PROTECTION - ad.porn.malware blocking. -Website: https://energized.pro -Github: https://github.com/EnergizedProtection/block -Copyright (c) 2018-2020, Energized Protection -License: CC-BY-NC-SA 4.0 -Version: 1.0.8 - -Symlinks: - >> Use any of the symlinks to run Energized Protection module. - -Usage: ep [options...] - -b, --black - >> Instantly add the domain(s) to hosts. - > e.g., ep -b example.com new.example.com www.example.com - -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. - > e.g., ep -c - -C, --config-file - >> Open and edit the config file. - > e.g., ep -C - -e, --extension - >> Add extension pack(s) to the hosts. - > e.g., - ep -e - ep -e porn - ep -e regional - ep -e xtreme - ep -e social - -h, --help - >> Print help. - -i, --info - >> Print all the information. - -m, --menu - >> Show the full menu with more information. - > e.g., ep -m - -o, --open - >> Open the hosts file. - > e.g., ep -o - -p, --pack [-e|--extension] - >> Download the pack and extension of your choice. - > e.g., - ep -p spark - ep -p blugo -e xtreme - 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. - >> Also whitelist, blacklist and redirect domains to current IP. - > e.g., ep -u - -w, --white - >> Instantly whitelist the domain(s) from hosts. - > e.g., ep -w example.com new.example.com www.example.com - -W, --whitelist - >> Whitelist the domains in whitelist file to hosts. - >> whitelist file in /sdcard/EnergizedProtection directory. - > e.g., ep -W - -bp, --backup - >> Backup the current hosts setup. - > e.g., ep -bp - -ck, --check - >> Check whether the domain is in the list. - > e.g., ep -ck example.com - -ip, --redirect-ip [-4|-v4|-6|-v6] - >> Change current redirection IP. - > e.g., - ep -ip -4 127.0.0.1 - ep -ip -6 ::1 - -ir, --instant-redirect [-4|-v4|-6|-v6] - >> Instantly redirect the domain(s) to specific IPV4/V6. - > 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 - >> Restore the backed up hosts setup. - > e.g., ep -re - -un, --uninstall - >> Uninstall the module setup. - > e.g., ep -un + 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.01; + echo -e $W"$divider"$N; sleep 0.01; + echo -e $Y" ad.porn.malware blocking."$N + echo -e $W"$divider"$N; sleep 0.01; + echo -e $W"> Website: "$N$Y"energized.pro"$N + echo -e $W"> Github : "$N$Y"github.com/EnergizedProtection/magisk"$N + echo -e $W"> License: "$N$Y"CC-BY-NC-SA 4.0"$N + echo -e $W"> Version: "$N$Y"$version"$N + echo -e $W"Copyright (c) 2018-2020, Energized Protection"$N + echo '' + echo -e $Y"Symlinks: "$N$C""$N + echo ">> Use any of the symlinks to run Energized Protection module." + echo '' + echo -e $Y"Usage: "$N$C"ep [options...]"$N + echo -e $Y" -b, --black "$N$C""$N + echo " >> Instantly add the domain(s) to hosts." + echo " > e.g., ep -b abc.com x.abc.com" + echo -e $Y" -B, --blacklist"$N + echo " >> Add the domains in blacklist file to hosts." + echo " >> blacklist file in \n /sdcard/Energized Protection directory." + echo " > e.g., ep -B" + echo -e $Y" -c, --clear"$N + echo " >> Clear the hosts file and revert back to stock." + echo " > e.g., ep -c" + echo -e $Y" -C, --config-file"$N + echo " >> Open and edit the config file." + echo " > e.g., ep -C" + echo -e $Y" -e, --extension"$N + echo " >> Add extension pack(s) to the hosts." + echo " > e.g.," + echo " ep -e " + echo " ep -e porn" + echo " ep -e regional" + echo " ep -e xtreme" + echo " ep -e social" + echo -e $Y" -h, --help"$N + echo " >> Print help." + echo -e $Y" -i, --info"$N + echo " >> Print all the information." + echo -e $Y" -m, --menu"$N + echo " >> Show the full menu with more information." + echo " > e.g., ep -m" + echo -e $Y" -o, --open"$N + echo " >> Open the hosts file." + echo " > e.g., ep -o" + echo -e $Y" -p, --pack"$N$C" "$N$Y" [-e|--extension]"$N$C" "$N + echo " >> Download the pack and \n extension of your choice." + echo " > e.g.," + echo " ep -p spark" + echo " ep -p blugo -e xtreme" + echo " ep -p blu -e regional social" + echo -e $Y" -r, --redirect"$N + echo " >> Redirect the domains in \n redirectlist file to specific IPV4/V6." + echo " >> redirectlist file in \n /sdcard/EnergizedProtection directory." + echo " > e.g., ep -r" + echo -e $Y" -u, --update"$N + echo " >> Update currently applied hosts and \n extensions. Also whitelist, blacklist and \n redirect domains to current IP." + echo " > e.g., ep -u" + echo -e $Y" -w, --white"$N$C" "$N + echo " >> Instantly whitelist the domain(s) from hosts." + echo " > e.g., ep -w abc.com x.abc.com" + echo -e $Y" -W, --whitelist"$N + echo " >> Whitelist the domains in \n whitelist file to hosts." + echo " >> whitelist file in \n /sdcard/EnergizedProtection directory." + echo " > e.g., ep -W" + echo -e $Y" -bp, --backup"$N + echo " >> Backup the current hosts setup." + echo " > e.g., ep -bp" + echo -e $Y" -ck, --check "$N$C""$N + echo " >> Check whether the domain is in the list." + echo " > e.g., ep -ck abc.com" + echo -e $Y" -ip, --redirect-ip"$N$G" [-4|-v4|-6|-v6] "$N$C""$N + echo " >> Change current redirection IP." + echo " > e.g.," + echo " ep -ip -4 127.0.0.1" + echo " ep -ip -6 ::1" + echo -e $Y" -ir, --instant-redirect"$N$G" [-4|-v4|-6|-v6] "$N$C""$N + echo " >> Instantly redirect the domain(s)\n to specific IPV4/V6." + echo " > e.g.," + echo " ep -ir -4 127.0.0.1 abc.com x.abc.com" + echo " ep -ir -6 ::1 abc.com x.abc.com" + echo -e $Y" -re, --restore"$N + echo " >> Restore the backed up hosts setup." + echo " > e.g., ep -re" + echo -e $Y" -un, --uninstall"$N + echo " >> Uninstall the module setup." + echo " > e.g., ep -un" + echo -e $Y" -v, --version"$N + echo " >> Print version." -[+] For further assistance, head to https://t.me/EnergizedProtection + echo -e $W"\n[+] For further assistance, head to "$N$B"https://t.me/EnergizedProtection"$N + + echo -e $Y"\nStay Safe, Stay Energized!"$N -Stay Safe, Stay Energized! -HELP } # ---------------------------------------- \ No newline at end of file