File: hydra-wizard.sh

package info (click to toggle)
hydra 9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 4,008 kB
  • sloc: ansic: 21,638; sh: 2,166; makefile: 110
file content (44 lines) | stat: -rwxr-xr-x 1,731 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# based on a script by Shivang Desai <shivang.ice.2010@gmail.com>
#
echo
echo "Welcome to the Hydra Wizard"
echo
read -p "Enter the service to attack (eg: ftp, ssh, http-post-form): " service
test -z "$service" && { echo Error: service may not be empty ; exit 1 ; }
read -p "Enter the target to attack (or filename with targets): " target
test -z "$target" && { echo Error: target may not be empty ; exit 1 ; }
read -p "Enter a username to test or a filename: " user
test -z "$user" && { echo Error: user may not be empty ; exit 1 ; }
read -p "Enter a password to test or a filename: " pass
test -z "$pass" && { echo Error: pass may not be empty ; exit 1 ; }
read -p "If you want to test for passwords (s)ame as login, (n)ull or (r)everse login, enter these letters without spaces (e.g. \"sr\") or leave empty otherwise: " pw
read -p "Port number (press enter for default): " port
echo
echo The following options are supported by the service module:
hydra -U $service
echo
read -p "If you want to add module options, enter them here (or leave empty): " opt
echo

ports=""
pws=""
opts=""
test -e "$target" && targets="-M $target"
test -e "$target" || targets="$target"
test -e "$user" && users="-L $user"
test -e "$user" || users="-l $user"
test -e "$pass" && passs="-P $pass"
test -e "$pass" || passs="-p $pass"
test -n "$port" && ports="-s $port"
test -n "$pw" && pws="-e $pw"
test -n "$opt" && opts="-m '$opt'"

echo The following command will be executed now:
echo " hydra $users $passs -u $pws $ports $opts $targets $service"
echo
read -p "Do you want to run the command now? [Y/n] " yn
test "$yn" = "n" -o "$yn" = "N" && { echo Exiting. ; exit 0 ; }
echo
hydra $users $passs -u $pws $ports $opts $targets $service