⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threadscan.java

📁 基于JAVA的简单扫描器
💻 JAVA
字号:
package Scanner;
import java.net.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

 class ThreadScan implements ActionListener
{
public static JFrame main=new JFrame("TCP端口扫描");
public static JTextArea Result=new JTextArea("",4,43);
public static JTextField hostname=new JTextField("localhost",8);
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  Label DLGINFO=new Label("");
public static Label status=new Label("扫描状态:未开始");
 public  JMenuBar mb=new JMenuBar();//
 public  JMenu m1=new JMenu("运行");
 public  JMenu m2=new JMenu("关于");
 public JMenuItem i1=new JMenuItem("扫描端口");
 public  JMenuItem i2=new JMenuItem("扫描主机");
 public JMenuItem  ipch=new JMenuItem("域名解析");
 public  JMenuItem i3=new JMenuItem("退出");
 public JMenuItem i4=new JMenuItem("帮助");
 public JMenuItem i5=new JMenuItem("声明");
 //
 public static JPanel mPanel=new JPanel();


//IPSCAN 
public static JTextArea Result1=new JTextArea("",4,43);
public static JLabel staipl=new JLabel("起始IP:");
public static JTextField startip=new JTextField("192.168.1.1",12);
public static JLabel endipl=new JLabel("终止IP:");
public static JTextField endip=new JTextField("192.168.1.254",12);
public static JTextField ipthread=new JTextField("20",4);
public static JLabel  iprst=new JLabel("主机扫描结果:                                            ");
public static JButton strbutton=new JButton("开始");
public static JButton canbutton=new JButton("取消");
public static JPanel ippanel =new JPanel();
public static JLabel TNUM1=new JLabel("线程数:");
public static JLabel status1=new JLabel("扫描状态:未开始");
//public static JLabel mes1=new JLabel("下面是主机扫描界面:      ");
//


 public ThreadScan ()
{
main.setSize(500,400);
main.setLocation(300,300);
main.setResizable(false);
DLGError.setSize(300,100);
DLGError.setLocation(400,400);

JScrollPane sp =new JScrollPane(Result1);

main.setJMenuBar(mb);//
mb.setBackground(Color.gray);
mb.setBorder(BorderFactory.createRaisedBevelBorder());
 
  m1.setBorder(BorderFactory.createRaisedBevelBorder());
  m2.setBorder(BorderFactory.createRaisedBevelBorder());
  m1.setBackground(Color.red);
  m2.setBackground(Color.red);
  m1.setForeground(Color.yellow);
  m2.setForeground(Color.yellow);
mb.add(m1);
mb.add(m2);
m1.add(i1);
m1.addSeparator(); 
//i1.addActionListener(this);
m1.add(i2);
m1.addSeparator();
//i2.addActionListener(this);//WAITING FOR CHANGE
m1.add(ipch);
m1.addSeparator();
m1.add(i3);
i3.addActionListener(this);
m2.add(i4);
i4.addActionListener(this);
m2.addSeparator();
m2.add(i5);
i5.addActionListener(this);

JPanel mainPanel = new JPanel();
JLabel H=new JLabel("ip或域名:");
JLabel P1=new JLabel("端口范围:");
JLabel P2=new JLabel("~");
JLabel TNUM=new JLabel("线程数:");
JLabel RST=new JLabel("端口扫描结果:                                       ");
//JLabel con=new JLabel("                                                                                                              ");
Result.setLineWrap(true);
Result.setEditable(false);
Result1.setLineWrap(true);
Result1.setEditable(false);
JButton OK = new JButton("确定");
JButton Submit = new JButton("确定");
JButton Cancel = new JButton("取消");
//Container mPanel = main.getContentPane();
Container dPanel = DLGError.getContentPane();
//
main.setLayout(new GridLayout(2,1));
main.add(mPanel);
main.add(ippanel);
mPanel.setBackground(Color.orange);
ippanel.setBackground(Color.yellow);
mPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
dPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
ippanel.setLayout(new FlowLayout(FlowLayout.LEFT));
mPanel.add(H);
mPanel.add(hostname);
mPanel.add(P1);
mPanel.add(minPort);
mPanel.add(P2);
mPanel.add(maxPort);
mPanel.add(TNUM);
mPanel.add(maxThread);
mPanel.add(RST);

Result.setBackground(Color.black);
Result.setForeground(Color.white);
mPanel.add(Result);
mPanel.add(Submit);
mPanel.add(Cancel);
mPanel.add(status);
//mPanel.add(con);
//
//mPanel.add(ippanel);
//ippanel.add(mes1);
Result1.setBackground(Color.black);
Result1.setForeground(Color.white);
ippanel.add(staipl);
ippanel.add(startip);
ippanel.add(endipl);
ippanel.add(endip);
ippanel.add(TNUM1);
ippanel.add(ipthread);
ippanel.add(iprst);
ippanel.add(sp);
//Result1.add(sp);

ippanel.add(strbutton);
ippanel.add(canbutton);
ippanel.add(status1);
//
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  dPanel.add(DLGINFO);
  dPanel.add(OK);
    main.setVisible(true);
    Submit.addActionListener(new SubmitAction());
    i1.addActionListener(new SubmitAction());
    i2.addActionListener(new ipAction());
    strbutton.addActionListener(new ipAction());
    Cancel.addActionListener(new CancleAction());
    canbutton.addActionListener(new CancleAction());
    OK.addActionListener(new OKAction());
    ipch.addActionListener(new Ipchange());
   }
   
    public void actionPerformed(ActionEvent a)
   {
   	if(a.getActionCommand().equals("退出"))	
   {main.dispose();
    }
    
    if(a.getActionCommand().equals("帮助"))
    {
    	new dialogclass();}
    
   
    if(a.getActionCommand().equals("声明"))
    {new claimclass(); }
   }	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -