Ok, so if I include use Crypt::SSLeay, in the script before building the exe, it works fine on the host with perl and all the modules installed, but on a host without perl, I now get this message below. Before I was including the dlls with the exe for each machine that would use the exe, but following your link I can include the dlls with the exe thank you.
C:\Temp>cam_reset.exe addmac 12345
Can't load 'C:\DOCUME~1\user\LOCALS~1\Temp\par-user\cache-e9e273248eb8
+5950f89b80
530b42a0c4aab23932\b58c32ab.dll' for module Crypt::SSLeay: load_file:T
+his applic
ation has failed to start because the application configuration is inc
+orrect. Re
installing the application may fix this problem at C:/strawberry/perl/
+lib/DynaLo
ader.pm line 203.
at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 82
Compilation failed in require at script/cam_reset.pl line 7.
BEGIN failed--compilation aborted at script/cam_reset.pl line 7.
| [reply] [d/l] |
More info:
Options tried for compile:
pp -l C:\WINNT\system32\libeay32.dll -l C:\WINNT\system32\ssleay32.dll -M Crypt::SSLeay cam_reset.pl -o cam_reset.exe
Including -M Crypt:SSLeay appears to make no difference. On machines where perl is not installed, Exe produces:
Server returned error: 501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed)
Including use Crypt::SSLeay; in source script exe produces:
Can't load 'C:\DOCUME~1\user\LOCALS~1\Temp\user\cache-956f4474c8469d5dc52a0b30e6e115813cf9edc8\b58c32ab.dll' for module Crypt::SSLeay: load_file:This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem at C:/strawberry/perl/lib/DynaLoader.pm line 203. at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 82
Compilation failed in require at script/cam_reset.pl line 8.
BEGIN failed--compilation aborted at script/cam_reset.pl line 8.
It appears that everything needed by the script gets loaded on the client (no perl installed) machine to C:\DOCUME~1\user\LOCALS~1\Temp\par-user, included dlls, SSL crypt, etc.
Part of the script:
#!\C:\strawberry\perl\bin
use strict;
use HTTP::Request::Common qw(POST GET);
use HTTP::Headers;
use LWP::UserAgent;
use MIME::Base64;
use Crypt::SSLeay;
# set up the stuff
my $ua = LWP::UserAgent->new();
# Set our own user-agent string!
$ua->agent("CCAAgent/v3.5.8 CleanAccessManager API");
# Set the Basic Authentication credentials
my $encoded = encode_base64('user:pass');
my $url = "https://somehost/admin/cisco_api.jsp";
# Params required for the POST...
if (($ARGV[0] eq 'addmac') and defined($ARGV[1])) {
my $req = POST $url,
'Authorization' => "Basic ".$encoded,
Content => [
admin => "user",
passwd => "pass",
op => "addmac",
mac => "$ARGV[1]",
user => "i-command",
provider => "pxebuild",
type => "userole",
role => "Authorized_Asset",
desc => "Reset via icmd" # no comma here!
];
# Fire the cannon now !
my $res = $ua->request($req);
# Get the error back from the server if any
my $err = $res->status_line;
if ($err != 200) {
print "Server returned error: $err\n";
exit 1;
}
# Just print the whole stuff
#print $res->as_string;
# Just print the return html
print $res->content;
exit 0;
| [reply] [d/l] |