👨‍💻
Hacking Notes
  • Hacking Notes
  • 💅One-Liners
  • ⚔️Offensive
    • Exploit Workflow
    • Recon
      • OSINT
      • DNS
        • Domain Discovery
      • Layer 2 Config and Analysis
      • Port Scanning and Discovery
      • Port Attacks
      • Link it all together
    • Payloads
      • MSFVenom
      • Reverse Shells
    • Websites
      • Enumeration
      • Injection/LFI
      • Session Management
      • Brute Forcing
      • JavaScript & XSS
      • SSRF
      • XXE
      • PHP
    • Password Attacks
      • Brute Forcing
      • Mimikatz
      • Password Cracking
      • Hash Extraction
      • Wordlist Generation
    • Databases
      • SQL
      • Mongodb
    • Microsoft Windows Exploits
      • Enumeration
      • Powershell
      • Cmd
      • Privilege Escalation
      • Active Directory
      • Bloodhound
    • Social Engineering
    • Netcat & Socat
    • File Transfers
    • Metasploit
      • Writing Modules
    • PS Empire
    • Priv Escalation
    • Post Exploitation
    • Pivoting
    • Certs and Secrets
    • NGROK
    • Misc.
  • 🛡️Defensive
    • Defensive Notes
    • Windows Forensics
      • Program Execution Artifacts
      • ASEP Locations
      • Event Logs
    • Linux Forensics
    • Network Forensics
      • tshark
      • Wireshark Filters
    • Memory Forensics
    • Stego
    • Malware Analysis
    • Volatility
  • 🌩️Cloud
    • Scope and Shared Responsibility
    • AWS CLI
    • Azure CLI
    • SaaS Attacks
    • PaaS
  • ⌨️Programming
    • Programming Notes
    • Examples and Quick Scripts
    • PowerShell
    • Pwn
      • Windows Pwn
    • Python
      • Basic Python
      • Modules
      • Working with Files
      • Networking
      • Attack Related
      • Scapy
        • Using Scapy
        • Reading PCAP
    • C
      • Code Examples
      • GDB
    • PHP
Powered by GitBook
On this page

Was this helpful?

  1. Programming
  2. Python

Scapy

Scapy is so special it earns its own page

Send data over ICMP!

from scapy.all import *
import time, random

# Read in the picture as a file
with open('./hahaha.jpg', 'rb') as manning:
    peyton = manning.read()

# Encode the file to hex (easier to send as hex)
peyton = peyton.hex()

# How long each payload should be
n = 32
# Split the encoded hex into a list of n-sized pieces
haha = [peyton[i:i+n] for i in range(0, len(peyton), n)]

# Loop to constantly send ICMP
while True:
    # Loop through entire list and send in order
    for i in range(len(haha)):
        # Re-encode payload as bytes for index
        payload = bytes.fromhex(haha[i])
        send(IP(dst="127.0.0.1")/ICMP(type=8)/payload)
        # Sleep for a bit to make it less consistent
        time.sleep(random.randint(1,15))
    # Sleep between each set
    time.sleep(random.randint(600,1500))
PreviousAttack RelatedNextUsing Scapy

Last updated 3 years ago

Was this helpful?

⌨️