Commit Graph

62 Commits

Author SHA1 Message Date
nnposter 2758101bf5 Rudimentary NSE support for 802.1Q / 802.1ad VLAN tags 2026-09-11 03:01:08 +00:00
nnposter 271cabb86a Correct a unit test 2026-08-24 02:56:30 +00:00
nnposter 20c8fe450c Improve IP options parsing. Fix #3447 2026-08-24 02:41:29 +00:00
dmiller aed330325b Check for tcp th_off < 5 (NSE) 2026-06-26 22:06:06 +00:00
dmiller 7ef4ee030a Stop parsing on a zero-length packet option
Fixes #3368. Closes #3373.
2026-06-11 18:31:31 +00:00
nnposter c58eb84340 Avoid hard-coded ethertypes 2025-06-06 19:06:09 +00:00
nnposter 28e47f9361 Collapse Packet.ether_parse() into the constructor.
It was called from there anyway and never called on its own from elsewhere.
Furthermore, its documentation did not match its behavior.
2024-08-25 23:25:18 +00:00
nnposter 2646596f0f Resolves ether_type incompatibility in packet.Frame
Frame:new() was populating the value as a 16-bit integer while
Frame:build_ether_frame() was expectng a two-byte string
Ethertype constants from various locations have been migrated to packet.lua
2024-08-25 17:43:17 +00:00
dmiller 4b28defac6 Fix UDP checksum for IPv6 in packet.lua 2024-06-13 17:45:10 +00:00
dmiller 86deb87187 Use local functions instead of anonymous functions for gsub (less GC overhead) 2020-11-30 23:22:06 +00:00
dmiller 041838d986 Clean up packet.lua, add a few unit tests. 2020-11-04 22:26:58 +00:00
dmiller c4ae093630 Fix a meaningless error message when parsing IPv6 extension headers. 2020-09-17 21:41:18 +00:00
dmiller edb130e908 Replace some print calls with proper debug functions. See #1774 2019-10-07 03:13:09 +00:00
dmiller 2f7f6c7b6a Remove unused requires 2019-06-27 19:13:41 +00:00
dmiller e0af0179eb Remove use of bit library from all NSE libs 2018-08-28 15:21:53 +00:00
dmiller f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +00:00
dmiller 0e74dd7a35 Replace some string.char and bin.pack calls with literals 2015-02-27 19:42:56 +00:00
dmiller 204d37e4d7 Replace packet.toip* and ip*tobin with ipOps.ip_to_str and str_to_ip 2015-02-27 19:42: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 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 69e343f0aa Reindent the last of the NSE libraries.
https://secwiki.org/w/Nmap/Code_Standards
2014-02-04 19:47:26 +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
kroosec f73e6665a1 Renamed Packet:ip6_set_len into Packet:ip6_set_plen for consistency. 2012-06-15 16:09:16 +00:00
kroosec 6f29a6a1d4 Fixed a bug in packet.lua library that caused tcp_data_length to have an incorrect size in IPv6 packets due to IPv4 packet length and IPv6 payload length fields being used the same way to calculate tcp_data_length. 2012-06-15 16:08:00 +00:00
kroosec 08e2f98ebe Added Packet:ip6_set_len(plen) function to set IPv6 payload length field. 2012-06-15 15:13:20 +00:00
kroosec 6ea3969357 Added Packet:ip_set_id(id). 2012-06-06 08:52:13 +00:00
kroosec e47d988e44 Small typo in Packet:build_ip_packet documentation. 2012-06-01 10:46:27 +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 ab33bede2c Added ICMP echo request support to the packet library. 2012-04-22 18:42:41 +00:00
patrik 134d55890c Added the MLDV2_LISTENER_REPORT constant 2012-04-09 09:53:56 +00:00
henri 1f431b953f Consistent naming of the address fields between IPv4 and IPv6.
All IP packet objects now have the following attributes:

  - ip_bin_src (binary src address)
  - ip_bin_dst (binary dst address)
  - ip_src (decimal-dotted string src address)
  - ip_dst (decimal-dotted string dst address)

The ip6_src and ip6_dst attributes have therefore been renamed (ip_bin_src and
ip_bin_dst).

This patch also updates the scripts accordingly.
2012-01-21 14:46:00 +00:00
patrik bf7a46fc0d Added support for decoding the ether_type to Frame:ether_parse in the packet
library. [Patrik]
2012-01-10 06:59:45 +00:00
henri ed2fc828ac Added IPv6 support to firewalk.nse. 2012-01-08 15:13:35 +00:00
henri 27aec6396d Indentation fix 2012-01-02 22:13:50 +00:00
henri 77465c37df Proper method call with ":" instead of "."
This fixes broadcast-listener.nse failure:
/home/henri/nmap/nselib/packet.lua:521: attempt to index local 'self' (a number value)
2011-11-18 15:42:09 +00:00
david ef5dfd8479 Compress strings of zeros in packet.toipv6.
I do this just by passing the uncompressed names through nmap.resolve.

Before:
fe80:0000:0000:0000:0000:0000:0000:0001, 2001:0470:1f05:155e:0000:0000:0000:0003
After:
fe80::1, 2001:470:1f05:155e::3
2011-10-29 19:40:19 +00:00
david 622e2e08a7 Standardize on ip6_nhdr in packet.lua.
Some places were using ip6_nxt_hdr and some were using ip6_nhdr.
ip6_nhdr seemed to be the prevailing usage.
2011-10-29 19:40:14 +00:00
david 2c45aa3b8a Add Weilin's patch to packet.lua to handle IPv6. 2011-09-02 04:10:59 +00:00
weilin 586b8464b2 Reverted the unintended changes on nselib/packet.lua@25009. 2011-07-21 02:32:47 +00:00
weilin 1dcf652410 Added ND ping for local IPv6 nets, merging from /nmap-exp/weilin/nmap-nd. 2011-07-19 02:31:54 +00:00
gorjan 70b09c9598 Small fix: missed an 'end' 2011-07-13 09:34:19 +00:00
gorjan c08ca750fa Added default values for the index and length parameters if no value is supplied in the Packet:raw(index,length) function of the nselib/packet.lua library 2011-07-13 09:27:54 +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
batrick 6fb600782f Don't use io.write to print error information. 2010-12-08 14:08:35 +00:00
david 7d0c08a097 Brief copyediting of NSEDoc for modules. 2010-07-12 19:42:43 +00:00
jah 4554312eb6 Added UDP header support. 2010-04-10 00:16:32 +00:00
kris d1e4ae6dc7 Set header variables like ip_ttl when calling ip_set_ttl() rather than just
setting the packet data.  This was confusing watching packets go correctly
over the wire but having incorrect variables.
2010-01-24 20:16:40 +00:00
david bef983abdd Make packet.in_cksum more efficient by not making lots of substring
copies.
2009-10-29 00:28:29 +00:00
david 9817ee470d Make packet.in_cksum work for data with an odd length. 2009-10-29 00:15:04 +00:00
batrick 90a712ae2b Patch to libraries that were inappropriately using globals.
Often two (or more) scripts using the same library would
overwrite the globals each was using. This would result
in (at best) an error or (at worst) a deadlock.

The patch changes the global accesses to local.
2009-07-07 00:20:52 +00:00