1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-05 22:19:03 +00:00
Commit Graph

8834 Commits

Author SHA1 Message Date
dmiller
197f28265f New function stdnse.format_mac
This function will format a MAC address as colon-separated hex bytes.
It's really very simple: stdnse.tohex(mac, {separator=":"})

This commit updates all the instances I could find of the varying
convoluted attempts at performing this conversion.
2014-01-16 21:50:30 +00:00
dmiller
a6b79f9976 Add CHANGELOG entry for tls library 2014-01-16 21:50:26 +00:00
dmiller
b61d378d3a Update script.db 2014-01-16 19:09:13 +00:00
dmiller
a998d97216 Add sstp-discover NSE script from Niklaus Schiess 2014-01-16 19:07:43 +00:00
dmiller
645ef2a0bd Update ssl-date to use tls lib 2014-01-16 18:10:04 +00:00
dmiller
760da1788f Let tls-nextprotoneg use tls.lua library
Required fixes to tls lib's extensions (did not previously support
extension data)
2014-01-16 18:10:02 +00:00
dmiller
35148980ef Update ssl-enum-ciphers to use tls.lua 2014-01-16 18:09:59 +00:00
dmiller
71b0769fc3 New tls.lua library for handling TLS records 2014-01-16 18:09:57 +00:00
dmiller
b083fb98e6 Update comm library NSEdoc
Document some missing options to the functions, and adjust an error
message to use the correct option name.
2014-01-15 20:11:39 +00:00
dmiller
3b5b0ba154 Note that HTTPS is supported by http NSE library 2014-01-15 16:52:46 +00:00
dmiller
55c7fb605f Improve performance of StringPool.unique
This saves a function call by using subclassing dict instead of using a
real dict. When a cache hit occurs, there is no overhead beyond a
standard dict lookup, which in most implementations is very fast. Cache
miss is similar performance to previous.

Also added a unittest for this functionality.
2014-01-15 15:37:25 +00:00
dmiller
2b2edabc80 Fix typo in Nmap XML parsing in zenmap 2014-01-14 23:18:30 +00:00
dmiller
c5a4ef91fb Add more unittests to ipOps 2014-01-14 23:18:28 +00:00
dmiller
8b70dfa0a4 Replace exception-as-flow-control pattern
In general, it's better to use explicit flow control than to throw
and/or catch generic exceptions. Example:

try:
    thing = d["key"]
except:
    pass

This 1. catches an inspecific exception (probably KeyError), 2. can be
replaced with a check for ("key" is in d), and 3. can often be replaced
with d.get("key", some_default_value).
2014-01-13 15:37:39 +00:00
henri
0b2a445ddd Use strjoin() instead of '..' to concatenate strings.
This significantly decreases CPU usage, that could reach
100% on large scans.
2014-01-13 08:35:00 +00:00
dmiller
4b34673a0b Add more complete unittests for ipOps.compare_ip 2014-01-11 15:05:43 +00:00
robert
0772a10895 Updated Nmap NSIS file to use WinPcap 4.1.3 installer. 2014-01-11 15:00:05 +00:00
robert
98ed1cb771 Updated WinPcap to 4.1.3. 2014-01-11 14:55:10 +00:00
dmiller
da0c947004 Enforce PEP 8 style on Ndiff
Issues fixed:

1       E111 indentation is not a multiple of four
1       E201 whitespace after '['
14      E251 no spaces around keyword / parameter equals
7       E301 expected 1 blank line, found 0
55      E302 expected 2 blank lines, found 1
69      E501 line too long (80 characters)
3       W291 trailing whitespace
4       W601 .has_key() is deprecated, use 'in'
2014-01-10 20:43:32 +00:00
dmiller
393b4b21ee Add Ndiff tests to "make check" 2014-01-10 16:26:42 +00:00
dmiller
434efb1266 Cause make check to run nmap --script=unittest 2014-01-10 16:26:40 +00:00
dmiller
098d3b9b1a Restore missing import of zenmapCore.I18N
This was causing make check to fail because _() was not defined
2014-01-10 16:26:38 +00:00
dmiller
4d5c493e8e PEP 8 style issues: space after comma, blank lines between defs 2014-01-09 22:33:29 +00:00
dmiller
314a519dfc Delay loading modules and objects until gettext is loaded
This was resulting in strings not getting translated, especially when
the calls to gettext came at the lowest indent level of the module.
2014-01-09 22:27:15 +00:00
dmiller
bc47cb3d97 Replace explicit X == True/False with X/not X 2014-01-09 16:47:24 +00:00
dmiller
51b143353b Replace == and != with is and is not for comparisons with None 2014-01-09 16:47:20 +00:00
dmiller
96141b431e Implement "make check" for zenmap
Currently, this just uses Python's unittest module to autodiscover
tests, which may skip some, but is better than nothing. TODO: move tests
to their own module and let the zenmap_check target test them directly.
2014-01-09 16:39:39 +00:00
dmiller
3c9eeb3608 Remove some unneeded imports of re, and compile one pattern 2014-01-08 23:09:32 +00:00
dmiller
b254234118 Replace key existence tests with dict.get()
Replaced instances of this pattern:

if 'key' in somedict:
    var = somedict['key']
else:
    var = ""

...with this much simpler pattern:

var = somedict.get('key', "")

Some variations, like returning None if the key is not found were also
replaced.
2014-01-08 20:28:12 +00:00
dmiller
5c662fffdc Apply PEP 8 style guidance to zenmap
Using the pep8 tool (https://pypi.python.org/pypi/pep8), fixed the
following style issues:

Count   Issue
11      E201 whitespace after '['
8       E203 whitespace before ','
41      E211 whitespace before '('
11      E221 multiple spaces before operator
61      E225 missing whitespace around operator
237     E231 missing whitespace after ':'
91      E251 no spaces around keyword / parameter equals
19      E261 at least two spaces before inline comment
41      E301 expected 1 blank line, found 0
200     E302 expected 2 blank lines, found 1
356     E303 too many blank lines (2)
563     E501 line too long (106 characters)
39      E701 multiple statements on one line (colon)
13      E702 multiple statements on one line (semicolon)
4       W291 trailing whitespace
2       W293 blank line contains whitespace
8       W391 blank line at end of file
21      W601 .has_key() is deprecated, use 'in'
2       W602 deprecated form of raising exception

The remaining issues are long lines due to very deep data structures. I
chose not to alter them, as it would involve backslash-continuation
where whitespace is not permitted:

./zenmapGUI/ScanInterface.py:323:80: E501 line too long (90 characters)
./zenmapGUI/ScanInterface.py:456:80: E501 line too long (84 characters)
./zenmapGUI/ScanInterface.py:464:80: E501 line too long (84 characters)
./zenmapGUI/ScanInterface.py:472:80: E501 line too long (122 characters)
./zenmapGUI/ScanInterface.py:479:80: E501 line too long (122 characters)
./zenmapGUI/ScanInterface.py:920:80: E501 line too long (94 characters)
./zenmapGUI/ScanInterface.py:923:80: E501 line too long (93 characters)
./zenmapGUI/MainWindow.py:575:80: E501 line too long (99 characters)
./zenmapGUI/MainWindow.py:906:80: E501 line too long (99 characters)
2014-01-08 19:50:22 +00:00
d33tah
9210a7f1fa Replace '# Fingerprint' with just '#' to make it more consistent. 2014-01-08 01:14:33 +00:00
dmiller
7e521bcc4f Remove unecessary circular import from radialnet.util.misc 2014-01-07 20:03:46 +00:00
dmiller
0c995f95d8 Add missing make_graph_from_nmap_parser needed by some unittests 2014-01-07 20:03:44 +00:00
dmiller
fc49e4ade6 Let "make check" only check appropriate things
When configuring --without-ncat, "make check" was trying to run Ncat's
test suite. This commit splits the check target into ncat_check and
nsock_check, and makes each conditional on that subsystem's configure
status.
2014-01-07 19:04:12 +00:00
dmiller
351054de12 Add some CHANGELOG entries for recent changes 2014-01-06 20:19:23 +00:00
dmiller
d1304e602c Fix windows build breakage from r32558 2014-01-06 20:19:21 +00:00
d33tah
4816358475 Replace all tab characters at the beginnings of lines with 8 spaces.
Mixed indentation annoyed my vim.
2014-01-05 19:14:26 +00:00
dmiller
3570ca78d8 Adjust unittest definitions to generate proper nsedoc 2014-01-04 03:48:13 +00:00
dmiller
c70a7be88f Remove stupid hacks that are unneeded because of select() magic 2014-01-03 23:02:02 +00:00
dmiller
739fee324b Fix some requires in unittest.lua 2014-01-03 21:16:38 +00:00
dmiller
d95cbeb2b9 Add some unit tests to ipOps. Far from complete coverage! 2014-01-03 21:10:03 +00:00
dmiller
dc617c42f3 New unittest library and driver script for NSE testing
Please read the documentation. This is a way to add unit testing to NSE
libraries (not scripts, yet). Please add tests to your libraries!
Examples to come in further commits.
2014-01-03 21:10:01 +00:00
dmiller
54cea8be4f Let nsedebug.tostr support other datatypes with tostring
Instead of erroring, just use tostring to handle functions, userdata,
etc. This works for booleans and numbers, too, so no need for special
handling there.

Also switched from a string-concatenation model to a table-building one,
with a final concatenation. This could prevent catastrophic slowness
with representing large tables due to continuous reallocation of
strings.
2014-01-03 21:09:59 +00:00
dmiller
395a91b026 Fix @output nsedoc for targets-asn 2014-01-03 21:09:57 +00:00
d33tah
7d5879d4d1 Fix an assertion that always evaluated to true. Reported by David
Binderman here: http://seclists.org/nmap-dev/2014/q1/6
2014-01-02 17:18:32 +00:00
dmiller
4842def2f6 Update bundled liblua from 5.2.2 to 5.2.3 2014-01-02 15:33:55 +00:00
d33tah
36fc84ab31 Fix coding style - only run begin_sniffer in case of a raw scan. 2013-12-30 18:56:43 +00:00
henri
0ba3dc0be7 Include stddef only if required 2013-12-30 14:35:50 +00:00
d33tah
c7927c5449 Add missing stddef.h import. 2013-12-30 13:58:46 +00:00
fyodor
8418f18274 Minor updates to comments. For example, wanted to clarify that the Nikto http-enum integration was done with cooperation/encouragement from Nikto folks 2013-12-27 03:45:53 +00:00