uP2P - 6 lines, 436 bytes, sh and netcat

23 February 2005 - updated 17 May 2008
Tags for this page: 200502 200805 molester
[Site traffic Strip-O-Meter]

Click to censor the Strip-O-Meter.

Prof.  Pascal Felber, of the Institut d'informatique, Université de Neuchâtel, Switzerland, forwarded me this link to his uP2P file-sharing program - currently 6 lines totalling 436 bytes, implemented in sh with the networking done by netcat.

The nature of sh pretty much requires somewhat relaxing the "no external programs" limitation, and netcat is a fairly standard, commonly-available utility.  As he points out, netcat is just at the TCP level, so it's probably within the rules I suggested for minimal-byte challenge programs.  Using shell and invoking other programs does feel like it's edging close to triviality - why not just invoke ftp from the command line and have done with it?  - but on the other hand, the coding is impressive.  Any of these kinds of attempts ultimately come down to what kinds of ready-made pieces you can manage to connect to inside whatever arbitrary rules you make for yourself.  He's gotten a lot of features into very few bytes.

It also seems to be more efficient than MoleSter, in that it'll only download the file once; that makes it more practical for actual use.  I say "seems" because although I've read the code, I haven't fully understood it, even in the commented and documented version - I never became an expert shell programmer because I use Perl for that kind of task.  I do have some concern about security, because the old "include metacharacters in input and make the variable substitutions misbehave" thing is very often a problem for shell scripts; but I don't know of any specific flaws of that nature in this code.

Comments

No comments yet.

New comments are disabled, pending transition to new site code.
Copyright 2005, 2008 Matthew Skala
Updates to this site: [RSS syndication file]