• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

t/H26-Jan-2019-977828

tools/H26-Jan-2019-1,504669

Changes.mdH A D26-Jan-201914.5 KiB366317

LICENSEH A D26-Jan-20191.1 KiB2117

MANIFESTH A D26-Jan-2019377 1918

META.jsonH A D26-Jan-2019617 2726

META.ymlH A D26-Jan-2019447 2019

Makefile.PLH A D26-Jan-2019824 3022

Parser.pmH A D26-Jan-201957 KiB1,960810

README.mdH A D26-Jan-20195 KiB13194

README.md

1# Nmap-Parser
2Parse nmap scan data with perl.
3
4This module implements a interface to the information contained in an nmap scan. It is implemented by parsing the xml scan data that is generated by nmap. This will enable anyone who utilizes nmap to quickly create fast and robust security scripts that utilize the powerful port scanning abilities of nmap.
5
6See *[API Reference](http://search.cpan.org/~apersaud/Nmap-Parser/Parser.pm)*
7
8The latest version of this module can be found on here [http://modernistik.github.com/Nmap-Parser/](http://modernistik.github.com/Nmap-Parser/)
9
10### Code Status
11[![CPAN version](https://badge.fury.io/pl/Nmap-Parser.svg)](http://search.cpan.org/~apersaud/Nmap-Parser/Parser.pm)
12[![Build Status](https://travis-ci.org/modernistik/Nmap-Parser.svg?branch=master)](https://travis-ci.org/modernistik/Nmap-Parser)
13
14## Overview
15Here is a small example on how to use the module. You can view the more detailed API and examples in the POD documentation.
16
17```perl
18    use Nmap::Parser;
19    my $np = new Nmap::Parser;
20
21    $np->parsescan($nmap_path, $nmap_args, @ips);
22    #or
23    $np->parsefile($file_xml);
24
25    my $session    = $np->get_session();
26    my $host       = $np->get_host($ip_addr);
27    my $service = $host->tcp_service(80);
28    my $os         = $host->os_sig();
29```
30
31Another method is to setup callbacks for each section.
32
33```perl
34    my $np2 = new Nmap::Parser;
35
36    $np2->callback(\&my_callback);
37
38    $np2->parsefile($file_xml);
39    #or
40    $np2->parsescan($nmap_path, $nmap_args, @ips);
41
42    sub my_callback {
43	    my $host = shift; #Nmap::Parser::Host object
44    	#.. see documentation for all methods ...
45    }
46```
47
48## CPAN Installation (recommended)
49The easiest way to install a Perl module is to use span. Run this in the command prompt to install directly from CPAN (may need root priviledges):
50
51```bash
52	$ perl -MCPAN -e 'install Nmap::Parser'
53	# or cpan bin
54	$ cpan install Nmap::Parser
55```
56
57## Manual Install
58Download the file and unpack. This is usually done by:
59
60	$ tar zxvf Nmap-Parser-x.xx.tar.gz
61
62Where x.xx is the version number. Next change into the newly created directory. To install this module type the following:
63
64  $ cpanm --quiet --installdeps --notest .
65	$ perl Makefile.PL
66	$ make
67	$ make test
68	$ make install
69
70If you would like to install Nmap-Parser in a different directory (or if you do
71not have root access use `perl Makefile.PL PREFIX=/install/path`, where
72`/install/path` is the directory in which you want to install the module. Note
73that you should then use the "use lib '/install/path'" in your scripts.
74
75## ActiveState Perl (Windows only)
76To install it on Windows, you may need to have installed the ActiveState Perl Package Manager (PPM). Run this in the command prompt:
77
78	ppm install Nmap-Parser
79
80This should contact the ActiveState respository, download the file and install it automagically.
81
82### Dependencies
83This module requires these other modules and libraries:
84
85* XML::Twig 3.16+
86* Storable (comes with Perl 5+)
87
88In addition, you will need nmap 3.00+. You don't exactly need it, but this
89version of nmap supports the xml output that this module can parse. So, you do
90not really need the executable, but the xml output that you will be parsing
91(or able to parse), must be from this version onward.
92
93### Issues, Bugs and Feature Requests
94Please submit any bugs or feature requests to: [https://github.com/modernistik/Nmap-Parser/issues](https://github.com/modernistik/Nmap-Parser/issues)
95
96Please make sure that you submit the xml-output file of the scan which you are having
97trouble with. This can be done by running your scan with the `-oX filename.xml` nmap switch. Please remove any important IP addresses for security reasons. It saves time in reproducing issues.
98
99### Releasing
100To release a new version of the module, update the version number in Parser.pm and type the following commands:
101
102  $ perl Makefile.PL
103  $ make
104  $ make test
105  $ make dist
106
107This will generate a `tar.gz` to upload to https://pause.perl.org.
108
109### Copyright and License
110Copyright (C) 2003-2018 Anthony Persaud [https://www.modernistik.com](https://www.modernistik.com)
111
112MIT License
113
114Permission is hereby granted, free of charge, to any person obtaining a copy
115of this software and associated documentation files (the "Software"), to deal
116in the Software without restriction, including without limitation the rights
117to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
118copies of the Software, and to permit persons to whom the Software is
119furnished to do so, subject to the following conditions:
120
121The above copyright notice and this permission notice shall be included in
122all copies or substantial portions of the Software.
123
124THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
125IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
126FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
127AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
128LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
129OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
130THE SOFTWARE.
131