I'm trying to use libpcap in python3 using ctypes.
given the following function in C
pcap_lookupnet(dev, &net, &mask, errbuf)
in python I have the following
pcap_lookupnet = pcap.pcap_lookupnet
mask = ctypes.c_uint32
net = ctypes.c_int32
if(pcap_lookupnet(dev,net,mask,errbuf) == -1):
print("Error could not get netmask for device {0}".format(errbuf))
sys.exit(0)
and the error i get is
File "./libpcap.py", line 63, in <module>
if(pcap_lookupnet(dev,net,mask,errbuf) == -1):
ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2
how do you deal with &blah values ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…