forked from zedsec390/NMAP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tn3270-screen.nse
84 lines (79 loc) · 2.82 KB
/
tn3270-screen.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
local stdnse = require "stdnse"
local shortport = require "shortport"
local tn3270 = require "tn3270"
description = [[
Connects to a tn3270 'server' and returns the screen.
]]
---
-- @usage
-- nmap --script tn3270-info,tn3270_screen <host>
--
-- @output
-- PORT STATE SERVICE VERSION
-- 23/tcp open tn3270 Telnet TN3270
-- | tn3270-screen:
-- | Mainframe Operating System z/OS V1.6
-- | FFFFF AAA N N DDDD EEEEE ZZZZZ H H III
-- | F A A NN N D D E Z H H I
-- | FFFF AAAAA N N N D D EEEE Z HHHHH I
-- | F A A N NN D D E Z H H I
-- | F A A N N DDDD EEEEE ZZZZZ H H III
-- |
-- | ZZZZZ / OOOOO SSSS
-- | Z / O O S
-- | Z / O O SSS
-- | Z / O O S
-- | ZZZZZ / OOOOO SSSS
-- |
-- | Welcome to Fan DeZhi Mainframe System!
-- |
-- | Support: http://zos.efglobe.com
-- | TSO - Logon to TSO/ISPF NETVIEW - Netview System
-- | CICS - CICS System NVAS - Netview Access
-- | IMS - IMS System AOF - Netview Automation
-- |
-- | Enter your choice==>
-- | Hi! Enter one of above commands in red.
-- |
-- |_Your IP(10.10.10.375 :64199), SNA LU( ) 05/30/15 13:33:37
--
-- @args tn3270.commands a semi-colon seperated list of commands you want to
-- issue before printing the screen
--
--
-- @changelog
-- 2015-05-30 - v0.1 - created by Soldier of Fortran
-- 2015-11-14 - v0.2 - added commands argument
--
author = "Philip Young aka Soldier of Fortran"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"safe", "discovery"}
dependencies = {"tn3270-info"}
portrule = shortport.port_or_service({23,992}, {"tn3270"})
action = function(host, port)
local commands = stdnse.get_script_args(SCRIPT_NAME .. '.commands')
local t = Telnet:new()
local status, err = t:initiate(host,port)
if not status then
stdnse.debug("Could not initiate TN3270: %s", err )
return
else
if commands then
local run = stdnse.strsplit(";%s*", commands)
for i = 1, #run do
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
t:send_cursor(run[i])
t:get_all_data()
t:get_screen_debug()
end
end
status = t:get_all_data()
if t:any_hidden() then
local hidden_buggers = t:hidden_fields()
for i = 1, #hidden_buggers do
stdnse.verbose("Hidden Field # %s: %s", i, hidden_buggers[i])
end
end
return t:get_screen()
end
end