-
Notifications
You must be signed in to change notification settings - Fork 9
/
jupyter-notebook-discovery.nse
46 lines (37 loc) · 1.32 KB
/
jupyter-notebook-discovery.nse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local shortport = require "shortport"
local http = require "http"
local nmap = require "nmap"
local table = require "table"
local stdnse = require "stdnse"
description = [[
The Jupyter Notebook is a web-based interactive computing platform. Default TCP port is 8888.
]]
---
-- @usage
-- nmap -p 8888 --script jupyter-notebook-discovery.nse <target>
--
-- @output
--PORT STATE SERVICE
--8888/tcp sun-answerbook http
--| jupyter-notebook-discovery:
--|_ Jupyter Notebook found!
--
author = "Icaro Torres"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
portrule = shortport.version_port_or_service(8888, "sun-answerbook", "tcp")
action = function(host, port)
local http_response_login = http.get(host, port, "/login")
local http_response_lab = http.get(host, port, "/lab")
local jupyter_header = {}
if not http_response_login or not http_response_login.status or http_response_login.status ~= 200 or not http_response_login.body then
return
end
if not http_response_lab or not http_response_lab.status or http_response_lab.status ~= 200 or not http_response_lab.body then
return
end
if http_response_login and http_response_lab then
table.insert(jupyter_header, "Jupyter Notebook found!")
end
return stdnse.format_output(true, jupyter_header)
end