#!/usr/bin/perl use LWP::UserAgent; use HTTP::Request; use HTTP::Cookies; use SOAP::Lite; print "-----------------------------------\n"; print "- Nokia N9 Firmware Downloader -\n"; print "-----------------------------------\n"; print "Downloading product list...\n"; my $cookies=HTTP::Cookies->new; my $ua=LWP::UserAgent->new(cookie_jar => $cookies); $ua->agent("PerlFirm/0.9001 "); my $req = HTTP::Request->new(GET => 'https://www.dsut.online.nokia.com/oti/get_params.do?application_id=2'); my $res = $ua->request($req); $cookies->as_string =~ /JSESSIONID=(.*?)\;/; my $soap = SOAP::Lite->new(proxy => "https://www.dsut.online.nokia.com/oti/CareSuite"); my $param = SOAP::Data->new; $soap->autotype(0); $soap->default_ns('http://www.posti-care_suite.posti.nokia.com/POSTI_CareSuite_Interface.wsdl'); $param->name("string"); $param->value($1); $param->type("string"); $param->prefix(""); my $param2=SOAP::Data->new; $param2->name("string0"); $param2->type("string"); $param2->value(""); my $som=$soap->GetProductList($param,$param2); my $nokn9; foreach my $prod ( @{$som->result}) { $nokn9=$prod->{productID} if $prod->{marketName} eq "Nokia N9"; } my $param3=SOAP::Data->new; $param3->name("longVal"); $param3->value($nokn9); print "Downloading Nokia N9 SW versions...\n"; my $som2=$soap->GetReleasesForProduct($param,$param3); print "Select Nokia N9 SW Release:\n"; my $count; for ( $count = 0;$count < scalar(@{$som2->result});$count++){ print $count,". ", $som2->result->[$count]->{version},"\n"; } print "Input number: "; my $choice= <>; $choice>=0 and $choice<=$count or die "Please input a number from the list next time.\n"; my $relId=$som2->result->[$choice]->{releaseID}; my $param4=SOAP::Data->new; $param4->name("longVal"); $param4->value($relId); print "Downloading Release Versions.. [Lots of output]\n"; my $som3=$soap->GetReleaseVariants($param,$param4); for ( $count = 0;$count < scalar(@{$som3->result});$count++){ print $count,". ",$som3->result->[$count]->{name},"\n"; } print "Select release:"; $choice= <>; $choice>=0 and $choice<=$count or die "Please input a number from the list next time.\n"; my $down= $som3->result->[$choice]->{files}; for ( $count = 0;$count < scalar(@{$down});$count++){ print $count,". ", $down->[$count]->{fileName},"\n"; } print "Insert comma separated numbers of files to download\n>"; $choice= <>; $choice>=0 and $choice<=$count or die "Please input a number from the list next time.\n"; for my $filespl(split(/,/,$choice)){ my $url= $down->[$filespl]->{downloadURL}; `wget $url`; }