You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log "Applying merged hosts file via Magisk overlay..."
70
+
mkdir -p "$(dirname "$HOSTS_FILE")"
71
+
cp "$MERGED_HOSTS""$HOSTS_FILE"|| {
72
+
log "Failed to copy merged hosts file to $HOSTS_FILE"
73
+
exit 1
74
+
}
75
+
chmod 644 "$HOSTS_FILE"
76
+
chown root:root "$HOSTS_FILE"
77
+
log "Merged hosts file applied successfully."
78
+
}
79
+
80
+
# === Restart DNS Services ===
81
+
restart_dns() {
82
+
log "Restarting DNS services to apply the new hosts file..."
83
+
setprop net.dns1 8.8.8.8
84
+
setprop net.dns2 8.8.4.4
85
+
log "DNS services restarted."
86
+
}
87
+
88
+
# === Cleanup Temporary Files ===
89
+
cleanup() {
90
+
log "Cleaning up temporary files..."
91
+
rm -f "$TMP_DIR"/hosts*"$MERGED_HOSTS"
92
+
log "Temporary files cleaned successfully."
93
+
}
94
+
95
+
# === Update Module Description ===
96
+
update_module_prop() {
97
+
MODULE_PROP="$MODDIR/module.prop"
98
+
log "Updating module.prop with current date..."
99
+
string="description=(Updated: $(date)) Ever wanted to get rid of those annoying ads that pop every 2 seconds in mobile games you're playing or websites you are visiting? Well, look no further with Malwack, your defense against ads!"
100
+
sed -i "s/^description=.*/$string/g""$MODULE_PROP"
description=Say goodbye to unwanted digital pests and send malware running with Malwack, your virtual fly swatter for the cyber world. It's like having a bouncer for your device – no entry for malware, bugs, or party crashers!
6
+
description=Ever wanted to get rid of those annoying ads that pop every 2 seconds in mobile games you're playing or websites you are visiting? Well, look no further with Malwack, your defense against ads!
# === Apply Merged Hosts File via Magisk Overlay ===
62
+
apply_hosts_magisk() {
63
+
log "Applying merged hosts file via Magisk overlay..."
64
+
mkdir -p "$(dirname "$HOSTS_FILE")"
65
+
cp "$MERGED_HOSTS""$HOSTS_FILE"|| {
66
+
log "Failed to copy merged hosts file to $HOSTS_FILE"
67
+
exit 1
68
+
}
69
+
chmod 644 "$HOSTS_FILE"
70
+
chown root:root "$HOSTS_FILE"
71
+
log "Merged hosts file applied successfully."
72
+
}
27
73
28
-
# Final log message
29
-
echo"Hosts file updated successfully with permissions!">>"$log_file"
74
+
# === Cleanup Temporary Files ===
75
+
cleanup() {
76
+
log "Cleaning up temporary files..."
77
+
rm -f "$TMP_DIR"/hosts*"$MERGED_HOSTS"
78
+
log "Temporary files cleaned successfully."
79
+
}
80
+
81
+
# === Update Module Description ===
82
+
update_module_prop() {
83
+
MODULE_PROP="$MODDIR/module.prop"
84
+
log "Updating module.prop with current date..."
85
+
string="description=(Updated: $(date)) Ever wanted to get rid of those annoying ads that pop every 2 seconds in mobile games you're playing or websites you are visiting? Well, look no further with Malwack, your defense against ads!"
86
+
sed -i "s/^description=.*/$string/g""$MODULE_PROP"
87
+
log "module.prop updated successfully."
88
+
}
89
+
90
+
# === Main Logic ===
91
+
log "Starting dynamic hosts update..."
92
+
93
+
# Ensure Root Permissions
94
+
if [ "$(id -u)"-ne 0 ];then
95
+
abort "Root access is required to run this script."
0 commit comments