Hook系统服务隐藏端口.doc

上传人:自*** 文档编号:126228487 上传时间:2020-03-23 格式:DOC 页数:13 大小:45KB
返回 下载 相关 举报
Hook系统服务隐藏端口.doc_第1页
第1页 / 共13页
Hook系统服务隐藏端口.doc_第2页
第2页 / 共13页
Hook系统服务隐藏端口.doc_第3页
第3页 / 共13页
Hook系统服务隐藏端口.doc_第4页
第4页 / 共13页
Hook系统服务隐藏端口.doc_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《Hook系统服务隐藏端口.doc》由会员分享,可在线阅读,更多相关《Hook系统服务隐藏端口.doc(13页珍藏版)》请在金锄头文库上搜索。

1、Hook 系统服务隐藏端口 Hook 系统服务隐藏端口 创建时间:2004-04-07 更新时间:2004-04-11 文章属性:原创 文章提交:jiurl (jiurl_at_) Hook 系统服务隐藏端口 作者: JIURL 主页: http:/ 日期: 2004-03-30 有时候写程序,调试程序真是一件非常有趣的事,就比如这次,蹦蹦跳跳,笑嘻嘻,意犹未尽的就把这个程序搞好了。 netstat 或者其他各种列举端口的工具,比如fport,或者 sysinternals 的 Tcpview,都是调用 Iphlpapi.dll 中的 API 来完成端口的列举。而 Iphlpapi.dll 中

2、的 API 最终是使用 ZwDeviceIoControlFile ,向设备对象 DeviceTcp 发 IOCTL_TCP_QUERY_INFORMATION_EX 来得到各种信息的。于是我们只要Hook相应的System Service ,然后对得到的结果做一些处理,弄掉不希望出现的端口信息就可以了。不过真正的问题在于,IOCTL_TCP_QUERY_INFORMATION_EX 和端口相关的各种结构定义,参数含义目前都(大部分)是未公开,没人知道的,也就是Undocumented的。Undocumented? ring3调试,我熟啊。ring0调试,我熟啊。Windows驱动,我熟啊。W

3、indows系统,我熟啊。我怕谁啊我。Undocumented?爽,要的就是Undocumented。 通过ring3调试,分析Iphlpapi.dll是如何使用 IOCTL_TCP_QUERY_INFORMATION_EX 相关的各种参数,结合msdn中的一些信息,于是很轻松的搞清了需要了解的结构。用我自己写的awx建一个VC的驱动项目,写好了Hook部分。 关于本例中使用的解决Hook在各种Windows版本下运行的方法,在很多地方很多地方都出现了,我不清楚最早是谁想出来的,我是在Undocumented Windows NT一书的源码中第一次看到这种方法的。 下面是实现源码,很简单,我就

4、不多说什么了。 #if 0 /= Copyright (c) JIURL, All Rights Reserved = /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/ Module Name: Jiurl_tcpioctl.h About: - 这个驱动项目由一个我写的 AppWizard 创建。 HomePage http:/ Email Forum http:/ - 有偿定制 AppWizard ,请发邮件联系 。 Comments: 本文件中的所有内容目前都是未公开的,由我分析得出,是隐藏端

5、口的关键内容。 Undocumented? 爽!要的就是 Undocumented 。 /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/ #endif / jiurl / IPSNMPInfo 结构的定义是根据 RFC 2011 / jiurl / 所以我根据 RFC 2022 ,仿 IPSNMPInfo, 定义结构 TCPSNMPInfo / jiurl / 再通过一些分析得到一些扩展部分的定义 typedef struct TCPSNMPInfo ULONG tcpsi_RtoAlgorithm;

6、 ULONG tcpsi_RtoMin; ULONG tcpsi_RtoMax; ULONG tcpsi_MaxConn; ULONG tcpsi_ActiveOpens; ULONG tcpsi_PassiveOpens; ULONG tcpsi_AttemptFails; ULONG tcpsi_EstabResets; ULONG tcpsi_CurrEstab; ULONG tcpsi_InSegs; ULONG tcpsi_OutSegs; ULONG tcpsi_RetransSegs; ULONG tcpsi_unknown1; ULONG tcpsi_unknown2; ULO

7、NG tcpsi_numconn; TCPSNMPInfo; #define tcpRtoAlgorithm_other 1 / none of the following #define tcpRtoAlgorithm_constant 2 / a constant rto #define tcpRtoAlgorithm_rsre 3 / MIL-STD-1778, Appendix B #define tcpRtoAlgorithm_vanj 4 / Van Jacobsons algorithm #define TCP_MIB_STATS_ID 1 #define TCP_MIB_ADD

8、RTABLE_ENTRY_ID 0x101 #define TCP_MIB_ADDRTABLE_ENTRY_EX_ID 0x102 typedef struct TCPAddrEntry ULONG tae_ConnState; ULONG tae_ConnLocalAddress; ULONG tae_ConnLocalPort; ULONG tae_ConnRemAddress; ULONG tae_ConnRemPort; TCPAddrEntry; #define tcpConnState_closed 1 #define tcpConnState_listen 2 #define t

9、cpConnState_synSent 3 #define tcpConnState_synReceived 4 #define tcpConnState_established 5 #define tcpConnState_finWait1 6 #define tcpConnState_finWait2 7 #define tcpConnState_closeWait 8 #define tcpConnState_lastAck 9 #define tcpConnState_closing 10 #define tcpConnState_timeWait 11 #define tcpConn

10、State_deleteTCB 12 typedef struct TCPAddrExEntry ULONG tae_ConnState; ULONG tae_ConnLocalAddress; ULONG tae_ConnLocalPort; ULONG tae_ConnRemAddress; ULONG tae_ConnRemPort; ULONG pid; TCPAddrExEntry; #if 0 /= Copyright (c) JIURL, All Rights Reserved = /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

11、*/*/*/*/*/*/*/*/*/*/*/ Module Name: JiurlPortHide.h About: - 这个驱动项目由一个我写的 AppWizard 创建。 HomePage http:/ Email Forum http:/ - 有偿定制 AppWizard ,请发邮件联系 。 /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/ #endif #define PORTHIDE 139 #pragma pack(1) typedef struct ServiceDescriptorEntry unsigned int *ServiceTableBase; unsigned int *ServiceCounterTableBase;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号