|
|
|
|
|
by 1vuio0pswjnm7
894 days ago
|
|
Another alternative. This uses only HTTP and requires no special software, except the server. Elegant, IMHO. Extremely robust in fact. https://github.com/nwtgck/go-piping-server After starting the server, a few options. Method 1: Visit https://127.0.0.1:8080 in a Javascript-enabled browser and fill out HTML form Method 2: Visit https://127.0.0.1:8080/noscript in any browser and fill out HTML form Method 3: Use any TCP or HTTP client. For example here is a quick and dirty shell script #!/bin/sh
test $1||exec echo usage: $0 something file
test $2||exec echo usage: $0 something file
x=$(stat -c %s $2)
{
printf 'POST /'$1' HTTP/1.1\r\n'
printf 'Host: 127.0.0.1\r\n'
printf 'Content-Type: multipart/form-data; boundary=\"yxxxxzxxxzxxxzzxyxzx\"\r\n'
printf 'Content-Length: '$x'\r\n'
printf 'Connection: close\r\n'
printf '\r\n'
cat $2
echo ---yxxxxzxxxzxxxzzxyxzx
} \
|nc -vvn 127.1 8080
laptop> 1.sh whatever 1.pdf
phone> curl http://127.0.0.1:8080/whatever > 1.pdf
laptop> 1.sh 1.pdf 1.pdf
On phone, type into browser: https://127.0.0.1:8080/1.pdf
This file is saved as 1.pdf
YMMV
There is also a Rust version. |
|
Replace 127.0.0.1 with an appropriate address for computers on the LAN, e.g., RFC 1918 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12.