-
Notifications
You must be signed in to change notification settings - Fork 25
/
kata.sh
57 lines (52 loc) · 1.08 KB
/
kata.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
#!/bin/bash
# Parse arguments
while getopts ":d:c:p:ef:u:cs:" opt; do
case ${opt} in
d )
depth=$OPTARG
;;
c )
concurrency=$OPTARG
;;
p )
threads=$OPTARG
;;
ef )
extensions=$OPTARG
;;
u )
tld=$OPTARG
;;
cs )
restrict=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" 1>&2
exit 1
;;
: )
echo "Option -$OPTARG requires an argument." 1>&2
exit 1
;;
esac
done
# Check if top level domain is provided
if [ -z "${tld}" ]
then
if [ -z "$1" ]
then
echo "Top level domain argument is missing. Usage: $0 [-u <tld>] <tld>" >&2
exit 1
else
tld=$1
fi
fi
# Prepend the TLD with the https:// prefix
tld="https://${tld}"
# Set default value for the restrict argument if not provided
if [ -z "${restrict}" ]
then
restrict="^.*\.?$(echo ${tld} | sed 's|https\?://||' | sed 's|/.*||').*$"
fi
# Run Katana command
katana -d ${depth:-5} -c ${concurrency:-50} -p ${threads:-20} -ef ${extensions:-"ttf,woff,svg,jpeg,jpg,png,ico,gif,css"} -u ${tld} -cs "${restrict}"