!/usr/local/bin/perl
■ このスレッドは過去ログ倉庫に格納されています
0001名無し
04/12/26 15:53:15ID:h9wJ8dyI$script_name = "script";
$version = "1";
# 設定
# CGIのURL
$self_url = "http://.../proxy.cgi";;
# スタートページのURL
$form_url = "http://.../";;
# プロクシ経由でwebページを取得するときは指定する
$proxy = "";
# ログを残すディレクトリ
$logdir = "log/";
0002a
04/12/26 15:55:15ID:h9wJ8dyI$send_xff = "Yes";
# Cookie の送受信
$send_cookie = "Yes";
# 送信する Cookie を固定する
# $fixed_cookie = "cookie=dummy";
# Referer の送信
$send_referer = "Yes";
# 送信する Referer を固定する
# $fixed_referer = "http://www.2ch.net/";;
0003User
04/12/26 15:57:08ID:h9wJ8dyI$send_ua = "Yes";
# 送信する User-Agent を固定する
# $fixed_ua = "Proxy1";
# 設定以上
0004Url
04/12/26 15:59:56ID:h9wJ8dyI$key_url = "PProxyUrl"; # 入力からURLを取り出す時のキー名
$key_ref = "PProxyRef"; # 入力からRefererを取り出す時のキー名
$amp{'&&'} = '&'; # 入力からパラメータを取り出すときに使用
$sock = "SOCK"; # ソケットのファイルハンドル
$log = "LOG"; # ログファイルのファイルハンドル
$lock = "LOCK"; # ロックファイルのファイルハンドル
$block_size = 4096; # URL変換を実行するトリガとなるバッファサイズ
%input = undef; # 入力パラメータを格納するハッシュ
$req_entity = undef; # リクエストエンテティ
$req_query = undef; # リクエストするときのクエリー
$target_scheme = undef; # (ex) http
$target_host = undef; # (ex) www.host.com, www.host.com:80
$target_hostname = undef; # (ex) www.host.com
$target_port = undef; # (ex) 80
$target_path = undef; # (ex) /tongco2/index.html
$target_query = undef; # (ex) abc=123
$target_sh = undef; # (ex) http://www.host.com
$target_shp = undef; # (ex) http://www.host.com/tongco2/index.html
$base_sh = undef; # ベースとなるURLのホスト部分まで
$base_path = undef; # ベースとなるURLのパス部分(ファイル名まで)
$base_file = undef; # ベースとなるURLのパス部分(ファイル名以降)
0005und
04/12/26 16:01:05ID:h9wJ8dyI$req_url = undef; # リクエストラインに入れるURI
$resp_status = undef; # レスポンスのステータス
$resp_header = undef; # レスポンスヘッダ
$resp_length = undef; # レスポンスヘッダの Content-Length 値
$resp_buf = undef; # エンティティボディをうけるバッファ
$resp_entity = undef; # クライアントに出力すべきエンティティボディ
$recv_size = undef; # 受信したエンティティボディのサイズ
$chunk = undef; # チャンク形式転送の受信処理フェーズを示す
$chunk_size = undef; # チャンクのサイズ
$chunk_recv = undef; # 受信したチャンクのサイズ
$urlchange = undef; # URL変換をするかどうかを示すフラグ
$log_msg = undef; # ログに書く内容
0006T
04/12/26 16:22:53ID:h9wJ8dyI# バッファリングなし バイナリモード
$| = 1;
binmode(STDOUT);
binmode(STDIN);
$log_msg = "$ENV{REMOTE_ADDR} $ENV{REQUEST_METHOD}";
# パラメータ部分を抽出
$req_query = $ENV{QUERY_STRING};
if ( $ENV{REQUEST_METHOD} eq "POST" ) {
# POST メソッド
read(STDIN, $req_entity, $ENV{CONTENT_LENGTH});
if ( $ENV{CONTENT_TYPE} =~ /^multipart\/form-data;
(?:[\ \t]|\r?\n[\ \t])*boundary=([^\s;]+)/x ) {
0007E
04/12/26 16:24:18ID:h9wJ8dyImy $boundary = "--$1";
my ($param, @params);
@params = split(/$boundary/, $req_entity);
shift(@params); # boundaryが先頭なので最初の要素は空
$req_entity = "";
foreach $param ( @params ) {
if ( $param =~
/^\r?\n
Content-Disposition:(?:[\ \t]|\r?\n[\ \t])*form-data;
(?:[\ \t]|\r?\n[\ \t])*name=
(?:"(\Q$key_url\E|\Q$key_ref\E)"|
(\Q$key_url\E|\Q$key_ref\E))
(?:[^\r\n]|\r?\n[^\r\n])*
\r?\n\r?\n
(.*[^\r])\r?\n$/sx ) {
■ このスレッドは過去ログ倉庫に格納されています