1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00
Commit Graph

55 Commits

Author SHA1 Message Date
dmiller
6a567c7c0a Correctly handle parsing of invalid URL segments. Fixes #2651 2023-05-30 21:15:04 +00:00
dmiller
6bd98c22ea Consolidate URL tests and add round-trip parsing checks 2023-05-30 21:15:03 +00:00
dmiller
e3ab97215d Handle internationalized domain names (IDN) 2022-09-21 21:03:57 +00:00
nnposter
67a04de96a Use uppercase hex digits in percent encoding. Fixes #2281 2021-05-17 21:31:32 +00:00
dmiller
86deb87187 Use local functions instead of anonymous functions for gsub (less GC overhead) 2020-11-30 23:22:06 +00:00
nnposter
74626ba5c9 Minor optimization of url.parse_query() 2020-07-20 22:39:09 +00:00
dmiller
8515e83671 Handle redirect URLs without a host, e.g. https:///path 2020-02-04 18:54:20 +00:00
dmiller
8d7a2bc004 Add clarifying parentheses to complex boolean statements as needed. 2019-04-13 21:42:56 +00:00
nnposter
4b3c5dfcb4 Forces escape/unescape to return only one value
Otherwise secondary values from string.gsub were leaking over, causing
issues with code constructs like { url.escape(str) }
2019-02-10 22:53:58 +00:00
dmiller
dcc0e3ed7e New tableaux library containing table auxiliary functions. 2018-10-17 15:34:30 +00:00
nnposter
8ca04d127f Fixes a trivial oversight 2018-08-28 23:49:25 +00:00
dmiller
069c76a1de Handle https://example.com:80 and http://example.com:443 cases
The shortport.ssl check can be expensive (6-second timeout on HTTP
services if you don't use -sV), so we want to avoid it if possible. As
discussed at
b2deb019ed (commitcomment-30289632)
this commit restores the SSL check in cases where it might matter (http
and https default ports) and adds a bypass when the URI scheme is
explicitly requested, as in http.get_url and when following redirects.
2018-08-26 18:24:43 +00:00
dmiller
0e2683e079 Cache a static table instead of regenerating every time 2018-08-11 21:23:59 +00:00
dmiller
689ea0e05d Spelling corrections. Fixes #1160 2018-03-26 14:59:41 +00:00
dmiller
37937e3f89 Decode unreserved characters before parsing urls 2018-02-28 03:43:12 +00:00
nnposter
4303c2f6ea Changes absolute_path() behavior with respect to dot and dot-dot path segments
to comply with RFC 3986, section 5.2. Fixes #1129
2018-02-25 01:52:13 +00:00
nnposter
cec59fa085 Fixes line wrapping 2018-02-25 00:33:50 +00:00
dmiller
e30340b05a Document ascii_host field of url.parse 2017-09-28 16:31:05 +00:00
dmiller
bec78e7ea9 Allow parsing Unicode URLs 2017-09-28 01:57:26 +00:00
rewanth
c2a9a5bbe3 Removes parse_url from http.lua and makes url.parse more functional. Closes #952. 2017-08-14 20:30:57 +00:00
nnposter
0bc76dea8e Removes excessive pattern escaping; no functional change 2017-08-03 22:13:12 +00:00
nnposter
86cf5a1393 Avoids URL/percent encoding of unreserved characters. Fixes #936 2017-07-22 01:10:40 +00:00
nnposter
e80976a13a Provides a common function, url.get_default_port(), for obtaining
the default port number for a given scheme. Fixes #781
2017-04-19 18:00:36 +00:00
nnposter
af6bbc35bb Changes the port type returned from url.parse() to an actual integer, as
opposed to a string that represents an integer. Fixes #833, fixes #817.
2017-04-19 17:02:32 +00:00
nnposter
5636767c85 Fixes hard-to-read code indentation 2017-04-01 21:11:47 +00:00
dmiller
ea58c6bebb Replace chained concatenation reassignment with simple concatenation
Example:

x = y
x = x .. z

Fixed:

x = y
.. z

This simple fix would save 1 string creation/deletion. Most changes
involve many more than this.
2015-03-02 13:47:42 +00:00
dmiller
5952b9745b Move url-encoding to url.build_query
patch from nnposter: http://seclists.org/nmap-dev/2014/q3/427
2014-10-15 18:12:58 +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
1c0c090ace Refactor some Lua string concatenations.
Using this regular expression, '\(\w*\)\s*=\s*\1\s*\.\.', found and
replaced many string concatenation-reassignments. These can cause
performance issues, since a new string gets allocated for each
reassignment. In many cases, the replacement is simply a single string,
wrapped across lines with the '\z' escape, which consumes a newline and
whitespace following it. In other cases, a table is used to hold the
substrings until the final string is built with a single table.concat
operation (same technique used in stdnse.strbuf).

Also, some string-building loops of this form:

s = ""
for i = 1, 100, 1 do
  s = s .. "\0"
end

were replaced with this much faster and cleaner version:

s = string.rep("\0", 100)
2014-02-18 18:10:23 +00:00
dmiller
961ea25225 Re-indent some NSE libraries.
https://secwiki.org/w/Nmap/Code_Standards
2014-02-03 19:47:34 +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
david
4fb61350d8 url.parse should convert all schemes to lower case.
RFC 3986 section 3.1:
Although schemes are case-insensitive, the canonical form is lowercase
and documents that specify schemes must do so with lowercase letters.
An implementation should accept uppercase letters as equivalent to
lowercase in scheme names (e.g., allow "HTTP" as well as "http") for the
sake of robustness but should only produce lowercase scheme names for
consistency.
2013-02-07 23:43:47 +00:00
david
a210d38769 Allow empty path in url.parse.
I got a redirect of "?p=indisponible" and url.parse returned
{query="p=indisponible"}. Now it returns
{path="", query="p=indisponible"}.
2013-02-07 22:37:38 +00:00
david
ac5a479a73 Treat empty port in URL the same as absent.
RFC 3986 says that these URLs are equivalent:

http://example.com/
http://example.com:/

url.parse was returning port="" for the latter. Make it instead return
port=nil like the former.
2013-02-07 03:06:30 +00:00
david
1c7c414fbb URL ports have to be decimal digits.
RFC 3986 section 3.2.3.
2013-02-07 03:06:29 +00:00
david
45b5d92f3d Don't treat an empty string as an invalid URL.
To me, this is a relative URL with a path of "". I.e., it refers to the
same document as wherever the URL appeared, like when people do
<form action="" enctype="multipart/form-data" method="POST">
2013-02-07 02:28:23 +00:00
david
bf69c6b5b9 port is part of a url table. 2012-08-02 04:29:56 +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
david
33fa3fae76 Summarize URL tables in url.lua NSEDoc. 2012-03-05 23:00:49 +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
186cb2d6a3 canonicalize some code 2011-05-11 14:38:52 +00:00
david
7d0c08a097 Brief copyediting of NSEDoc for modules. 2010-07-12 19:42:43 +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
david
5f166e19ec Don't use empty parentheses when referring to functions by name in NSE
documentation.
2008-11-07 22:49:49 +00:00
david
af4497669b Proofread and update documentation of pop3, shortport, snmp, ssh1, ssh2,
strbuf, tab, unpwdb, and url.
2008-10-24 20:12:36 +00:00
david
3ee17ecb5c Fix NSEDoc error messages, except for some "documenting undefined parameter"
that happen when one function is defined to be another by assignment.
2008-10-24 17:05:40 +00:00
david
99c30b1d1b Merge documetation for unpwdb, url, bit, tab, base64, and bin. 2008-10-16 03:18:03 +00:00
batrick
670792a4a6 Updated all libraries documentation.
packet and url both need more work.
2008-08-18 04:03:45 +00:00
batrick
462c289f4a Fixed all the modules to give a default name if absent.
Also necessary for the documentation system to know the name
of the module.
2008-08-16 04:20:15 +00:00
fyodor
454e4e3b17 I hope this will recover nselib history 2007-11-27 22:50:00 +00:00