Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patatetom/salted.http.server
http.server with salt
https://github.com/patatetom/salted.http.server
file-sharing http-server htttp python python3
Last synced: about 1 month ago
JSON representation
http.server with salt
- Host: GitHub
- URL: https://github.com/patatetom/salted.http.server
- Owner: patatetom
- Created: 2019-07-26T13:41:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-28T20:20:54.000Z (over 5 years ago)
- Last Synced: 2024-09-13T02:51:40.844Z (3 months ago)
- Topics: file-sharing, http-server, htttp, python, python3
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# salted.http.server
Python `http.server` with salt.
Python and its `http.server` module are a great way to occasionally provide a tree structure for downloading.
However, when the command `python3 -m http.server` popularized by many HowTo is used, the tree structure is offered to all winds without restriction !
`salted.http.server` adds a constraint to `http.server` that prevents the display of the offered tree structure if the salt grain is not present :
`curl http://PublicIpAddr:Port/` will work with `http.server` but will not work with `salted.http.server` where the computed salt should be added to the url (eg. `curl http://PublicIpAddr:Port/ComputedSalt/`).**`salted.http.server` is mainly intended to prevent accidental sharing of data on the network !**
### installation
- make tree directory in your local Python 3.7 library with `mkdir -p ~/.local/lib/python3.7/site-packages/salted/http/`, `touch ~/.local/lib/python3.7/site-packages/salted/__init__.py` and `touch ~/.local/lib/python3.7/site-packages/salted/http/__init__.py`
- [download](server.py) `server.py` in `~/.local/lib/python3.7/site-packages/salted/http/`> modify `…/python3.7/…` if you are not running Python 3.7.
### usage
- ask help :
```console
$ python -m salted.http.server --help
usage: server.py [-h] [--directory DIRECTORY] [port]positional arguments:
port Specify alternate port [default: 8000]optional arguments:
-h, --help show this help message and exit
--directory DIRECTORY, -d DIRECTORY
Specify alternative directory [default:current
directory]
```- start `salted.http.server` in current directory with default port :
```console
$ python -m salted.http.server
Serving HTTP on http://192.168.1.2:8000/0faa60f9887cd932343adc4300dd4f83/ ... # link to share ;-)
```- try without salt grain :
```console
$ curl -q http://192.168.1.2:8000/
curl: (52) Empty reply from server
```- try with salt grain :
```console
$ curl -q http://192.168.1.2:8000/0faa60f9887cd932343adc4300dd4f83/Directory listing for /
Directory listing for /
...```
**and finally share the provided link `http://PublicIpAddr:Port/ComputedSalt/` to your friends !**