-2

I am new to Spark. I have pcap file. How can Spark read that file using python? How can I upload pcap file in Spark using python and how can it process?

conf = SparkConf().setMaster("local").setAppName("SparkStreamingPcap")
sc = SparkContext(conf = conf)
sc.setLogLevel("ERROR")
spark = SparkSession(sc)
FileLog = sc.textFile("pcapFiles/ipv4frags.pcap")
df = FileLog.map(lambda line: line.split("\n"))
print("Helloo")
print (df.count())
Zainub Wahid
  • 251
  • 2
  • 6

1 Answers1

1

You could also try using dpkt or scapy to parse pcap files in pyspark code.

Vijay Anand Pandian
  • 1,027
  • 11
  • 23
  • True: indeed, you can’t read a pcap as text but as binary with its own format. You’ll have to implement magic handling and lots of stuff if not using an already existing API – Cukic0d Sep 28 '18 at 15:51