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 Basics Shivi 0 904 Sep-25-2023, 07:37 AM
Last Post: Shivi
  How to send a HTTP response packet using scapy JeffreyStoner 0 2,629 Apr-18-2022, 05:23 AM
Last Post: JeffreyStoner
  How to get every IP found by a Scapy traceroute? jao 0 2,435 Feb-06-2022, 01:00 AM
Last Post: jao
  scapy wifi scan to get payload \ data korenron 0 2,110 Nov-16-2021, 01:47 PM
Last Post: korenron
  can I set scan interval for scapy? korenron 0 2,305 Dec-31-2020, 01:43 PM
Last Post: korenron
  scapy trazom 1 2,607 Aug-30-2020, 04:17 PM
Last Post: micseydel
  network and scapy trazom 0 2,043 Aug-16-2020, 03:54 PM
Last Post: trazom
  Pyshark filter message ziv_t 0 2,067 Apr-03-2020, 10:21 PM
Last Post: ziv_t
  Need Help with creating an IP packet with timestamp field using Scapy RTD 0 3,432 Jun-15-2019, 08:21 PM
Last Post: RTD
  Scapy, creating response for GET request. SyRex1013 4 5,077 Dec-11-2018, 07:39 AM
Last Post: SyRex1013

Forum Jump:

User Panel Messages

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