【文件属性】:
文件名称:java 端口扫描工具 端口扫描
文件大小:28KB
文件格式:ZIP
更新时间:2014-09-23 07:35:07
java 端口扫描工具 端口扫描
public static JFrame main=new JFrame("JAVA端口扫描器");
//显示扫描结果
public static JTextArea Result=new JTextArea("",4,40);
//滚动条面板
public static JScrollPane resultPane = new JScrollPane(Result,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//输入主机名文本框
public static JTextField hostname=new JTextField("localhost",8);
//输入ip地址前3位的输入框
public static JTextField fromip1=new JTextField("0",3);
//输入ip地址4~6位的输入框
public static JTextField fromip2=new JTextField("0",3);
//输入ip地址7~9位的输入框
public static JTextField fromip3=new JTextField("0",3);
//输入起始ip地址最后4位的输入框
public static JTextField fromip4=new JTextField("0",3);
//输入目标ip地址最后4位的输入框
public static JTextField toip=new JTextField("0",3);
//输入最小端口的输入框
public static JTextField minPort=new JTextField("0",4);
//输入最大端口的输入框
public static JTextField maxPort=new JTextField("1000",4);
//输入最大线程数量的输入框
public static JTextField maxThread=new JTextField("100",3);
//错误提示框
public static JDialog DLGError=new JDialog(main,"错误!");
public static JLabel DLGINFO=new JLabel("");
public static JLabel type=new JLabel("请选择:");
//扫描类型
public static JRadioButton radioIp = new JRadioButton("IP地址:");
public static JRadioButton radioHost = new JRadioButton("主机名:",true);
//单选框组
public static ButtonGroup group = new ButtonGroup();
public static JLabel P1=new JLabel("端口范围:");
public static JLabel P2=new JLabel("~");
public static JLabel P3=new JLabel("~");
public static JLabel Pdot1 = new JLabel(".");
public static JLabel Pdot2 = new JLabel(".");
public static JLabel Pdot3 = new JLabel(".");
public static JLabel TNUM=new JLabel("线程数:");
public static JLabel RST=new JLabel("扫描结果: ");
public static JLabel con=new JLabel(" ");
//定义按钮
public static JButton OK = new JButton("确定");
public static JButton Submit = new JButton("开始扫描");
public static JButton Cancel = new JButton("退出");
public static JButton saveButton = new JButton("保存扫描结果");
//菜单栏
public static JMenuBar myBar = new JMenuBar();
public static JMenu myMenu = new JMenu("文件(F)");
public static JMenuItem saveItem = new JMenuItem("保存扫描结果(S)");
public static JMenuItem exitItem = new JMenuItem("退出(Q)");
public static JMenu myMenu2 = new JMenu("帮助");
public static JMenuItem helpItem = new JMenuItem("阅读");
public static void main(String[] args){
main.setSize(500,400);
main.setLocation(300,300);
main.setResizable(false);
main.setLayout(new GridBagLayout());
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DLGError.setSize(300,100);
DLGError.setLocation(400,400);
//添加“菜单栏”
myMenu.add(saveItem);
myMenu.add(exitItem);
myMenu2.add(helpItem);
myBar.add(myMenu);
myBar.add(myMenu2);
main.setJMenuBar(myBar);
//设置热键
myMenu.setMnemonic('F');
saveItem.setMnemonic ('S');
//为“另存为”组件设置快捷键为ctrl+s
saveItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_S,InputEvent.CTRL_MASK));
exitItem.setMnemonic('Q');
exitItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_E,InputEvent.CTRL_MASK));
//采用表格包型布局
Container mPanel = main.getContentPane();
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(10,0,0,10);
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 10;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(type,c);
group.add(radioIp);
group.add(radioHost);
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(radioIp,c);
c.gridx = 1;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(fromip1,c);
c.gridx = 2;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(Pdot1,c);
c.gridx = 3;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(fromip2,c);
c.gridx = 4;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(Pdot2,c);
c.gridx = 5;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(fromip3,c);
c.gridx = 6;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(Pdot3,c);
c.gridx = 7;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(fromip4,c);
c.gridx = 8;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(P2,c);
c.gridx = 9;
c.gridy = 1;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(toip,c);
c.gridx = 0;
c.gridy = 2;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(radioHost,c);
c.gridx = 1;
c.gridy = 2;
c.gridwidth = 3;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(hostname,c);
c.gridx = 0;
c.gridy = 3;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(P1,c);
c.gridx = 1;
c.gridy = 3;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(minPort,c);
c.gridx = 2;
c.gridy = 3;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(P3,c);
c.gridx = 3;
c.gridy = 3;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(maxPort,c);
c.gridx = 0;
c.gridy = 4;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(TNUM,c);
c.gridx = 1;
c.gridy = 4;
c.gridwidth = 3;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
mPanel.add(maxThread,c);
【文件预览】:
源代码
----AboutDialog.java(1KB)
----nostatic()
--------AboutDialog.java(1KB)
--------TCPThread.java.bak(5KB)
--------ThreadScan.java.bak(14KB)
--------TCPThread.java(4KB)
--------ThreadScan.java(14KB)
----TCPThread.java(5KB)
----ThreadScan.java(15KB)
----MANIFEST.MF(95B)
打包发布
----ThreadScan.bat(25B)
----ThreadScan.jar(12KB)
网友评论
- 能用,但是不是很好用
- 可以用非常不错,已经优化了2000线程飞快
- 程序很好用,写的很好,确实能扫描端口
- 没啥太大用处
- 界面差了点,其他的还行
- jdk1.6完美运行。虽然界面有点简陋,主要功能还是能正常使用。
- 还行吧,可以运行。
- 程序能运行,但是多核情况下运行会出问题
- 为啥我启动不起来,会不会是JDK的问题。。。