Skip to content

Instantly share code, notes, and snippets.

View EONRaider's full-sized avatar
💀
Start The World

EONRaider

💀
Start The World
  • Curitiba, Brazil
View GitHub Profile
@EONRaider
EONRaider / keybase.md
Created June 11, 2020 14:43
keybase.md

Keybase proof

I hereby claim:

  • I am eonraider on github.
  • I am eonraider (https://keybase.io/eonraider) on keybase.
  • I have a public key ASCJEi_PalH4GZmzMPxDozNkedPapTiJpKrgegb2A6e1SAo

To claim this, I am signing this object:

@EONRaider
EONRaider / validate_mac.py
Last active August 19, 2024 23:43
Validate a MAC address using REGEX in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/c34f6799b9cf2259e90fce54a39d693c
__author__ = 'EONRaider, keybase.io/eonraider'
import re
def validate_mac(mac_address: str) -> bool:
is_valid_mac = re.match(r'([0-9A-F]{2}[:]){5}[0-9A-F]{2}|'
@EONRaider
EONRaider / randomize_mac.py
Last active October 23, 2020 18:50
Generate a random MAC address in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/ebda160f27ce0a09f1ab1c7733ba0e8c
__author__ = 'EONRaider, keybase.io/eonraider'
import random
def randomize_mac(*, sep: str = ':') -> str:
"""
Generates random MAC addresses in the format XX:XX:XX:XX:XX:XX by
@EONRaider
EONRaider / get_ip_address.py
Last active August 17, 2024 18:47
Get the IP address of a network interface in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/3b7a8ca433538dc52b09099c0ea92745
__author__ = 'EONRaider, keybase.io/eonraider'
import fcntl
import socket
import struct
try:
from netifaces import AF_INET, ifaddresses
@EONRaider
EONRaider / interface_info.py
Last active October 24, 2020 11:01
Get the IP, MAC, netmask and broadcast addresses of a network interface in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/f2284ccf75613c8751e20062b9e750f3
__author__ = 'EONRaider, keybase.io/eonraider'
try:
import netifaces
except ModuleNotFoundError as e:
raise SystemExit(f"Requires {e.name} module. Run 'pip install {e.name}' "
f"and try again.")
@EONRaider
EONRaider / icmp_ping.py
Created October 28, 2020 12:32
Execute an ICMP ping scan on a network in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/a59d6c4636c1211c7a854c384ddf19a0
__author__ = 'EONRaider, keybase.io/eonraider'
import argparse
import ipaddress
try:
from scapy.all import *
from scapy.layers.inet import ICMP, IP
@EONRaider
EONRaider / packet_sniffer.py
Created October 29, 2020 11:27
Sniff TCP/IP packets on a network in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/32c5dbf467c786f393bd0e7601246ddf
__author__ = 'EONRaider @ keybase.io/eonraider'
"""
A low-level network sniffer for TCP/IP packets.
"""
import struct
from binascii import hexlify
@EONRaider
EONRaider / CONKY.md
Last active October 31, 2020 11:07
Configuration file for Conky system monitor
@EONRaider
EONRaider / translate_tcp_flags.py
Last active November 7, 2020 12:15
Translate TCP flags from HEX, INT or OCTAL values to text in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/35484fc55c643ddbdac7ae55f919419d
__author__ = 'EONRaider, keybase.io/eonraider'
def translate_tcp_flags(flag_code: str, *, base: int):
flag_names = 'NS', 'CWR', 'ECE', 'URG', 'ACK', 'PSH', 'RST', 'SYN', 'FIN'
flag_bits = format(int(flag_code, base=base), '09b')
yield from (flag_name for flag_name, flag_bit in zip(flag_names, flag_bits)
if flag_bit == '1')
@EONRaider
EONRaider / http_get.py
Last active April 2, 2021 18:53
Send a HTTP GET request using socket in Python 3
#!/bin/env/python3
# https://gist.github.com/EONRaider/d6041f6c5845f9b8e726bed33d09c6c6
__author__ = 'EONRaider, keybase.io/eonraider'
from socket import socket
def get_request(hostname: str, path: str = None, port: int = 80,
encoding: str = 'utf_8'):
path = path if path is not None else '/'