Allows for quick setup of a web-server that can be used to check firewall connection, routing and defuse network problems.
- Perl 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| LICENSE | ||
| README.md | ||
| tinyweb | ||
tinyweb
A lightweight HTTP web server written in Perl for testing firewalls, routing, loadbalancers, and network connectivity.
Description
tinyweb creates simple HTTP services on one or more ports. When accessed, it returns a plain text response indicating the hostname and port that was reached. This makes it ideal for:
- Testing firewall rules
- Verifying routing configurations
- Testing load balancers
- Network connectivity diagnostics
- Port accessibility verification
Requirements
- Perl with
IO::Socket::INETmodule
Usage
tinyweb <start|stop|status|catlog> {port1,port2,...}
Commands
Start the service
# Start on default port (8080)
tinyweb start
# Start on a single custom port
tinyweb start 8000
# Start on multiple ports
tinyweb start 8000,8001,8020
Stop all services
tinyweb stop
This will terminate all running tinyweb processes.
Check status
tinyweb status
Lists all currently running tinyweb processes.
View logs
tinyweb catlog
Displays the log file contents.
How It Works
When a client connects to any of the listening ports, tinyweb responds with:
HTTP/1.1 200 OK
Content-Type: text/plain
Success! You have reached: <hostname>:<port>
Logging
- Root user: Logs are written to
/var/log/tinyweb.log - Regular user: Logs are written to
~/tinyweb.log
Log entries include timestamps and connection information (port and connecting hostname).
Examples
Start a web service on port 8080 and test it:
# Start the service
tinyweb start 8080
# Test with curl
curl http://localhost:8080
# Output: Success! You have reached: yourhostname:8080
# Check the status
tinyweb status
# View the logs
tinyweb catlog
# Stop the service
tinyweb stop
Start multiple services for load balancer testing:
# Start services on three different ports
tinyweb start 8080,8081,8082
# Each port will respond with its own port number
curl http://localhost:8080 # Success! You have reached: yourhostname:8080
curl http://localhost:8081 # Success! You have reached: yourhostname:8081
curl http://localhost:8082 # Success! You have reached: yourhostname:8082
Author
Written by pal.ekran@nhn.no (November 2023)