Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2005 15:37:19 +0000
From:      Brian Candler <B.Candler@pobox.com>
To:        Marcin Jessa <lists@yazzy.org>
Cc:        freebsd-isp@freebsd.org
Subject:   Re: ISP's supporting sshd on port 443?
Message-ID:  <20051222153719.GA3259@uk.tiscali.com>
In-Reply-To: <20051222143213.0b98e6c2.lists@yazzy.org>
References:  <122020051635.14761.43A832C8000DE4BB000039A922058863609D0A90079D0B02019B9C010D@comcast.net> <17321.26449.603277.510191@canoe.dclg.ca> <20051222132041.GA2830@uk.tiscali.com> <20051222143213.0b98e6c2.lists@yazzy.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 22, 2005 at 02:32:13PM +0000, Marcin Jessa wrote:
> The attached what?

Perl script, cgish.pl. Maybe I forgot to attach it. Here it is in-line:

#!/usr/bin/perl
use CGI;

$a = $ENV{'REMOTE_ADDR'};
if ($a ne "127.0.0.1" and $a ne "192.168.1.1") {
  print "Content-Type: text/html\n\n";
  print "Permission denied";
  exit;
}

$c = new CGI;
$p = $c->param("command");
$d = $c->param("cwd");

chdir($d) if $d;
if ($p =~ /^cd(\s+(.*))$/) {
  chdir($2) if $2;
  chomp($d = `pwd`);
  $p = "pwd";
}

$| = 1;
print "Content-Type: text/html\n\n";
print "Enter command: $d <form method=get><input type=text name=command><input type=hidden name=cwd value=$d></form>\n";

if ($p) {
  print "<pre>\n";
  system($p. " 2>&1 | sed -e 's/&/\\&amp;/g' -e 's/</\\&lt;/g' -e 's/>/\\&gt;/g'");
  print "</pre>\n";
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051222153719.GA3259>