This repository has been archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmrdr.sh
87 lines (87 loc) · 2.54 KB
/
cmrdr.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
#!/bin/bash
exitfn () {
trap SIGINT
echo -e '\nInterrupt detected!\nExiting...'
exit 1
}
trap "exitfn" INT
OPTIND=1
LEVEL=4
CREDS="${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/credentials.json"
ROUTES="${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/routes"
OUTPUT=""
DEBUG=false
IFS=$'\n'
set -f
help() {
echo "Usage: $0 [Options]"
echo " req=required, opt=optional"
echo "MAIN OPTIONS"
echo " -f <iplist file path>: Specify an IP list file location [req]"
echo " -o <output file path>: Specify a location for a newly created output file [opt]"
echo " -s <speed value>: Specify a speed value (0-5, default=4) [opt]"
echo " -c <json file path>: Specify credentials json location (default=${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/credentials.json) [opt]"
echo " -r <json file path>: Specify routes json location (default=${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/routes) [opt]"
echo "EXTRAS"
echo " -d: Enable debug logs"
echo " -h: Display this help message"
}
if [[ ! $@ =~ ^\-.+ ]]; then
echo "Usage: $0 [Options]" >&2
echo -e "\nFor a full list of commands please use $0 -h"
exit 1
fi
while getopts ":f:o:s:hc:dr:" argument; do
case "${argument}" in
f)
TARGETS=${OPTARG}
;;
o)
OUTPUT=${OPTARG}
;;
s)
LEVEL=${OPTARG}
;;
h)
help
exit 1
;;
c)
CREDS=${OPTARG}
;;
d)
DEBUG=true
;;
r)
ROUTES=${OPTARG}
;;
?)
echo "Usage: $0 [Options]" >&2
echo -e "\nFor a full list of commands please use $0 -h"
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ ! -f $TARGETS ]]; then
echo 'The IP list file is invalid'
exit 1
elif [[ ! -s $TARGETS ]]; then
echo -e '\e[1m\e[91mThe IP list file is empty.'
exit 1
else
echo 'If there is an error or nothing happens, make sure you specified a valid ip list file and GOPATH is set.'
fi
if [[ $OUTPUT != "" ]]; then
echo -n "" > $OUTPUT
for i in `cat $TARGETS`; do
echo 'Attacking '$i' with level '$LEVEL' speed...'
$GOPATH/bin/cameradar run -t $i -s $LEVEL -c $CREDS -d $DEBUG -r $ROUTES |& tee -a $OUTPUT
done
else
for i in `cat $TARGETS`; do
echo 'Attacking '$i' with level '$LEVEL' speed...'
$GOPATH/bin/cameradar run -t $i -s $LEVEL -c $CREDS -d $DEBUG -r $ROUTES
done
fi
trap SIGINT