LoginSignup
11
15

More than 5 years have passed since last update.

Scapy入門①(Scapyのインストールから実行まで)

Last updated at Posted at 2017-08-22

Scapy入門(Scapyのインストールから実行まで)

はじめに

こんにちは。あかこうです。
最近はCTF関連のことでScapyを触る必要が出てきたので、これから数回に分けてScapyの使い方等についてまとめたいと思います。
今回は題名の通り、Scapyのインストールから実行までまとめます。

環境

  • CF-S10
  • Antergos
  • Python3
  • pip3

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).

適当に上の方だけ訳すと、Scapyとはイケてるインタラクティブパケット操作プログラムで、パケットを作ったり広範囲のプロトコルにデコードしたり、それらのパケットを実際に投げて レスポンスを受け取ったりできるやつです。
(和訳間違ってたらごめんなさい)

実践

Scapyのインストール

pipを使ってインストールします。
$ sudo pip3 install scapy-python3

Scapyの起動

私の環境だと、パケット送信のときにパーミッションが必要だったのでsudoをつかって起動します。
$ sudo scapy

Pythonモジュールとしての使用

一行目で以下のコードを実行することで、scapyを直接起動した状態と同じ状態を作ることができます。
ファイルに保存されたスクリプトとして使用する場合は、こちらを使いましょう。

# Scapyのインポート
from scapy.all import *

最後に

こんな感じで今回はscapyのインストールと起動についてまとめました。
次回はscapyを利用したパケット送信についてまとめたいと思います。

11
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
15