This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
def validate_workday(date_to_check): | |
# valid work days | |
# Monday = 1 | |
# Tuesday = 2 | |
# Wednesday = 3 | |
# Thursday = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
This Python script is designed to colorize specific words in a string of | |
text. The colorized text is written to the console. | |
""" | |
__author__ = 'John Bumgarner' | |
__date__ = 'June 25, 2021' | |
__status__ = 'Production' | |
__license__ = 'MIT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
This Python script is designed to colorize specific words in a string of | |
text. The colorized text is written to an HTML file. | |
""" | |
__author__ = 'John Bumgarner' | |
__date__ = 'June 24, 2021' | |
__status__ = 'Production' | |
__license__ = 'MIT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################################################### | |
# The re module is part of the standard Python library which regular expression | |
# matching operations similar to those found in Perl. | |
###################################################################################### | |
import re as regex | |
###################################################################################### | |
# The email module is part of the standard Python library which provides | |
# functions for reading, writing, and sending simple email messages. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################################################### | |
# The concurrent.futures module is part of the standard Python library which provides | |
# a high level API for launching asynchronous tasks. | |
###################################################################################### | |
import concurrent.futures | |
############################################################################################# | |
# The OS module in provides functions for interacting with the operating system. | |
# | |
# os.path() provides various functions to handle pathnames. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################################################### | |
# The concurrent.futures module is part of the standard Python library which provides | |
# a high level API for launching asynchronous tasks. | |
###################################################################################### | |
import concurrent.futures | |
###################################################################################### | |
# The Python module Pillow is the folk of PIL, the Python Imaging Library | |
# reference: https://pillow.readthedocs.io/en/3.0.x/index.html | |
###################################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract_http_information(packet): | |
""" | |
This function is designed to extract the HTTP information from IPv4 and ICMPv6 packets. | |
:param packet: PCAP packet | |
:return: | |
""" | |
try: | |
if 'IPv4' in str(packet.layers[0]) and 'HTTP' in str(packet.layers): | |
source_address = packet.ip.src | |
destination_address = packet.ip.dst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use with pyshark | |
def extract_dns_information(packet): | |
""" | |
This function is designed to extract DNS elements from a PCAP packet. | |
:param packet: PCAP packet | |
:return: | |
""" | |
if hasattr(packet, 'udp') and packet[packet.transport_layer].dstport == '53': | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use with pyshark | |
def extract_ipv6_information(packet): | |
""" | |
This function is designed to extract specific IPv6 elements from a PCAP packet. | |
:param packet: PCAP packet | |
:return: | |
""" | |
try: | |
if 'IPV6' in str(packet.layers): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use with pyshark | |
import re as regex | |
def extract_conversation_header(packet): | |
""" | |
This function is designed to extract the conversation header information | |
from IPv4 or ICMPv6 packets. | |
:param packet: PCAP packet | |
:return: {protocol} {source_address}:{source_port} --> {destination_address}:{destination_port} |
NewerOlder