-
Notifications
You must be signed in to change notification settings - Fork 1
/
cinema-barco-projector.nse
226 lines (197 loc) · 9.27 KB
/
cinema-barco-projector.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
local nmap = require "nmap"
local stdnse = require "stdnse"
local snmp = require "snmp"
description = [[
Detects socket fingerprint of Barco DCI cinema projector and flags if found.
Will attempt to pull out software and firmware version of system
Sockets required for scan, 21,22,80,1173,43680,43728
Port 43680 - S1
Port 43728 - S2
NOTE: not tested against Series4 projectors, very different API/socket implementation.
Tool uses SNMP, OID for query data.
]]
--------------------------------------------------------------------
---
-- @usage
-- nmap -sS -p21,22,80,1173,43680,43728 --script=cinema-barco-projector --script-args 'getcerts=true' <target>
-- @output
-- PORT STATE SERVICE
-- 21/tcp open ftp
-- 22/tcp open ssh
-- 80/tcp open http
-- | cinema-barco-projector:
-- | classification: dci-projector
-- | vendor: Barco
-- | productName: DP2K-20C
-- | serialNumber: 1190136617
-- | version: 4.5.454
-- | tiPackageVersion: 4.5.454
-- | tiSerialNumber: 01d96e261a000085
-- | enigmaVersion: P1.8(24)
-- | enigmaSerialNumber: 860e1b4a0c06359d
-- | lampSerialNumber: E914Wq158
-- | lampArticleNumber: R9855937 OSRAM(R) XBO 4000W/DHP OFR
-- | location: ChinetownC1
-- | projectorCert: -----BEGIN CERTIFICATE-----
-- | MIIEzTCCA7WgAwIBAgIDAYVwMA0GCSqGSIb3DQEBCwUAMIGZMSkwJwYDVQQLEyBD
-- | QS02LkRMUC1DaW5lbWEuVGV4YXNJbnN0cnVtZW50czEkMCIGA1UEChMbRExQLUNp
-- | bmVtYS5UZXhhc0luc3RydW1lbnRzMR8wHQYDVQQDExYuVGV4YXNJbnN0cnVtZW50
-- | cy5DQS42MSUwIwYDVQQuExxyNjNkNFdGdmhkc1dLMjBweTRaamV0a0lBZEk9MB4X
-- | DTE4MDIyNDE1MDM0NFoXDTQxMDIyNjAwMDAwMFowgaQxJDAiBgNVBAsTG0RMUC1D
-- | aW5lbWEuVGV4YXNJbnN0cnVtZW50czEkMCIGA1UEChMbRExQLUNpbmVtYS5UZXhh
-- | c0luc3RydW1lbnRzMS8wLQYDVQQDEyZQUi5ETFAtQ2luZW1hLlNlcmllczIuMDFE
-- | OTZFMjYxQTAwMDA4NTElMCMGA1UELhMcOW40QW0xa1pzYnZxV2VDOHlWRXp3Tk0z
-- | b1pBPTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwcjQx7YFeNR9Hb
-- | +MISPpPCJnG16CpiBAe4Sa+zBA/OXqyR50SSdVZkG736ZR7l1zXSLc+17i+wPW1k
-- | 98pj6bDzGiu8Y91oJAWfMCUXZXloWCRMoyWT/5J7VFBVxZ5etxKIA+KTA/hqgW8e
-- | THAPG6DqeSUIGgxMRP3wl2A24U/QZjsft3D8v6QB36ngErJwkg+IGmUgglE0z+D4
-- | V6HKHTlz0TqitjXBM5dUlY7F4DKt1PIn+XMzJ4/EI3mFMr7N8tUS0NLLx6syvGqN
-- | flQh8eJelheqy3aFPRvDDpQ5JHtc7P0k90uswrWMQDdh2Zsr3HCIS2PLgL8rdGk+
-- | 973cBNcCAwEAAaOCAQ8wggELMIHOBgNVHSMEgcYwgcOAFK+t3eFhb4XbFittKcuG
-- | Y3rZCAHSoYGnpIGkMIGhMSQwIgYDVQQKExtETFAtQ2luZW1hLlRleGFzSW5zdHJ1
-- | bWVudHMxLDAqBgNVBAsTI1Jvb3QtQ0EuRExQLUNpbmVtYS5UZXhhc0luc3RydW1l
-- | bnRzMSQwIgYDVQQDExsuVGV4YXNJbnN0cnVtZW50cy5Sb290LUNBLjAxJTAjBgNV
-- | BC4THGZmQW1JdVdSenVuTVgrKzJuQmNnTDFpeXdHST2CAQcwHQYDVR0OBBYEFPZ+
-- | AJtZGbG76lngvMlRM8DTN6GQMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgSwMA0G
-- | CSqGSIb3DQEBCwUAA4IBAQCogIHREIdVpdQq5ULV+YBDc4XqEezm59pfol96NfjH
-- | MmPai9Hwg4x1QpneumkWdrJMxwRM8ok6FfIGcjrHyi+ZG6adeB3wZClgvDPso3ls
-- | ny+/r0xQ+ZpBTJe2MwmdkwCCsrmWONpAp//sXdcxZylYQGxtVNDvj6Y7PJ/HkLpH
-- | Pzk+QMm++AAOkMzl6qXSLkQWPPnKGPyEeLKSs7SBSY0P9EDSJZRefbe8MrL6ncTC
-- | Xg5RXDTlYWqGK19rulnbSuwbMKWk+0gEOFypOt122X1kmAMVrxagmbx6X1DJOBVH
-- | mD2KHaPFUoj9FTzNcJxdpBtIP+V+Y70kK+7D8nwi/RLe
-- | -----END CERTIFICATE----7
-- | -----END CERTIFICATE---
-- | linkDecryptorCert: -----BEGIN CERTIFICATE-----
-- | MIIEzTCCA7WgAwIBAgIDAIt/MA0GCSqGSIb3DQEBCwUAMIGZMSkwJwYDVQQLEyBD
-- | QS02LkRMUC1DaW5lbWEuVGV4YXNJbnN0cnVtZW50czEkMCIGA1UEChMbRExQLUNp
-- | bmVtYS5UZXhhc0luc3RydW1lbnRzMR8wHQYDVQQDExYuVGV4YXNJbnN0cnVtZW50
-- | cy5DQS42MSUwIwYDVQQuExxyNjNkNFd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T9WSmz9l7CrT6jQaMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgSwMA0G
-- | CSqGSIb3DQEBCwUAA4IBAQClp2XLcC9WS0BegmPkPewS8ADQBVFtXpc6RSTVWzlC
-- | 7I2njwVYg8m7lKGvSJN7vO3CABi5qhK5VB0dGy5YjxLDjdEcpRy5EFyq9jUXJFJ5
-- | Fxew5C9cskgGa6xyjiGnaeYALbMkapFLw7rcGp7f+P6myFIVb/iw4ApdovV35aqn
-- | u2edWrY22EUXN4fc99EoTNP+hBlSZiXIdt0MVEnQ44kYX/rLpfPJ/H4u7RGOTUJM
-- | fvi2Ce9mook9Sjah98DJ7Z4cPYr0ZnlqNWTDsSM9McuIqUhYUpGwHHk05FDs4RRq
-- | dEvTzLD3QBuc+uCD4/Mebc3Q8nt3gIvEgI85pvyq+Rm7
-- |_-----END CERTIFICATE---
-- 1173/tcp open d-cinema-rrp
-- 43680/tcp open unknown
-- 43728/tcp open unknown
author = "James Gardiner"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = { "cinema", "safe", "intrusive" }
-- if port 80 and port 21, 22, 1173, 43680, 43728 are the right state, we try and query the target
portrule = function(host, port)
if port.number ~= 80 then
return false
end
if port.state ~= "open" or port.protocol ~= "tcp" then
return false
end
-- if port 80 and all these following ports are open, we can assume its a Dolby player
local ftp = { number = 21, protocol = "tcp" }
local ftp_open = nmap.get_port_state(host, ftp)
local ssh = { number = 22, protocol = "tcp" }
local ssh_open = nmap.get_port_state(host, ssh)
local dci = { number = 1173, protocol = "tcp" }
local dci_open = nmap.get_port_state(host, dci)
local barcoS1 = { number = 43680, protocol = "tcp" }
local barcoS1_open = nmap.get_port_state(host, barcoS1)
local barcoS2 = { number = 43680, protocol = "tcp" }
local barcoS2_open = nmap.get_port_state(host, barcoS2)
local res = false
if ftp_open.state == 'open' and
ssh_open.state == 'open' and
dci_open.state == 'open' and
(barcoS1_open.state == 'open' or barcoS2_open.state == 'open') then
res = true
end
return res
end
-------------------------------------------------------------------------------------------------------------
local function all_trim(s)
if s == nil then
return ''
end
return s:match("^%s*(.-)%s*$")
end
local function hexencode(str)
return (str:gsub(".", function(char) return string.format("%02x", char:byte()) end))
end
function get_snmp_IOD_value(host, port, iod)
local res = ''
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
local status, retvar = snmpHelper:get({ reqId = 28428 }, iod)
if status == false then
res = 'na'
else
res = all_trim(retvar[1][1])
end
return res
end
-- Now lets try and query the player for some useful information
action = function(host, port)
local getcerts = stdnse.get_script_args('getcerts')
if getcerts == 'y' or getcerts == 'yes' or getcerts == 'true' then
getcerts = true
else
getcerts = false
end
local snmp_port = { number = 161, protocol = "udp" }
local output = stdnse.output_table()
-- required variables are
--- classification, vendor, productName, serialNumber, version
output.classification = 'dci-projector'
output.vendor = 'Barco'
--
-- productName / .1.3.6.1.2.1.1.1.0
output.productName = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.2.1.1.1.0')
--
-- serialNumber .1.3.6.1.4.1.12612.220.11.2.2.1.0
output.serialNumber = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.2.2.1.0')
--
-- tiPackageVersion - .1.3.6.1.4.1.12612.220.11.1.2.12.0
local tiPackageVersion = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.12.0')
-- tiSerialNumber - .1.3.6.1.4.1.12612.220.11.1.2.16.0
local tiSerialNumber = hexencode(get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.16.0'))
output.version = tiPackageVersion
output.tiPackageVersion = tiPackageVersion
output.tiSerialNumber = tiSerialNumber
-- enigmaVersion .1.3.6.1.4.1.12612.220.11.1.2.18.0
output.enigmaVersion = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.18.0')
-- enigmaSerialNumber .1.3.6.1.4.1.12612.220.11.1.2.19.0
output.enigmaSerialNumber = hexencode(get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.19.0'))
-- lampSerialNumber .1.3.6.1.4.1.12612.220.11.2.2.4.1.0
output.lampSerialNumber = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.2.2.4.1.0')
-- lampArticleNumber .1.3.6.1.4.1.12612.220.11.2.2.4.2.0
output.lampArticleNumber = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.2.2.4.2.0')
-- location .1.3.6.1.2.1.1.6.0
output.location = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.2.1.1.6.0')
if getcerts then
-- Proj Cert .1.3.6.1.4.1.12612.220.11.1.2.17.1.3.1
local projectorCert = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.17.1.3.1')
projectorCert = projectorCert:gsub("\x0D", "")
output.projectorCert = projectorCert
-- Link Decryptor Cert .1.3.6.1.4.1.12612.220.11.1.2.17.1.3.2
local linkDecryptorCert = get_snmp_IOD_value(host, snmp_port, '.1.3.6.1.4.1.12612.220.11.1.2.17.1.3.2')
linkDecryptorCert = linkDecryptorCert:gsub("\x0D", "")
output.linkDecryptorCert = linkDecryptorCert
end
return output
end