Guest User

Download N900 FIASCO images

a guest
Jan 31st, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.27 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use LWP::UserAgent;
  4. use HTTP::Request;
  5. use HTTP::Cookies;
  6. use SOAP::Lite;
  7.  
  8. my $cookies=HTTP::Cookies->new;
  9. my $ua=LWP::UserAgent->new(cookie_jar => $cookies);
  10. $ua->agent("PerlFirm/0.9001 ");
  11. my $req = HTTP::Request->new(GET => 'https://www.dsut.online.nokia.com/oti/get_params.do?application_id=2');
  12. my $res = $ua->request($req);
  13. $cookies->as_string =~ /JSESSIONID=(.*?)\;/;
  14. my $soap = SOAP::Lite->new(proxy => "https://www.dsut.online.nokia.com/oti/CareSuite");
  15. my $param = SOAP::Data->new;
  16. $soap->autotype(0);
  17. $soap->default_ns('http://www.posti-care_suite.posti.nokia.com/POSTI_CareSuite_Interface.wsdl');
  18. $param->name("string");
  19. $param->value($1);
  20. $param->type("string");
  21. $param->prefix("");
  22. my $param2=SOAP::Data->new;
  23. $param2->name("string0");
  24. $param2->type("string");
  25. $param2->value("");
  26. my $som=$soap->GetProductList($param,$param2);
  27. foreach my $prod ( @{$som->result}) {
  28.     if ( $prod->{marketName} ne "Nokia N900" ) { next; }
  29.     my $nokn9=$prod->{productID};
  30.     my $param3=SOAP::Data->new;
  31.     $param3->name("longVal");
  32.     $param3->value($nokn9);
  33.     my $som2=$soap->GetReleasesForProduct($param,$param3);
  34.     my $count;
  35.     my %files;
  36.     for ( $count = 0;$count < scalar(@{$som2->result});$count++){
  37.         my $relId=$som2->result->[$count]->{releaseID};
  38.         my $param4=SOAP::Data->new;
  39.         $param4->name("longVal");
  40.         $param4->value($relId);
  41.         my $som3=$soap->GetReleaseVariants($param,$param4);
  42.         for ( $count1 = 0;$count1 < scalar(@{$som3->result});$count1++){
  43.             my $down= $som3->result->[$count1]->{files};
  44.             for ( $count2 = 0;$count2 < scalar(@{$down});$count2++){
  45.                 if ( $files{$down->[$count2]->{fileName}} ) { next; }
  46.                 if ( $down->[$count2]->{fileName} =~ /.*signature.*/ ) { next; }
  47.                 if ( $down->[$count2]->{fileName} =~ /.*bin/ ) {
  48.                     for my $filespl(split(/,/,$count2)){
  49.                         my $url= $down->[$filespl]->{downloadURL};
  50.                         $files{$down->[$count2]->{fileName}} = $url;
  51.                     }
  52.                 }
  53.             }
  54.         }
  55.     }
  56.     foreach (keys %files) {
  57.         print "Downloading file ", $_, " from ", $files{$_}, "\n";
  58.         `wget -nc $files{$_}`;
  59.     }
  60. }
Add Comment
Please, Sign In to add comment