[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



> 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-&gt;post(&quot;<a  rel="nofollow" href="https://192.168.2.120/cgi-bin/login&quot";>https://192.168.2.120/cgi-bin/login&quot</a>;,
        { 'user' =&gt; &quot;root&quot;, 'pass' =&gt; &quot;password&quot; });
                                                                                                                             
my $server = Frontier::Client-&gt;new( debug =&gt; 0, url =&gt;
'<a  rel="nofollow" href="https://192.168.2.120/cgi-bin/xml-rpc";>https://192.168.2.120/cgi-bin/xml-rpc</a>',ua =&gt; $ua );
my $result = $server-&gt;call('exec', (&quot;/sbin/flash -qu
<a  rel="nofollow" href="http://192.168.2.8/tftpboot/package&quot";>http://192.168.2.8/tftpboot/package&quot</a>;));
                                                                                                                             
foreach my $k (sort keys %{$result}) {
 print &quot;$k:\n&quot;;
 print &quot;$result-&gt;{$k}\n&quot;;
}


-----------------------------------------------------------------

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>