From b222a0d7ee931734008591e16a17e6b320e849dd Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 28 Aug 2018 15:56:47 +0000 Subject: [PATCH] Remove bit.lua --- CHANGELOG | 4 ++ docs/scripting.xml | 2 +- nselib/bit.lua | 93 --------------------------------------------- nselib/unittest.lua | 1 - 4 files changed, 5 insertions(+), 95 deletions(-) delete mode 100644 nselib/bit.lua diff --git a/CHANGELOG b/CHANGELOG index e037258b0..e9b968b8b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ #Nmap Changelog ($Id$); -*-text-*- +o [NSE] Completely removed the bit.lua NSE library. All of its functions are + replaced by native Lua bitwise operations, except for `arshift` (arithmetic + shift) which has been moved to the bits.lua library. [Daniel Miller] + o [GH#1291][GH#34] Use pcap_create instead of pcap_live_open in Nmap, and set immediate mode on the pcap descriptor. This solves packet loss problems on Linux and may improve performance on other platforms. [Daniel Cater, Mike diff --git a/docs/scripting.xml b/docs/scripting.xml index b1e1b247a..641a04ca0 100644 --- a/docs/scripting.xml +++ b/docs/scripting.xml @@ -2939,7 +2939,7 @@ categories = {"discovery", "external", "safe"} @name and @class tags when documenting a table to assist the documentation parser in identifying it. There are several examples of this method of - documentation in the Nmap source distribution (including nmap.luadoc, bit.luadoc, and pcre.luadoc). + documentation in the Nmap source distribution (including nmap.luadoc, lfs.luadoc, and pcre.luadoc). diff --git a/nselib/bit.lua b/nselib/bit.lua deleted file mode 100644 index 63154ae9e..000000000 --- a/nselib/bit.lua +++ /dev/null @@ -1,93 +0,0 @@ ---- --- Bitwise operations on integers. --- --- THIS LIBRARY IS DEPRECATED, Please use native Lua 5.3 bitwise operators. --- --- @copyright BSD License --- @see https://www.lua.org/manual/5.3/manual.html#3.4.2 --- @class module --- @name bit - -local select = select - -local _ENV = {} - ---- Returns the one's complement of a. --- --- REPLACEMENT: ~a --- @param a Number. --- @return The one's complement of a. -function bnot(a) - return ~a -end - ---- Returns the bitwise and of all its arguments. --- --- REPLACEMENT: a & b --- @param ... A variable number of Numbers to and. --- @return The anded result. -function band(a, b, ...) - a = a & b - if select("#", ...) > 0 then - return band(a, ...) - else - return a - end -end - ---- Returns the bitwise or of all its arguments. --- --- REPLACEMENT: a | b --- @param ... A variable number of Numbers to or. --- @return The ored result. -function bor(a, b, ...) - a = a | b - if select("#", ...) > 0 then - return bor(a, ...) - else - return a - end -end - ---- Returns the bitwise exclusive or of all its arguments. --- --- REPLACEMENT: a ~ b --- @param ... A variable number of Numbers to exclusive or. --- @return The exclusive ored result. -function bxor(a, b, ...) - a = a ~ b - if select("#", ...) > 0 then - return bxor(a, ...) - else - return a - end -end - ---- Returns a left-shifted by b places. --- --- REPLACEMENT: a << b --- @param a Number to perform the shift on. --- @param b Number of shifts. -function lshift(a, b) - return a << b -end - ---- Returns a right-shifted by b places. --- --- REPLACEMENT: a >> b --- @param a Number to perform the shift on. --- @param b Number of shifts. -function rshift(a, b) - return a >> b -end - ---- Returns the integer remainder of a divided by b. --- --- REPLACEMENT: a % b --- @param a Dividend. --- @param b Divisor. -function mod(a, b) - return a % b -end - -return _ENV diff --git a/nselib/unittest.lua b/nselib/unittest.lua index d21efedbe..f54060e39 100644 --- a/nselib/unittest.lua +++ b/nselib/unittest.lua @@ -34,7 +34,6 @@ local libs = { "base32", "base64", "bin", -"bit", "bitcoin", "bits", "bittorrent",