1/01/2009

simple python web server droopy and woof...

droopy
http://stackp.online.fr/?p=28


Droopy: easy file receiving
A mini Web server whose sole purpose is to let others upload files to your computer.

Droopy browser

Why ?
Say you’re chatting with a friend on MSN Messenger (perhaps with the excellent pidgin ?). She wants to send you amazing photos she took last week-end, so she uses Messenger file transfer. Unfortunately, the zip file is over 50 MB and it’s painfully slow. Now relax, droopy comes to rescue.

Does it work on my computer ?
You can use it on Unix (Linux, BSD, MacOSX) and Windows. Droopy is a python script so you’ll need to have Python installed.

How to use it ?
Droopy is a command-line program. I’ll suppose you’ve downloaded and saved the file in ~/bin/. Go to the directory where you want the uploaded files to be stored, for example:
mkdir ~/uploads
cd ~/uploads
Then, run droopy. You can give a message and a picture to display:
python ~/bin/droopy -m "Hi, it's me Bob. You can send me a file." -p ~/avatar.png
And it’s up and running on port 8000 of you computer. Check it out at http://localhost:8000, and give your computer’s address to your friends.

Droopy xterm

Type droopy -h to see all options:

Usage: droopy [options] [PORT]

Options:
-h, --help show this help message and exit
-m MESSAGE, --message=MESSAGE set the message
-p PICTURE, --picture=PICTURE set the picture
-d DIRECTORY, --directory=DIRECTORY set the directory to upload files to
--save-config save options in a configuration file
--delete-config delete the configuration file and exit

===================================================

woof
http://www.home.unix-ag.org/simon/woof.html

Simply exchange files with WOOF

I guess everybody with a laptop has experienced this problem at some point: You plug into a network and just want to exchange files with other participants. It always is a pain until you can exchange files with the person vis-a-vis.

Of course there are a lot of tools to tackle this problem. For large scale communities there are dozens of filesharing networks. However, they don't work for small local networks. Of course you could put your stuff to exchange on a local web server, but who really wants to maintain this? Tools like the ingenious npush/npoll are extremely helpful, provided that both parties have it installed, SAFT/sendfile also aims to solve this problem, but needs a permanently running daemon...

Woof (Web Offer One File) tries a different approach. It assumes that everybody has a web-browser or a commandline web-client installed. Woof is a small simple stupid webserver that can easily be invoked on a single file. Your partner can access the file with tools he trusts (e.g. wget). No need to enter passwords on keyboards where you don't know about keyboard sniffers, no need to start a huge lot of infrastructure, just do a
$ woof filename

and tell the recipient the URL woof spits out. When he got that file, woof will quit and everything is done.

And when someone wants to send you a file, woof has a switch to offer itself, so he can get woof and offer a file to you.
Prerequisites and usage

Woof needs Python, when you want to serve directories you need the tar utility as well.

Usage: woof [-i ] [-p ] [-c ] [-u]
woof [-i ] [-p ] [-c ] [-u] -s

Serves a single file times via http on port on IP
address .
When a directory is specified, a .tar.gz archive gets served (or an
uncompressed tar archive when -u is specified), when -s is specified
instead of a filename, woof distributes itself.

defaults: count = 1, port = 8080

You can specify different defaults in two locations: /etc/woofrc
and ~/.woofrc can be INI-style config files containing the default
port and the default count. The file in the home directory takes
precedence.

Sample file:

[main]
port = 8008
count = 2

댓글 없음: