Tamara
Tamara

Reputation: 427

Integrating nmap and WinPcap to PHP Application

I've done my research on this an still cant find any solution. the closest i have seen so far is Any ideas on how to integrate with nmap programmatically? . I am a php programmer and i'm currently building a network management system, I intend to embedd nmap and WinPcap to my php application, such that i can scan my network using both software using my application and have the information in my application application's database. can anyone shed some light on this? thank you.

Upvotes: 1

Views: 768

Answers (1)

bonsaiviking
bonsaiviking

Reputation: 5995

Nmap doesn't currently have a defined IPC or RPC interface. Its API is defined by its command-line arguments and its XML output (the best, most complete machine-readable output option). To see how an application can use this "API," you can look at some existing applications that integrate with Nmap:

  • Zenmap is Nmap's official graphical front-end. It is written in Python and is maintained by the Nmap development team, so you can count on it to be "correct."
  • Rainmap is a web application for hosted Nmap scanning. Developed as part of Google Summer of Code with the Nmap dev team, it is also written in Python (Django). It should be a good reference for how to use Nmap in a multi-user web application environment.
  • Metasploit uses Nmap and parses its output with Ruby (Nokogiri), storing relevant info in a database.
  • PBNJ is a network monitor that compares Nmap scans. It is written in Perl.

In addition to all these, there are a few thousand "scan with Nmap from PHP" pages and questions on the Internet that can help with issues surrounding request timeouts, etc. Most of all, I must warn you not to accept arbitrary user input to the scan arguments, since it is trivial to trick Nmap into executing any OS commands (which is why Nmap should never be installed setuid).

Upvotes: 1

Related Questions