[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Mon Feb 14 13:38:40 2005 -->
- <!--x-from-r13: psbjyre ng bhgcbfgfragvary.pbz (Quevfgbcure Tbjyre) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Base64 encoding in Perl -->
- <li><em>date</em>: Mon Feb 14 13:38:40 2005</li>
- <li><em>from</em>: cfowler at outpostsentinel.com (Christopher Fowler)</li>
- <li><em>in-reply-to</em>: <<a href="msg00531.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00524.html">[email protected]</a>> <<a href="msg00526.html">[email protected]</a>> <<a href="msg00528.html">[email protected]</a>> <<a href="msg00531.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Base64 encoding in Perl</li>
> Hrmm. I'd put the upgrade file available by (password protected) HTTP
> and then send the client the URL (and maybe even credentials) and have
> it pull the upgrade via curl/wget/LWP::Simple::getstore. But that's
> just me . . .
Yep. Unfortunately XML-RPC has no authentication specs. WTF? So I
wrote my perl program to log into the device via a login form and then I
had to modify the Frontier::Client constructor to accept a
LEP::UserAgent object. This way I'm able to do this with
authentication. My device also supports ACL's so a non-admin may be
able to execute some procedures but not one that pushes a software
upgrade.
-----------------------------------------------------------------
Here is how:use Frontier::Client;
use HTTP::Request;
use LWP::UserAgent;
use strict;
my $ua = LWP::UserAgent->new();
$ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
my $response = $ua->post("<a rel="nofollow" href="https://192.168.2.120/cgi-bin/login"">https://192.168.2.120/cgi-bin/login"</a>;,
{ 'user' => "root", 'pass' => "password" });
my $server = Frontier::Client->new( debug => 0, url =>
'<a rel="nofollow" href="https://192.168.2.120/cgi-bin/xml-rpc">https://192.168.2.120/cgi-bin/xml-rpc</a>',ua => $ua );
my $result = $server->call('exec', ("/sbin/flash -qu
<a rel="nofollow" href="http://192.168.2.8/tftpboot/package"">http://192.168.2.8/tftpboot/package"</a>;));
foreach my $k (sort keys %{$result}) {
print "$k:\n";
print "$result->{$k}\n";
}
-----------------------------------------------------------------
The exec procedure returns the exit code and STDOUT of the program to be
executed. This one simply sent the command to flash the unit via a URL.
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00524" href="msg00524.html">[ale] Base64 encoding in Perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00526" href="msg00526.html">[ale] Base64 encoding in Perl</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
<li><strong><a name="00528" href="msg00528.html">[ale] Base64 encoding in Perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00531" href="msg00531.html">[ale] Base64 encoding in Perl</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00532.html">[ale] Re: speedfactory dsl router setup</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00534.html">[ale] Easy to use CMS?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00531.html">[ale] Base64 encoding in Perl</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00534.html">[ale] Easy to use CMS?</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00533"><strong>Date</strong></a></li>
<li><a href="threads.html#00533"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>