https://github.com/fadeevab/python-3-simple-server-with-header-manipulations
Simple Python 3 server to experiment with header manipulation, e.g. cookie, origin, etc.
https://github.com/fadeevab/python-3-simple-server-with-header-manipulations
Last synced: 11 months ago
JSON representation
Simple Python 3 server to experiment with header manipulation, e.g. cookie, origin, etc.
- Host: GitHub
- URL: https://github.com/fadeevab/python-3-simple-server-with-header-manipulations
- Owner: fadeevab
- License: mit
- Created: 2020-04-23T11:57:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-01T17:58:06.000Z (about 6 years ago)
- Last Synced: 2025-03-25T20:47:01.123Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple Python 3 server with header manipulations,
e.g. `Set-Cookie`, `Origin`, and `Host` in the current example.
## How-To Use
Run the server:
```
python3 ./server-example-with-headers.py
```
1. `Origin` header is forged by client:
```
$ curl localhost:8080 -H 'Origin: fadeevab.com'
I believe this request is from fadeevab.com!
Hello, world!
```
2. `Set-Cookie` header is returned:
```
$ curl localhost:8080 -v
....
< HTTP/1.0 200 OK
< Server: BaseHTTP/0.6 Python/3.7.5
< Date: ...
< Set-Cookie: auth=1234; Domain=sub.localhost
```
`-v` is just to show headers
## Tip
To experiment with subdomains on your local machine just modify `/etc/hosts` file (`C:\\Windows\\System32\\Drivers\\etc\\hosts`) like the following:
```
127.0.0.1 sub.localhost
```