Python Forum
sniffing real time with pyshark or scapy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sniffing real time with pyshark or scapy
#1
Hello , i'am looking for a way to sniff the traffic in real time and save it on a cap file or csv so i can load it in logstash .
(i tried pyshark but i got a none csv file format while opening the file)

import os
import pyshark

#sniff de l'interface en temps réel
fichier = open("sniff.csv", "w") #création du fichier qui contiendra les capture
#Faire Une boucle infini
capture = pyshark.LiveCapture(interface ='eth0',decryption_key='',encryption_type='wpa-psk')
capture.sniff (timeout=10)
for pkt in capture:
pkt = str(pkt) #conversion en chaine de caractère
fichier.write(pkt) #Ecrtit le resultat mais pas sur le bon format







Thank you
Reply
#2
I don't get the file error.
You should probably use the csv package if you need output to be csv
but this has nothing to do with your error.
Reply
#3
can i send you some screenshots by email ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  scapy wifi scan to get payload \ data korenron 0 184 Nov-16-2021, 01:47 PM
Last Post: korenron
  can I set scan interval for scapy? korenron 0 906 Dec-31-2020, 01:43 PM
Last Post: korenron
  scapy trazom 1 1,223 Aug-30-2020, 04:17 PM
Last Post: micseydel
  network and scapy trazom 0 885 Aug-16-2020, 03:54 PM
Last Post: trazom
  Pyshark filter message ziv_t 0 943 Apr-03-2020, 10:21 PM
Last Post: ziv_t
  Need Help with creating an IP packet with timestamp field using Scapy RTD 0 1,946 Jun-15-2019, 08:21 PM
Last Post: RTD
  Scapy, creating response for GET request. SyRex1013 4 2,982 Dec-11-2018, 07:39 AM
Last Post: SyRex1013
  Failed to recieve scapy udp packet SkyAmryBoi 1 2,501 Sep-29-2017, 01:26 PM
Last Post: camp0
  Scapy route6 configuration peterkl 0 2,510 Mar-06-2017, 03:58 PM
Last Post: peterkl
  Scapy Beacon Frames peterkl 1 4,104 Feb-28-2017, 09:00 PM
Last Post: peterkl

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020