withinhost
and can
33 | -- not be used in combination. (default: false)
34 | --
35 |
36 | author = "Patrik Karlsson"
37 | license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
38 | categories = {"discovery", "safe"}
39 |
40 |
41 | portrule = shortport.http
42 |
43 | function action(host, port)
44 | local EMAIL_PATTERN = "[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?"
45 |
46 | local crawler = httpspider.Crawler:new(host, port, nil, {
47 | scriptname = SCRIPT_NAME
48 | }
49 | )
50 |
51 | if ( not(crawler) ) then
52 | return
53 | end
54 | crawler:set_timeout(10000)
55 |
56 | local emails = {}
57 | while(true) do
58 | local status, r = crawler:crawl()
59 | -- if the crawler fails it can be due to a number of different reasons
60 | -- most of them are "legitimate" and should not be reason to abort
61 | if ( not(status) ) then
62 | if ( r.err ) then
63 | return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
64 | else
65 | break
66 | end
67 | end
68 |
69 | -- Collect each e-mail address and build a unique index of them
70 | for email in r.response.body:gmatch(EMAIL_PATTERN) do
71 | emails[email] = true
72 | end
73 | end
74 |
75 | -- if no email addresses were collected abort
76 | if ( not(emails) ) then return end
77 |
78 | local results = {}
79 | for email, _ in pairs(emails) do
80 | table.insert(results, email)
81 | end
82 |
83 | results.name = crawler:getLimitations()
84 |
85 | return stdnse.format_output(true, results)
86 | end
87 |
--------------------------------------------------------------------------------
/nse/http-screenshot.nse:
--------------------------------------------------------------------------------
1 | -- This file is part of IVRE.
2 | -- Copyright 2011 - 2016 Pierre LALET User Audit Security Report | 23 |
$users | 26 |