Nmap Development mailing list archives

[PATCH] bugfix for NSE http library to really use targetname when building HTTP request


From: Sven Klemm <sven () c3d2 de>
Date: Sun, 11 May 2008 12:04:56 +0200

Hi nmap-dev

the NSE http library uses the targetname specified on the commandline when doing the socket.connect() instead of when building the HTTP request. The attached patch fixes the behaviour.

Cheers
Sven

--
Sven Klemm
http://cthulhu.c3d2.de/~sven/

Index: nselib/http.lua
===================================================================
--- nselib/http.lua     (revision 7464)
+++ nselib/http.lua     (working copy)
@@ -24,7 +24,7 @@
   options = options or {}
   local presets = {Host=host,Connection="close",['User-Agent']="Nmap NSE"}
   if type(host) == 'table' then
-    presets['Host'] = ( host.name ~= '' and host.name ) or host.ip
+    presets['Host'] = host.targetname or ( host.name ~= '' and host.name ) or host.ip
   end
 
   local header = options.header or {}
@@ -72,7 +72,7 @@
   options = options or {}
 
   if type(host) == 'table' then
-    host = host.targetname or ( host.name ~= '' and host.name ) or host.ip
+    host = host.ip
   end
 
   local protocol = 'tcp'

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: