This file contains hidden or 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 * | |
DNSServerIP = "172.16.20.40" | |
filter = "udp port 53 and ip dst " + DNSServerIP + " and not ip src " + DNSServerIP | |
def DNS_Responder(localIP): | |
def forwardDNS(orig_pkt): | |
print "Forwarding: " + orig_pkt[DNSQR].qname | |
response = sr1(IP(dst="8.8.8.8")/UDP(sport=orig_pkt[UDP].sport)/\ |
This file contains hidden or 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 * | |
answer = sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")),verbose=0) | |
print answer[DNS].summary() |
This file contains hidden or 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 random | |
# Define end host and TCP port range | |
host = "www.facebook.com" | |
portRange = [22,23,80,443,3389] | |
# Send SYN with random Src Port for each Dst port | |
for dstPort in portRange: | |
srcPort = random.randint(1025,65534) | |
resp = sr1(IP(dst=host)/TCP(sport=srcPort,dport=dstPort,flags="S"),timeout=1,verbose=0) |
This file contains hidden or 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 | |
# Define IP range to ping | |
network = "172.16.20.0/24" | |
# make list of addresses out of network, set live host counter | |
addresses = netaddr.IPNetwork(network) | |
liveCounter = 0 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |