1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 21:51:28 +00:00

change http User-Agent header value to: Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)

This commit is contained in:
fyodor
2008-05-31 03:24:25 +00:00
parent 746e2872b8
commit 76f7cced70
4 changed files with 4 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ require 'url'
-- fetch relative URL with get request -- fetch relative URL with get request
get = function( host, port, path, options ) get = function( host, port, path, options )
options = options or {} options = options or {}
local presets = {Host=host,Connection="close",['User-Agent']="Nmap NSE"} local presets = {Host=host,Connection="close",['User-Agent']="Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)"}
if type(host) == 'table' then if type(host) == 'table' then
presets['Host'] = host.targetname or ( host.name ~= '' and host.name ) or host.ip presets['Host'] = host.targetname or ( host.name ~= '' and host.name ) or host.ip
end end

View File

@@ -69,7 +69,7 @@ local function get_page(host, port, httpurl)
query = query .. "GET " .. httpurl .. " HTTP/1.1" query = query .. "GET " .. httpurl .. " HTTP/1.1"
query = query .. "Accept: */*" query = query .. "Accept: */*"
query = query .. "Accept-Language: en" query = query .. "Accept-Language: en"
query = query .. "User-Agent: Nmap NSE" query = query .. "User-Agent: Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)"
query = query .. "Host: " .. host.ip .. ":" .. port.number query = query .. "Host: " .. host.ip .. ":" .. port.number
try(soc:send(strbuf.dump(query, '\r\n') .. '\r\n\r\n')) try(soc:send(strbuf.dump(query, '\r\n') .. '\r\n\r\n'))

View File

@@ -106,7 +106,7 @@ action = function(host, port)
-- create an HTTP request for the file, using the host and port we extracted earlier -- create an HTTP request for the file, using the host and port we extracted earlier
payload = payload .. "GET /" .. xfile .. " HTTP/1.1\r\n" payload = payload .. "GET /" .. xfile .. " HTTP/1.1\r\n"
payload = payload .. "Accept: text/xml, application/xml, text/html\r\n" payload = payload .. "Accept: text/xml, application/xml, text/html\r\n"
payload = payload .. "User-Agent: Mozilla/4.0 (compatible; NMAP NSE)\r\n" payload = payload .. "User-Agent: Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)\r\n"
payload = payload .. "Host: " .. xhost .. ":" .. xport .. "\r\n" payload = payload .. "Host: " .. xhost .. ":" .. xport .. "\r\n"
payload = payload .. "Connection: Keep-Alive\r\n" payload = payload .. "Connection: Keep-Alive\r\n"
payload = payload .. "Cache-Control: no-cache\r\n" payload = payload .. "Cache-Control: no-cache\r\n"

View File

@@ -43,7 +43,7 @@ action = function(host, port)
local query = "GET / HTTP/2.1\r\n" local query = "GET / HTTP/2.1\r\n"
query = query .. "Accept: */*\r\n" query = query .. "Accept: */*\r\n"
query = query .. "Accept-Language: en\r\n" query = query .. "Accept-Language: en\r\n"
query = query .. "User-Agent: Nmap NSE\r\n" query = query .. "User-Agent: Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)\r\n"
query = query .. "Host: " .. host.ip .. ":" .. port.number .. "\r\n\r\n" query = query .. "Host: " .. host.ip .. ":" .. port.number .. "\r\n\r\n"
local socket = nmap.new_socket() local socket = nmap.new_socket()