The following regex works to confirm if the input passed into it contains the string ping
elsif($RunCommand =~ m/^s*pings+(.+)/)
现在我想确认,通过的投入是否包含管道指挥。
下述工作似乎并不正确:
elsif($RunCommand =~ m/^s*|s+(.+)/)
A. 背景情况 如果是,我有下列情况: 我在上面添加了5份声明,以核实和安放;或“与”;或“与”;或 但是,它没有正确开展工作......现在它总是去往和安放;PrintPage HeaderBC(“c”);而含有ing、ns等的企图(可接受的指挥)现在却不做他们应该做的事情。 我认为,问题必须是,我所加的5个小区在连接和进入含有“安”的文字方面是不正确的;或“lt”;或“gt”;或 任何帮助? 我确信,我所做的5项个人陈述(可能不正确)也可以合并为一个发言。
# First discard command attempts that contain & ; < > |, then acceptable commands are executed, then final else to non-functional command
if($RunCommand =~ m/^s*&s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
elsif($RunCommand =~ m/^s*;s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
elsif($RunCommand =~ m/^s*<s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
elsif($RunCommand =~ m/^s*>s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
elsif($RunCommand =~ m/^s*|s+(.+)/)
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
# Now start acceptable commands
# PING
elsif($RunCommand =~ m/^s*pings+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
# TELNET
elsif($RunCommand =~ m/^s*telnets+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#DIG
elsif($RunCommand =~ m/^s*digs+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#NSLOOKUP
elsif($RunCommand =~ m/^s*nslookups+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#HOST
elsif($RunCommand =~ m/^s*hosts+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#NMAP
elsif($RunCommand =~ m/^s*nmaps+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#TRACEROUTE
elsif($RunCommand =~ m/^s*traceroutes+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
#WHOIS
elsif($RunCommand =~ m/^s*whoiss+(.+)/)
{
&PrintPageHeader("c");
#$Prompt = $WinNT ? "$CurrentDir> " : "[admin@$ServerName $CurrentDir]$ ";
$Prompt = $WinNT ? "$CurrentDir> " : "$ ";
print "<code>$Prompt $RunCommand</code><xmp>";
$Command = "cd "$CurrentDir"".$CmdSep.$RunCommand.$Redirector;
if(!$WinNT)
{
$SIG{ ALRM iii = &CommandTimeout;
alarm($CommandTimeoutDuration);
iii
if($ShowDynamicOutput) # show output as it is generated
{
$|=1;
$Command .= " |";
open(CommandOutput, $Command);
while(<CommandOutput>)
{
$_ =~ s/(
|
)$//;
print "$_
";
iii
$|=0;
iii
else # show output after command completes
{
print `$Command`;
iii
if(!$WinNT)
{
alarm(0);
iii
print "</xmp>";
iii
else
{
# Print PageHeaderBC that informs of non-functional command
&PrintPageHeaderBC("c");
iii
&PrintCommandLineInputForm;
&PrintPageFooter;
iii