[PYTHON] Introduction to Scapy ① (From installation to execution of Scapy)

Introduction to Scapy (from installation to execution of Scapy)

Introduction

Hello. This is Akako. Recently, it has become necessary to touch Scapy for CTF-related matters, so I would like to summarize how to use Scapy in several parts from now on. This time, as the title suggests, I will summarize from installation to execution of Scapy.

environment

What is Scapy?

What is Scapy

Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. It can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery (it can replace hping, 85% of nmap, arpspoof, arp-sk, arping, tcpdump, tethereal, p0f, etc.). It also performs very well at a lot of other specific tasks that most other tools can't handle, like sending invalid frames, injecting your own 802.11 frames, combining technics (VLAN hopping+ARP cache poisoning, VOIP decoding on WEP encrypted channel, ...), etc. See interactive tutorial and the quick demo: an interactive session (some examples may be outdated).

If you translate only the upper part appropriately, ** Scapy ** is a cool ** interactive ** packet manipulation program **, ** packet creation **, ** decoding to a wide range of protocols * It's the one who can * or ** actually throw those ** packets and receive a ** ** response **. (I'm sorry if the Japanese translation is wrong)

Practice

Install Scapy

Install using pip. $ sudo pip3 install scapy-python3

Start Scapy

In my environment, I needed permission to send packets, so I use sudo to start it. $ sudo scapy

Use as a Python module

By executing the following code in the first line, you can create the same state as when scapy is started directly. If you want to use it as a script saved in a file, use this.

#Import Scapy
from scapy.all import *

Finally

With this feeling, this time I summarized the installation and startup of scapy. Next time, I would like to summarize packet transmission using scapy.

Recommended Posts

Introduction to Scapy ① (From installation to execution of Scapy)
[Ansible installation procedure] From installation to execution of playbook
From the introduction of pyethapp to the execution of contract
Introduction of ferenOS 1 (installation)
From editing to execution
[Introduction to cx_Oracle] Overview of cx_Oracle
Python development environment construction 2020 [From Python installation to poetry introduction]
Now "average of sums from 1 to 10" and its execution speed
Explanation from installation of Sphinx to use of external theme (Bootswatch)
From Elasticsearch installation to data entry
Python (from first time to execution)
Introduction of ferenOS 3 (package update, installation)
From Ubuntu 20.04 introduction to environment construction
Getting Started with Poetry From installation to execution and version control
[Introduction to pytorch-lightning] Autoencoder of MNIST and Cifar10 made from scratch ♬
From the introduction of JUMAN ++ to morphological analysis of Japanese with Python
[Note] [PyTorch] From installation to easy usage
From MuJoCo license acquisition, renewal to execution
From Attention of Zero Tsuku 2 to Transformer
Flask tutorial (from installation to hello world)
Summary of vtkThreshold (updated from time to time)
[Introduction to Data Scientists] Basics of Python ♬
From the introduction of GoogleCloudPlatform Natural Language API to how to use it
Introduction to MQTT (Introduction)
Introduction to Scrapy (1)
[Introduction to cx_Oracle] (16th) Handling of LOB types
Summary of gcc options (updated from time to time)
Installation of Anaconda3
Introduction to Scrapy (3)
Introduction of Python
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
Introduction of scikit-optimize
Introduction to Tkinter 1: Introduction
Installation of CentOS 8
Introduction to OPTIMIZER ~ From Linear Regression to Adam to Eve
Setting to output the log of cron execution
Introduction of PyGMT
[Introduction to Udemy Python 3 + Application] 19. Copy of list
[Introduction to cx_Oracle] (Part 3) Basics of Table Reference
Introduction to PyQt
[2021 version] From Selenium Basic installation to Web scraping execution by Python Windows 10 (64bit)
Change the decimal point of logging from, to.
Introduction of ferenOS 2 (settings after installation, Japanese input settings)
[Linux] Introduction to Linux
From ROS for Windows installation to operation check
Introduction to Scrapy (4)
Introduction to Python "Re" 1 Building an execution environment
Introduction to discord.py (2)
[Introduction to cx_Oracle] (5th) Handling of Japanese data
[Introduction to cx_Oracle] (Part 7) Handling of bind variables
From easy git installation to docker startup python
The story of moving from Pipenv to Poetry
Introduction to Scapy ② (ICMP, HTTP (TCP) transmission using Scapy)
Introduction of cymel
Introduction to discord.py
Introduction of Python
[Introduction to Python] Basic usage of lambda expressions
Summary from the beginning to Chapter 1 of the introduction to design patterns learned in the Java language
The wall of changing the Django service from Python 2.7 to Python 3
I want to detect images of cats from Instagram
Used from the introduction of Node.js in WSL environment