Kumi
debe84737d
Enhanced PyFiche with the `-M` switch, enabling users to set a maximum paste size, with a default limit of 5 MiB. This addition offers better control over resource usage and helps prevent abuse. Instructions for usage are updated in the README.
99 lines
2 KiB
Markdown
99 lines
2 KiB
Markdown
# PyFiche
|
|
|
|
PyFiche is a simple pastebin optimized for the command line, written in Python
|
|
and heavily inspired by [fiche](https://github.com/solusipse/fiche/), or rather
|
|
a shameless translation. It has no dependencies outside the Python standard
|
|
library.
|
|
|
|
It also comes with a re-implementation of Lines, the HTTP server that comes
|
|
with Fiche, which this time around also allows you to upload files using POST
|
|
requests. Additionally, PyFiche also comes with a simple TCP server, Recup,
|
|
to download pastes through netcat without using HTTP(S), in the same way you
|
|
upload them.
|
|
|
|
## Installation
|
|
|
|
### Dependencies
|
|
|
|
- Python 3 (tested with 3.11)
|
|
|
|
### Local Installation
|
|
|
|
```bash
|
|
$ python -m venv venv
|
|
$ source venv/bin/activate
|
|
$ pip install -U git+https://kumig.it/PrivateCoffee/pyfiche.git
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Fiche Server
|
|
|
|
```bash
|
|
$ source venv/bin/activate
|
|
$ pyfiche-server # try --help for options
|
|
```
|
|
|
|
With the exception of the `-u` option, all arguments of the original Fiche
|
|
should work as expected. `-u` is not implemented because, well, just use the
|
|
right user in the first place. 🤷♀️
|
|
|
|
Additionally, PyFiche also supports the `-M` option, which allows you to
|
|
specify a maximum paste size in bytes. The default is 5 MiB.
|
|
|
|
Use `-h` to see all options.
|
|
|
|
#### Uploading files
|
|
|
|
```bash
|
|
$ nc <server> <port> < <file>
|
|
```
|
|
|
|
### Recup Server
|
|
|
|
```bash
|
|
$ source venv/bin/activate
|
|
$ pyfiche-recup # try --help for options
|
|
```
|
|
|
|
#### Downloading files
|
|
|
|
Pipe the ID of an uploaded file to `nc`:
|
|
|
|
```bash
|
|
$ echo <id> | nc <server> <port> > <file>
|
|
```
|
|
|
|
### Lines Server
|
|
|
|
```bash
|
|
$ source venv/bin/activate
|
|
$ pyfiche-lines # try --help for options
|
|
```
|
|
|
|
#### Viewing pastes in a browser
|
|
|
|
Go to `http://<server>:<port>/<id>`.
|
|
|
|
#### Downloading raw pastes
|
|
|
|
```bash
|
|
$ curl http://<server>:<port>/<id>/raw
|
|
```
|
|
|
|
#### Uploading pastes
|
|
|
|
```bash
|
|
$ curl -X POST -d '<paste content>' http://<server>:<port>
|
|
```
|
|
|
|
Or use a file:
|
|
|
|
```bash
|
|
$ curl -X POST -d @<file> http://<server>:<port>
|
|
```
|
|
|
|
## License
|
|
|
|
PyFiche is licensed under the MIT license. See the [LICENSE](LICENSE) file for
|
|
more information.
|