- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一名学生,试图了解更多关于 C# 中的 ARP 和套接字的信息
为此,我尝试使用原始 Socket
发送 ARP 请求和回复。在 C# 中。
我已经在一个字节数组中手动重建了一个 ARP 回复,我正在尝试使用 Socket.Send
发送它。方法。
static void Main(string[] args)
{
// Create a raw socket
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw);
// Setup ARP headers
byte[] buffer = new byte[]
{
0x34, 0x97, 0xf6, 0x22, 0x04, 0xe8, // Ethernet Destination mac
0x70, 0x1c, 0xe7, 0x51, 0x94, 0x0b, // Ethernet source mac
0x08, 0x06, // Type: ARP
00, 0x01, // Hardware type: Ethernet
0x08, 0x00, // Protocol type: IPv4
0x06, // Hardware size: 6
0x04, // Protocol size: 4
00, 0x02, // Opcode: Reply
0x70, 0x1c, 0xe7, 0x51, 0x94, 0x0b, // Sender mac addr
0xc0, 0xa8, 0x01, 0x34, // Sender IP addr 192.168.1.52
0x34, 0x97, 0xf6, 0x22, 0x04, 0xe8, // Target mac addr
0xc0, 0xa8, 0x01, 0x01 // Target ip addr 192.168.1.1
};
// Send ARP reply
socket.Send(buffer, buffer.Length, SocketFlags.None);
Console.ReadKey();
}
SocketException
:
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
Socket
正确发送 ARP 回复(/request) ?
最佳答案
过了一会儿,我忘记了这个问题,但从 an article my teacher showed me about Raw Sockets in a WinSock annex on MSDN 得到了答案.
关于这个问题,本文的一部分特别有趣:
原始套接字的限制
在 Windows 7、Windows Vista、带有 Service Pack 2 (SP2) 的 Windows XP 和带有 Service Pack 3 (SP3) 的 Windows XP 上,通过原始套接字发送流量的能力受到以下几种方式的限制:
UDP datagrams with an invalid source address cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped. This change was made to limit the ability of malicious code to create distributed denial-of-service attacks and limits the ability to send spoofed packets (TCP/IP packets with a forged source IP address).
关于C# 原始套接字 ARP 回复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49608790/
我需要在本地网络中查找 MAC 地址并且我使用的是 Linux。我所做的是使用 libnet 发送一个 ARP 请求,但是在我发送 3 个请求后,缓存仍然不会更新。我使用 wireshark 来捕获数
我正在尝试学习 ARP 协议(protocol)。我对 ARP 的看法是,它是一种有助于将 IP 寻址到确切 MAC 地址的协议(protocol)。 但是当我尝试这样做时: arp -a 我认为它将
因此,在我玩过 Digitalsquid 开发的 Network Spoofer (http://digitalsquid.co.uk/netspoof/) 之后,我一直试图通过编写一个执行某些操作的
我目前正在编写一个发送 arp 请求的小程序,该程序似乎可以工作,因为 wireshark 捕获了数据包,但有一些奇怪的地方;首先,目标主机没有收到数据包(我没有收到任何响应,甚至在目标上运行 wir
我们有一个运行 Windows XP Embedded SP1 的产品。我们在 ARP 表中为假 IP 配置假(不存在)MAC 地址。当发生通信时,Windows 将数据包发送到伪造的 MAC 和伪造
我试图在 Linux 中将 ARP 绑定(bind)添加到 ARP 表中,我的 arp 表如下所示: IP address HW type Flags HW addre
使用 ARP 表,我们可以访问 Android 9 及更早版本的热点连接设备的 IP 和 MAC。现在来自 Android 10 的权限被拒绝。请建议我如何在 Android 10 中访问连接设备的
我正在尝试在 Linux 上用 c 语言制作一个简单的 arp 欺骗程序(主要是为了更好地理解低级网络)。到目前为止,我成功地创建了一个 arp 请求并获得了带有目标和网关 mac 地址的 arp 回
我需要在任意 IP 网络上存储对第三方设备的持久引用,其中设备的 IP 地址可能是静态的或由 DHCP 随机分配的。我不控制网络上的设备,我不能依赖 DNS 和其他现有的或与设备一起使用的临时网络协议
Scapy 文档给出了以下 ARP 缓存中毒的例子: send(Ether(dst=clientMAC)/ARP(op="who-has", psrc=gateway, pdst=client)) 问
我正在尝试在我的 android 设备上调用“arp -a”,但由于它仅适用于 pc - 我该如何更改?有没有办法访问 arp -a 给你的 IP 地址列表,但是在 android 上? 我的代码在a
我正在从事一个网络安全项目,我注意到一些我无法解释的事情: 为什么我们需要arp中的源硬件地址字段?它不是已经包含在以太网 header 中了吗? 最佳答案 ARP 是这样设计的,因此它可以在其他硬件
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我正在通过 PC1 向 PC2 发送数据,两者都是 Linux 2.6 内核机器。此传输将需要几个小时。 PC1 中的 ARP 缓存过时超时设置为 50 秒。因此在数据传输期间,PC1 每隔 50 秒
我需要编写一个java程序,获取所有计算机网络接口(interface)并扫描子网内的IP地址和MAC地址。 我不太确定该怎么做,但我发现有一个方法叫做: Arping.scan(deviceName
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我需要一些可在 Linux 下编译的 C 或 C++ 代码,以便能够获取一些任意数量的远程主机的 IP 地址列表,并为每个主机获取一个以太网 MAC 地址。这些主机可能在同一个子网上,也可能在路由器后
我一直在尝试找出将 Linux ARP 表复制到数组中的最佳方法,我只需要 IP 和 MAC 地址。我试过复制/proc/net/arp 文件,但我发现这不是最好的方法,我读到除了 ARP(IPv6
我需要编写一个程序来显示这些信息: 网络统计 TCP/UDP 连接 有关IP的信息 ipconfig/all arp-a 路线图 我已经有了其中的大部分,但是我在 route print 和 arp
我正在为 WiFi direct 编写一个应用程序,它使用我通过另一种方法(有效)传输的 mac 地址,客户端将使用 ARP 表查找主机的 IP,因为 groupownerintent 在全部在安卓上
我是一名优秀的程序员,十分优秀!