我是刚毕业的学生,大家帮帮我吧,再做不出来,就要被公司淘汰了!
解决方案 »
- 公司不能用QQ,想做一个能代替QQ连接到腾讯服务器的简单聊天界面?
- Unhandled exception in CollectData.exe (KERNEL32.DLL):0xC0000005:Access Violation.
- [交流]关于对话框DoModal()函数调用失败的原因分析
- (顶级难度)诚信请教高手!--如何调整菜单栏 MenuBar 位置?
- 请问如何在线程中使用ADO
- ● 谁有WinIO类操作并口的代码 我不懂这个 想学一下 万分感激
- 请问各位都用什么开发数据库?包括语言,开发工具,使用的数据库技术。进者有分。
- 有了dll和它的.h头文件,怎么调用还是无法调用啊!!
- 请问现在大家做帮助一般用什么软件?谢谢!
- DDN网络系统组建?
- 动态添加控件-------(在线等待 )
- 有关可行性报告!
太难了记得以前在http://shotgun.xici.net
上有一个sniffer的源代码叫gunsniffer
你去找找不知道你说的是要截获别人的IPX包还是想自定义IPX包头来收发
如果想自定义IPX包来收发
用原始套接字试一试如果要截获别人的包
那就更难了
但是具体在什么地方忘记了
我把我的程序和系统自自带的网络监视器对比,发现IP包我都收到了,但是用IPX的就没有收到!我要截的包是截自己机器上的别人发过来的包,用sniffer没有问题!现在就是想试出IPX怎么收到!
ipxdump/ipxparse (ftp://platan.vc.cvut.cz/pub/linux/ncpfs/latest/*.tgz).
If you need something more detailed, there is
ftp://platan.vc.cvut.cz/pub/linux/ncpfs/ncpanal-0.02.tgz
all above work in LinuX.and I find a MFC example from codeproject.
http://www.codeproject.com/internet/ipxcheck.asp
而是网段地址和网卡地址,别的都一样
主要就这点区别
你自己再查查资料
....................
但用
m_s = socket( AF_IPX , SOCK_RAW , NSPROTO_IPX ) ;
程序就会出错!
(用m_s = socket( AF_INET , SOCK_RAW , IPPROTO_IP)不会!)
................
能不能也用原始套接字来截IPX包!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/errno.h>#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netipx/ipx.h>#define IPX_DATA_LEN 20#define IPXPROTO_NETBIOS 20u_short checksum(u_short * data,u_short length)
{
register long value;
u_short i;
for(i=0;i<(length>>1);i++)
value+=data[i];
if((length&1)==1)
value+=(data[i]<<8);
value=(value&65535)+(value>>16);
return(~value);
}
int main(int argc, char ** argv)
{
struct sockaddr_ipx sipx;
int sock,err;
char buffer[sizeof(struct ipx)+IPX_DATA_LEN];
struct ipx * ipxheader=(struct ipx *)buffer;
struct ipx_addr addr;
char src_addr[30];
char dst_addr[30];
char sck_addr[30];
if (argc<3)
{
fprintf(stderr,"usage: %s src_ipx_addr dst_ipx_addr\n",argv[0]);
return (-1);
}
bzero(&sipx,sizeof(struct sockaddr_ipx));
sipx.sipx_family=AF_IPX;
bzero(&buffer, sizeof(struct ipx)+IPX_DATA_LEN);
ipxheader->ipx_len=sizeof(struct ipx)+IPX_DATA_LEN;
ipxheader->ipx_tc =0;
ipxheader->ipx_pt =IPXPROTO_NETBIOS;
addr=ipx_addr(argv[2]);
bcopy(&addr, &sipx.sipx_addr, sizeof(struct ipx_addr));
bcopy(&addr,&ipxheader->ipx_dna, sizeof(struct ipx_addr));
addr=ipx_addr(argv[1]);
bcopy(&addr,&ipxheader->ipx_sna, sizeof(struct ipx_addr)); ipxheader->ipx_sum=0;//checksum((u_short *)ipxheader, sizeof(struct ipx)
); if ((sock=socket(PF_IPX,SOCK_RAW,IPXPROTO_RAW))==-1)
{
fprintf(stderr,"couldn't allocate raw socket\n");
return (-1);
} sprintf(sck_addr,"%s",ipx_ntoa(sipx.sipx_addr));
sprintf(src_addr,"%s",ipx_ntoa(ipxheader->ipx_sna));
sprintf(dst_addr,"%s",ipx_ntoa(ipxheader->ipx_dna));
if((err=sendto(sock, buffer, sizeof(struct ipx)+IPX_DATA_LEN, 0, (struct sockad
dr *) &sipx, sizeof(struct sockaddr_ipx)))==-1)
{
fprintf(stderr,"couldn't send packet\n");
fprintf(stderr,"%s : %s -> %s\n",sck_addr,src_addr,dst_addr); switch(errno)
{
case EBADF: { fprintf(stderr,"EBADF\n"); break; }
case EACCES: { fprintf(stderr,"EACCES\n"); break;}
case ENOTSOCK: { fprintf(stderr,"ENOTSOCK\n");break;}
case EFAULT: { fprintf(stderr,"EFAULT\n"); break;}
case EMSGSIZE: { fprintf(stderr,"EMSGSIZE\n"); break;}
case EAGAIN: { fprintf(stderr,"EAGAIN\n"); break;}
case ENOBUFS: { fprintf(stderr,"ENOBUFS\n"); break;}
case EHOSTUNREACH: { fprintf(stderr,"EHOSTUNREACH\n"); break;}
default: { fprintf(stderr,"%d: unknown error\n",errno); break;}
}
return (-1);
}
fprintf(stderr,"IPX packet was sent:\n%s : %s -> %s\n",sck_addr,src_addr,dst_ad
dr);
return (0);
}
#include <sys/errno.h>#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netipx/ipx.h>这些头文件我去什么地方下载,我的机器上没有
上大学的时候在学校做过一点的。
是直接调用的netware 的中断,(书上讲的这么做)
想用ipx写一个聊天的程序
做了几个月,能传通数据了,
但是,老出问题,(水平低了)
你要吗?
是全dos的。
谢谢,只要能把数据发出来就行,不要很稳定![email protected]麻烦你也告诉我网卡地址在IPX里面怎么定义!
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netipx/ipx.h>哪里有下载,我找了两小时在网上都没有找到!