From a860338f31ebcb3dcfdfa413cbd3c7f8aa778c58 Mon Sep 17 00:00:00 2001 From: alejandro Date: Mon, 12 Feb 2024 15:39:01 +0100 Subject: [PATCH] upload web_check_lwp.pl --- pandora_plugins/web_check/web_check_lwp.pl | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pandora_plugins/web_check/web_check_lwp.pl diff --git a/pandora_plugins/web_check/web_check_lwp.pl b/pandora_plugins/web_check/web_check_lwp.pl new file mode 100644 index 0000000000..73b1c0a028 --- /dev/null +++ b/pandora_plugins/web_check/web_check_lwp.pl @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use LWP::UserAgent (); +use Data::Dumper; + +die "Usage: $0 \n" unless @ARGV == 3; + +my ($URL, $username, $password) = @ARGV; + +my $ua = LWP::UserAgent->new(timeout => 10); +$ua->protocols_allowed( ['http', 'https'] ); +$ua->ssl_opts("verify_hostname" => 0); + +$ua->credentials($URL, "", $username, $password); + +my $response = $ua->get($URL); + +if ($response->is_success) { + print $response->decoded_content; +} +else { + die print(Dumper($response)); +}