1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00
Commit Graph

70 Commits

Author SHA1 Message Date
dmiller
6637d76846 Use SOA request to get domain name in dns-zone-transfer. Fixes #3014 2025-07-14 19:17:09 +00:00
dmiller
274ecc0248 simplify a loop 2024-11-13 19:15:13 +00:00
dmiller
d21a4ee4ce Correctly pack TCP payload size for dns.lua 2024-11-13 19:15:12 +00:00
dmiller
0671064cf9 Consolidate DNS code, fix a few small issues 2024-06-07 16:34:06 +00:00
dmiller
9adda8c0f3 Fix DNS TXT record parsing 2023-06-06 15:10:48 +00:00
dmiller
4a4253cc95 Add some tests for dns.lua 2023-06-06 15:10:48 +00:00
dmiller
8d7a2bc004 Add clarifying parentheses to complex boolean statements as needed. 2019-04-13 21:42:56 +00:00
dmiller
0500811f5a Move string utility functions to stringaux.lua 2018-10-18 01:08:19 +00:00
dmiller
2a11de56e4 Remove more bin.lua packing, including the last 'binary string' packing 2018-09-16 04:28:25 +00:00
dmiller
e8d7f3bf2e Remove bin.lua from dns.lua 2018-09-16 04:28:24 +00:00
dmiller
d84ddbe3fd Remove bit library from a few more libs 2018-08-28 03:52:55 +00:00
nnposter
3fc825b15e Takes advantage of freshly implemented ipOps.get_first_ip() 2018-08-05 21:11:48 +00:00
nnposter
6c848f1c85 Improves compliance with RFC 7871 by properly zeroing out insignificant bits
and discarding insignificant octets.
2018-07-29 01:42:19 +00:00
nnposter
40e6327c64 * Fixes a bug causing the same DNS ECS option table to be useable only once
because of a side effect on the address family member.

* Allows the ECS address family to be supplied either as string or integer.
2018-07-29 00:15:24 +00:00
nnposter
ddd48caec0 Removes unused local variables 2018-07-28 23:49:29 +00:00
nnposter
2e08baefd4 Replaces original experimental DNS ECS option code
with value prescribed by RFC 7871. Closes #1271
2018-07-28 23:06:27 +00:00
batrick
7f5ec526fe Merge branch 'nse-lua53'
Lua 5.3 adds several awesome features of particular interest to nmap including
bitwise operators and integers, a utf8 library, and standard binary pack/unpack
functions.

In addition to adding Lua 5.3, this branch changes:

o Complete removal of the NSE bit library (in C), It has been replaced with
  a new Lua library wrapping Lua 5.3's bit-wise operators.

o Complete removal of the NSE bin library (in C). It has been replaced with a
  new Lua library wrapping Lua 5.3's string.pack|unpack functions.

o The bin.pack "B" format specifier (which has never worked correctly) is
  unimplemented.  All scripts/libraries which use it have been updated. Most
  usage of this option was to allow string based bit-wise operations which are no
  longer necessary now that Lua 5.3 provides integers and bit-wise operators.

o The base32/base64 libraries have been reimplemented using Lua 5.3's new
  bitwise operators. (This library was the main user of the bin.pack "B" format
  specifier.)

o A new "bits" library has been added for common bit hacks. Currently only has
  a reverse function.

Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and  Paulino
Calderon for testing this branch.
2016-07-02 17:02:27 +00:00
dmiller
f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +00:00
dmiller
498f0c3371 fix some string-building in dns.lua 2015-02-10 05:58:46 +00:00
batrick
ee6622aea4 nselib stdnse.print_debug -> stdnse.debug
$ f() { find -name \*.lua -exec /bin/echo sed -i "$1" {} \; ; }
$ f 's/stdnse.print_debug( *\([0-9]*\) *, */stdnse.debug\1(/'
$ f 's/stdnse.print_debug( *"\(.*\))/stdnse.debug1("\1)/'
2014-08-03 00:56:45 +00:00
dmiller
17c3e9755e NSEdoc cleanup.
1. The first paragraph of a function's NSEdoc is used as a short
summary. Some of these were very long, so I split off a shorter summary.

2. Use asterisks (*) to denote bulletted lists, not 'o'

3. Wrap lines at 80 columns

4. a couple other spelling and formatting fixes
2014-03-10 19:01:19 +00:00
dmiller
1b71f75aad Spelling fixes for Lua files
Mostly in documentation/comments, but a couple code bugs were caught,
including a call to stdnse.pirnt_debug and a mis-declared variable.
2014-02-19 04:15:46 +00:00
dmiller
6a98f70197 More DNS TCP support from John Bond
http://seclists.org/nmap-dev/2014/q1/154
2014-02-12 17:08:40 +00:00
dmiller
69e343f0aa Reindent the last of the NSE libraries.
https://secwiki.org/w/Nmap/Code_Standards
2014-02-04 19:47:26 +00:00
dmiller
972d799143 Add TCP support to dns.lua
Slightly modified from patch from John Bond:
http://seclists.org/nmap-dev/2014/q1/118
2014-01-31 15:14:31 +00:00
dmiller
620f9fdb34 Remove trailing whitespace in lua files
Whitespace is not significant, so this should not be a problem.
https://secwiki.org/w/Nmap/Code_Standards
2014-01-23 21:51:58 +00:00
aca
78c48319cf Merged dns-nsec3-enum to trunk 2012-06-09 18:44:46 +00:00
patrik
b683234f45 o [NSE] Applied patch from Daniel Miller that fixes bug in several scripts and
libraries http://seclists.org/nmap-dev/2012/q2/593 [Daniel Miller]
2012-06-04 04:37:29 +00:00
batrick
000f6dc4d9 Lua 5.2 upgrade [1] for NSE.
[1] http://seclists.org/nmap-dev/2012/q2/34
2012-05-27 08:53:32 +00:00
patrik
86f58e1090 Add support for returning non authoritative answers as packets 2012-04-21 21:36:51 +00:00
patrik
80e998b91f o [NSE] Added support for edns-client-subnet requests to the DNS library and
the script dns-client-subnet-scan that scans for addresses resolved from
  different subnets. [John Bond]
2012-02-19 13:22:20 +00:00
patrik
c579d844ba o [NSE] Added script dns-nsid by John Bond, that retrieves name server ID and
version information.

o [NSE] Applied patch to DNS library by John Bond that adds support for the
  CHAOS class and NSID requests.
2012-01-17 11:37:19 +00:00
henri
b7df13296e Fix a bug in dns.lua: ensure that dns.query() always return two values (status and response).
Update asn-query.nse accordingly.
2011-09-22 18:00:44 +00:00
patrik
5558837091 o [NSE] Added two new scripts broadcast-netbios-master-browser and smb-mbenum:
- broadcast-netbios-master-browser attempts to discover master browsers in
    the broadcast domain
  - smb-mbenum lists servers registered with the master browser
  [Patrik]
2011-06-19 18:47:19 +00:00
batrick
4444071f03 use # length operator instead of string.len (canonicalize)
Used this perl command:

$ # perl -pi -e 's/string\.len\((.*?)\)/#\1/g' *.lua

Also fixed one instance where the above command didn't correctly
translate the intended code (string.len(a .. b .. c)).
2011-05-11 15:08:55 +00:00
david
832fae4c11 Restore working DNS updates in dns.encode.
This was broken in the merge in r22778. Patrick Donnelly noticed this
with nse_check_globals.
2011-04-27 20:33:04 +00:00
david
cd462ade8f Whitespace in dns.lua: Expand tabs, remove trailing space, change from
3-space to 4-space indents.
2011-03-28 22:52:37 +00:00
david
03a42edfe5 Parse more than one type bitmap block in an NSEC record if present. 2011-03-27 05:07:26 +00:00
david
6d90b593b7 Change the "name" member of a decoded NSEC record to be called
"next_dname" instead.
2011-03-27 05:07:16 +00:00
david
4f054a058e Remove intermediate calculations from a decoded NSEC table: WinBlockNo,
bmplength, and bin. Factor out a function to read the type bitmap.
2011-03-27 05:07:03 +00:00
david
477bd66fc9 Merge r22369:22777 from /nmap-exp/david/nmap-nsec. This adds the
dns-nsec-enum script, originally by John Bond and improved by him and
me.

Changes in dns.lua:
  Add dnssec option to dns.query that adds an OPT RR with the DO (DNSSEC
    okay) flag set.
  Add answer fetcher for NSEC records (unused currently).
  Add decoder for NSEC records.
  Add rudimentary handling of the additional section in dns.encode.
  Add a check that a decoder exists before trying to call it.
 
Also added a copy of the simplified BSD license that the new script is
under.
2011-03-27 04:24:43 +00:00
patrik
583f65227c o [NSE] Added support for dynamic updates to the DNS library. Added the
script dns-update.nse, which attempts to add a DNS record to a given zone.
  [Patrik]
2011-01-14 15:15:24 +00:00
ron
61ca42638d Merging changes from http-dns-cleanup branch. A few documentation changes, big improvement to main NSEDoc. 2010-11-02 02:15:39 +00:00
patrik
d0eecf5392 Fixed the following error reported by Ron:
NSE: test threw an error!
[string "local connect, socket_lock = ...;..."]:4: bad argument #2 to 'connect' (string expected, got boolean)
stack traceback:
       [C]: in function 'connect'
       [string "local connect, socket_lock = ...;..."]:4: in function 'connect'
       ./nselib/dns.lua:53: in function 'sendPackets'
       ./nselib/dns.lua:252: in function <./nselib/dns.lua:215>
       (tail call): ?
       (tail call): ?
       (tail call): ?
       (tail call): ?
       ././test.nse:41: in function <././test.nse:15>
       (tail call): ?

[Patrik]
2010-10-29 17:19:06 +00:00
ron
af72edc2a5 Fixed a bug (misspelled variable) in dns.lua 2010-10-29 13:01:37 +00:00
patrik
2c7045aa10 Fixed variable 'host' is not declared in dns.lua, reported by Ron and
introduced by me when adding multicast support. [Patrik]
2010-10-29 05:03:39 +00:00
david
18157ed081 Merge from /nmap-exp/david/nmap-unconnected. This adds unconnected
socket support to NSE, with updates in scripts and libraries.

o [NSE] Added the ability to send and receive on unconnected sockets.
  This can be used, for example, to receive UDP broadcasts without
  using pcap. A number of scripts have been changed so that they can
  work as prerule scripts to discover services by UDP broadcasting,
  optionally add the discovered targets to the scanning queue:
    - ms-sql-info
    - upnp-info
    - dns-service-discovery
  The nmap.new_socket function can now optionally take a default
  protocol and address family, which will be used if the socket is not
  connected. There is a new nmap.sendto function to be used with
  unconnected UDP sockets. [David, Patrik]
2010-10-16 00:48:44 +00:00
david
7d0c08a097 Brief copyediting of NSEDoc for modules. 2010-07-12 19:42:43 +00:00
jah
19117c80be Fixed error in dns.lua reported by Eugene Alexeev:
nselib/dns.lua:110: attempt to get length of field 'dtype' (a number value)
2010-04-10 21:25:50 +00:00
david
e942244ba2 Add a patch to dns.lua from Patrik Karlsson to cope with some mDNS
implementations.
2010-01-22 23:44:51 +00:00