iT邦幫忙

2023 iThome 鐵人賽

0
SideProject30

DDOS:閑的沒事就開始DDOS系列 第 31

[Day 31] 閑的沒事 - HTTP SESSION GET REQUEST

  • 分享至 

  • xImage
  •  

HTTP Session

向網頁10.211.55.10:12345發送GET Request。用其他verbs只要替換掉就可以了。

網頁靶機

10.211.55.10:12345

from flask import Flask, request

app = Flask(__name__)
@app.route("/")
def hello():
    remote_addr = request.remote_addr
    headers = request.headers
    return f'Remote Address: {remote_addr}<br><br>Headers: {headers}'

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=12345)

Get Request

package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	// build http client
	client := &http.Client{}

	// build get request
	getURL := "http://10.211.55.10:12345/"
	getReq, err := http.NewRequest("GET", getURL, nil)
	if err != nil {
		fmt.Println("Error creating GET request:", err)
		return
	}

	// set HTTP 1.1 Keep-Alive header
	getReq.Header.Set("Connection", "keep-alive")

    // 發送10個get request
	for i := 0; i < 10; i++ {
		wg.Add(1)

		go func() {
			defer wg.Done()

			// execute get request
			getResp, err := client.Do(getReq)
			if err != nil {
				fmt.Println("Error sending GET request:", err)
				return
			}
			defer getResp.Body.Close()

			body, err := io.ReadAll(getResp.Body)
			if err != nil {
				fmt.Println("Error reading response body:", err)
				return
			}
			fmt.Println("response body:", string(body))
		}()

		wg.Wait()
	}
}

Response

Flask web response:

response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip


response body: Remote Address: 10.211.55.2<br><br>Headers: Host: 10.211.55.10:12345
User-Agent: Go-http-client/1.1
Connection: keep-alive
Accept-Encoding: gzip

上一篇
[Day 30] 閑的沒事 - HTTP SESSION
系列文
DDOS:閑的沒事就開始DDOS31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
obarisk
iT邦研究生 1 級 ‧ 2023-10-28 15:49:09

偷渡python

我要留言

立即登入留言