Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement shell code to prevent ARP attacks

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to achieve the shell code to prevent ARP attacks, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The code is as follows:

#! / bin/bash

Declare gw= `route-n | grep-e'^ 0.0.0.0`

Declare gwname= `echo $gw | grep-oe'\ walled echo'`

Declare gwip= `echo $gw | grep-oe'[0-9]\ {2Magne3\}\. [0-9]\ {1Magne3\}\. [0-9]\ {1Magne3\}\. [0-9]\ {1recover3\}'`

Declare gwmac= `arp-n | grep-e $gwip | grep-oe'[0-9A-F]\ {2\}: [0-9A-F]\ {2\}: [0-9A-F]\ {2\}: [0-9A-

F]\ {2\}: [0-9A-F]\ {2\}: [0-9A-F]\ {2\}'`

Echo "switch $gwname arp: $gwip-$gwmac to static"

Arp-s $gwip $gwmac

Echo "done, off arp reuqest..."

Ifconfig $gwname-arp

Echo "all done."

The method of solving ARP attack under linux

Users under Windows can use antiArp Firewall, which can basically solve the problem, but what about brothers and sisters who like linux? that's what bothers me today.

I use fedora core 6, I first hang up several image files, search with the keyword arp, and find arptables, and arpwatcher is first of all arpwatcher, it seems that it can only monitor the local ip/arp address change and so on, it does not seem to prevent arp attacks. When I looked at arptables, I immediately thought of iptables. When I installed it, sure enough, the command line was exactly the same. But here's the problem: it's easy to keep this machine free from arp attacks (just bind it with static arp), but other people's gateways will still be attacked, we are not network administrators, and I can only "watch from afar but not play with them"!

When the road was blocked, we changed our way, and arping caught my eye. When I returned to shell, I found that la had been installed:

"arping-send ARP REQUEST to a neighbour host" arping [- AbDfhqUV] [- c count] [- w deadline] [- s source]-I interface destination-U Unsolicited ARP mode to update neighbours' ARP caches. No replies are expected.

Key commands:

Arping-U-I network card interface for sending packets-s source ip destination ip

Example:

Suppose the ip corresponding to your eth0 interface is 192.168.1.1 and the gateway is 192.168.1.255, you can use it.

Arping-U-I eth0-s 192.168.1.1 192.168.1.255

The above is all the contents of the article "how to implement shell code to prevent ARP attacks". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report