Skip to content

Commit 448bb7e

Browse files
authored
Add files via upload
1 parent 301d3a1 commit 448bb7e

File tree

6 files changed

+1226
-61
lines changed

6 files changed

+1226
-61
lines changed

customize.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ set_permissions() {
5050

5151
# For directories (includes files in them):
5252
# set_perm_recursive <dirname> <owner> <group> <dirpermission> <filepermission> <contexts> (default: u:object_r:system_file:s0)
53-
set_perm $MODPATH/system/bin/add 0 0 0755
54-
set_perm $MODPATH/system/bin/remove 0 0 0755
55-
set_perm $MODPATH/system/bin/updater 0 0 0755
53+
set_perm $MODPATH/system/bin/script 0 0 0755
5654
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
5755
# set_perm_recursive $MODPATH/system/vendor/lib/soundfx 0 0 0755 0644
5856

install.zip

6.8 KB
Binary file not shown.

module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=StevenBlock
22
name=StevenBlock | Anti-Malware & Ad Blocker
3-
version=v1.1.8
4-
versionCode=19
3+
version=v1.1.9
4+
versionCode=20
55
author=𝗪𝗜𝗡𝗭𝗢𝗥𝗧
66
description=StevenBlock protects your device from malware and unwanted ads. This Magisk module keeps your browsers and apps safe from malicious content, so you can enjoy a clean and smooth internet experience.
77
updateJson=https://raw.githubusercontent.com/mikropsoft/StevenBlock/main/update.json

system/bin/script

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/system/bin/sh
2+
3+
# Function to add a host entry
4+
add_host() {
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 add <hostname>"
7+
exit 1
8+
fi
9+
10+
host="$1"
11+
hosts_file="/etc/hosts"
12+
13+
if grep -qxF "0.0.0.0 $host" "$hosts_file"; then
14+
echo "Entry for $host already exists in $hosts_file"
15+
else
16+
if echo "0.0.0.0 $host" >> "$hosts_file"; then
17+
echo "Entry for $host added to $hosts_file"
18+
else
19+
echo "Error: Failed to add entry to $hosts_file"
20+
exit 1
21+
fi
22+
fi
23+
}
24+
25+
# Function to remove a host entry
26+
remove_host() {
27+
if [ -z "$1" ]; then
28+
echo "Usage: $0 remove <hostname>"
29+
exit 1
30+
fi
31+
32+
word="$1"
33+
hosts_file="/etc/hosts"
34+
temp_file="$(mktemp)"
35+
36+
if grep -qF "$word" "$hosts_file"; then
37+
if grep -vF "$word" "$hosts_file" > "$temp_file"; then
38+
if mv "$temp_file" "$hosts_file"; then
39+
echo "Entry for $word removed from $hosts_file"
40+
else
41+
echo "Error: Failed to update $hosts_file"
42+
rm "$temp_file"
43+
exit 1
44+
fi
45+
else
46+
echo "Error: Failed to create temporary file"
47+
rm "$temp_file"
48+
exit 1
49+
fi
50+
else
51+
echo "No entry found for $word"
52+
fi
53+
}
54+
55+
# Function to update the hosts file
56+
update_hosts() {
57+
PS3='Choose your preferred option: '
58+
options=("Ultimate Hosts" "Daily Hosts" "Quit")
59+
60+
update_hosts_file() {
61+
local url="$1"
62+
if curl -sf "$url" -o /etc/hosts; then
63+
echo "Successfully updated"
64+
else
65+
echo "Failed to update. Please check your internet connection or try again later."
66+
fi
67+
}
68+
69+
select opt in "${options[@]}"; do
70+
case $opt in
71+
"Ultimate Hosts")
72+
echo "Unified hosts + fakenews + gambling + porn + social"
73+
update_hosts_file "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts"
74+
break
75+
;;
76+
"Daily Hosts")
77+
echo "Unified hosts = (adware + malware)"
78+
update_hosts_file "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
79+
break
80+
;;
81+
"Quit")
82+
echo "User requested exit"
83+
break
84+
;;
85+
*)
86+
echo "Invalid option $REPLY"
87+
;;
88+
esac
89+
done
90+
}
91+
92+
# Main script
93+
if [ $# -lt 1 ]; then
94+
echo "Usage: $0 {add|remove|update} [hostname]"
95+
exit 1
96+
fi
97+
98+
case $1 in
99+
add)
100+
shift
101+
add_host "$@"
102+
;;
103+
remove)
104+
shift
105+
remove_host "$@"
106+
;;
107+
update)
108+
update_hosts
109+
;;
110+
*)
111+
echo "Usage: $0 {add|remove|update} [hostname]"
112+
exit 1
113+
;;
114+
esac

0 commit comments

Comments
 (0)