创建恶意程序假体文件批处理,可以用来预防网吧系统恶意程序的运行

需求:

在已知的恶意程序所在文件夹和文件名的情况下,预防网吧系统这些恶意程序:包括但不限于类似广告程序、各种挖矿恶意程序等

需求分析:

这种需求一般来讲比较简单的,所以本批处理实际的作用也是预防一些比较low的网吧系统广告程序,恶意程序。采用的方法是著名的「假体文件」方式。就好像给系统打了疫苗一样,比如你已经知道某某正规网吧软件运行后会在c:\temp\下固定释放名为xxx.exe的后门插件并运行。那么我就可以提前创建好一个c:\temp\xxx.exe文件,这个xxx.exe就称为假体文件夹,因为windows系统文件命名规则约定不能同名。所以当你创建了这个假体文件夹后,真正的恶意程序将无法创建并运行,这样就起到了一个网吧系统恶意程序「疫苗」的作用。

编码分析:

通过以上需求分析后,编码起来就容易了,核心的代码逻辑就分为两步:

1、创建假体文件夹

这个可以直接使用windows创建文件夹命令 md

md 文件夹名称,就可以创建一个文件夹

比如 md aaa就会在当前文件夹下创建个aaa的文件夹

md %systemroot%\system32\soft.dll.exe

就会在系统目录的system32文件夹下创建一个名为soft.dll.exe的文件夹。

2、设置文件夹权限为只读、系统级、隐藏属性

这样做的目的是防止被重写。

这个可以用attrib命令来完成。

attrib命令的参数如下:

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U]
       [drive:][path][filename] [/S [/D]] [/L]

  +   设置属性。
  -   清除属性。
  R   只读文件属性。
  A   存档文件属性。
  S   系统文件属性。
  H   隐藏文件属性。
  O   脱机属性。
  I   无内容索引文件属性。
   X   无清理文件属性。
  V   完整性属性。
  P   固定属性。
  U   非固定属性。
  [drive:][path][filename]
      指定属性要处理的文件。
  /S  处理当前文件夹及其所有子文件夹中
      的匹配文件。
  /D  也处理文件夹。
  /L  处理符号链接和
      符号链接目标的属性

除了aatrib还可以用ntfs文件夹权限设置命令cacls

cacls /?查询参数:

CACLS filename [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]
        [/R user [...]] [/P user:perm [...]] [/D user [...]]
    filename      显示 ACL。
    /T            更改当前目录及其所有子目录中
                  指定文件的 ACL。
    /L            对照目标处理符号链接本身
    /M            更改装载到目录的卷的 ACL
    /S            显示 DACL 的 SDDL 字符串。
    /S:SDDL       使用在 SDDL 字符串中指定的 ACL 替换 ACL。
                  (/E、/G、/R、/P 或 /D 无效)。
    /E            编辑 ACL 而不替换。
    /C            在出现拒绝访问错误时继续。
    /G user:perm  赋予指定用户访问权限。
                  Perm 可以是: R  读取
                               W  写入
                               C  更改(写入)
                               F  完全控制
    /R user       撤销指定用户的访问权限(仅在与 /E 一起使用时合法)。
    /P user:perm  替换指定用户的访问权限。
                  Perm 可以是: N  无
                               R  读取
                               W  写入
                               C  更改(写入)
                               F  完全控制
    /D user       拒绝指定用户的访问。

可以得知设置当前aaa文件夹everyone用户拒绝访问的命令是: cacls aaa /D everyone

所以,创建aaa假体文件夹命令加起来就3行代码

md aaa

attrinb aaa +S +R +h

cacls aaa /d everyone

多个文件夹就复制下代码,多次执行,操作对象文件夹变了而已。

完整代码:

@echo off
@echo ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗
@echo ┋                枫 龙 联  邦                        ┋
@echo ┋                                                    ┋
@echo ┋    DIY 个 性 BAT C 盘 防 毒 批 处 理               ┋
@echo ┋                                                    ┋
@echo ┋ 预防LOGO病毒和网络执法官的批处理!  请相信我们!    ┋
@echo ┋                                                    ┋
@echo ┋                                                    ┋
@echo ┋                                 QQ:654525258       ┋ 
@echo ┋                                                    ┋
@echo ┋                              官方:WwW.FL68.CoM     ┋
@echo ╚┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╝ 

@pause

md %systemroot%\0sy.exe
attrib %systemroot%\0sy.exe +S +R +H

md %systemroot%\1sy.exe
attrib %systemroot%\1sy.exe +S +R +H

md %systemroot%\2sy.exe
attrib %systemroot%\2sy.exe +S +R +H

md %systemroot%\3sy.exe
attrib %systemroot%\3sy.exe +S +R +H

md %systemroot%\4sy.exe
attrib %systemroot%\4sy.exe +S +R +H

md %systemroot%\5sy.exe
attrib %systemroot%\5sy.exe +S +R +H

md %systemroot%\6sy.exe
attrib %systemroot%\6sy.exe +S +R +H

md %systemroot%\7sy.exe
attrib %systemroot%\7sy.exe +S +R +H

md %systemroot%\8sy.exe
attrib %systemroot%\8sy.exe +S +R +H

md %systemroot%\9sy.exe
attrib %systemroot%\9sy.exe +S +R +H

md %systemroot%\logo1_.exe
attrib %systemroot%\logo1_.exe +S +R +H

md %systemroot%\logo.exe
attrib %systemroot%\logo.exe +S +R +H

md %systemroot%\logo1.exe
attrib %systemroot%\logo1.exe +S +R +H

md %systemroot%\logo_1.exe
attrib %systemroot%\logo_1.exe +S +R +H

md %systemroot%\rundl132.exe
attrib %systemroot%\rundl132.exe +S +R +H

md %systemroot%\rund1l32.exe
attrib %systemroot%\rundl132.exe +S +R +H

md %systemroot%\rund1132.exe
attrib %systemroot%\rundl132.exe +S +R +H

md %systemroot%\CA_Crash_info.nfo
attrib %systemroot%\CA_Crash_info.nfo +S +R +H

md %systemroot%\cmcc.exe
attrib %systemroot%\cmcc.exe +S +R +H

md %systemroot%\csrss.exe
attrib %systemroot%\ccsrss.exe +S +R +H

md %systemroot%\fox.exe
attrib %systemroot%\fox.exe +S +R +H

md %systemroot%\GOG.exe
attrib %systemroot%\GOG.exe +S +R +H

md %systemroot%\GOG.sys
attrib %systemroot%\GOG.sys +S +R +H

md %systemroot%\kernel32.exe
attrib %systemroot%\kernel32.exe +S +R +H

md %systemroot%\lesste.exe
attrib %systemroot%\lesste.exe +S +R +H

md %systemroot%\MFCD3O.DLL
attrib %systemroot%\MFCD3O.DLL +S +R +H

md %systemroot%\MSTRAY.EXE
attrib %systemroot%\MSTRAY.EXE +S +R +H

md %systemroot%\smss.exe
attrib %systemroot%\smss.exe +S +R +H

md %systemroot%\svch0st_.exe
attrib %systemroot%\svch0st_.exe +S +R +H

md %systemroot%\svchost64.exe
attrib %systemroot%\svchost64.exe +S +R +H

md %systemroot%\sws.dll
attrib %systemroot%\sws.dll +S +R +H

md %systemroot%\system33.exe
attrib %systemroot%\system33.exe +S +R +H

md %systemroot%\Systra.exe
attrib %systemroot%\Systra.exe +S +R +H

md %systemroot%\doc1.exe
attrib %systemroot%\doc1.exe +S +R +H

md %systemroot%\doc.exe
attrib %systemroot%\doc.exe +S +R +H

md %systemroot%\sws32.dll
attrib %systemroot%\sws32.dll +S +R +H

md %systemroot%\KILL.EXE
attrib %systemroot%\KILL.EXE +S +R +H

md %systemroot%\systra.exe
attrib %systemroot%\systra.exe +S +R +H

md %systemroot%\virDll.dll
attrib %systemroot%\virDll.dll +S +R +H

::======================================================
::                        system32
::======================================================

md %systemroot%\system32\hxdef.exe
attrib %systemroot%\system32\hxdef.exe +S +R +H

md %systemroot%\system32\kernel66.dll
attrib %systemroot%\system32\kernel66.dll +S +R +H

md %systemroot%\system32\Latterpy.dll
attrib %systemroot%\system32\Latterpy.dll +S +R +H

md %systemroot%\system32\LayerInstall.exe
attrib %systemroot%\system32\LayerInstall.exe +S +R +H

md %systemroot%\system32\layerpop.ini
attrib %systemroot%\system32\layerpop.ini +S +R +H

md %systemroot%\system32\msjdbc11.dll
attrib %systemroot%\system32\msjdbc11.dll +S +R +H

md %systemroot%\system32\MSSIGN30.DLL
attrib %systemroot%\system32\MSSIGN30.DLL +S +R +H

md %systemroot%\system32\NetMeeting.exe
attrib %systemroot%\system32\NetMeeting.exe +S +R +H

md %systemroot%\system32\ntdhcp.exe
attrib %systemroot%\system32\ntdhcp.exe +S +R +H

md %systemroot%\system32\odbc16.dll
attrib %systemroot%\system32\odbc16.dll +S +R +H

md %systemroot%\system32\ravmond.exe
attrib %systemroot%\system32\ravmond.exe +S +R +H

md %systemroot%\system32\Runouce.exe
attrib %systemroot%\system32\Runouce.exe +S +R +H

md %systemroot%\system32\spollsv.exe
attrib %systemroot%\system32\spollsv.exe +S +R +H

md %systemroot%\system32\sys.exe
attrib %systemroot%\system32\sys.exe +S +R +H

md %systemroot%\system32\word.exe
attrib %systemroot%\system32\word.exe +S +R +H

md %systemroot%\system32\0sy.exe
attrib %systemroot%\system32\0sy.exe +S +R +H

md %systemroot%\system32\1sy.exe
attrib %systemroot%\system32\1sy.exe +S +R +H

md %systemroot%\system32\2sy.exe
attrib %systemroot%\system32\2sy.exe +S +R +H

md %systemroot%\system32\3sy.exe
attrib %systemroot%\system32\3sy.exe +S +R +H

md %systemroot%\system32\4sy.exe
attrib %systemroot%\system32\4sy.exe +S +R +H

md %systemroot%\system32\5sy.exe
attrib %systemroot%\system32\5sy.exe +S +R +H

md %systemroot%\system32\6sy.exe
attrib %systemroot%\system32\6sy.exe +S +R +H

md %systemroot%\system32\7sy.exe
attrib %systemroot%\system32\7sy.exe +S +R +H

md %systemroot%\system32\8sy.exe
attrib %systemroot%\system32\8sy.exe +S +R +H

md %systemroot%\system32\9sy.exe
attrib %systemroot%\system32\9sy.exe +S +R +H

md %systemroot%\system32\logo1_.exe
attrib %systemroot%\system32\logo1_.exe +S +R +H

md %systemroot%\system32\logo.exe
attrib %systemroot%\system32\logo.exe +S +R +H

md %systemroot%\system32\logo1.exe
attrib %systemroot%\system32\logo1.exe +S +R +H

md %systemroot%\system32\logo_1.exe
attrib %systemroot%\system32\logo_1.exe +S +R +H

md %systemroot%\system32\rundl132.exe
attrib %systemroot%\system32\rundl132.exe +S +R +H

md %systemroot%\system32\rund1l32.exe
attrib %systemroot%\system32\rundl132.exe +S +R +H

md %systemroot%\system32\rund1132.exe
attrib %systemroot%\system32\rundl132.exe +S +R +H

md %systemroot%\system32\001.exe
attrib %systemroot%\system32\001.exe +S +R +H

md %systemroot%\system32\111.dll
attrib %systemroot%\system32\111.dll +S +R +H

md %systemroot%\system32\444.reg
attrib %systemroot%\system32\444.reg +S +R +H

md %systemroot%\system32\alerte.exe
attrib %systemroot%\system32\alerte.exe +S +R +H

md %systemroot%\system32\capp.exe
attrib %systemroot%\system32\capp.exe +S +R +H

md %systemroot%\system32\chk20.exe
attrib %systemroot%\system32\chk20.exe +S +R +H

md %systemroot%\system32\chk.exe
attrib %systemroot%\system32\chk.exe +S +R +H

md %systemroot%\system32\comload.dll
attrib %systemroot%\system32\comload.dll +S +R +H

md %systemroot%\system32\comwsock.dll
attrib %systemroot%\system32\comwsock.dll +S +R +H

md %systemroot%\system32\cvssdp.exe
attrib %systemroot%\system32\cvssdp.exe +S +R +H

md %systemroot%\system32\dmsti.exe
attrib %systemroot%\system32\dmsti.exe +S +R +H

md %systemroot%\system32\exp1orer.exe
attrib %systemroot%\system32\exp1orer.exe +S +R +H

md %systemroot%\system32\fensvc32.exe
attrib %systemroot%\system32\fensvc32.exe +S +R +H

md %systemroot%\system32\hiddukel.dll
attrib %systemroot%\system32\hiddukel.dll +S +R +H

md %systemroot%\system32\huanyuan.exe
hattrib %systemroot%\system32\uanyuan.exe +S +R +H

md %systemroot%\system32\interapi32.dll
attrib %systemroot%\system32\interapi32.dll +S +R +H

md %systemroot%\system32\interapi64.dll
attrib %systemroot%\system32\interapi64.dll +S +R +H

md %systemroot%\system32\intneter.exe
attrib %systemroot%\system32\intneter.exe +S +R +H

md %systemroot%\system32\istinstall_mpb1126.exe
attrib %systemroot%\system32\istinstall_mpb1126.exe +S +R +H

md %systemroot%\system32\grouppolicy
attrib %systemroot%\system32\grouppolicy +S +R +H

md %systemroot%\system32\lmmib20.dll
attrib %systemroot%\system32\lmmib20.dll +S +R +H

md %systemroot%\system32\mofei.cfg
attrib %systemroot%\system32\mofei.cfg +S +R +H

md %systemroot%\system32\msbb.exe
attrib %systemroot%\system32\msbb.exe +S +R +H

md %systemroot%\system32\msconfd.dll
attrib %systemroot%\system32\msconfd.dll +S +R +H

md %systemroot%\system32\mseggrpid.dll
attrib %systemroot%\system32\mseggrpid.dll +S +R +H

md %systemroot%\system32\navihelper.dll
attrib %systemroot%\system32\avihelper.dll +S +R +H

md %systemroot%\system32\ncmyb.dll
attrib %systemroot%\system32\ncmyb.dll +S +R +H

md %systemroot%\system32\ndistcp.exe
attrib %systemroot%\system32\ndistcp.exe +S +R +H

md %systemroot%\system32\netservice.exe
attrib %systemroot%\system32\netservice.exe +S +R +H

md %systemroot%\system32\nmgamex.dll
attrib %systemroot%\system32\nmgamex.dll +S +R +H

md %systemroot%\system32\p2ecom.dll
attrib %systemroot%\system32\p2ecom.dll +S +R +H

md %systemroot%\system32\packet.dll
attrib %systemroot%\system32\packet.dll +S +R +H

md %systemroot%\system32\pj.exe
attrib %systemroot%\system32\pj.exe +S +R +H

md %systemroot%\system32\pojie.exe
attrib %systemroot%\system32\pojie.exe +S +R +H

md %systemroot%\system32\psintbs.dll
attrib %systemroot%\system32\psintbs.dll +S +R +H

md %systemroot%\system32\reg678.dll
attrib %systemroot%\system32\reg678.dll +S +R +H

md %systemroot%\system32\rundl132.exe
attrib %systemroot%\system32\rundl132.exe +S +R +H

md %systemroot%\system32\rund1l32.exe
attrib %systemroot%\system32\rund1l32.exe +S +R +H

md %systemroot%\system32\rund1132.exe
attrib %systemroot%\system32\rund1132.exe +S +R +H

md %systemroot%\system32\scardsvr32.dll
attrib %systemroot%\system32\scardsvr32.dll +S +R +H

md %systemroot%\system32\scardsvr32.exe
attrib %systemroot%\system32\scardsvr32.exe +S +R +H

md %systemroot%\system32\sinaproc327.exe
attrib %systemroot%\system32\sinaproc327.exe +S +R +H

md %systemroot%\system32\soft.dll.exe
attrib %systemroot%\system32\soft.dll.exe +S +R +H

md %systemroot%\system32\sptres.dll
attrib %systemroot%\system32\sptres.dll +S +R +H

md %systemroot%\system32\syscpy1.exe
attrib %systemroot%\system32\syscpy1.exe +S +R +H

md %systemroot%\system32\syscpy.exe
attrib %systemroot%\system32\syscpy.exe +S +R +H

md %systemroot%\system32\sysexplorer.exe
attrib %systemroot%\system32\sysexplorer.exe +S +R +H

md %systemroot%\system32\syslggo.exe
attrib %systemroot%\system32\syslggo.exe +S +R +H

md %systemroot%\system32\sysnet.exe
attrib %systemroot%\system32\sysnet.exe +S +R +H

md %systemroot%\system32\system32.exe
attrib %systemroot%\system32\system32.exe +S +R +H

md %systemroot%\system32\system.exe
attrib %systemroot%\system32\system.exe +S +R +H

md %systemroot%\system32\systemwin.exe
attrib %systemroot%\system32\systemwin.exe +S +R +H

md %systemroot%\system32\systrect.exe
attrib %systemroot%\system32\systrect.exe +S +R +H

md %systemroot%\system32\sysvem.dll
attrib %systemroot%\system32\sysvem.dll +S +R +H

md %systemroot%\system32\tcdex.exe
attrib %systemroot%\system32\tcdex.exe +S +R +H

md %systemroot%\system32\temphttp.dll
attrib %systemroot%\system32\temphttp.dll +S +R +H

md %systemroot%\system32\vmm32.vxd
attrib %systemroot%\system32\vmm32.vxd +S +R +H

md %systemroot%\system32\win32usb.exe
attrib %systemroot%\system32\win32usb.exe +S +R +H

md %systemroot%\system32\winhelp.exe
attrib %systemroot%\system32\winhelp.exe +S +R +H

md %systemroot%\system32\winrpc.exe
attrib %systemroot%\system32\winrpc.exe +S +R +H

md %systemroot%\system32\winsocks.dll
attrib %systemroot%\system32\winsocks.dll +S +R +H

md %systemroot%\system32\winsym.exe
attrib %systemroot%\system32\winsym.exe +S +R +H

md %systemroot%\system32\ws2_64.dll
attrib %systemroot%\system32\ws2_64.dll +S +R +H

md %systemroot%\system32\wsink.dll
attrib %systemroot%\system32\wsink.dll +S +R +H


执行效果预览:

注意事项:

上面代码内置了前辈们收集整理的多个恶意程序文件路径。如果你要自定义自己的,直接全部清理掉代码,重新写即可。如下代码,把aaa.exe替换成你的假体文件夹完整路径即可!

md "aaa.exe"
attrinb "aaa.exe" +S +R +h
cacls "aaa.exe" /t /p Everyone:n

考虑到aaa.exe时完整的路径,路径中可能带有空格,所以加上英文输入法下的双引号""把整个路径包起来。不然会出错!如果确认路径中没哟空格等奇怪字符,可以不用""

如果创建假体时已经有同名进程在运行,那么需要结束掉这个进程再创建。结束进程的命令:

taskkill /im aaa.exe /f 

另外,因为以上代码需要操作系统文件夹,所以请以管理员模式运行。否则会提示拒绝访问之类的错误!

上面的代码没有加入cacls这个权限控制命令,只是使用了attrib来设置文件夹的隐藏,系统,只读属性,大家可以根据以上代码分析加上cacls来让假体文件夹更安全。防止被篡改!

本文来源:天下网吧 作者:天下码农

声明
声明:本站所发表的文章、评论及图片仅代表作者本人观点,与本站立场无关。若文章侵犯了您的相关权益,请及时与我们联系,我们会及时处理,感谢您对本站的支持!联系Email:support@txwb.com,系统开号,技术支持,服务联系QQ:1175525021本站所有有注明来源为天下网吧或天下网吧论坛的原创作品,各位转载时请注明来源链接!
天下网吧·网吧天下
  • 本周热门
  • 本月热门
  • 阅读排行