Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local http = require "http"
- local nmap = require "nmap"
- local shortport = require "shortport"
- local stdnse = require "stdnse"
- local string = require "string"
- description = [[
- Detects HTTP cameras.
- Based on HTTP title script.
- ]]
- ---
- --@output
- -- Nmap scan report for scanme.nmap.org (74.207.244.221)
- -- PORT STATE SERVICE
- -- 80/tcp open http
- -- |_http-title: Go ahead and ScanMe!
- --
- -- @xmloutput
- -- <elem key="title">Go ahead and ScanMe!</elem>
- -- @xmloutput
- -- <elem key="title">Wikipedia, the free encyclopedia</elem>
- -- <elem key="redirect_url">http://en.wikipedia.org/wiki/Main_Page</elem>
- author = "Anonymous hacker"
- license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
- categories = {"default", "discovery", "safe"}
- portrule = shortport.http
- action = function(host, port)
- local resp, redirect_url, title
- resp = http.get( host, port, '/' )
- -- check for a redirect
- if resp.location then
- redirect_url = resp.location[#resp.location]
- if resp.status and tostring( resp.status ):match( "30%d" ) then
- resp = http.get( host, port, redirect_url )
- end
- end
- if ( not(resp.body) ) then
- return
- end
- -- try and match mobotix camera keywords
- local match = string.match(resp.body, "[Mm][Oo][Bb][Oo][Tt][Ii][Xx]")
- if match then
- return_val = "MOBOTIX camera detected"
- else
- return
- end
- local output_tab = stdnse.output_table()
- output_tab.title = return_val
- --output_tab.redirect_url = redirect_url
- local output_str = return_val
- return output_tab, output_str
- end
Advertisement
Add Comment
Please, Sign In to add comment