Difference between revisions of "Script to Test Ports"
From Observer GigaFlow Support | VIAVI Solutions Inc.
Kevin Wilkie (Talk | contribs) (Created page with " //tcpPortTest(JSONArray jsa, String ip, String portsList, int timeout, int threads) var utils = Java.type('ros.CROSUtils'); var jsonarray = Java.type('org.json.JSONArray')...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:Scripts]] | |
//tcpPortTest(JSONArray jsa, String ip, String portsList, int timeout, int threads) | //tcpPortTest(JSONArray jsa, String ip, String portsList, int timeout, int threads) | ||
var utils = Java.type('ros.CROSUtils'); | var utils = Java.type('ros.CROSUtils'); | ||
var jsonarray = Java.type('org.json.JSONArray') | var jsonarray = Java.type('org.json.JSONArray') | ||
− | var results=new jsonarray() | + | var results=new jsonarray(true) |
utils.tcpPortTest(results,"172.21.40.254","22-23,80,443,1000-1050",100,10) | utils.tcpPortTest(results,"172.21.40.254","22-23,80,443,1000-1050",100,10) | ||
log.warn("results.length:"+results.length()); | log.warn("results.length:"+results.length()); |
Latest revision as of 11:59, 23 November 2018
//tcpPortTest(JSONArray jsa, String ip, String portsList, int timeout, int threads)
var utils = Java.type('ros.CROSUtils'); var jsonarray = Java.type('org.json.JSONArray') var results=new jsonarray(true) utils.tcpPortTest(results,"172.21.40.254","22-23,80,443,1000-1050",100,10) log.warn("results.length:"+results.length()); for (var i=0;i<results.length();i++){ var entry =results.getJSONObject(i); if (entry.getInt("response")>-1){ log.warn("Response for port "+entry.getInt("port")+" in "+entry.getInt("response")+" ms"); }else{ log.warn("No response for port "+entry.getInt("port")); } }