python - scapy: struct.error: cannot convert argument to integer -


i'm using scapy write construct network packets , write pcap file. i'm getting struct.error: cannot convert argument integer error while writing them, although converted tcp port numbers unsigned short using ctypes in python.

def create_packet(sip, dip, sport, dport, payload):       sp = ctypes.c_ushort(sport)       dp = ctypes.c_ushort(dport)       packet = ip(src = sip, dst = dip)/tcp(sport=sp,                 dport=dp)/str(payload.replace(' ','').decode("hex"))       return packet  def write_packet(file, pkt):       wrpcap(file, pkt, append=true)  

edit#1: error due huge payload string passing write pcap function.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -