👨‍💻
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
  3. Scapy

Using Scapy

Basics

BEFORE WE CAN SEND PACKETS, WE MUST FIX IPTABLES! SCAPY BYPASSES THE NORMAL KERNEL PROCEDURES!

Without this, we will NEVER see the responses from our packets we send!

iptables –A OUTPUT –p tcp –tcp-flags RST RST –j DROP

There are several basics we can use to create layers in a packet for whatever we would like!

Command

Description

ls()

list protocols or variable

lsc()

list supported commands

send()

send layer 3, match all responses

sendp()

send layer 2, no response

srp1()

send layer 2, match 1 response

srp()

send layer 2, match all responses

# send and receive [packet], define the return as ans and unans with “_”, print the summary
sr([packet]);
ans, unans = _
ans.summary()

# send a TCP snipe to end the connection, must hit the correct seq from the most recent ack in order to be accepted
send(IP(dst=”192.168.1.200”)/TCP(sport=45089, dport=999, flags=”RA”, seq=3689929657))

i = sniff(filter=”host 192.168.1.100 and icmp”, count=2)
i.summary()

PreviousScapyNextReading PCAP

Last updated 3 years ago

Was this helpful?

⌨️