- 论坛徽章:
- 0
|
上周五,公司内网有人占用我的私人IP,搞的我上不了网,很是恼火,
由于公司内网有很多机器,不可能主动查找出事谁
所以想起来发送免费ARP似乎可以解决这个问题,于是就用python libnet库写了一个脚本发送ARP
估计对方发现这个IP冲突了,对方很快就释放了
可能是同事无意占用了我的IP
上传脚本,可能对大家有用,
- #!/usr/bin/python
- import sys
- import libnet
- from libnet.constants import *
- l = libnet.context(
- LINK, # The injection type
- 'eth0' # Device name
- )
- dst_ip = l.name2addr4(
- '10.0.0.9', # Let's get the network byte ordered representation of this IP
- DONT_RESOLVE
- )
- dst='ffffffffffff'
- dst_mac = dst.decode("hex")
- src='001d92e08f26'
- src_mac = src.decode("hex")
- arp_tag = l.autobuild_arp(
- 1,
- #l.get_hwaddr(),
- src_mac,
- dst_ip,
- dst_mac,
- dst_ip,
- )
- eth_tag = l.autobuild_ethernet(
- dst_mac,
- 0x0806,
- )
- # Now let's write the packet and check for an error
- # tcp syn google.com
- import time
- while 1:
- time.sleep(10)
- l.write()
- #l.write()
复制代码 |
|