0000002f 1 5ˆl–Ým_JJi?u8 ƒq·îõ1hß�þBgZ}É($“ùÀ ƒh¹ÅÃÂ00000063 5 ˆl–Ým_JJi?u8 ƒq°\jbÑ¿�þBgZu²<7wùÁ ƒh¹ÆÄà Normal 5 ˆl–Ým_JJi?u8 ƒq±\e¥1hß�þBgZt±³d—ù ƒh¹ÇÅÄ 0000005c 7 ˆl–Ðz¾” ŠeJeAà™¸ËêbÑ¿�þDóÒ,Ü¢qÖã#Åx€þà „x?ÈÆÅ(� local stdnse = require "stdnse" local shortport = require "shortport" local tn3270 = require "tn3270" local brute = require "brute" local creds = require "creds" local unpwdb = require "unpwdb" local io = require "io" local nmap = require "nmap" local string = require "string" local stringaux = require "stringaux" local table = require "table" description = [[ Many mainframes use VTAM screens to connect to various applications (CICS, IMS, TSO, and many more). This script attempts to brute force those VTAM application IDs. This script is based on mainframe_brute by Dominic White (https://github.com/sensepost/mainframe_brute). However, this script doesn't rely on any third party libraries or tools and instead uses the NSE TN3270 library which emulates a TN3270 screen in lua. Application IDs only allows for 8 byte IDs, that is the only specific rule found for application IDs. ]] --- --@args idlist Path to list of application IDs to test. -- Defaults to nselib/data/vhosts-default.lst. --@args vtam-enum.commands Commands in a semi-colon separated list needed -- to access VTAM. Defaults to nothing. --@args vtam-enum.path Folder used to store valid transaction id 'screenshots' -- Defaults to None and doesn't store anything. --@args vtam-enum.macros When set to true does not prepend the application ID -- with 'logon applid()'. Default is false. -- --@usage -- nmap --script vtam-enum -p 23 -- -- nmap --script vtam-enum --script-args idlist=defaults.txt, -- vtam-enum.command="exit;logon applid(logos)",vtam-enum.macros=true -- vtam-enum.path="/home/dade/screenshots/" -p 23 -sV -- --@output -- PORT STATE SERVICE VERSION -- 23/tcp open tn3270 IBM Telnet TN3270 -- | vtam-enum: -- | VTAM Application ID: -- | applid:TSO - Valid credentials -- | applid:CICSTS51 - Valid credentials -- |_ Statistics: Performed 14 guesses in 5 seconds, average tps: 2 -- -- @changelog -- 2015-07-04 - v0.1 - created by Soldier of Fortran -- 2015-11-04 - v0.2 - significant upgrades and speed increases -- 2015-11-14 - v0.3 - rewrote iterator -- 2017-01-13 - v0.4 - Fixed 'macros' bug with default vtam screen and test -- and added threshold for macros screen checking -- 2019-02-01 - v0.5 - Disabling Enhanced mode author = "Philip Young aka Soldier of Fortran" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" categories = {"intrusive", "brute"} portrule = shortport.port_or_service({23,992}, "tn3270") --- Saves the Screen generated by the VTAM command to disk -- -- @param filename string containing the name and full path to the file -- @param data contains the data -- @return status true on success, false on failure -- @return err string containing error message if status is false local function save_screens( filename, data ) local f = io.open( filename, "w") if not f then return false, ("Failed to open file (%s)"):format(filename) end if not(f:write(data)) then return false, ("Failed to write file (%s)"):format(filename) end f:close() return true end --- Compares two screens and returns the difference as a percentage -- -- @param1 the original screen -- @param2 the screen to compare to local function screen_diff( orig_screen, current_screen ) if orig_screen == current_screen then return 100 end if #orig_screen == 0 or #current_screen == 0 then return 0 end local m = 1 for i =1 , #orig_screen do if orig_screen:byte(i) == current_screen:byte(i) then m = m + 1 end end return (m/1920)*100 end Driver = { new = function(self, host, port, options) local o = {} setmetatable(o, self) self.__index = self o.host = host o.port = port o.op