-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·105 lines (88 loc) · 1.97 KB
/
run.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# RUNFILE is used to check if run.sh is running
RUNFILE="/tmp/columbus-popular.pid"
# ISFAILED used to indicate that one of the scripts failed while running run.sh
ISFAILED=0
FILE=popular.domains
if [ -f "$RUNFILE" ]
then
echo "Another instance is running!"
exit 0
else
touch "$RUNFILE"
fi
# Verify binaries
OUTPUT=$(sha256sum -c bins.sha)
if [ $? != 0 ]
then
echo "Failed to verify binaries!"
echo "$OUTPUT"
rm "$RUNFILE"
exit 1
fi
while read DOMAIN
do
if [[ "$DOMAIN" == *"//"* ]]
then
# Skip comments
continue
elif [[ "$DOMAIN" == "" ]]
then
# Skip empty lines
continue
fi
if [ -f "uptimehook" ]
then
curl -s "$(cat uptimehook)" > /dev/null
fi
echo "Running $DOMAIN at $(date)"
RESULT="${DOMAIN}.result"
echo " -> Running Amass at $(date +%H:%M)..."
OUTPUT=$(./bin/amass enum -d "$DOMAIN" -o ${DOMAIN}.result 2>&1)
if [ $? != 0 ]
then
echo "Amass failed:"
echo $OUTPUT
cat "$RESULT" >> failed.list
ISFAILED=1
continue
fi
echo " -> Running Subfinder at $(date +%H:%M)..."
OUTPUT=$(./bin/subfinder -silent -d "$DOMAIN" >> "${DOMAIN}.result" 2>&1)
if [ $? != 0 ]
then
echo "Subfinder failed:"
echo $OUTPUT
cat "$RESULT" >> failed.list
ISFAILED=1
continue
fi
echo " -> Inserting at $(date +%H:%M)..."
OUTPUT=$(./bin/columbus insert file "${DOMAIN}.result" 2>&1)
if [ $? != 0 ]
then
echo "Columbus failed:"
echo $OUTPUT
ISFAILED=1
continue
fi
rm "$RESULT"
done < "$FILE"
if [ -f "failed.list" ]
then
echo "Inserting leftover at $(date +%H:%M)..."
OUTPUT=$(./bin/columbus insert file failed.list 2>&1)
if [ $? != 0 ]
then
echo "Columbus failed:"
echo $OUTPUT
ISFAILED=1
else
rm failed.list
fi
fi
rm "$RUNFILE"
if [ $ISFAILED == 1 ]
then
exit 1
fi