netwatch.py/python-nmap-0.3.4/nmap.html

569 lines
43 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module nmap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>nmap</strong></big></big> (version 0.3.4)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/xael/ESPACE_KM/python/python-nmap/nmap/nmap.py">/home/xael/ESPACE_KM/python/python-nmap/nmap/nmap.py</a></font></td></tr></table>
<p><tt>nmap.py&nbsp;-&nbsp;version&nbsp;and&nbsp;date,&nbsp;see&nbsp;below<br>
&nbsp;<br>
Source&nbsp;code&nbsp;:&nbsp;https://code.google.com/p/python-nmap/<br>
&nbsp;<br>
Author&nbsp;:<br>
&nbsp;<br>
*&nbsp;Alexandre&nbsp;Norman&nbsp;-&nbsp;norman&nbsp;at&nbsp;xael.org<br>
&nbsp;<br>
Contributors:<br>
&nbsp;<br>
*&nbsp;Steve&nbsp;'Ashcrow'&nbsp;Milner&nbsp;-&nbsp;steve&nbsp;at&nbsp;gnulinux.net<br>
*&nbsp;Brian&nbsp;Bustin&nbsp;-&nbsp;brian&nbsp;at&nbsp;bustin.us<br>
*&nbsp;old.schepperhand<br>
*&nbsp;Johan&nbsp;Lundberg<br>
*&nbsp;Thomas&nbsp;D.&nbsp;maaaaz<br>
*&nbsp;Robert&nbsp;Bost<br>
&nbsp;<br>
Licence&nbsp;:&nbsp;GPL&nbsp;v3&nbsp;or&nbsp;any&nbsp;later&nbsp;version<br>
&nbsp;<br>
&nbsp;<br>
This&nbsp;program&nbsp;is&nbsp;free&nbsp;software:&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and/or&nbsp;modify<br>
it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;as&nbsp;published&nbsp;by<br>
the&nbsp;Free&nbsp;Software&nbsp;Foundation,&nbsp;either&nbsp;version&nbsp;3&nbsp;of&nbsp;the&nbsp;License,&nbsp;or<br>
any&nbsp;later&nbsp;version.<br>
&nbsp;<br>
This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,<br>
but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of<br>
MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the<br>
GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.<br>
&nbsp;<br>
You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License<br>
along&nbsp;with&nbsp;this&nbsp;program.&nbsp;&nbsp;If&nbsp;not,&nbsp;see&nbsp;&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.<br>
&nbsp;<br>
&nbsp;<br>
Test&nbsp;strings&nbsp;:<br>
^^^^^^^^^^^^<br>
&gt;&gt;&gt;&nbsp;import&nbsp;nmap<br>
&gt;&gt;&gt;&nbsp;if&nbsp;__get_last_online_version()&nbsp;!=&nbsp;__version__:<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise&nbsp;ValueError('Current&nbsp;version&nbsp;is&nbsp;{0}&nbsp;-&nbsp;Last&nbsp;published&nbsp;version&nbsp;is&nbsp;{1}'.format(__version__,&nbsp;__get_last_online_version()))<br>
&gt;&gt;&gt;&nbsp;nm&nbsp;=&nbsp;nmap.<a href="#PortScanner">PortScanner</a>()<br>
&gt;&gt;&gt;&nbsp;try:<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nm.scan(arguments='-wrongargs')<br>
...&nbsp;except&nbsp;nmap.<a href="#PortScannerError">PortScannerError</a>:<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
&gt;&gt;&gt;&nbsp;'error'&nbsp;in&nbsp;nm.scan('yahoo.fs',&nbsp;arguments='-sP')['nmap']['scaninfo']<br>
True<br>
&gt;&gt;&gt;&nbsp;r=nm.scan('127.0.0.1',&nbsp;'22-25')<br>
&gt;&gt;&gt;&nbsp;r=nm.analyse_nmap_xml_scan(open('../scanme_output.xml').read())<br>
&gt;&gt;&gt;&nbsp;nm.command_line()<br>
'./nmap-6.40/nmap&nbsp;-sV&nbsp;-oX&nbsp;scanme_output.xml&nbsp;scanme.nmap.org'<br>
&gt;&gt;&gt;&nbsp;nm.scaninfo()<br>
{'tcp':&nbsp;{'services':&nbsp;'1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389',&nbsp;'method':&nbsp;'connect'}}<br>
&gt;&gt;&gt;&nbsp;nm.all_hosts()<br>
['74.207.244.221']<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221'].hostname()<br>
'scanme.nmap.org'<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221'].state()<br>
'up'<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221'].all_protocols()<br>
['addresses',&nbsp;'tcp',&nbsp;'vendor']<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221']['tcp'].keys()<br>
dict_keys([80,&nbsp;9929,&nbsp;22])<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221'].has_tcp(22)<br>
True<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221'].has_tcp(23)<br>
False<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221']['tcp'][22]<br>
{'product':&nbsp;'OpenSSH',&nbsp;'state':&nbsp;'open',&nbsp;'version':&nbsp;'5.3p1&nbsp;Debian&nbsp;3ubuntu7',&nbsp;'name':&nbsp;'ssh',&nbsp;'conf':&nbsp;'10',&nbsp;'extrainfo':&nbsp;'Ubuntu&nbsp;Linux;&nbsp;protocol&nbsp;2.0',&nbsp;'reason':&nbsp;'syn-ack',&nbsp;'cpe':&nbsp;'cpe:/o:linux:linux_kernel'}<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221']['tcp'][22]&nbsp;==&nbsp;nm['74.207.244.221'].tcp(22)<br>
True<br>
&gt;&gt;&gt;&nbsp;nm['74.207.244.221']['tcp'][22]['state']<br>
'open'<br>
&gt;&gt;&gt;&nbsp;nm.scanstats()['uphosts']<br>
'1'<br>
&gt;&gt;&gt;&nbsp;nm.scanstats()['downhosts']<br>
'0'<br>
&gt;&gt;&gt;&nbsp;nm.scanstats()['totalhosts']<br>
'1'<br>
&gt;&gt;&gt;&nbsp;'timestr'&nbsp;in&nbsp;nm.scanstats().keys()<br>
True<br>
&gt;&gt;&gt;&nbsp;'elapsed'&nbsp;in&nbsp;nm.scanstats().keys()<br>
True<br>
&gt;&gt;&gt;&nbsp;nm.listscan('192.168.1.0/30')<br>
['192.168.1.0',&nbsp;'192.168.1.1',&nbsp;'192.168.1.2',&nbsp;'192.168.1.3']<br>
&gt;&gt;&gt;&nbsp;nm.listscan('localhost/30')<br>
['127.0.0.0',&nbsp;'127.0.0.1',&nbsp;'127.0.0.2',&nbsp;'127.0.0.3']<br>
&gt;&gt;&gt;&nbsp;import&nbsp;os<br>
&gt;&gt;&gt;&nbsp;if&nbsp;os.getuid()&nbsp;==&nbsp;0:<br>
...&nbsp;&nbsp;&nbsp;r=nm.scan('127.0.0.1',&nbsp;arguments='-O')<br>
...&nbsp;&nbsp;&nbsp;len(nm['127.0.0.1']['osclass'])&gt;0<br>
...&nbsp;&nbsp;&nbsp;len(nm.csv())&nbsp;&gt;&nbsp;0<br>
...&nbsp;else:<br>
...&nbsp;&nbsp;&nbsp;True<br>
...&nbsp;&nbsp;&nbsp;True<br>
True<br>
True<br>
&gt;&gt;&gt;&nbsp;if&nbsp;os.getuid()&nbsp;==&nbsp;0:<br>
...&nbsp;&nbsp;&nbsp;r=nm.scan(hosts='127.0.0.1',&nbsp;ports='139',&nbsp;arguments="-sC&nbsp;-T4")<br>
&gt;&gt;&gt;&nbsp;if&nbsp;os.getuid()&nbsp;==&nbsp;0:<br>
...&nbsp;&nbsp;&nbsp;nm['127.0.0.1']['hostscript'][0].keys()<br>
dict_keys(['output',&nbsp;'id'])<br>
&gt;&gt;&gt;&nbsp;if&nbsp;os.getuid()&nbsp;==&nbsp;0:<br>
...&nbsp;&nbsp;&nbsp;r=nm.scan('192.168.0.254',&nbsp;arguments='-O')<br>
...&nbsp;&nbsp;&nbsp;len(nm['192.168.0.254']['vendor'])&nbsp;&gt;&nbsp;0<br>
...&nbsp;else:<br>
...&nbsp;&nbsp;&nbsp;True<br>
True</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="collections.html">collections</a><br>
<a href="csv.html">csv</a><br>
<a href="io.html">io</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="re.html">re</a><br>
<a href="shlex.html">shlex</a><br>
</td><td width="25%" valign=top><a href="string.html">string</a><br>
<a href="subprocess.html">subprocess</a><br>
<a href="sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="types.html">types</a><br>
<a href="xml.html">xml</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#Exception">builtins.Exception</a>(<a href="builtins.html#BaseException">builtins.BaseException</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="nmap.html#PortScannerError">PortScannerError</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="builtins.html#dict">builtins.dict</a>(<a href="builtins.html#object">builtins.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="nmap.html#PortScannerHostDict">PortScannerHostDict</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="nmap.html#PortScanner">PortScanner</a>
</font></dt><dt><font face="helvetica, arial"><a href="nmap.html#PortScannerAsync">PortScannerAsync</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="nmap.html#PortScannerYield">PortScannerYield</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PortScanner">class <strong>PortScanner</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#PortScanner">PortScanner</a>&nbsp;class&nbsp;allows&nbsp;to&nbsp;use&nbsp;nmap&nbsp;from&nbsp;python<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="PortScanner-__getitem__"><strong>__getitem__</strong></a>(self, host)</dt><dd><tt>returns&nbsp;a&nbsp;host&nbsp;detail</tt></dd></dl>
<dl><dt><a name="PortScanner-__init__"><strong>__init__</strong></a>(self, nmap_search_path<font color="#909090">=('nmap', '/usr/bin/nmap', '/usr/local/bin/nmap', '/sw/bin/nmap', '/opt/local/bin/nmap')</font>)</dt><dd><tt>Initialize&nbsp;<a href="#PortScanner">PortScanner</a>&nbsp;module<br>
&nbsp;<br>
*&nbsp;detects&nbsp;nmap&nbsp;on&nbsp;the&nbsp;system&nbsp;and&nbsp;nmap&nbsp;version<br>
*&nbsp;may&nbsp;raise&nbsp;<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;if&nbsp;nmap&nbsp;is&nbsp;not&nbsp;found&nbsp;in&nbsp;the&nbsp;path<br>
&nbsp;<br>
:param&nbsp;nmap_search_path:&nbsp;tupple&nbsp;of&nbsp;string&nbsp;where&nbsp;to&nbsp;search&nbsp;for&nbsp;nmap&nbsp;executable.&nbsp;Change&nbsp;this&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;use&nbsp;a&nbsp;specific&nbsp;version&nbsp;of&nbsp;nmap.<br>
:returns:&nbsp;nothing</tt></dd></dl>
<dl><dt><a name="PortScanner-all_hosts"><strong>all_hosts</strong></a>(self)</dt><dd><tt>returns&nbsp;a&nbsp;sorted&nbsp;list&nbsp;of&nbsp;all&nbsp;hosts</tt></dd></dl>
<dl><dt><a name="PortScanner-analyse_nmap_xml_scan"><strong>analyse_nmap_xml_scan</strong></a>(self, nmap_xml_output<font color="#909090">=None</font>, nmap_err<font color="#909090">=''</font>, nmap_err_keep_trace<font color="#909090">=''</font>)</dt><dd><tt>Analyses&nbsp;NMAP&nbsp;xml&nbsp;scan&nbsp;ouput<br>
&nbsp;<br>
May&nbsp;raise&nbsp;<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;if&nbsp;nmap&nbsp;output&nbsp;was&nbsp;not&nbsp;xml<br>
&nbsp;<br>
Test&nbsp;existance&nbsp;of&nbsp;the&nbsp;following&nbsp;key&nbsp;to&nbsp;know&nbsp;if&nbsp;something&nbsp;went&nbsp;wrong&nbsp;:&nbsp;['nmap']['scaninfo']['error']<br>
If&nbsp;not&nbsp;present,&nbsp;everything&nbsp;was&nbsp;ok.<br>
&nbsp;<br>
:param&nbsp;nmap_xml_output:&nbsp;xml&nbsp;string&nbsp;to&nbsp;analyse<br>
:returns:&nbsp;scan_result&nbsp;as&nbsp;dictionnary</tt></dd></dl>
<dl><dt><a name="PortScanner-command_line"><strong>command_line</strong></a>(self)</dt><dd><tt>returns&nbsp;command&nbsp;line&nbsp;used&nbsp;for&nbsp;the&nbsp;scan<br>
&nbsp;<br>
may&nbsp;raise&nbsp;AssertionError&nbsp;exception&nbsp;if&nbsp;called&nbsp;before&nbsp;scanning</tt></dd></dl>
<dl><dt><a name="PortScanner-csv"><strong>csv</strong></a>(self)</dt><dd><tt>returns&nbsp;CSV&nbsp;output&nbsp;as&nbsp;text<br>
&nbsp;<br>
Example&nbsp;:<br>
host;protocol;port;name;state;product;extrainfo;reason;version;conf;cpe<br>
127.0.0.1;tcp;22;ssh;open;OpenSSH;protocol&nbsp;2.0;syn-ack;5.9p1&nbsp;Debian&nbsp;5ubuntu1;10;cpe<br>
127.0.0.1;tcp;23;telnet;closed;;;conn-refused;;3;<br>
127.0.0.1;tcp;24;priv-mail;closed;;;conn-refused;;3;</tt></dd></dl>
<dl><dt><a name="PortScanner-get_nmap_last_output"><strong>get_nmap_last_output</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;last&nbsp;text&nbsp;output&nbsp;of&nbsp;nmap&nbsp;in&nbsp;raw&nbsp;text<br>
this&nbsp;may&nbsp;be&nbsp;used&nbsp;for&nbsp;debugging&nbsp;purpose<br>
&nbsp;<br>
:returns:&nbsp;string&nbsp;containing&nbsp;the&nbsp;last&nbsp;text&nbsp;output&nbsp;of&nbsp;nmap&nbsp;in&nbsp;raw&nbsp;text</tt></dd></dl>
<dl><dt><a name="PortScanner-has_host"><strong>has_host</strong></a>(self, host)</dt><dd><tt>returns&nbsp;True&nbsp;if&nbsp;host&nbsp;has&nbsp;result,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScanner-listscan"><strong>listscan</strong></a>(self, hosts<font color="#909090">='127.0.0.1'</font>)</dt><dd><tt>do&nbsp;not&nbsp;scan&nbsp;but&nbsp;interpret&nbsp;target&nbsp;hosts&nbsp;and&nbsp;return&nbsp;a&nbsp;list&nbsp;a&nbsp;hosts</tt></dd></dl>
<dl><dt><a name="PortScanner-nmap_version"><strong>nmap_version</strong></a>(self)</dt><dd><tt>returns&nbsp;nmap&nbsp;version&nbsp;if&nbsp;detected&nbsp;(int&nbsp;version,&nbsp;int&nbsp;subversion)<br>
or&nbsp;(0,&nbsp;0)&nbsp;if&nbsp;unknown<br>
:returns:&nbsp;(nmap_version_number,&nbsp;nmap_subversion_number)</tt></dd></dl>
<dl><dt><a name="PortScanner-scan"><strong>scan</strong></a>(self, hosts<font color="#909090">='127.0.0.1'</font>, ports<font color="#909090">=None</font>, arguments<font color="#909090">='-sV'</font>)</dt><dd><tt>Scan&nbsp;given&nbsp;hosts<br>
&nbsp;<br>
May&nbsp;raise&nbsp;<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;if&nbsp;nmap&nbsp;output&nbsp;was&nbsp;not&nbsp;xml<br>
&nbsp;<br>
Test&nbsp;existance&nbsp;of&nbsp;the&nbsp;following&nbsp;key&nbsp;to&nbsp;know&nbsp;if&nbsp;something&nbsp;went&nbsp;wrong&nbsp;:&nbsp;['nmap']['scaninfo']['error']<br>
If&nbsp;not&nbsp;present,&nbsp;everything&nbsp;was&nbsp;ok.<br>
&nbsp;<br>
hosts&nbsp;=&nbsp;string&nbsp;for&nbsp;hosts&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'scanme.nmap.org'&nbsp;or&nbsp;'198.116.0-255.1-127'&nbsp;or&nbsp;'216.163.128.20/20'<br>
ports&nbsp;=&nbsp;string&nbsp;for&nbsp;ports&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'22,53,110,143-4564'<br>
arguments&nbsp;=&nbsp;string&nbsp;of&nbsp;arguments&nbsp;for&nbsp;nmap&nbsp;'-sU&nbsp;-sX&nbsp;-sC'<br>
&nbsp;<br>
:returns:&nbsp;scan_result&nbsp;as&nbsp;dictionnary</tt></dd></dl>
<dl><dt><a name="PortScanner-scaninfo"><strong>scaninfo</strong></a>(self)</dt><dd><tt>returns&nbsp;scaninfo&nbsp;structure<br>
{'tcp':&nbsp;{'services':&nbsp;'22',&nbsp;'method':&nbsp;'connect'}}<br>
&nbsp;<br>
may&nbsp;raise&nbsp;AssertionError&nbsp;exception&nbsp;if&nbsp;called&nbsp;before&nbsp;scanning</tt></dd></dl>
<dl><dt><a name="PortScanner-scanstats"><strong>scanstats</strong></a>(self)</dt><dd><tt>returns&nbsp;scanstats&nbsp;structure<br>
{'uphosts':&nbsp;'3',&nbsp;'timestr':&nbsp;'Thu&nbsp;Jun&nbsp;&nbsp;3&nbsp;21:45:07&nbsp;2010',&nbsp;'downhosts':&nbsp;'253',&nbsp;'totalhosts':&nbsp;'256',&nbsp;'elapsed':&nbsp;'5.79'}<br>
&nbsp;<br>
may&nbsp;raise&nbsp;AssertionError&nbsp;exception&nbsp;if&nbsp;called&nbsp;before&nbsp;scanning</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PortScannerAsync">class <strong>PortScannerAsync</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#PortScannerAsync">PortScannerAsync</a>&nbsp;allows&nbsp;to&nbsp;use&nbsp;nmap&nbsp;from&nbsp;python&nbsp;asynchronously<br>
for&nbsp;each&nbsp;host&nbsp;scanned,&nbsp;callback&nbsp;is&nbsp;called&nbsp;with&nbsp;scan&nbsp;result&nbsp;for&nbsp;the&nbsp;host<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="PortScannerAsync-__del__"><strong>__del__</strong></a>(self)</dt><dd><tt>Cleanup&nbsp;when&nbsp;deleted</tt></dd></dl>
<dl><dt><a name="PortScannerAsync-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Initialize&nbsp;the&nbsp;module<br>
&nbsp;<br>
*&nbsp;detects&nbsp;nmap&nbsp;on&nbsp;the&nbsp;system&nbsp;and&nbsp;nmap&nbsp;version<br>
*&nbsp;may&nbsp;raise&nbsp;<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;if&nbsp;nmap&nbsp;is&nbsp;not&nbsp;found&nbsp;in&nbsp;the&nbsp;path</tt></dd></dl>
<dl><dt><a name="PortScannerAsync-scan"><strong>scan</strong></a>(self, hosts<font color="#909090">='127.0.0.1'</font>, ports<font color="#909090">=None</font>, arguments<font color="#909090">='-sV'</font>, callback<font color="#909090">=None</font>)</dt><dd><tt>Scan&nbsp;given&nbsp;hosts&nbsp;in&nbsp;a&nbsp;separate&nbsp;process&nbsp;and&nbsp;return&nbsp;host&nbsp;by&nbsp;host&nbsp;result&nbsp;using&nbsp;callback&nbsp;function<br>
&nbsp;<br>
<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;from&nbsp;standard&nbsp;nmap&nbsp;is&nbsp;catched&nbsp;and&nbsp;you&nbsp;won't&nbsp;know&nbsp;about&nbsp;it<br>
&nbsp;<br>
:param&nbsp;hosts:&nbsp;string&nbsp;for&nbsp;hosts&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'scanme.nmap.org'&nbsp;or&nbsp;'198.116.0-255.1-127'&nbsp;or&nbsp;'216.163.128.20/20'<br>
:param&nbsp;ports:&nbsp;string&nbsp;for&nbsp;ports&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'22,53,110,143-4564'<br>
:param&nbsp;arguments:&nbsp;string&nbsp;of&nbsp;arguments&nbsp;for&nbsp;nmap&nbsp;'-sU&nbsp;-sX&nbsp;-sC'<br>
:param&nbsp;callback:&nbsp;callback&nbsp;function&nbsp;which&nbsp;takes&nbsp;(host,&nbsp;scan_data)&nbsp;as&nbsp;arguments</tt></dd></dl>
<dl><dt><a name="PortScannerAsync-still_scanning"><strong>still_scanning</strong></a>(self)</dt><dd><tt>:returns:&nbsp;True&nbsp;if&nbsp;a&nbsp;scan&nbsp;is&nbsp;currently&nbsp;running,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScannerAsync-stop"><strong>stop</strong></a>(self)</dt><dd><tt>Stop&nbsp;the&nbsp;current&nbsp;scan&nbsp;process</tt></dd></dl>
<dl><dt><a name="PortScannerAsync-wait"><strong>wait</strong></a>(self, timeout<font color="#909090">=None</font>)</dt><dd><tt>Wait&nbsp;for&nbsp;the&nbsp;current&nbsp;scan&nbsp;process&nbsp;to&nbsp;finish,&nbsp;or&nbsp;timeout<br>
&nbsp;<br>
:param&nbsp;timeout:&nbsp;default&nbsp;=&nbsp;None,&nbsp;wait&nbsp;timeout&nbsp;seconds</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PortScannerError">class <strong>PortScannerError</strong></a>(<a href="builtins.html#Exception">builtins.Exception</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="builtins.html#Exception">Exception</a>&nbsp;error&nbsp;class&nbsp;for&nbsp;<a href="#PortScanner">PortScanner</a>&nbsp;class<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="nmap.html#PortScannerError">PortScannerError</a></dd>
<dd><a href="builtins.html#Exception">builtins.Exception</a></dd>
<dd><a href="builtins.html#BaseException">builtins.BaseException</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PortScannerError-__init__"><strong>__init__</strong></a>(self, value)</dt></dl>
<dl><dt><a name="PortScannerError-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>
<dl><dt><a name="PortScannerError-__str__"><strong>__str__</strong></a>(self)</dt></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="builtins.html#Exception">builtins.Exception</a>:<br>
<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#PortScannerError-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="builtins.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
<hr>
Methods inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><a name="PortScannerError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerError-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
<dl><dt><a name="PortScannerError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerError-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
<dl><dt><a name="PortScannerError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
<dl><dt><a name="PortScannerError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerError-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
<dl><dt><a name="PortScannerError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
<dl><dt><a name="PortScannerError-with_traceback"><strong>with_traceback</strong></a>(...)</dt><dd><tt><a href="builtins.html#Exception">Exception</a>.<a href="#PortScannerError-with_traceback">with_traceback</a>(tb)&nbsp;--<br>
set&nbsp;self.<strong>__traceback__</strong>&nbsp;to&nbsp;tb&nbsp;and&nbsp;return&nbsp;self.</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><strong>__cause__</strong></dt>
<dd><tt>exception&nbsp;cause</tt></dd>
</dl>
<dl><dt><strong>__context__</strong></dt>
<dd><tt>exception&nbsp;context</tt></dd>
</dl>
<dl><dt><strong>__dict__</strong></dt>
</dl>
<dl><dt><strong>__traceback__</strong></dt>
</dl>
<dl><dt><strong>args</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PortScannerHostDict">class <strong>PortScannerHostDict</strong></a>(<a href="builtins.html#dict">builtins.dict</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Special&nbsp;dictionnary&nbsp;class&nbsp;for&nbsp;storing&nbsp;and&nbsp;accessing&nbsp;host&nbsp;scan&nbsp;result<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="nmap.html#PortScannerHostDict">PortScannerHostDict</a></dd>
<dd><a href="builtins.html#dict">builtins.dict</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PortScannerHostDict-all_ip"><strong>all_ip</strong></a>(self)</dt><dd><tt>:returns:&nbsp;list&nbsp;of&nbsp;ip&nbsp;ports</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-all_protocols"><strong>all_protocols</strong></a>(self)</dt><dd><tt>:returns:&nbsp;a&nbsp;list&nbsp;of&nbsp;all&nbsp;scanned&nbsp;protocols</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-all_sctp"><strong>all_sctp</strong></a>(self)</dt><dd><tt>:returns:&nbsp;list&nbsp;of&nbsp;sctp&nbsp;ports</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-all_tcp"><strong>all_tcp</strong></a>(self)</dt><dd><tt>:returns:&nbsp;list&nbsp;of&nbsp;tcp&nbsp;ports</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-all_udp"><strong>all_udp</strong></a>(self)</dt><dd><tt>:returns:&nbsp;list&nbsp;of&nbsp;udp&nbsp;ports</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-has_ip"><strong>has_ip</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;ip&nbsp;port<br>
:returns:&nbsp;True&nbsp;if&nbsp;ip&nbsp;port&nbsp;has&nbsp;info,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-has_sctp"><strong>has_sctp</strong></a>(self, port)</dt><dd><tt>:returns:&nbsp;True&nbsp;if&nbsp;sctp&nbsp;port&nbsp;has&nbsp;info,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-has_tcp"><strong>has_tcp</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;tcp&nbsp;port<br>
:returns:&nbsp;True&nbsp;if&nbsp;tcp&nbsp;port&nbsp;has&nbsp;info,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-has_udp"><strong>has_udp</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;udp&nbsp;port<br>
:returns:&nbsp;True&nbsp;if&nbsp;udp&nbsp;port&nbsp;has&nbsp;info,&nbsp;False&nbsp;otherwise</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-hostname"><strong>hostname</strong></a>(self)</dt><dd><tt>:returns:&nbsp;hostname</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-ip"><strong>ip</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;ip&nbsp;port<br>
:returns:&nbsp;info&nbsp;for&nbsp;ip&nbsp;port</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-sctp"><strong>sctp</strong></a>(self, port)</dt><dd><tt>:returns:&nbsp;info&nbsp;for&nbsp;sctp&nbsp;port</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-state"><strong>state</strong></a>(self)</dt><dd><tt>:returns:&nbsp;host&nbsp;state</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-tcp"><strong>tcp</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;tcp&nbsp;port<br>
:returns:&nbsp;info&nbsp;for&nbsp;tpc&nbsp;port</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-udp"><strong>udp</strong></a>(self, port)</dt><dd><tt>:param&nbsp;port:&nbsp;(int)&nbsp;udp&nbsp;port<br>
:returns:&nbsp;info&nbsp;for&nbsp;udp&nbsp;port</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-uptime"><strong>uptime</strong></a>(self)</dt><dd><tt>:returns:&nbsp;host&nbsp;state</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="builtins.html#dict">builtins.dict</a>:<br>
<dl><dt><a name="PortScannerHostDict-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-__contains__">__contains__</a>(k)&nbsp;-&gt;&nbsp;True&nbsp;if&nbsp;D&nbsp;has&nbsp;a&nbsp;key&nbsp;k,&nbsp;else&nbsp;False</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__delitem__"><strong>__delitem__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__delitem__">__delitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;del&nbsp;x[y]</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__eq__"><strong>__eq__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__eq__">__eq__</a>(y)&nbsp;&lt;==&gt;&nbsp;x==y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__ge__"><strong>__ge__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__ge__">__ge__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;=y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__gt__"><strong>__gt__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__gt__">__gt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;help(type(x))&nbsp;for&nbsp;signature</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__iter__"><strong>__iter__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__iter__">__iter__</a>()&nbsp;&lt;==&gt;&nbsp;iter(x)</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__le__"><strong>__le__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__le__">__le__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;=y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__len__">__len__</a>()&nbsp;&lt;==&gt;&nbsp;len(x)</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__lt__"><strong>__lt__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__lt__">__lt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__ne__"><strong>__ne__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__ne__">__ne__</a>(y)&nbsp;&lt;==&gt;&nbsp;x!=y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__setitem__"><strong>__setitem__</strong></a>(...)</dt><dd><tt>x.<a href="#PortScannerHostDict-__setitem__">__setitem__</a>(i,&nbsp;y)&nbsp;&lt;==&gt;&nbsp;x[i]=y</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-__sizeof__"><strong>__sizeof__</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-__sizeof__">__sizeof__</a>()&nbsp;-&gt;&nbsp;size&nbsp;of&nbsp;D&nbsp;in&nbsp;memory,&nbsp;in&nbsp;bytes</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-clear"><strong>clear</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-clear">clear</a>()&nbsp;-&gt;&nbsp;None.&nbsp;&nbsp;Remove&nbsp;all&nbsp;items&nbsp;from&nbsp;D.</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-copy"><strong>copy</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-copy">copy</a>()&nbsp;-&gt;&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;D</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-fromkeys"><strong>fromkeys</strong></a>(...)</dt><dd><tt><a href="builtins.html#dict">dict</a>.<a href="#PortScannerHostDict-fromkeys">fromkeys</a>(S[,v])&nbsp;-&gt;&nbsp;New&nbsp;<a href="builtins.html#dict">dict</a>&nbsp;with&nbsp;keys&nbsp;from&nbsp;S&nbsp;and&nbsp;values&nbsp;equal&nbsp;to&nbsp;v.<br>
v&nbsp;defaults&nbsp;to&nbsp;None.</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-get"><strong>get</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-get">get</a>(k[,d])&nbsp;-&gt;&nbsp;D[k]&nbsp;if&nbsp;k&nbsp;in&nbsp;D,&nbsp;else&nbsp;d.&nbsp;&nbsp;d&nbsp;defaults&nbsp;to&nbsp;None.</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-items"><strong>items</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-items">items</a>()&nbsp;-&gt;&nbsp;a&nbsp;set-like&nbsp;<a href="builtins.html#object">object</a>&nbsp;providing&nbsp;a&nbsp;view&nbsp;on&nbsp;D's&nbsp;items</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-keys"><strong>keys</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-keys">keys</a>()&nbsp;-&gt;&nbsp;a&nbsp;set-like&nbsp;<a href="builtins.html#object">object</a>&nbsp;providing&nbsp;a&nbsp;view&nbsp;on&nbsp;D's&nbsp;keys</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-pop"><strong>pop</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-pop">pop</a>(k[,d])&nbsp;-&gt;&nbsp;v,&nbsp;remove&nbsp;specified&nbsp;key&nbsp;and&nbsp;return&nbsp;the&nbsp;corresponding&nbsp;value.<br>
If&nbsp;key&nbsp;is&nbsp;not&nbsp;found,&nbsp;d&nbsp;is&nbsp;returned&nbsp;if&nbsp;given,&nbsp;otherwise&nbsp;KeyError&nbsp;is&nbsp;raised</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-popitem"><strong>popitem</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-popitem">popitem</a>()&nbsp;-&gt;&nbsp;(k,&nbsp;v),&nbsp;remove&nbsp;and&nbsp;return&nbsp;some&nbsp;(key,&nbsp;value)&nbsp;pair&nbsp;as&nbsp;a<br>
2-tuple;&nbsp;but&nbsp;raise&nbsp;KeyError&nbsp;if&nbsp;D&nbsp;is&nbsp;empty.</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-setdefault"><strong>setdefault</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-setdefault">setdefault</a>(k[,d])&nbsp;-&gt;&nbsp;D.<a href="#PortScannerHostDict-get">get</a>(k,d),&nbsp;also&nbsp;set&nbsp;D[k]=d&nbsp;if&nbsp;k&nbsp;not&nbsp;in&nbsp;D</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-update"><strong>update</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-update">update</a>([E,&nbsp;]**F)&nbsp;-&gt;&nbsp;None.&nbsp;&nbsp;Update&nbsp;D&nbsp;from&nbsp;<a href="builtins.html#dict">dict</a>/iterable&nbsp;E&nbsp;and&nbsp;F.<br>
If&nbsp;E&nbsp;present&nbsp;and&nbsp;has&nbsp;a&nbsp;.<a href="#PortScannerHostDict-keys">keys</a>()&nbsp;method,&nbsp;does:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;k&nbsp;in&nbsp;E:&nbsp;D[k]&nbsp;=&nbsp;E[k]<br>
If&nbsp;E&nbsp;present&nbsp;and&nbsp;lacks&nbsp;.<a href="#PortScannerHostDict-keys">keys</a>()&nbsp;method,&nbsp;does:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(k,&nbsp;v)&nbsp;in&nbsp;E:&nbsp;D[k]&nbsp;=&nbsp;v<br>
In&nbsp;either&nbsp;case,&nbsp;this&nbsp;is&nbsp;followed&nbsp;by:&nbsp;for&nbsp;k&nbsp;in&nbsp;F:&nbsp;D[k]&nbsp;=&nbsp;F[k]</tt></dd></dl>
<dl><dt><a name="PortScannerHostDict-values"><strong>values</strong></a>(...)</dt><dd><tt>D.<a href="#PortScannerHostDict-values">values</a>()&nbsp;-&gt;&nbsp;an&nbsp;<a href="builtins.html#object">object</a>&nbsp;providing&nbsp;a&nbsp;view&nbsp;on&nbsp;D's&nbsp;values</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="builtins.html#dict">builtins.dict</a>:<br>
<dl><dt><strong>__hash__</strong> = None</dl>
<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#PortScannerHostDict-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="builtins.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PortScannerYield">class <strong>PortScannerYield</strong></a>(<a href="nmap.html#PortScannerAsync">PortScannerAsync</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#PortScannerYield">PortScannerYield</a>&nbsp;allows&nbsp;to&nbsp;use&nbsp;nmap&nbsp;from&nbsp;python&nbsp;with&nbsp;a&nbsp;generator<br>
for&nbsp;each&nbsp;host&nbsp;scanned,&nbsp;yield&nbsp;is&nbsp;called&nbsp;with&nbsp;scan&nbsp;result&nbsp;for&nbsp;the&nbsp;host<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="nmap.html#PortScannerYield">PortScannerYield</a></dd>
<dd><a href="nmap.html#PortScannerAsync">PortScannerAsync</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PortScannerYield-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Initialize&nbsp;the&nbsp;module<br>
&nbsp;<br>
*&nbsp;detects&nbsp;nmap&nbsp;on&nbsp;the&nbsp;system&nbsp;and&nbsp;nmap&nbsp;version<br>
*&nbsp;may&nbsp;raise&nbsp;<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;if&nbsp;nmap&nbsp;is&nbsp;not&nbsp;found&nbsp;in&nbsp;the&nbsp;path</tt></dd></dl>
<dl><dt><a name="PortScannerYield-scan"><strong>scan</strong></a>(self, hosts<font color="#909090">='127.0.0.1'</font>, ports<font color="#909090">=None</font>, arguments<font color="#909090">='-sV'</font>)</dt><dd><tt>Scan&nbsp;given&nbsp;hosts&nbsp;in&nbsp;a&nbsp;separate&nbsp;process&nbsp;and&nbsp;return&nbsp;host&nbsp;by&nbsp;host&nbsp;result&nbsp;using&nbsp;callback&nbsp;function<br>
&nbsp;<br>
<a href="#PortScannerError">PortScannerError</a>&nbsp;exception&nbsp;from&nbsp;standard&nbsp;nmap&nbsp;is&nbsp;catched&nbsp;and&nbsp;you&nbsp;won't&nbsp;know&nbsp;about&nbsp;it<br>
&nbsp;<br>
:param&nbsp;hosts:&nbsp;string&nbsp;for&nbsp;hosts&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'scanme.nmap.org'&nbsp;or&nbsp;'198.116.0-255.1-127'&nbsp;or&nbsp;'216.163.128.20/20'<br>
:param&nbsp;ports:&nbsp;string&nbsp;for&nbsp;ports&nbsp;as&nbsp;nmap&nbsp;use&nbsp;it&nbsp;'22,53,110,143-4564'<br>
:param&nbsp;arguments:&nbsp;string&nbsp;of&nbsp;arguments&nbsp;for&nbsp;nmap&nbsp;'-sU&nbsp;-sX&nbsp;-sC'<br>
:param&nbsp;callback:&nbsp;callback&nbsp;function&nbsp;which&nbsp;takes&nbsp;(host,&nbsp;scan_data)&nbsp;as&nbsp;arguments</tt></dd></dl>
<dl><dt><a name="PortScannerYield-still_scanning"><strong>still_scanning</strong></a>(self)</dt></dl>
<dl><dt><a name="PortScannerYield-stop"><strong>stop</strong></a>(self)</dt></dl>
<dl><dt><a name="PortScannerYield-wait"><strong>wait</strong></a>(self, timeout<font color="#909090">=None</font>)</dt></dl>
<hr>
Methods inherited from <a href="nmap.html#PortScannerAsync">PortScannerAsync</a>:<br>
<dl><dt><a name="PortScannerYield-__del__"><strong>__del__</strong></a>(self)</dt><dd><tt>Cleanup&nbsp;when&nbsp;deleted</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="nmap.html#PortScannerAsync">PortScannerAsync</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-convert_nmap_output_to_encoding"><strong>convert_nmap_output_to_encoding</strong></a>(value, code<font color="#909090">='ascii'</font>)</dt><dd><tt>Change&nbsp;encoding&nbsp;for&nbsp;scan_result&nbsp;<a href="builtins.html#object">object</a>&nbsp;from&nbsp;unicode&nbsp;to&nbsp;whatever<br>
&nbsp;<br>
:param&nbsp;value:&nbsp;scan_result&nbsp;as&nbsp;dictionnary<br>
:param&nbsp;code:&nbsp;default&nbsp;=&nbsp;"ascii",&nbsp;encoding&nbsp;destination<br>
&nbsp;<br>
:returns:&nbsp;scan_result&nbsp;as&nbsp;dictionnary&nbsp;with&nbsp;new&nbsp;encoding</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__last_modification__</strong> = '2014.06.22'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Alexandre&nbsp;Norman&nbsp;(norman@xael.org)</td></tr></table>
</body></html>