mirror of
https://github.com/nmap/nmap.git
synced 2026-10-20 19:01:56 +00:00
Only change the port state to PORT_OPEN during service scan if it is not
already open. Rob Nicholls pointed out that setting the state unconditionally results in multiple messages per port: Discovered open port 3389/tcp Discovered open port 3389/tcp Discovered open port 3389/tcp Discovered open port 3389/tcp This is because setPortState has the side effect of printing a message.
This commit is contained in:
parent
6804b8d435
commit
1f6c6d1aac
1 changed files with 6 additions and 6 deletions
|
|
@ -1700,13 +1700,13 @@ static void adjustPortStateIfNeccessary(ServiceNFO *svc) {
|
|||
char host[128];
|
||||
|
||||
oldstate = svc->target->ports.getPortState(svc->portno, svc->proto);
|
||||
svc->target->ports.setPortState(svc->portno, svc->proto, PORT_OPEN);
|
||||
if (svc->proto == IPPROTO_TCP)
|
||||
svc->target->ports.setStateReason(svc->portno, svc->proto, ER_TCPRESPONSE, 0, 0);
|
||||
if (svc->proto == IPPROTO_UDP)
|
||||
svc->target->ports.setStateReason(svc->portno, svc->proto, ER_UDPRESPONSE, 0, 0);
|
||||
|
||||
if (oldstate != PORT_OPEN) {
|
||||
svc->target->ports.setPortState(svc->portno, svc->proto, PORT_OPEN);
|
||||
if (svc->proto == IPPROTO_TCP)
|
||||
svc->target->ports.setStateReason(svc->portno, svc->proto, ER_TCPRESPONSE, 0, 0);
|
||||
if (svc->proto == IPPROTO_UDP)
|
||||
svc->target->ports.setStateReason(svc->portno, svc->proto, ER_UDPRESPONSE, 0, 0);
|
||||
|
||||
if (o.verbose || o.debugging > 1) {
|
||||
svc->target->NameIP(host, sizeof(host));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue