Skip to content

Instantly share code, notes, and snippets.

@gagarine
Forked from wose/easybox_sip_passwd.pl
Created July 23, 2011 18:20
Show Gist options
  • Select an option

  • Save gagarine/1101711 to your computer and use it in GitHub Desktop.

Select an option

Save gagarine/1101711 to your computer and use it in GitHub Desktop.

Revisions

  1. @wose wose created this gist Feb 14, 2011.
    35 changes: 35 additions & 0 deletions easybox_sip_passwd.pl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    #!/usr/bin/env perl
    use strict;
    use warnings;
    use Digest::MD5 'md5_hex';

    print_usage() unless($#ARGV==5);

    my ($method, $uri, $user, $realm, $nonce, $response) = @ARGV;
    my $hash_method_uri = md5_hex(join(':', $method, $uri));

    my $passwd = 0;
    while($passwd < 100000000) { # arcor/vodafone sip passwords consists of 8 digets
    my $calc_response = md5_hex(join(':',
    md5_hex(join(':',
    $user,
    $realm,
    $passwd)),
    $nonce,
    $hash_method_uri));
    if($calc_response eq $response) {
    print "password found: $passwd\n";
    exit;
    }
    $passwd++;
    }
    print "password not found :-(\n";

    sub print_usage {
    print <<"USAGE";
    ./$0 <method> <uri> <user> <realm> <nonce> <response>
    ./$0 INVITE sip:12345\@bar.baz 0123456789 bar.baz 1234567890abcdef1234567890abcdef12345678 1234567890abcdef1234567890abcdef
    USAGE
    exit;
    }