LoginSignup
10
16

More than 5 years have passed since last update.

初心者Webアプリ診断員がWebアプリをpythonで一から学んで書いてみる~cgi編~

Last updated at Posted at 2016-10-30

webアプリケーションの診断員も開発ができるといい

webアプリケーションの診断作業は非常にシンプルです。私は興味があるので問題ないのですが、脆弱性診断員は飽きが来るとも言われているそうです。しかし。Webアプリケーションの仕組みをわかっていたり、様々な観点から診断ができるようになると、さらに診断の質が良くなるし飽きることもないと信じているので、試したことをメモとして残します。

python3上でcgiを動かす

.
├── cgi-bin
│ └── cgitest.py
└── cgiserver.py

pythonのルートディレクトリから上記のようなフォルダ構成にする。

cgitest.py
\#!/usr/bin/env python
print('Content-type: text/html; charset=UTF-8\r\n')
print('Hello, World!')
cgiserver.py
\# -*- coding: utf-8 -*-
import http.server
http.server.test(HandlerClass=http.server.CGIHTTPRequestHandler)

ルートディレクトリ上コマンドプロンプトでサーバもどきを動かす。
python -m http.server --cgi

以下のURLにアクセスするとcgitest.pyの中身が出てくる。

そして、URLを指定してアクセスする。
http://localhost:8000/cgi-bin/test.py

ローカルプロキシで通信を見てみると・・・
burp1.png

となります。通信も見ながらだと色々見えてきて面白いかもです。

参考サイト

10
16
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
10
16