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
## Returns a string of a random int between 1 and 254(default) | |
def randOct(end = 254): | |
return str(random.randint(1, end)) | |
## Used for random size or TTL | |
def randTS(max = 256): | |
return str(random.randint(1, max/8) * 8) | |
## Returns a string of a hex number 4 digits long, with the preceding '0x' sliced off | |
def randHex(max = 65535): |
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 scapy.all import * | |
import netaddr | |
import random | |
# Define IP range to scan | |
network = "172.16.20.0/29" | |
# Define TCP port range | |
portRange = [22,23,80,443,449] | |
# make list of addresses out of network, set live host counter |
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 valid_ip(address): | |
try: | |
host_bytes = address.split('.') | |
valid = [int(b) for b in host_bytes] | |
valid = [b for b in valid if b >= 0 and b<=255] | |
return len(host_bytes) == 4 and len(valid) == 4 | |
except: | |
return False |
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
import paramiko | |
import re | |
from time import sleep | |
# Router connection details (could be read in from file or argparse) | |
peer = '172.16.2.10' | |
username = 'admin' | |
password = 'admin' | |
def collect_output(shell, command): |
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
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
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 scapy.all import * | |
def arp_display(pkt): | |
if pkt[ARP].op == 1: #who-has (request) | |
return "Request: " + pkt[ARP].psrc + " is asking about " + pkt[ARP].pdst | |
if pkt[ARP].op == 2: #is-at (response) | |
return "*Response: " + pkt[ARP].hwsrc + " has address " + pkt[ARP].psrc | |
print sniff(prn=arp_display, filter="arp", store=0, count=10) |
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 | |
import random | |
from ipaddress import IPv4Network | |
from typing import List | |
from scapy.all import ICMP, IP, sr1, TCP | |
# Define IP range to scan | |
network = "192.168.40.0/30" |
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
# define API options | |
options = {"url": "http://hosted.app/api/packets", "token": "supersecretusertoken"} | |
# create parent function with passed in arguments | |
def customAction(options): | |
# uploadPacket function has access to the options object because they are 'closed' in the nested function | |
def uploadPacket(packet): | |
# upload packet, using passed arguments | |
headers = {'content-type': 'application/json'} | |
r = requests.post(options["url"], data=json.dumps(packet,options["token"]), headers=headers) |
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
Update { | |
withdrawn_routes: [], | |
attributes: [ | |
ORIGIN( | |
IGP | |
), | |
AS_PATH( | |
ASPath { | |
segments: [] | |
} |
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
extern crate pcarp; | |
use std::fs::File; | |
use std::io::{Cursor, Read}; | |
use std::net::IpAddr; | |
use std::path::Path; | |
use std::result::Result; | |
use bgp_rs::{Header, Message, Reader}; | |
use byteorder::{NetworkEndian, ReadBytesExt}; |