|
团队决策人
  
E.S.T顾问团首席顾问 - 帖子
- 617
- 精华
- 22
- 积分
- 4944
- 阅读权限
- 255
- 在线时间
- 1706 小时
- 注册时间
- 2005-1-7
- 最后登录
- 2008-5-14
|
楼主
大 中
小 发表于 2007-9-23 22:54 只看该作者
[转载]ipguard 0.04 for Linux patch
信息来源:邪恶八进制信息安全团队( www.eviloctal.com) Code Language : Diff *** packet.c.orig 2005-08-22 21:46:48.000000000 +0800 --- packet.c 2007-09-23 22:46:38.000000000 +0800 *************** *** 27,32 **** --- 27,34 ---- #include <sys/types.h> #include <sys/socket.h> + #include <time.h> + #include <netinet/ether.h> #ifdef __OpenBSD__ # include <net/if.h> # include <net/if_arp.h> *************** *** 302,314 **** --- 304,319 ---- for (n = 0, p = pairs; n < pair_num; n++, p++) { if (!memcmp(&zp_addr, &p->ip, sizeof(struct in_addr))) { + /* wildcard IP */ if (!memcmp(&sh_addr, &p->mac, sizeof(struct ether_addr))) { zip++; if (!addr_nosubst) return; } } if (!memcmp(&zh_addr, &p->mac, sizeof(struct ether_addr))) { + /* wildcard MAC */ if (!memcmp(&sp_addr, &p->ip, sizeof(struct in_addr))) { zmac++; if (!addr_nosubst) return; } } if (!memcmp(&sh_addr, &p->mac, sizeof(struct ether_addr))) { if (!memcmp(&sp_addr, &p->ip, sizeof(struct in_addr))) { good++; return; } + /* listed MAC but IP is not */ if (verbose) { snprintf(s, 128, \"%s %-15s\", ether_ntoa(&sh_addr), inet_ntoa(sp_addr)); snprintf(s, 128, \"%s %-15s\", s, inet_ntoa(tp_addr)); *************** *** 316,328 **** --- 321,338 ---- } bip++; warn++; } else if (!memcmp(&sp_addr, &p->ip, sizeof(struct in_addr))) { + /* listed IP but MAC is not*/ if (verbose) { snprintf(s, 128, \"%s %-15s\", ether_ntoa(&sh_addr), inet_ntoa(sp_addr)); snprintf(s, 128, \"%s %-15s\", s, inet_ntoa(tp_addr)); log_str(NOTICE, \"bmac:\", s); } bmac++; warn++; + } else if (!memcmp(&tp_addr, &p->ip, sizeof(struct in_addr))) { + /* weird gratuitous ARP (Linux, MacOS, Vista) */ + if (!memcmp(&zp_addr, &sp_addr, sizeof(struct in_addr))) { return; } } + } if (!warn) { *************** *** 341,348 **** --- 351,360 ---- if (buffer_num) buffer_add(); + /* do not block gratuitous ARP if hidden mode */ if (!memcmp(&sp_addr, &tp_addr, sizeof(struct in_addr))) { bent++; if (hidden) return; } + /* block evil IP */ if (!read_only) packet_sendfake(); }
Parsed in 0.013 seconds Libnet 1.0.2a
幸福,那就是……我饿了,看别人手里拿个肉包子,那他就比我幸福;我冷了,看别人穿了一件厚棉袄,他就比我幸福;我想上茅房,就一个坑,你蹲那了,你就比我幸福。
|