2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-18 20:30:56 +00:00

Modify split code as per XiaoPeng's comments

This commit is contained in:
Casandra Qiu
2016-03-30 10:19:31 -04:00
parent 7f9b5e8b57
commit 6754e3902c

View File

@ -666,12 +666,8 @@ sub nmap_scan {
#################################################
#display the raw output
#################################################
if (exists($globalopt{r})) {
if (defined($globalopt{r}) || defined($globalopt{verbose})) {
send_msg($request, 0, "$result\n" );
} else {
if (exists($globalopt{verbose})) {
send_msg($request, 0, "$result\n" );
}
}
#################################################
@ -839,18 +835,16 @@ sub snmp_scan {
#################################################
#display the raw output
#################################################
if (exists($globalopt{r})) {
if (defined($globalopt{r}) || defined($globalopt{verbose})) {
send_msg($request, 0, "$result\n" );
} else {
if (exists($globalopt{verbose})) {
send_msg($request, 0, "$result\n" );
}
}
my @lines = split /\n/, $result;
# each line like this: "Discovered open port 161/udp on 10.4.25.1"
# only open port will be scan
foreach my $line (@lines) {
my $ip = `echo "$line\n" |awk '{printf \$6}'`;
my @array = split / /, $line;
my $ip = $array[5];
if (exists($globalopt{verbose})) {
send_msg($request, 0, "Run snmpwalk command to get information for $ip");
}