500分! 求win2k下探测和阻塞ping的源码.

brapler 2003-09-13 01:06:25
需要自己开发ndis, 但现在没时间做, 只有请坛子里的朋友帮忙了.

我说话算话, 500相送。事后再开4帖结帐。
...全文
59 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
emmyjeff 2003-09-18
  • 打赏
  • 举报
回复
源程序发给你了,用vc编译一下就可以了
brapler 2003-09-18
  • 打赏
  • 举报
回复
这是五贴, 共500分 , 再次感谢!
http://expert.csdn.net/Expert/topic/2276/2276355.xml?temp=.1394464
http://expert.csdn.net/Expert/topic/2276/2276360.xml?temp=.540951
http://expert.csdn.net/Expert/topic/2276/2276364.xml?temp=.4398462
http://expert.csdn.net/Expert/topic/2276/2276372.xml?temp=5.776614E-02
http://expert.csdn.net/Expert/topic/2276/2276374.xml?temp=.3336145
brapler 2003-09-18
  • 打赏
  • 举报
回复
emmyjeff(jeff) :
Thanks a lot ,Check it out!
njtlxm 2003-09-18
  • 打赏
  • 举报
回复
自己看DDK中的例子passthru,改动不到20行代码就可以搞定了。

再说了,这种东西用分是很难买的。
brapler 2003-09-18
  • 打赏
  • 举报
回复
还有人愿意写吗 ? 我照样出500.
brapler 2003-09-17
  • 打赏
  • 举报
回复
up !
Carapee 2003-09-16
  • 打赏
  • 举报
回复
写一个中间层的驱动就可以了!
你要什么样的接口?
我可以写给你。
LuckFox 2003-09-16
  • 打赏
  • 举报
回复
关注
HanZhu1 2003-09-16
  • 打赏
  • 举报
回复
看看这个可不可以
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <string.h>

typedef struct tagIPINFO
{
u_char Ttl; // Time To Live
u_char Tos; // Type Of Service
u_char IPFlags; // IP flags
u_char OptSize; // Size of options data
u_char FAR *Options; // Options data buffer
}IPINFO, *PIPINFO;

typedef struct tagICMPECHO
{
u_long Source; // Source address
u_long Status; // IP status
u_long RTTime; // Round trip time in milliseconds
u_short DataSize; // Reply data size
u_short Reserved; // Unknown
void FAR *pData; // Reply data buffer
IPINFO ipInfo; // Reply options
}ICMPECHO, *PICMPECHO;


// ICMP.DLL Export Function Pointers
HANDLE (WINAPI *pIcmpCreateFile)(VOID);
BOOL (WINAPI *pIcmpCloseHandle)(HANDLE);
DWORD (WINAPI *pIcmpSendEcho)
(HANDLE,DWORD,LPVOID,WORD,PIPINFO,LPVOID,DWORD,DWORD);

//
//
void main(int argc, char **argv)
{
WSADATA wsaData; // WSADATA
ICMPECHO icmpEcho; // ICMP Echo reply buffer
HANDLE hndlIcmp; // LoadLibrary() handle to ICMP.DLL
HANDLE hndlFile; // Handle for IcmpCreateFile()
LPHOSTENT pHost; // Pointer to host entry structure
struct in_addr iaDest; // Internet address structure
DWORD *dwAddress; // IP Address
IPINFO ipInfo; // IP Options structure
int nRet; // General use return code
DWORD dwRet; // DWORD return code
int x;

// Check arguments
if (argc != 2)
{
fprintf(stderr,"\nSyntax: pingi HostNameOrIPAddress\n");
return;
}

// Dynamically load the ICMP.DLL
hndlIcmp = LoadLibrary("ICMP.DLL");
if (hndlIcmp == NULL)
{
fprintf(stderr,"\nCould not load ICMP.DLL\n");
return;
}
// Retrieve ICMP function pointers
pIcmpCreateFile = (HANDLE (WINAPI *)(void))
GetProcAddress(hndlIcmp,"IcmpCreateFile");
pIcmpCloseHandle = (BOOL (WINAPI *)(HANDLE))
GetProcAddress(hndlIcmp,"IcmpCloseHandle");
pIcmpSendEcho = (DWORD (WINAPI *)
(HANDLE,DWORD,LPVOID,WORD,PIPINFO,LPVOID,DWORD,DWORD))
GetProcAddress(hndlIcmp,"IcmpSendEcho");
// Check all the function pointers
if (pIcmpCreateFile == NULL ||
pIcmpCloseHandle == NULL ||
pIcmpSendEcho == NULL)
{
fprintf(stderr,"\nError getting ICMP proc address\n");
FreeLibrary(hndlIcmp);
return;
}

// Init WinSock
nRet = WSAStartup(0x0101, &wsaData );
if (nRet)
{
fprintf(stderr,"\nWSAStartup() error: %d\n", nRet);
WSACleanup();
FreeLibrary(hndlIcmp);
return;
}
// Check WinSock version
if (0x0101 != wsaData.wVersion)
{
fprintf(stderr,"\nWinSock version 1.1 not supported\n");
WSACleanup();
FreeLibrary(hndlIcmp);
return;
}

// Lookup destination
// Use inet_addr() to determine if we're dealing with a name
// or an address
iaDest.s_addr = inet_addr(argv[1]);
if (iaDest.s_addr == INADDR_NONE)
pHost = gethostbyname(argv[1]);
else
pHost = gethostbyaddr((const char *)&iaDest,
sizeof(struct in_addr), AF_INET);
if (pHost == NULL)
{
fprintf(stderr, "\n%s not found\n", argv[1]);
WSACleanup();
FreeLibrary(hndlIcmp);
return;
}

// Tell the user what we're doing
printf("\nPinging %s [%s]", pHost->h_name,
inet_ntoa((*(LPIN_ADDR)pHost->h_addr_list[0])));

// Copy the IP address
dwAddress = (DWORD *)(*pHost->h_addr_list);

// Get an ICMP echo request handle
hndlFile = pIcmpCreateFile();
for (x = 0; x < 4; x++)
{
// Set some reasonable default values
ipInfo.Ttl = 255;
ipInfo.Tos = 0;
ipInfo.IPFlags = 0;
ipInfo.OptSize = 0;
ipInfo.Options = NULL;
//icmpEcho.ipInfo.Ttl = 256;
// Reqest an ICMP echo
dwRet = pIcmpSendEcho(
hndlFile, // Handle from IcmpCreateFile()
*dwAddress, // Destination IP address
NULL, // Pointer to buffer to send
0, // Size of buffer in bytes
&ipInfo, // Request options
&icmpEcho, // Reply buffer
sizeof(struct tagICMPECHO),
5000); // Time to wait in milliseconds
// Print the results
iaDest.s_addr = icmpEcho.Source;
printf("\nReply from %s Time=%ldms TTL=%d",
inet_ntoa(iaDest),
icmpEcho.RTTime,
icmpEcho.ipInfo.Ttl);
if (icmpEcho.Status)
{
printf("\nError: icmpEcho.Status=%ld",
icmpEcho.Status);
break;
}
}
printf("\n");
// Close the echo request file handle
pIcmpCloseHandle(hndlFile);
FreeLibrary(hndlIcmp);
WSACleanup();
}
brapler 2003-09-16
  • 打赏
  • 举报
回复
很简单, 只需要探测ICMP echo request就可以了, 探测到后弹出一个报警消息框就行了.
你多久能做好, 最好快点, 我保证你今晚发源码给我明天你的专家分就可多500!
brapler 2003-09-15
  • 打赏
  • 举报
回复
up.
brapler 2003-09-15
  • 打赏
  • 举报
回复
wwww2() :
请给出url, 急, 谢谢!
wwww2 2003-09-15
  • 打赏
  • 举报
回复
DDK里面有个源码,自己修改不了多少就可实现了
xiaohedou 2003-09-14
  • 打赏
  • 举报
回复
看看这个:

http://www.vckbase.com/document/viewdoc.asp?id=652

再谈突破TCP-IP过滤/防火墙进入内网(icmp篇)
作者:TOo2y

一 现状
二 ICMP协议转发数据报原理
三 QQicmp工作流程
四 QQicmp代码分析
五 小结
六 QQicmp源代码

cxf1976 2003-09-14
  • 打赏
  • 举报
回复
想想办法,up
brapler 2003-09-14
  • 打赏
  • 举报
回复
up
bbgbianbaogui 2003-09-14
  • 打赏
  • 举报
回复
up
brapler 2003-09-13
  • 打赏
  • 举报
回复
ping的源码好简单, 但探测和阻塞ICMP包的源码就难了.
bb123456789 2003-09-13
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2238/2238340.xml?temp=.4278833
brapler 2003-09-13
  • 打赏
  • 举报
回复
up !
加载更多回复(3)

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧