Skip to content

Instantly share code, notes, and snippets.

@diraol
diraol / 01_parse_of_pcaps.py
Last active February 15, 2021 11:34
Python code to parse PCAP files with openflow (1.0) messages
"""Small script to parse pcap openflow files with python-openflow library.
######################################################################
Copyright (C) 2016, Diego Rabatone Oliveira <diraol AT diraol DOT eng DOT br>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@diraol
diraol / build_nested_python_dict
Created January 9, 2018 15:47
Create a nested python dict from a list of items to be splitted
# This gist shows how to build a nested python dict
# based on a string that will be splitted based on one specific character
# It can be a list, a dict or whatever you want to.
one_level_dict = {
'2.0/jobs/create': 'POST',
'2.0/jobs/list': 'GET',
'2.0/jobs/delete': 'POST',
'2.0/jobs/get': 'GET',
'2.0/jobs/reset': 'POST',