-
Notifications
You must be signed in to change notification settings - Fork 0
/
xray-prep-updates.sh
executable file
·74 lines (56 loc) · 1.83 KB
/
xray-prep-updates.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# first check if all utils are available
required=("curl" "jq" "go")
for util in "${required[@]}"; do
if ! which "$util" >/dev/null 2>&1; then
echo "Error: $util is required but not found" >&2
exit 1
fi
done
cd ~/git/geoip/
echo "Pulling geoip"
git pull
mkdir -p ../tmp/
rm -rf ../tmp/*
cp -r * ../tmp/
cd ../tmp
cp ../home-automation/geoip-config.json config.json
# get netflix
curl --silent "https://api.bgpview.io/asn/2906/prefixes" | jq ".data.ipv4_prefixes[].prefix" | sed 's|"||g'>./netflix.txt
sleep 1
# get hulu
curl --silent "https://api.bgpview.io/asn/23286/prefixes" | jq ".data.ipv4_prefixes[].prefix" | sed 's|"||g'>./hulu.txt
sleep 1
# get youtube
curl --silent "https://api.bgpview.io/asn/36040/prefixes" | jq ".data.ipv4_prefixes[].prefix" | sed 's|"||g'>./youtube.txt
sleep 1
curl --silent "https://api.bgpview.io/asn/43515/prefixes" | jq ".data.ipv4_prefixes[].prefix" | sed 's|"||g'>>./youtube.txt
sleep 1
# get tiktok
curl --silent "https://api.bgpview.io/asn/138699/prefixes" | jq ".data.ipv4_prefixes[].prefix" | sed 's|"||g'>./tiktok.txt
go run ./
# move
echo "Moving..."
mv output/dat/mygeo.dat ~/git/home-automation/
echo "Pulling domains"
cd ~/git/domain-list-community
git pull
# get OISD.nl (small, regex)
curl "https://small.oisd.nl/"|awk '/^\|\|/ {sub(/^\|\|/, ""); sub(/\^$/, ""); print}' > ./data/oisd-small-regex
# excludes come from here - !!!but need HEAVY cleaup!!!
###curl https://oisd.nl/excludes.php | ./pup 'a text{}' > ./data/oisd-excludes
# compile to dlc.dat
echo "Compiling..."
go run ./
#move
echo "Moving..."
mv dlc.dat ~/git/home-automation/mysites.dat
echo "Pushinig cript"
cd ~/git/home-automation
scp mysites.dat mygeo.dat [email protected]:/usr/share/xray/
git add mysites.dat
git add mygeo.dat
git add xray-prep-updates.sh
git add geoip-config.json
git commit -m "upd"
git push