360java运行_Java判断系统是否装了获正在运行360(某种软件)

通过判断进程判断系统正在运行某个软件

package aa;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

public class BanSupport extends JFrame {

private String keyWord;

private JLabel msg;

public BanSupport(String keyWord) {

super("想禁谁,就可以禁谁");

this.setBounds(200, 200, 500, 200);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

msg=new JLabel("所谓监控用户硬盘,只是个笑话.根本就是公开的API。 ");

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+",为了保障您的安全,本软件即将退出。请关闭"+s+"后再使用本检测软件。");

System.exit(-1);

}

}

} catch (IOException e) {

e.printStackTrace();

}

}

}

package aa;

public class Ban360 extends BanSupport {

public Ban360() {

super("360");//这里可以换成QQ

}

public static void main(String[] args) {

Ban360 demo = new Ban360();

demo.setVisible(true);

}

}

判断注册表查看安装了某款软件

package aa;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

public class BanSupport extends JFrame {

private String keyWord;

private JLabel msg;

public BanSupport(String keyWord) throws IOException {

super("想禁谁,就可以禁谁");

this.setBounds(200, 200, 500, 200);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

msg=new JLabel("所谓监控用户硬盘,只是个笑话.根本就是公开的API。");

this.getContentPane().add(msg);

this.keyWord = keyWord.toLowerCase();

this.check();

}

public void check() throws IOException {

Runtime runtime = Runtime.getRuntime();

Process process = null;

process = runtime.exec("cmd /c reg query HKEY_LOCAL_MACHINE//SOFTWARE//"+keyWord);

BufferedReader in = new BufferedReader(new InputStreamReader(

process.getInputStream()));

while (in.readLine() != null) {

JOptionPane.showMessageDialog(this, "您的系统中检测到"+keyWord+",为了保障您的安全,本软件即将退出。请卸载"+s+"后再使用本检测软件。");

System.exit(-1);

}

in.close();

process.destroy();

}

}

package aa;

import java.io.IOException;

public class Ban360 extends BanSupport {

public Ban360() throws IOException {

super("sd360");//这里可以换成Tencent

}

public static void main(String[] args) throws IOException {

Ban360 demo = new Ban360();

demo.setVisible(true);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值