62,614
社区成员
发帖
与我相关
我的任务
分享
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
public class BanSupport extends JFrame {
private static final long serialVersionUID = 1L;
private String keyWord;
private JLabel msg;
public BanSupport(String keyWord) {
super("BanSupport");
this.setBounds(200, 200, 500, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
msg=new JLabel("所谓监控用户硬盘,只是个笑话.根本就是公开的API。360是SB ", SwingConstants.CENTER);
this.getContentPane().add(msg);
this.keyWord = keyWord.toLowerCase();
this.check();
}
public void check() {
Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec("cmd /c Tasklist");
BufferedReader in = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String s = "";
while ((s = in.readLine()) != null) {
s = s.toLowerCase();
if (s.startsWith(keyWord)) {
s = s.substring(0, s.indexOf(".exe") + 4);
JOptionPane.showMessageDialog(this, "您的系统中检测到"+s+",为了保障您的安全,本软件即将退出。请卸载后再使用本检测软件。");
System.exit(-1);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
BanSupport ban360 = new BanSupport("360");
ban360.setVisible(true);
}
}