怎样测试哪些端口被封
给你提供个程序吧import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.OutputStream;import java.net.Socket;/** * @author 作者 E-mail: * @version 创建时间:2015-10-15 上午10:25:31 类说明 */public class TelnetServers{ public static void main(String args) { if (args.length \u0026lt; 2) { System.out.println("usage: java TelentServets srcFilePath resultFilePath!"); } new TelnetServers().telnetServerList(args, args); } /** * 测试源文件当中的ip和端口是否能够连通 * * @param srcFilePath * 源文件 * @param resultFilePath * 结果文件 */ private void telnetServerList(String srcFilePath, String resultFilePath) { final File srcFile = new File(srcFilePath); final File resFile = new File(resultFilePath); InputStream inputStream; OutputStream outputStream; try { inputStream = new FileInputStream(srcFile); outputStream = new FileOutputStream(resFile); final BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String ipAndPortStr = null; while ((ipAndPortStr = br.readLine()) != null) { \t\t\t\tif(ipAndPortStr.isEmpty())\t\t\t\t{\t\t\t\t\tcontinue;\t\t\t\t} int index = ipAndPortStr.indexOf(" "); final String ip = ipAndPortStr.substring(0, index); final int port = Integer.parseInt(ipAndPortStr.substring(index + 1)); final boolean flag = telnetServer(ip, port); if (!flag) { ipAndPortStr += "\"; outputStream.write(ipAndPortStr.getBytes("UTF-8")); outputStream.flush(); } } } catch(Exception e) { e.printStackTrace(); } } /** * 连接server * * @param ip * @param port * @return 连接成功返回true 失败返回false */ private boolean telnetServer(String ip, int port) { Socket socket = null; try { socket = new Socket(ip, (port)); if (socket.isConnected()) { return true; } } catch(IOException ex) { System.out.println("Connection false ip = " + ip + " port = " + port); return false; } finally { try { if (socket != null) { socket.close(); } } catch(IOException e) { e.printStackTrace(); } } return true; }}
■网友
使用站长工具中的IP端口扫描,不过只能优先定义所扫描的端口,
■网友
现成的nmap不用么
■网友
你可以用 telnet 目标IP地址 port端口号 试试就能看到还访问是否有应答,就可判断端口情况。如果你的服务器地址是外网地址,可以在公网上的Whois this 查询上,对指定的端口号进行批量查询。
推荐阅读
- 聪明人养花,这3种“花”怎样也要养一盆,每年能省不少医药费
- 互联网怎样解决“家政服务上门速度慢”的问题
- 怎样看待从1月8号起,QQ钱包开始提现收费
- 银行it人怎样转型
- 医院|感染艾滋病毒初期有哪些征兆?可以自行检查吗?共用马桶会传染吗
- 玩游戏花钱最多的有哪些游戏,哪些人
- 大学再有三个月就结束了,没学到知识,参加一个软件测试培训机构好吗
- 汽车|冬天怎样让车内温度快速升高?座椅加热的最佳使用方式二,外循环的作用总结
- 旅行|需要准备哪些物品?全面冬季出游清单,建议收藏带宝宝出门旅行
- 怎样进入通信行业
