-
Notifications
You must be signed in to change notification settings - Fork 0
/
pf-810ck-f4c3800k.sh
60 lines (46 loc) · 1.81 KB
/
pf-810ck-f4c3800k.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
#!/bin/ksh
####### pf-810ck-f4c3800k.sh
### AUTHOR: seheyah
### CREATION: 2022/05/09
### DATE: 2022/05/09
### UPDATE:
# Add variable for filexwww
# Add cp command for website
### CONSTANT
# ARRAY
# FILE
filerun01="/etc/pf-tables/pf-810ck-f4c3800k.pft"
filetmp01="/tmp/0.txt"
filetmp02="/tmp/pf-810ck-f4c3800k.pft"
# STRING
str0x00="pf-810ck-f4c3800k"
str0x01="2022/05/09"
str0x02="Falken"
str0x03="Oxff"
### VARIABLE
# INTEGER
##### MAIN
echo "|-------------------------------------------------------------------------------------------"
echo "| 0-0-0- |-> $str0x00\n|\n|\t Service: PF\n|\t Action: Update $str0x00 table\n|"
echo "|\t Version: $str0x03\n|\t Release date: $str0x02\n|\t Release name: $str0x01"
echo "|-------------------------------------------------------------------------------------------"
whois -h whois.radb.net -- '-i origin AS32934' | grep ^route >> $filetmp01
cat $filetmp01 | awk '{ print $2 }' >> $filetmp02
a="$(cat $filetmp02 | wc -l)"
b="$(cat $filerun01 | wc -l | awk '{ print $1 }')"
echo "|\n|\t Total of previous entries: $b"
echo "|\t Total of new entries: $a\n|"
echo "|-------------------------------------------------------------------------------------------"
echo "|\n| 0-0-0- |-> Table $str0x00 update in progress"
mv $filetmp02 $filerun01
pfctl -t $str0x00 -T replace -f $filerun01 > /dev/null 2>&1
echo "| 0-0-0- |-> Table $str0x00 updated\n|"
rm -f $filetmp01
rm -f $filetmp02
echo "|-------------------------------------------------------------------------------------------"
echo "|\n| 0-0-0- |-> Clean workspace: done\n|"
echo "|-------------------------------------------------------------------------------------------"
echo "| exit 0"
echo "|-------------------------------------------------------------------------------------------"
exit 0
####### END