1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00
Commit Graph

439 Commits

Author SHA1 Message Date
david
9817ee470d Make packet.in_cksum work for data with an odd length. 2009-10-29 00:15:04 +00:00
david
a8821f3cf4 Add the NSE function nmap.bind, which sets the source address of a
socket.
2009-10-11 23:08:43 +00:00
batrick
afa84d2320 [NSE] Added the reconnect_ssl method for sockets. We sometimes need
to reconnect a socket with SSL because the initial communication on the socket
is done without SSL. See this thread [1] for more details.

[1] http://seclists.org/nmap-dev/2009/q4/3
2009-10-06 13:02:12 +00:00
joao
8dfb8af45e Removing outdated params from tryssl description 2009-10-01 03:20:37 +00:00
david
361f10fc90 Update NSEDoc to say that nmap.get_port_state can return nil if you pass
it a port that was not scanned.
2009-09-29 14:58:44 +00:00
joao
4c13b99e95 Giving priority to transfer-encoding first than content-length, as mentioned in rfc2616, section 4.4.
isChunked now checks for transfer-encoding: identity instead of transfer-encoding: chunked. If transfer encoding is present and it is not identity, chunked encoding is considered. Also rfc2616, section 4.4 (item 2)
2009-09-15 03:47:46 +00:00
joao
b9d1591739 Adding a few comments on some functions 2009-09-15 02:46:58 +00:00
joao
b0346e22b9 Fixing problem related to chunked pipelined responses on http.lua 2009-09-15 02:12:02 +00:00
david
8ba33e607b Make it clear in the NSEDoc that error values can be any false value:
<code>false</code> or <code>nil</code>. Basically it's anything that
matches the protocol of an nmap.new_try handler.
2009-09-14 15:56:49 +00:00
ron
9465a839c1 Added dhcp-discover script 2009-09-10 03:26:53 +00:00
ron
66399fc057 Added a couple more paths that might be interesting 2009-09-09 01:59:13 +00:00
ron
f4458c1917 Added the ability (off by defaultk, since it generates 20x requests) for http-enum.nse to generate variants of each file. This would probably be more useful to use after running a spider script than here, but the code should be essentially the same. I'm hoping it'll be used somewhere more appropriate, eventually.
Also added a couple fingerprints.
2009-09-08 19:51:53 +00:00
ron
537726defa Added '503 Service Unavailable' to the list of recognized error codes for 404 errors. I observed this on a 'Microsoft Project Server' host that gave valid results (though odd 404s). I also changed the code such that the scan will still run, even if an unrecognized error code is encountered. 2009-09-02 14:12:03 +00:00
ron
4564ed7503 Added '400' as a potential 404 page. Ran into this while scanning a Fortigate device. 2009-09-01 19:23:17 +00:00
ron
4dea760d93 Added in a link we originally removed (but shouldn't have) 2009-09-01 16:30:58 +00:00
ron
c792776a7c Added signature for BeEF (Browser Exploitation Framework) 2009-09-01 16:22:27 +00:00
david
8686ca7c06 Remove redundant "Favicon" from the end of some favicon-db entries.
Uncapitalize "Favicon" in some others.
2009-08-31 23:52:11 +00:00
david
e53657b4c8 Move favicon-db into nselib/scripts. 2009-08-31 23:21:26 +00:00
ron
7da313e8ac Added the status code to the rawheaders as well (so it's displayed in http-headers.nse). Also updated the @output in the nsedoc. 2009-08-27 15:47:10 +00:00
ron
62dedb9dc1 Added a 'path' script-arg to http-headers.nse. Changed it to use 'HEAD' by default, and fail to using 'GET' the same way other scripts do (also added a 'useget' script-arg to turn it off). Also fixed some print_debugs in http.lua that were prefixed with 'http-enum.nse:'. 2009-08-27 15:39:17 +00:00
ron
fc2b575fba Added 'rawheader' when parsing http requests. It saves the header fields, in order, preserving the case. Change http-headers.nse to read this instead of the processed headers. 2009-08-27 15:24:09 +00:00
ron
8a8ae22532 Fixing a fingerprint 2009-08-26 22:10:21 +00:00
ron
1ac3ea773b Adding a new fingerprint after finding a /backup.sql file in a test 2009-08-26 21:10:02 +00:00
ron
46711fa004 Fixed a big in the http library that cropped up while scanning multiple hosts at the same ip address. The reason this occurred is because the result would be cached based on the ip address, not the target name, so different vhosts on the same ip address would be considered the same by the cache. 2009-08-26 16:01:00 +00:00
ron
d63fba1dd6 Add some more fingerprints that a commercial tool just found in an application I'm assessing.
I realize we're getting too many fingerprints to handle, but we can always trim it down later.
2009-08-25 00:05:02 +00:00
ron
986ba5ab8c Realized the my check_get() function was elminating perfectly good hosts. Some of our printers use a '301 Moved Permanently' to redirect you to their login page from the root page, but my script was mistaking those for an off-site redirect. I changed check_get() to display a warning rather than causing the scan to fail. 2009-08-24 19:56:52 +00:00
ron
a02756a5e4 Adding a fix for false positives discovered in http-enum.nse and http-userdir-enum.nse. It seems that some hosts (or, at least, one host) returns different results for:
a) Lowercase path (a login page)
b) Paths containing uppercase (becomes a '400 Unknown Error' that indicates a corrupt harddrive)
c) Paths containing a path and no uppercase (the same login page as (a) is displayed, except the font changes colour
The server itself returns that it's 'ACOS HTTPD/1.1.4', and the telnet port says it's 'Lingo VoIP config telnetd'. OS guesses seem to indicate a Telephony device of some sort. In any case, this patch detects these conditions and doesn't bother checking the device if it cannot tell these errors apart
2009-08-24 03:42:01 +00:00
ron
a46298dcc2 Added a script-arg to http.lua: pipeline. Setting pipeline lets you artificially increase/lower pipelining. The primary reason I added it is because sorting through packet captures with a hundred requests pipelined is difficult, so now I can lower it for debugging. I suggest using '--script-args=pipeline=1,limit=5' if troubleshooting issues with http-enum.nse. 2009-08-24 03:26:01 +00:00
batrick
600ec30c9f [NSE] The HTTP Library now caches responses generated from http.get or
http.head (in revision . Because many scripts tend to request the same object,
this helps to prevent sending duplicate requests that consume network
resources needlessly.

The cache is transparent to the script writer in that it will return a cached
result if present when http.get/http.head is called. How the cache is used may
be controlled by options table (described in [1]) passed to the http functions.

Three new boolean values are present:
  o bypass_cache -- The contents of the cache is ignored for the request
                    (method == "GET" or "HEAD")
  o no_cache -- The result of the request is not saved in the cache
                (method == "GET" or "HEAD")
  o no_cache_body -- The body of the request is not saved in the cache
                     (method == "GET" or "HEAD")

The size of the cache is by default 1 MB. The size can be changed using the
script arg (--script-args) http-max-cache-size (e.g. --script-args
http-max-cache-size=1e8).

[1] http://nmap.org/nsedoc/lib/http.html#request
2009-08-24 01:15:28 +00:00
ron
85e7b4dd89 Some fixes to fingerprints suggested by David Fifield 2009-08-23 22:58:12 +00:00
ron
fbf2c3d6a7 Print the http status along with the result, if it isn't 200 OK. This was the original behaviour, but it got lost along the way. 2009-08-23 16:58:53 +00:00
ron
f8e2fe6429 Added a check for a blank body, due to some false positives I found during a random scan 2009-08-23 04:11:04 +00:00
ron
b2a3cd1114 Added a check for default Ruby on Rails image 2009-08-23 01:01:13 +00:00
ron
fbc8e180ca Converted http-userdir-enum.nse to use my http-enum.nse logic (from http.lua). Also moved the 'displayall' script-arg back into the script, not http.lua, because http-userdir-enum.nse actually wants to find non-200 pages (403 Access Denied, for instance). 2009-08-23 00:43:46 +00:00
ron
cf33de55f3 Moved the definition for the 'displayall' argument into http.lua. 2009-08-23 00:24:23 +00:00
ron
77e7738545 Moved the meat of the http-enum.nse code (the 404-detection, HEAD-detection, etc) into http.lua. It may be a better idea to use http-helper.lua or something similar, but for now http.lua works. I'm open to suggestiosn. 2009-08-23 00:22:20 +00:00
ron
30fe087fd3 Added a '/' before 'robots.txt' 2009-08-23 00:20:18 +00:00
ron
cf91bcf799 Added robots.txt (there's another script for it, but it fits with these fingerprints 2009-08-23 00:08:58 +00:00
ron
532f44d00f added rss/atom to http-fingerprints.nse 2009-08-23 00:00:20 +00:00
ron
c9a62acf31 A major overhaul of the http-enum.nse script:
* Cleaned up and function-ized the code. Planning to move the functions to http.lua or similar to let other scripts (like http-userdir-enum.nse) use them. 
* Better support for different HTTP error codes
* Significantly improved detection of 404 pages to prevent false positives. Some of the techniques used:
  - Request a non-existent page and check the status code
    - If it's 200, try to remove anything that may change (times, URI, filenames, etc), md5 it if ssl is available, and store it. Request a second 404 page and do the same. If they don't match, abort. 
    - If it's any other error code, store it, and look for it in addition to 404 Not Found
  - Request the root folder, /
    - If it returns a 301 Move Permanently or 401 Authentication Required, abort
* Abstracted the fingerprints into files in the nselib/data directory:
  - http-fingerprints: common files/folders
  - yokoso-fingerprints: common applications (from the Yokoso project, by InGuardians -- used under the Nmap license with pemission from Kevin Johnson -- http://seclists.org/nmap-dev/2009/q3/0685.html)
* Added a script-arg that can display all output (except known 404s), instead of just 200 OK and 401 Authentication Required
* Added a lot of debugging messages
2009-08-22 23:19:16 +00:00
ron
393110baf1 Fixed a bug where http.pipeline() would print a cryptic error if no requests were passed for it to perform. Changed it to print a warning if debugging is turned on, and return an empty set. 2009-08-22 22:23:03 +00:00
ron
08073b43b8 Fix two bugs in the http libraries:
1) Re-add 443 to the common ssl ports (it was accidentally removed in an earlier patch)
2) If the header doesn't return the number of pipelined requests to perform, default to 40 instead of leaving it nil
2009-08-21 23:42:07 +00:00
joao
2264838cf8 Fixed bug where socket error messages (like EOF) were appended to the HTTP pipeline response 2009-08-20 03:12:54 +00:00
ron
f2ed53ebfc Removed an undeclared variable in http.lua. 2009-08-18 02:20:33 +00:00
ron
6aee1ce91c Fixed a spelling mistake in http.lua. 2009-08-18 01:40:33 +00:00
batrick
d5748b1d83 If the response is already a table (from an error in http.request) then do not
try to parse a result, instead return nil.  This fixes an error where we try to
index match as though response is a string.
2009-08-15 14:53:28 +00:00
joao
a2dcbb7cd5 Fixing a bug where getPipelineMax was not returning any value, when it sould, at least, return 1. 2009-08-15 14:32:17 +00:00
david
6c766c58cd Add the nmap.get_ssl_certificate NSE function, which returns the peer
certificate of an SSL socket.
2009-08-13 23:32:33 +00:00
joao
0a3a1b091c Applying a lot of new features to http.lua:
- Cookie Support
- Pipelining Support
- New lib modularization (previously, single functions were taking care of too many tasks, we have splitted these tasks for better code reuse)
2009-08-12 01:40:06 +00:00
batrick
990cb8965d Removed unused bopt variable. 2009-08-11 05:56:41 +00:00