Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
pcap-fuzzer
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
smart-home-network-security
pcap-fuzzer
Validations
470023d5
Valider
470023d5
rédigé
2 years ago
par
François De Keersmaeker
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Rebuild each packet to fix timestamp bug
parent
e3a6249e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/packet/Packet.py
+8
-1
8 ajouts, 1 suppression
src/packet/Packet.py
src/pcap_tweaker.py
+12
-2
12 ajouts, 2 suppressions
src/pcap_tweaker.py
avec
20 ajouts
et
3 suppressions
src/packet/Packet.py
+
8
−
1
Voir le fichier @
470023d5
...
...
@@ -171,6 +171,13 @@ class Packet:
return
len
(
self
.
packet
.
getlayer
(
layer
))
def
rebuild
(
self
)
->
None
:
"""
Rebuild packet.
"""
self
.
packet
=
self
.
packet
.
__class__
(
bytes
(
self
.
packet
))
def
update_checksums
(
self
)
->
None
:
"""
Update packet checksums, if needed.
...
...
@@ -184,7 +191,7 @@ class Packet:
transport_layer
.
delfieldval
(
"
len
"
)
if
hasattr
(
transport_layer
,
"
chksum
"
):
transport_layer
.
delfieldval
(
"
chksum
"
)
self
.
packet
=
self
.
packet
.
__class__
(
bytes
(
self
.
packet
)
)
self
.
rebuild
(
)
def
get_dict_log
(
self
,
field
:
str
,
old_value
:
str
,
new_value
:
str
)
->
dict
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/pcap_tweaker.py
+
12
−
2
Voir le fichier @
470023d5
...
...
@@ -45,6 +45,16 @@ def must_edit_packet(i: int, packet_numbers: list, random_range: int) -> bool:
return
is_specified
or
is_random
def
rebuild_packet
(
packet
:
scapy
.
Packet
)
->
scapy
.
Packet
:
"""
Rebuild a Scapy packet from its bytes representation.
:param packet: Scapy packet
:return: Rebuilt Scapy packet
"""
return
packet
.
__class__
(
bytes
(
packet
))
def
tweak_pcaps
(
pcaps
:
list
,
output
:
str
,
random_range
:
int
=
1
,
packet_numbers
:
list
=
None
,
dry_run
:
bool
=
False
)
->
None
:
"""
Main functionality of the program:
...
...
@@ -90,7 +100,7 @@ def tweak_pcaps(pcaps: list, output: str, random_range: int = 1, packet_numbers:
my_packet
=
Packet
.
init_packet
(
packet
,
i
)
except
ValueError
:
# No supported protocol found in packet, skip it
new_packets
.
append
(
packet
)
new_packets
.
append
(
rebuild_packet
(
packet
)
)
pass
else
:
d
=
my_packet
.
tweak
()
...
...
@@ -103,7 +113,7 @@ def tweak_pcaps(pcaps: list, output: str, random_range: int = 1, packet_numbers:
# Packet won't be edited
# Go to next packet
i
+=
1
new_packets
.
append
(
packet
)
new_packets
.
append
(
rebuild_packet
(
packet
)
)
# Write output PCAP file
output_pcap
=
""
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter