Haskell软件包import socket
import struct
import binascii
raw = socket.socket(socket.PF_PACKET, socket.SOCK_RAW,
socket.ntohs(0x0806))
raw.bind(("wlp3s0",socket.htons(0x0806)))
mac_local = ''
ip_local = "192.168.1.6"
mac_dest = ''
ip_dest = "192.168.1.4"
type_hardware = 1
type_protocol = 0x0800
len_hardware = 6
len_protocol = 4
op = 2
src_ip = socket.inet_aton(ip_local)
dest_ip = socket.inet_aton(ip_dest)
mac_dest_byte_order = binascii.unhexlify(mac_dest.replace(":", ""))
mac_src_byte_order = binascii.unhexlify(mac_local.replace(":", ""))
# Ethernet frame
protocol = 0x0806
ethernet_frame = struct.pack("!6s6sH", mac_dest_byte_order,
mac_src_byte_order, protocol)
arp_header = struct.pack("!HHBBH6s4s6s4s",type_hardware,
type_protocol,
len_hardware,
len_protocol,
op,
mac_src_byte_order,
src_ip,
mac_dest_byte_order,
dest_ip)
pkt = ethernet_frame + arp_header
while True:
raw.send(pkt)
provides instructions用于为可执行文件创建bash完成脚本,然后建议这样做
应随程序一起提供,并在安装过程中通常复制到适当的目录(
optparse-applicative
)。
我希望随包一起发送和安装此脚本,以及可执行文件。如何指示Cabal(在我的.cabal中)进行
/etc/bash_completion.d/
吗?