https://github.com/chroming/fake_server
A fake server than catch all path and response success message or whatever data you defined.
https://github.com/chroming/fake_server
faker privacy python webserver
Last synced: 9 months ago
JSON representation
A fake server than catch all path and response success message or whatever data you defined.
- Host: GitHub
- URL: https://github.com/chroming/fake_server
- Owner: chroming
- License: apache-2.0
- Created: 2020-05-19T15:38:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T21:40:23.000Z (about 3 years ago)
- Last Synced: 2025-04-13T03:42:58.262Z (about 1 year ago)
- Topics: faker, privacy, python, webserver
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A fake server than catch all path and response success message or whatever data you defined.
## Usage
`python -m fake_server -t Success!`
Then you can access whatever path in 'http://127.0.0.1' (such as http://127.0.0.1/simple/a/b/c), and then get response text 'Success!'.
All arguments:
`python -m fake_server -t TEXT -f FILE_PATH -fc FILE_PATH -b 127.0.0.1:80 -s`
**SERVER ARGUMENTS**
+ -b --bind *IP:PORT*: Server bind host and port, default 127.0.0.1:80, if you what listen on all interface just use 0.0.0.0:80
+ -p --port *PORT*: Server bind port, same as port in --bind
+ -s --https: Server with https or not
**RESPONSE ARGUMENTS**
You can only choice one argument for response
+ -t --text *TEXT*: Return text, default Success
+ -f --file *FILE_PATH*: Return file as attachment
+ -fc --file_content *FILE_PATH*: Return file content
## Why you need this?
When you notice some software send your private data to their server(like: http://data.old_server.com ), and
the software need success response from server(like: {"result": "success"}), what can you do?
Now ,with fake_server, you can do like this:
1. Add this line to your hosts file (Linux/macOS: /etc/hosts, Windows: C:\Windows\System32\Drivers\etc\hosts)
`127.0.0.1 data.old_server.com`
2. Start fake server:
python -m fake_server '{"result": "success"}'
Then all data send to data.old_server.com will now send to your own compute, and software will get normal response as before!
## TODO
+ ~~To real command line tool as fake-server;~~
+ ~~Support https~~