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

20 Commits

Author SHA1 Message Date
dmiller
f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +00:00
dmiller
10dce0382c Clean up string concatenations
Building a string with var = var .. "something" has miserable time
complexities. This commit cleans up a lot of that in scripts, focusing
on packing of data with bin.pack and concatenations within loops.
Additionally, a few instances were replaced with string.rep
2015-02-25 19:58:42 +00:00
dmiller
40f36a4e3e Some string optimizations in NSE
Changes fall into these categories:

1. Avoid pathological string building. Loops over x = x .. "foo" can
become very slow. Instead, use strbuf.lua, table.concat, or just one
continuous concatenation; a = x .. y .. z is one operation, better than
a = x .. y; a = a .. z

2. Use hex-escaped strings instead of string.char. I find this more
readable in many cases, and it avoids a table lookup and function call.

3. Don't duplicate code. A few libraries and scripts had re-implemented
stdnse.generate_random_string or openssl.rand_bytes.
2014-09-03 04:49:54 +00:00
batrick
2a8c81c4f6 stdnse.print_debug -> stdnse.debug1
$ sed -i 's/stdnse.print_debug("%s \([^"]*\)", SCRIPT_NAME/stdnse.debug1("\1"/' *.nse
2014-08-01 21:35:56 +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
298be5bfaa Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
2014-01-31 17:36:09 +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
djalal
849d0c5101 o [NSE] Call the new nmap.get_interface_info() function instead of
nmap.get_interface_link() to get the network interface link type.
   The nmap.get_interface_link() function is deprecated and will be
   removed.
2011-04-22 22:19:08 +00:00
david
ec4db04494 Add checks for nmap.address_family == "inet" to scripts that require
that. Patch by Henri Doreau.
2011-04-19 18:09:15 +00:00
kris
fa858e041b Remove unused and newly unrequired arguments to the pcap check functions (which
replace the old callbacks) in scripts
2010-09-19 02:15:19 +00:00
batrick
de4ba536de Merge from /nmap-exp/patrick/nse-nsock-maintenance.
This is a maintenance fix for the NSE Nsock library binding. The patch focuses
on code correctness and simplicity. The patch also brings some initial updates
with an eye towards the upcoming Lua 5.2 release. See [1] for a post concerning
this branch.

[1] http://seclists.org/nmap-dev/2010/q3/710
2010-09-18 20:35:09 +00:00
kris
c632d0e6e2 remove unused port arg from host scripts' action/hostrule 2010-08-03 18:54:29 +00:00
fyodor
77ab5c4305 Remove email addresses from scripts as discussed in this thread: http://seclists.org/nmap-dev/2009/q4/466 2009-11-24 08:49:02 +00:00
fyodor
fea1ab7c39 Moved a bunch of scripts to the "safe" category, and some others to "intrusive" after
discussion on nmap-dev about how best to handle these.  I also updated the docs and
am about to regenerate script.db.  See this thread for more info:
http://seclists.org/nmap-dev/2009/q3/1008.html
2009-10-01 19:07:16 +00:00
batrick
3eba69f9f8 Removed packet.hextobin and packet.bintohex. Both are unnecessary
with the struct (bin) library available:

function hextobin(str) return bin.pack("H", str) end
function bintohex(str) return bin.unpack("H", str) end

Also removed a commented copy that was in the sniffer-detect.nse script.
2009-05-28 03:59:02 +00:00
jah
9f3a5e5210 Fix the closure of a multiline comment which is not strictly legal
http://www.lua.org/pil/1.3.html, but only impacts syntax
highlighting and not script execution.
2008-12-02 18:30:05 +00:00
david
85deff9ede Use a more straightforward return style in script rules. Instead of
if cond then
		return true
	else
		return false
	end

just do

	return cond
2008-11-18 16:59:09 +00:00
fyodor
989f48be6d mostly documentation cleanup, though I also moved ftp-anon into the safe category since I don't think it is any more intrusive than other scripts in that category 2008-11-07 04:35:22 +00:00
david
a44a66c68a Change some of the output of sniffer-detect.nse and add an @output section. 2008-11-06 03:49:39 +00:00
david
6fbc8868a9 Rename scripts (almost all of them) to make their names more consistent and
make them look better in output. The full list of changes is
  anonFTP => ftp-anon
  ASN => asn-query
  brutePOP3 => pop3-brute
  bruteTelnet => telnet-brute
  daytimeTest => daytime
  dns-safe-recursion-port => dns-random-srcport
  dns-safe-recursion-txid => dns-random-txid
  dns-test-open-recursion => dns-recursion
  ftpbounce => ftp-bounce
  HTTPAuth => http-auth
  HTTP_open_proxy => http-open-proxy
  HTTPpasswd => http-passwd
  HTTPtrace => http-trace
  iax2Detect => iax2-version
  ircServerInfo => irc-info
  ircZombieTest => irc-zombie
  MSSQLm => ms-sql-info
  MySQLinfo => mysql-info
  popcapa => pop3-capabilities
  PPTPversion => pptp-version
  promiscuous => sniffer-detect
  RealVNC_auth_bypass => realvnc-auth-bypass
  robots => robots.txt
  showHTMLTitle => html-title
  showOwner => identd-owners
  skype_v2-version => skypev2-version
  smb-enumdomains => smb-enum-domains
  smb-enumsessions => smb-enum-sessions
  smb-enumshares => smb-enum-shares
  smb-enumusers => smb-enum-users
  smb-serverstats => smb-server-stats
  smb-systeminfo => smb-system-info
  SMTPcommands => smtp-commands
  SMTP_openrelay_test => smtp-open-relay
  SNMPcommunitybrute => snmp-brute
  SNMPsysdescr => snmp-sysdescr
  SQLInject => sql-injection
  SSH-hostkey => ssh-hostkey
  SSHv1-support => sshv1
  SSLv2-support => sslv2
  strangeSMTPport => smtp-strangeport
  UPnP-info => upnp-info
  xamppDefaultPass => xampp-default-auth
  zoneTrans => zone-transfer
2008-11-06 02:52:59 +00:00