bat获取C盘id或者CPU序列号,接单必备暗锁基操

该文描述了一个使用BAT批处理脚本获取C盘ID和CPU序列号的流程,旨在防止未经授权的程序使用。脚本将ID写入图片的像素中,每次运行时对比ID,若超过一定次数的改动则退出程序。提供的代码示例展示了如何在Unity中执行类似操作。
摘要由CSDN通过智能技术生成

思路:调用bat获取到C盘id,然后将id写入背景图的一个角落里的像素,再用一个像素记录修改次数,每次运行程序Awake对比到C盘id不一样,则改写并增加次数,改写次数大于10次直接推出程序,或者做其他小操作,等钱到账在去掉。

宗旨:拒绝白嫖怪,不做杨白劳

@echo off

echo select disk 0 >C:\Users\Administrator\Desktop\d1.txt

echo detail disk >>C:\Users\Administrator\Desktop\d1.txt

diskpart /s C:\Users\Administrator\Desktop\d1.txt|findstr "ID:" >C:\Users\Administrator\Desktop\e1.txt

del /q C:\Users\Administrator\Desktop\d1.txt

::不能在同一个文本里直接操作,需分开两个

exit



注:
1.@echo off       表示隐藏cmd窗口。
2.echo 字符串 >文本路径      表示将字符串覆盖全文写在文本里;
   echo 字符串 >>文本路径    表示将字符串换行添加写在文本里。
3.cmd里可以一句一句输入,但是bat里需要diskpart调用中间文本里的另外两句命令。
4.del /q 文本路径     表示删除文本
5.双冒号表示注释


中间文本(3行):
“select disk 0 

detail disk 



 

输出文本(2行):
“磁盘 ID: C0F63564

------------------------------------------------------------------------------------------

@echo off

wmic CPU get ProcessorID> C:\Users\Administrator\Desktop\c1.txt

exit


注:输出文本为2行。
“ProcessorId       ”,
“BFEBFBFF000906E9  ”
 

/// <summary>

    /// 获取CPU序列号

    /// </summary>

    /// <returns></returns>

    IEnumerator GetCPUId()

    {

        //#if !UNITY_EDITOR && UNITY_STANDALONE_WIN

        string txtPath = @"C:/Users/Administrator/Desktop/temp.txt";

        string batPath = @"C:/Users/Administrator/Desktop/temp.bat";

        string resultPath = @"C:/Users/Administrator/Desktop/c1.txt";

        if (File.Exists(txtPath)) { File.Delete(txtPath); }

        if (File.Exists(batPath)) { File.Delete(batPath); }

        if (File.Exists(resultPath)) { File.Delete(resultPath); }

        File.WriteAllLines(txtPath, new string[]

        {

            @"@echo off",

            @"wmic CPU get ProcessorID> C:\Users\Administrator\Desktop\c1.txt",

            @"exit"

        });

        

        File.Move(txtPath, batPath);

        Application.OpenURL(batPath);

        yield return new WaitForSeconds(0.5f);//等待cmd输出结果到文本

        cpuId = File.ReadAllLines(resultPath)[1].Trim();

        Debug.Log("CPUId:" + cpuId);

    }

-----------------------------------------

基操讲完,后面怎么将数据记录到程序的背景图(或其他程序不可缺的图)上面去,我就不多讲了,分享归分享,不能把自己的老底拿给人家看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值