-
Notifications
You must be signed in to change notification settings - Fork 12
/
functions.sh
53 lines (49 loc) · 1.87 KB
/
functions.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
cleanupmassdns() {
input=$1
cat $input | awk '{print $1}' | sed 's/.$//' > cleaned
cp cleaned ../cleaned_copy & (cat ../cleaned_copy | extract_fld | anew ../flds && while read fld; do parseflds $fld | tee -a ../assets; done) &
}
sendrequest() {
input_file=$1
sort -u $input_file -o $input_file
cat $input_file | gzip > ${input_file}.tmp
gzip $input_file
input_file=${input_file}.tmp
response=$(curl -X POST --url "https://api.securitytrails.com/v1/submit/hostnames" -H 'Content-Encoding: gzip' --header 'APIKEY: $SECURITYTRAILS_TOKEN' --data-binary "@$input_file");
if [[ $response == *"has been exceeded"* ]]; then
echo "Waiting one hour because:"
echo $response
secs=$((60 * 60))
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
sendrequest $input_file | tee -a curl_out
else
echo $response
fi;
}
masscheckandsend() {
massdns -w massdns -o S -r /mnt/dataset/lists/resolvers.txt $1
cat massdns | awk '{print $1}' | sed 's/.$//' > cleaned
split -b 50m cleaned split/split
for cf in $(ls split/*); do
sort -u $cf -o $cf
sendrequest $cf
done
rm split/*
}
rundnscewl() {
domain=$1
DNScewl --target-list=$domain --append-list=../../../lists/vhosts.txt > dnscewl/$domain
masscheckandsend dnscewl/$domain
DNScewl --target-list=$domain --prepend-list=../../../lists/vhosts.txt > dnscewl/$domain
masscheckandsend dnscewl/$domain
DNScewl --target-list=$domain --set-list=../../../lists/vhosts.txt > dnscewl/$domain
masscheckandsend dnscewl/$domain
DNScewl --target-list=$domain --set-list=words > dnscewl/$domain
masscheckandsend dnscewl/$domain
rm dnscewl/$domain
rm assets_new
}