Last active
August 29, 2015 14:09
-
-
Save grepwood/c0b2153bddedd397359e to your computer and use it in GitHub Desktop.
Revisions
-
Michael Dec revised this gist
Nov 13, 2014 . 1 changed file with 18 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,36 +5,47 @@ use HTTP::Request; use LWP::UserAgent; use Net::SSLeay; use IO::Socket::SSL; my $options=(); getopts("ha:p:c:", \%main::options); if (defined $main::options{h}) { print "This program verifies SSL on a host\n"; print " -h see this message\n"; print " -a address of the host\n"; print " -p port (optional)\n"; print " -c path to SSL cert (optional)\n"; exit 0; } my $satisfied = 0; my $address = ""; my $port = 443; my $cert_filename = ""; if (defined $main::options{a}) { $satisfied += 1; $address = $main::options{a}; } if(($satisfied & 1) != 1) { print "Insufficient arguments. Check with -h what you missed\n"; exit -1; } if (defined $main::options{p}) { $port = $main::options{p}; } my $ua = ""; if (defined $main::options{c}) { $cert_filename = $main::options{c}; $ua = LWP::UserAgent->new( verify_hostname => 0, SSL_ca_file => "$cert_filename", ); } else { $ua = LWP::UserAgent->new(); } my $request = HTTP::Request->new(GET => "https://$address:$port/"); my $response = $ua->request($request); print $response->status_line . "\n"; -
Michael Dec created this gist
Nov 13, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ #!/usr/bin/perl use strict; use warnings; use Getopt::Std; use HTTP::Request; use LWP::UserAgent; use Net::SSLeay; my $options=(); getopts("ha:p:", \%main::options); if (defined $main::options{h}) { print "This program verifies SSL on a host\n"; print " -h see this message\n"; print " -a address of the host\n"; print " -p port (optional)\n"; exit 0; } my $satisfied = 0; my $address = ""; my $port = 443; if (defined $main::options{a}) { $satisfied += 1; $address = $main::options{a}; } if (defined $main::options{p}) { $port = $main::options{p}; } if(($satisfied & 1) != 1) { print "Insufficient arguments. Check with -h what you missed\n"; exit -1; } my $request = HTTP::Request->new(GET => "https://$address:$port/"); my $ua = LWP::UserAgent->new(); my $response = $ua->request($request); print $response->status_line . "\n";