リダイレクトと生リクエスト
リダイレクト追従と、send_request_cgi では足りないリクエストです。
send_request_cgi!
Section titled “send_request_cgi!”res = send_request_cgi!( { 'method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'old') }, 20, # timeout 3 # redirect_depth)30x のとき Location を追います。opts['redirect_uri'] に辿った URI が入ります。
POST 後のリダイレクトに注意
Section titled “POST 後のリダイレクトに注意”reconfig_redirect_opts! は POST を GET に変え、data / vars_post を空にします。ログイン POST のあとに「POST のまま追いたい」要件には向きません。その場合は自分で Location を読んで次の send_request_cgi を組み立てます。
res = send_request_cgi(...)if res && res.redirect? loc = res.redirection res = send_request_cgi( 'method' => 'GET', 'uri' => loc.path )endsend_request_raw
Section titled “send_request_raw”仕様を外す、または HTTP 以外に見せかけるときに使います。
send_request_raw({ 'method' => 'DESCRIBE', 'proto' => 'RTSP', 'version' => '1.0', 'uri' => '/' + ('../' * 560) + "\xcc\xcc\x90\x90" + '.smi'})send_request_raw( 'method' => 'GET', 'uri' => '/index.php', 'headers' => { 'Host' => "x\r\nX-Injected: 1" })query / フォームの組み立てが要る通常用途は send_request_cgi 側に戻します。
disconnect の制御
Section titled “disconnect の制御”# cgi の第3引数send_request_cgi({ 'uri' => '/' }, 20, false) # 切断しないsend_request_cgi({ 'uri' => '/next' }, 20, true)send_request_raw の default disconnect は false です。keep-alive や findsock 系で接続を残したいときに差が出ます。
別ホストへの一時リクエスト
Section titled “別ホストへの一時リクエスト”send_request_cgi( 'method' => 'GET', 'uri' => '/health', 'rhost' => '10.10.11.200', 'rport' => 8080, 'SSL' => false, 'vhost' => 'internal.htb')
