Using Pyrit in shell scripts

Pyrit 0.2.5-svn r216 now understands the option ‘-o’ (output-filename) in all attack-commands. The password – if found at all – is written to the given filename, which can be “-” to indicate stdout. This makes it very easy to integrate Pyrit into your own shell scripts.

Also note that Pyrit sets it’s process exit code depending on the result of the command. This behaviour has been integrated some time ago but seems to be pretty unknown. Pyrit signals failure in case…

  • the attack-commands do not find the password
  • the command verify stumbles upon a corrupted workunit
  • analyze can’t find at least one handshake in the capture-file
  • any runtime-error occurs

When combined, you can do things like:

# Save the password to a file (file is not touched if password is never found)
pyrit -r wpa2psk-linksys.dump.gz -i linksys.cow.gz -b 00:0b:86:c2:a4:85 -o 000b86c2a485_linksys.txt attack_cowpatty

# Send password by eMail via mailx
pyrit -r wpa2psk-linksys.dump.gz -i dict.gz -b 00:0b:86:c2:a4:85 -o – attack_passthrough | mailx -s “Password found” “myemail@mydomain”

# Batchprocess the database and then shutdown the computer
pyrit batch && shutdown -h now

2 Comments

  1. hello,
    If Pyrit find a password during attack_cowpatty, what is the right combination of options to save password into a file AND shutdown the PC? I dont uderstand how to do it.
    If it is not possible to do it with pyrit, a not-elegant workaround could be to use cron to periodically verifiy if password_found.txt exists: if yes, cron will run a script that shutdown pc or run other commands.

    • This one-liner wil shutdown if the password has been found:

      pyrit -r wpa2psk-linksys.dump.gz -i linksys.cow.gz -b 00:0b:86:c2:a4:85 -o 000b86c2a485_linksys.txt attack_cowpatty && shutdown -h now

      This small bash scripts shutdowns in any case:

      #!/bin/bash
      pyrit -r wpa2psk-linksys.dump.gz -i linksys.cow.gz -b 00:0b:86:c2:a4:85 -o 000b86c2a485_linksys.txt attack_cowpatty
      shutdown -h now


Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • RSS Unknown Feed

    • An error has occurred; the feed is probably down. Try again later.