nmap / nmap/npcap

Packet.dll routines should report errors if the service can't be started or the helper process can't be run

Open
#54 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
3.6k
Forks
592
PR merge metrics
No merged PRs in 30d

Description

I was trying to debug a problem where libpcap's findalldevstest program wasn't returning any interfaces; the problem is that I needed to copy the helper executable into the run/Debug subdirectory of my libpcap build directory.

If:

  • NpcapStartHelper() were to return FALSE if the helper needed to be started but couldn't be started, and TRUE otherwise;
  • PacketOpenAdapterNPF() were to return NULL if NpcapStartHelper()` returned FALSE;
  • PacketAddAdapterIPH() and PacketAddAdapterNPF() were to return FALSE for PacketOpenAdapterNPF() returning NULL and the error being any of the ShellExecuteExA() errors that mean "the helper couldn't be started" rather than meaning "there is no such adapter";
  • PacketGetAdaptersIPH(), PacketGetAdaptersNPF(), and PacketUpdateAdInfo() were to return FALSE if the corresponding PacketAddAdapterXXX() routine failed with one of those errors;
  • PacketPopulateAdaptersInfoList() were to do the same, and return a success/failure Boolean;

that would, I think, allow this.

This would also allow pcap_activate_npf() to return PCAP_ERROR_PERM_DENIED if a program tries to open an adapter, Npcap is in admin-only mode, and the user says "No" to the UAC prompt - and would also allow any future device-enumerating APIs to do so as well.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with findalldevstest and trace NpcapStartHelper(), PacketOpenAdapterNPF(), the PacketAddAdapterXXX(), PacketGetAdaptersXXX(), PacketUpdateAdInfo(), and PacketPopulateAdaptersInfoList() routines. Review how ShellExecuteExA() failures are currently handled. Done means helper-start failures propagate through adapter enumeration and pcap_activate_npf() can report permission denial when the UAC prompt is declined.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.