如何在C#中发送ARP请求以及要使用的库 [英] How do i send an ARP request in C# and which library to use

查看:474
本文介绍了如何在C#中发送ARP请求以及要使用的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一种执行中间人"攻击的软件,为此,我需要发送虚假的ARP请求.

I'm trying to develop a software that perform a "man in the middle" attack, and for that I need to send false ARP requests.

推荐答案

我假设您要欺骗 ARP 回复 . ARP 是一种链路层(L2)协议.要从用户模式在此层欺骗数据包,需要使用原始套接字(通常是TCP/负责此工作的内核中的IP堆栈.

I'm assuming you want to spoof ARP replies. ARP is a Link Layer (L2) protocol. To spoof packets at this layer from user mode requires using Raw Sockets (as it is usually the TCP/IP stack in the kernel who takes care of this).

换句话说,您不会在Windows中使用任何常见的/健全机制在C#中执行此操作.

In other words, you're not going to do it on Windows in C# with any sort of common / sane mechanism.

SendARP 可以使用Win32 API调用,但仅出于合法目的而存在:

The SendARP Win32 API call is available, but it is only there for this legitimate purpose:

...发送地址解析协议(ARP)请求以获取与指定的目标IPv4地址相对应的物理地址

... sends an Address Resolution Protocol (ARP) request to obtain the physical address that corresponds to the specified destination IPv4 address

(这些原因并非微不足道.)

(There's a reason these things are not trivial.)

这篇关于如何在C#中发送ARP请求以及要使用的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆