|
[求助]宽带连接下使用winpcap的问题
处理了, 协议层次 : 以太 - PPOE - IP - TCP |
|
[求助]宽带连接下使用winpcap的问题
PPP协议也封装了,发送不出去。问题不在这。 发现了一个问题,winpcap可以枚举到一个设备,但是从设备结构体中遍历地址时发现都是0,不知道是这么回事 代码片段: int Result = pcap_findalldevs(&NetwokDevice, WinpcapError); if (Result == - 1) { printf("pcap_findalldevs Error"); return 0; } for (Device = NetwokDevice, i = 0; Device && i < 10; Device = Device->next, i++) { printf("Number %d:", i); printf("%s:", Device->name); printf("%s\n", Device->description); sprintf(DeviceName[i], "%s", Device->name); } for (;;) { printf("Please Choose the Device Number:(0-%d)", i - 1); scanf("%d", &DeviceIndex); if (DeviceIndex > i - 1 || DeviceIndex < 0) { printf("Device Number Error\n"); continue; } else break; } for (Device = NetwokDevice, i=0; i<DeviceIndex; i++) { Device = Device->next; } DWORD dwHostIP; pcap_addr* adds = Device->addresses; while (adds) { if (adds->addr/* && ((sockaddr_in *)(adds->addr))->sin_family == AF_INET*/) { dwHostIP = ((sockaddr_in *)(adds->addr))->sin_addr.S_un.S_addr; printf("IP: %x\n", dwHostIP); if (dwHostIP!=0) { struct in_addr stInAddr; unsigned int iTemp = dwHostIP; stInAddr.s_addr=iTemp; char *pIp=inet_ntoa(stInAddr); printf("host ip %s\n", pIp); //此处打出来的地址都是0 } } adds = adds->next; } |
|
[求助]宽带连接下使用winpcap的问题
thanks~ 你说的抓包吗?抓包倒是可以抓到PPP协议封装的包。 我说的是winpcap枚举物理网卡,只获得一个: Number 0:\Device\NPF_{2FBCA9A9-7723-4FFC-B025-188E396144A5}:Intel(R) 82566DM-2 G igabit Network Connection Please Choose the Device Number:(0-0)0 然后用GetAdapterInfo函数后去适配器,有两个: \Device\NPF_{669A51AE-9527-4EC4-9A1F-F8FC44FE0756} 本机IP地址为:117.28.215.124 本机MAC为:00-00-00-00-00-00 网关IP地址为:0.0.0.0 \Device\NPF_{2FBCA9A9-7723-4FFC-B025-188E396144A5} 本机IP地址为:169.254.233.235 本机MAC为:00-23-AE-61-81-3E 网关IP地址为:0.0.0.0 网关IP都是0,不知为何? 我用宽带的IP和下面的MAC地址填进数据包,发送不出去。怀疑是winpcap没有枚举到宽带的那个设备。 |
|
|
|
[求助]宽带连接下使用winpcap的问题
谢谢 dppdpp 和 gougous的解答,按照你们的提示再摸索下!! |
|
[求助]宽带连接下使用winpcap的问题
谢谢解答! 你的两句代码貌似是C#的,我用的是VC... 暂时还不想改用C#,不知道宽带连接跟下面的本地连接是否属于一块网卡上,不懂 |
|
[公告] 《2015移动安全挑战赛》100,000元奖金等你赢![比赛结束]
看雪的魅力无限啊,阿里都来投了,强势围观 |
|
[原创]AES算法之理论与编程结合篇
可以选一两种常用的好好学学,难度太大的就只好用咯 |
|
[原创]AES算法之理论与编程结合篇
自己先坐沙发... |
|
[翻译]逆向工程之恶意程序Part1
之前我也一直在等第二部分出来,但是作者没有继续了。。。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值