Skip to content

notsobad/go-dummysite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Dummy-Site

Go-Dummy-Site is a mock website generator for HTTP testing. It is a Go version of ynm3k. This tool is designed to simulate various URL addresses, static and dynamic web pages, different status codes, response sizes, and more. It is particularly useful for testing CDN and WAF systems.

Installation

To install Go-Dummy-Site, use the following command:

go install github.com/notsobad/go-dummysite

Usage

To run Go-Dummy-Site, use the following command:

go-dummysite

You can then access the site at http://localhost:9527/.

Features

Static Files

Visiting the same URL will yield the same result. Use the following format:

/static/$RANDOM.$EXT

Examples:

Dynamic URLs

Visiting the same URL will yield different results. Use the following format:

/dynamic/$RANDOM.$EXT

Examples:

HTTP Status Codes

You can simulate different HTTP status codes. Use the following format:

/code/$CODE.$EXT

Examples:

Specified Size Response

You can output a file of a specified size. Use the following format:

/size/$SIZE.$EXT

Examples:

Slow Response Server

You can simulate a slow server response. Visit /slow/$SECONDS and the URL will take $SECONDS time to render.

Examples:

URL Redirect

You can simulate various URL redirect methods. Use the following format:

http://localhost:9527/redirect/$CODE?url=$URL

Normal redirect:

You can also redirect to a 'file://' protol address:

curl -v 'localhost:9527/redirect/301?url=file:///etc/passwd'

Chunked http response

You can simulate chunked http response. Use the following format, $COUNT is the count of chunked message.

http://localhost:9527/chunk/$COUNT

Examples:

HTTP Trace

You can view raw http request and request body in the /trace api.

in cmd line:

# post
curl 127.1:9527/trace -d 'a=1'