Forgot your password?
typodupeerror
The Internet Software Your Rights Online

World's Shortest P2P App: 15 Lines 443

Posted by CowboyNeal
from the no-need-to-be-fancy dept.
soren.harward writes "The New Scientist has an article about TinyP2P, the world's smallest P2P app. It's 15 lines of Python code brought to us by Edward Felten, CS Professor at Princeton and outspoken supporter of the digital rights the Slashdot community holds so dear. He wrote the program as a proof-of-concept that P2P apps are really easy to write, don't have to be complicated, and thus banning them (a la the INDUCE Act) is pointless and silly."
This discussion has been archived. No new comments can be posted.

World's Shortest P2P App: 15 Lines

Comments Filter:
  • Reported last month (Score:5, Informative)

    by joeldixon66 (808412) * <joelNO@SPAMjd53.com> on Thursday January 06, 2005 @08:39PM (#11283084) Homepage
    The 15 line P2P has been mentioned before [slashdot.org] by Slashdot - but the New Scientist article wasn't mentioned last time (as it hadn't yet been written).

    The last article also mentioned the 9 line Molestar written in Perl - which is now 6 lines [sooke.bc.ca].
    • by nxtr (813179) on Thursday January 06, 2005 @09:03PM (#11283340)
      Maybe New Scientist editors read Slashdot for their news, which then Slashdot user read for more news. I wouldn't be surprised if I saw this article in New Scientist next month.
    • by thrift24 (683443) on Thursday January 06, 2005 @09:06PM (#11283368) Homepage
      Molestar uses a very loose defintion of "lines". A line in perl is ussually where the ; is, which in readable code should be at the end of the actual line. I counted 5 ;'s in the first line of Molestar with a briefscan. A brief estimation would tell us Molestar is more like 30 actuall lines. (I don't see why Molestar doesn't just claim to be one line as all of this code, could work just fine in 1 "line" as they define.) I've never used Python before, but I would imagine by looking at the code to TinyP2P that python's lines truely end at the end of the line. So as far as line count is concerned TinyP2P is around half the size as Molestar.
      • by tepples (727027) <tepples&gmail,com> on Thursday January 06, 2005 @09:31PM (#11283590) Homepage Journal

        Machine language, the bytecode form of assembly language that microprocessors interpret, doesn't really have "lines" either. The point isn't that MoleSter is 6 lines as much as it is 466 bytes, and programming golf rules [xs4all.nl] state that a lower score in bytes is better.

      • by shellbeach (610559) on Thursday January 06, 2005 @10:29PM (#11284079)
        Molestar uses a very loose defintion of "lines" ... So as far as line count is concerned TinyP2P is around half the size as Molestar.

        No. Perhaps you should have had a look at the TinyP2P web site, which defines a line as follows: "Each line has 80 characters or fewer."

        If you really want to compare sizes though, compare the number of characters: TinyP2P has 951 non-whitespace characters; Molster has 436. And the author of Molster also makes the point that almost all the P2P work of TinyP2P is done by an external library. Have a look here [sooke.bc.ca] for more of the author's thoughts on the matter of sizes - they're quite interesting.
    • by jd (1658) <imipak@yaCOLAhoo.com minus caffeine> on Thursday January 06, 2005 @09:24PM (#11283519) Homepage Journal
      One of the best-publicised (amongst the geek community) protests against the ITAR regulations on encryption was the DES encryption algorithm on a t-shirt. What would be really cool, though, would be to have a P2P on a t-shirt and then have a CCD-based device that could "run" it when you walked into the room. "Me? No, I never loaded the computer with that."


      Of course, there are other interesting implementations out there. IIRC, there used to be a web server that was written entirely in Postscript. Although not written in Postscript, one of the early rivals to X - InterViews - used Postscript as the graphics language.


      The winner of the 50th Anniversary of the Manchester Mk. 1 programming contest was a program written in something like 20 words of assembly a programmable timer for chicken soup. (When you consider that the assembly language for the MM1 had 8 instructions, no add operation, and no real-time clock, that's not bad going.)

      • Of course, there are other interesting implementations out there. IIRC, there used to be a web server that was written entirely in Postscript.

        So, when can I use filesharing on my Laserjet 4000TN?

        • by peragrin (659227) on Thursday January 06, 2005 @10:28PM (#11284066)
          It's easy you can do it now. Just dump the raw hex of the files into a postscript and print. use a photocopier to make as many copies as you like.

          then hand them out. end users use OCR and their scanners. reassemble the files by hand.

          Warning large files may use lot's of paper.
          • Actually if you were to print out black/white "bits" on an A4-sized paper at 300x300 DPI you could fit rougly 1MB per side.

            Now if you were to use 600x600 DPI, 2 sides of the paper, you'd get 8MB on a single sheet of paper. An optical 2400x2400 scanner should be sufficient to correctly "read" the 600x600 format.

            Assuming you can recognize about 16 shades of gray on a paper, you now get (2^4=16, so 4x) 32MB on a single sheet.

            Assume you can do the same for the CMY colors too and you have 128MB on a sheet.

            I'
    • by dcarey (321183)
      The REALLY sad part is that I don't read slashdot but maybe twice a week on average and ever *I* remember the dupe story ... the link color is already darkened from where I visited precisly the same link the the very short past.

      No, I don't believe this is the "death of slashdot or anything silly like that." But it is conceivable that in that that glorious mound of slashdot web code there could be a way to check the relevant links in the current article against the laready existing articles within the past
    • Did anyone else initially pronounce "Molestar" the same way I did, before realizing it was "molestar" as in the burrowing rodent and the heavenly object?
  • by catbutt (469582) on Thursday January 06, 2005 @08:40PM (#11283089)
    dupe checker for slashdot
    • I bet you can't.
      • How difficult would it be ?

        All slashdot editors have to do is search through their archive to see if there are any similar stories. It wouldn't be difficult to automate.
        • There are thousands of stories in the Archive. Comparing every article submission against every story

          It wouldn't be difficult to automate.

          Really? How? Computers have a really hard time parsing human language, and comparing two paragraphs to see if they are about the same subject would be quite difficult. If you could write a program to do that well you'd be a billionare.

          The computer could check URLs, but often the URLs in dupe stories are different then in the original story.
          • World's Shortest P2P App: 15 lines [slashdot.org] just over the middle of the page.
            • Right, now compare that article against all articles from the last 6 months. Make sure you check against the keywords and common synonyms of the keywords.

              The editors could do this by hand, and in this case a computer could have caught "15 lines" and "p2p" if it could figure out that those were the keywords...

              Now, why is "30 Years of Adventure: A Celebration of D&D" in the results page for "world's shortest p2p app: 15 lines" ...

          • Excuse me ?, are you really suggesting this is a difficult problem ?.

            In this case all the editor would have had to have done is run this slashdot like this [slashdot.org]. When I said it would be easy to automate what I meant was that every time a story is posted a search is automatically run so the editor can check if the story has already been posted.
          • While you couldn't write a program that could tell you for sure whether or not the article is a dupe, you could have a list of articles displayed that show the same subject, (search for proper nouns, verbs, links) the only downside would be a small wait, but any decent computer could do it in a reasonable time (less than a minute?) and then if there were ones that "scored" high enough (enough matching nouns, verbs, links) then the editor would just look them over... but, no one will write it or use it so
          • Actually it isn't that hard, a few more than 15 but I'll bet I could do it in under 500, excluding libraries.
            • >> excluding libraries.

              There's the important part, I think. Any measure of a program's simplicity based on how many "lines" it is fails to take into account the level of abstraction the language itself provides. I mean how many instructions are called with those 15 lines?

              Simple to program != simple program
          • come on, you could get good results by just checking if the links are the same...

            a checker that required human interaction would at least be easy to write, one that would check for potential dupes(seriously, do the mods even _read_ slashdot? stuff like this is easy to remember even 6 months later that you have read about it, thus it probably being a dupe, so you should check....).
          • Maybe before articles are released to the general public, it should be pre-released to a "dupe checking" circle of readers... :)
            • ./ subscribers can preview articles.

              I was a subscriber at one point, and I submitted emails when I noticed a duplicate article in the queue, but the duplicate articles were rarely ever removed, and email to "daddypants" frequently bounced.

            • Yeah, and we could use a meta-dupe-checking group to ensure that the dupe-checkers were honestly and accurately checking for duplicates. And it would be a real success, just like the other checks and balances here on Slashdot!
        • by jarich (733129) on Thursday January 06, 2005 @09:13PM (#11283428) Homepage Journal
          All slashdot editors have to do is search through their archive

          Have you ever tried to find anything on /. with the built in search engine?

          Heck, for all we know, the editors ~are~ looking, but the search engine tells them it's a new article!

          It's a joke! Laugh! :)

  • by nizo (81281) * on Thursday January 06, 2005 @08:40PM (#11283098) Homepage Journal
    P2P apps are really easy to write, don't have to be complicated, and thus banning them (a la the INDUCE Act) is pointless and silly.

    Umm, if I publish a recipe for crack that uses 2 less ingredients than the normal recipe and takes only half the time to make, why would that be a valid argument for making crack legal? Don't get me wrong I think the act is idiotic, but I don't follow Mr. Felton's reasoning here.

    • by Skepparn (838310) on Thursday January 06, 2005 @08:43PM (#11283139) Journal
      i follow your point, but i think that his point is that banning ONE program is pointless, since "anyone" (not me though) easily could program a new p2p app..
    • by nurb432 (527695) on Thursday January 06, 2005 @08:45PM (#11283155) Homepage Journal
      But the act of publishing your recipe should remain legal. As should the existance P2P apps. I think is the point everyone is making, in their own way.

      Its the illegal use of your recipe, or the improper use of the p2p that should be dealt with, not the technology ( or information, in your example )..
    • The inherent ingredient in Crack, Cocaine, which egal to begin with. A P2P app inheriently is not illegal, but illegal acts can be commited by the use of the application though. The point of making the P2P app in 15 lines of code is to prove that legislation regulating and restricting the development/dissemination of P2P applications would be pointless.
    • I was going to make this point too. It's pretty easy to kill someone with a handgun - even easier than writing a 15 line P2P app. This doesn't mean murder should be legal.

      • But simply using p2p should not be illegal. There are legitimate uses for it. Your argument is like saying crack houses are bad, so let's ban houses.
        • I'm not saying that at all. If I were, then I'd be saying "let's ban computers".

          I strongly agree that there are some really great applications for P2P. For example, what if there was a P2P program that would help teachers trade lesson plans and teaching materials (i.e. not materials from a publisher, but materials created by a teacher who chooses to share them). I could imagine that such a system could help find lessons by subject, grade level, what text book it might supplement (or not).

          My point is not t
    • I think the real point is how do you enforce such a think meaningfully. The compiler isn't illegal, and if the code is a mere couple lines, you need no real expertise to code one, a simple internet search could easily yield a viable codebase. So, any joe shmoe with a text editor, a PC, and the appropriate compiler installed can create a P2P app and replicate it endlessly, not to mention quite easily distribute it too. At that point enforcement of any law banning such apps becomes really difficult to just
    • I think the point is not that it's just easier but 15 lines impies that it is very easy in which case there might be an argument for making it legal. Your example happens to be the best example I can think of. What if crack could be made with a handful of household ingredients and the method was simple enough that an average person could not only implement it but think it up. Sure crack wouldn't become any less harmful but any law against would be a joke. It would be unenforcable since anyone could make
    • Umm, if I publish a recipe for crack that uses 2 less ingredients than the normal recipe and takes only half the time to make, why would that be a valid argument for making crack legal?

      Probably not. Then again, if you published a simple to follow recipe for making crack using nothing but commonly available household items one would have to question the point of banning crack - giving the difficulty in enforcing such a ban. Which is the point.

      Jedidiah.
    • Umm, if I publish a recipe for crack that uses 2 less ingredients than the normal recipe and takes only half the time to make, why would that be a valid argument for making crack legal?

      Actually, yes, if the simplification of the method makes the law significantly less enforcable.

      Unenforcable laws should be removed from the books and moved from the province of laws to the province of morals. If you can't stop them when they do it, or have a good chance to catch them when they do, it's time to stop polici
  • Libraries (Score:2, Insightful)

    by flossie (135232)
    import sys, os, SimpleXMLRPCServer, xmlrpclib, re, hmac

    15 lines of code, but linking to libraries that do much of the hard work.

    • Re:Libraries (Score:5, Insightful)

      by LnxAddct (679316) <sgk25@drexel.edu> on Thursday January 06, 2005 @08:53PM (#11283247)
      In that case, next time you write a hello world program, make sure you write a custom OS with it and don't forget the thousands of drivers you'll need. Sharing or reusing code is a common and necessary practice.
      Regards,
      Steve
      • Re:Libraries (Score:4, Interesting)

        by syukton (256348) on Thursday January 06, 2005 @10:03PM (#11283879)
        In writing a hello world program, all you need is direct access to the framebuffer, which any language worth its salt will provide. Regarding your "thousands of drivers" remark, again, you don't really need all this: just the framebuffer and a screen. You don't need sound or floating point support, just you and the framebuffer. I know you were being a smartass, but everything you need for "Hello World" is in the BIOS, from the character set to interfacing with the framebuffer, and "Hello World" can be accomplished but a few dozen more bytes than there are in the string "Hello World."

        You know what happens when you don't totally reinvent a chunk of code but instead write a chunk of code suited directly to your specific goals? The file size shrinks and it does only what you want it to. Sounds good to me.

        For a look at what writing everything from scratch gets you, look at this demo:
        http://www.pouet.net/prod.php?which=482
        It 's a flythrough of the first level of Descent (remember Descent?) in 4096 bytes, including a MIDI soundtrack. Not 4096k, but 4096 bytes, or 4 kilobytes. 4k. Four K!

        Imagine what Microsoft could do if they rewrote code more often to directly suit a certain goal, instead of just building up on top of what they already have. I want the next release of Windows to have a *smaller* footprint than XP. heh.
    • by raehl (609729) <raehl311&yahoo,com> on Thursday January 06, 2005 @09:28PM (#11283557) Homepage
      The point isn't how trivial (or not) a complete P2P solution is.

      The point is that the DIFFERENCE between a networking application that has nothing to do with P2P and a P2P application is 15 lines. Thus, if you write a law that "bans something that allows peer-to-peer file sharing", you've probably just banned the standard distribution of Python since, being only 15 lines short of being a full P2P app, it pretty much allows peer to peer file sharing.
    • Yes, the wonderful world of component/object (RAD) based development. Nowadays creating a embedded webserver or ftpserver is just a matter of calling an class/object/library, like:

      httpd myServer = httpd(80)
      myServer.start();

      Easily done in C and C++ too, libhttpd.so, etc. Look at all the good stuff included in the GNOME and KDE environments. No reason to reinvent the wheel if you dont need to.
  • P2P (Score:3, Insightful)

    by tuxter (809927) on Thursday January 06, 2005 @08:42PM (#11283122) Journal
    NApster, kazaa, bittorrent, Whatever you use and they then ban will be replaced with another app. There is always someone smarter than the last guy, therefore you will never get rid of P2P altogether.
  • by OverlordQ (264228) on Thursday January 06, 2005 @08:42PM (#11283127) Journal
    Dr. Edward Felten recently posted a piece of code called TinyP2P, which demonstrates how easy it is to create a peer-to-peer filesharing application by doing it in just 15 lines of Python. However, TinyP2P uses a ready-made XMLRPC server library, which seems to me to be taking the easy way out. Here's my response: MoleSter, a non-trivial filesharing application in 6 lines of Perl, using no protocol library more sophisticated than TCP.


    MoleSter [sooke.bc.ca]
  • by krbvroc1 (725200) on Thursday January 06, 2005 @08:42PM (#11283131)
    10 wget http://localhost/warez/\* 20 pause 10 30 goto 10
  • Thank god! (Score:3, Funny)

    by ozric99 (162412) on Thursday January 06, 2005 @08:43PM (#11283142) Journal
    I've been waiting for a suprnova replacement for a while!
  • Why don't you guys just write a 15 line program that checks the first 50 replies to stories, and filter out 49 of them that say anything about it being a repost.
  • by nt7s (842196) on Thursday January 06, 2005 @08:44PM (#11283148) Homepage
    Does anyone want to enlighten me as to how a 15 line P2P app means that it is pointless and silly to ban them? TPTB are not going to care if you hack together a little P2P app that you and your buddies use. However, if that little app becomes as popular as Kazaa or BitTorrent, you can bet they will be gunning for your program; they won't care if it is 15 lines or 150000 lines.
    • by anum (799950) on Thursday January 06, 2005 @09:02PM (#11283327)
      POOR ANALOGY ALERT:
      The nearest analogy I can think of is Prohibition. You can make alcohol illegal and you can punish people for making it or selling it or drinking it, but there are a lot of people who want to drink and alcohol is VERY easy to make. So every time you close down one source another pops up. There is a demand and you can't control the supply because anyone with enough time can create a new supply.

      Now feel free to argue the inappropriate nature of my analogy. Have fun!
    • However, if that little app becomes as popular as Kazaa or BitTorrent, you can bet they will be gunning for your program; they won't care if it is 15 lines or 150000 lines.

      And then as soon as they start gunning for your program, 30 others will pop up and at least 5 of them will become just as popular as yours was, thus making it pointless to have gunned down the initial program; you just made the problem worse.

      Quoting the author of TinyP2P
      "P2P can be simple and written very quickly, so to try to ban or
    • Does anyone want to enlighten me as to how a 15 line P2P app means that it is pointless and silly to ban them?

      The point is that a ban would be ridiculously hard to enforce as pretty much anyone could write a new P2P app, which could quickly rise to popularity. You'd be fighting an endless battle with no hop of victory unless you start putting serious restrictions on compilers etc. at which stage... well...

      Jedidiah.
  • Under the regime of the new red scare by the leader Bill Gates.. hes now a communist.

    I apologize for blatant whoring.
  • Eh? (Score:4, Insightful)

    by ZSpade (812879) on Thursday January 06, 2005 @08:46PM (#11283171) Homepage
    How does the fact that they're simple to make have any ramifications on whether or not they should be banned? Meth is simple to make, but I don't see anyone using that as excuse to make it legal. "P2P can be simple and written very quickly, so to try to ban or prevent the technology is not feasible." What he fails to mention is that while they may be simple and quick to write, they take months to gather serious steam, giving ample time to stop them, at least from becoming mainstream like bit torrent, Kazaa, or edonkey. It honestly makes no sense. I don't agree that they should be made illegal, but this is not really a decent supporting argument as to why.
    • The difference being, as several others have pointed out, that meth is harmful, and P2P is not, unless its users CHOOSE to break the law.

      It's about like the gun analogy. P2P doesn't violate copyright. People with P2P apps violate copyright. Just because something CAN be used to break the law doesn't mean it WILL be, and should therefore be banned.

      p
    • Re:Eh? (Score:3, Interesting)

      by Thing 1 (178996)

      Meth is simple to make, but I don't see anyone using that as excuse to make it legal.

      No, but it is one of the reasons that it's a "social infection" that's damn hard to stamp out.

      Same with pot. It's a weed, fer chrissakes. It'll find a way to grow through concrete, and in areas where other plants will die. It's practically impossible to eradicate it (until we've got nanotech, but even then I think it would be foolish to attempt; once we have nanotech, there'll be much easier ways to achieve a hig

  • And to go along with this the MPAA and RIAA will quickly hit the programmer with the world's shortest lawsuit. It will be written in English.
  • by geekoid (135745) <dadinportland @ y a hoo.com> on Thursday January 06, 2005 @08:46PM (#11283177) Homepage Journal
    has mentioned that this story is a dupe?
  • Python? (Score:4, Funny)

    by Psychor (603391) on Thursday January 06, 2005 @08:48PM (#11283189) Homepage
    Python? That code is so hard to read I thought it was Perl!
    • Re:Python? (Score:3, Insightful)

      by Doppler00 (534739)
      This is the ugliest, hardest to read python code I've ever seen. How can someone abuse such a wonderful language like this?

      My guess is that most of the functionality of the code is in the standard libraries imported at the begining: SimpleXMLRPCServer, xmlrpclib

      They could have just as well imported "p2p_lib" if such a thing existed.
  • My goal in creating this program is not to facilitate copyright infringement. I do not condone copyright infringement. Nothing about the program's design is optimized for the sharing of infringing files. The program is useful mainly as a proof of concept. A more practical program would be faster, more secure, and more resilient against failure. But that would require a few more lines of code!


    Just because it can be done, doesn't mean you should.
  • by Anonymous Coward on Thursday January 06, 2005 @08:51PM (#11283223)
    heres some +5 comments for your viewing pleasure!

    The point is that a person/entity can create a P2P program with a very small amount of custom code. If someone is going to ban P2P for "inducing" copyright infringement, they'd look stupid for banning a program this small or they'd have to ban the libraries that are used too which is pretty unlikely.

    A p2p app is pretty pointless without a network stack but no one counts that as part of the app or supporting code. Don't pick the nits too much.

    Umm, you're missing the point. The fact is with commonly available tools, and I'd consider Perl and Python (or Java) with their massive stock libraries "commonly available", one can easily write a p2p app (heck, BitTorrent is written in Python, so I think it's a very valid example).

    Hell, by your logic, the following application:

    int main(int argc, char **argv)
    {
    printf("Hello World");
    }

    is cheating, since I'm using printf, and god knows how complicated that call is, not to mention all the code in the OS to make the text appear on stdout!

    Those are both cheating.

    Okay, here's p2p in two lines of perl:

    #!/usr/bin/perl
    `wget http://www.filefront.com/?filepath=/gnutelliums/gt k-gnutella/gtk-gnutella-0.92.1c.tar.gz`;

    It also uses files, which is totally cheating. Without fi.write(), this guy would have to do a lot more work to have the computer convert a virtual address into the a device real address and accessing the filesystem implementation specific rules to carry out the necessary data and metadata operations to complete the task. And thats just the half of it.

    Do Perl developers have some kind of reverse size-compensation complex?

    Anything you can do I can do smaller?

    It's commonly referred to as "golf". ;) http://www.perlmonks.org/index.pl?node=golf [perlmonks.org]

    I have just created a zero line P2P program which I have entitled "Walking to the Neighbor's House to Borrow a Movie".

    I could be evil and patent it, but I have decided to release it under the GPL.

    I have discovered a truly marvelous demonstration of P2P that this margin is too narrow to contain.

    --Fermat's Second-to-Last Conjecture

    I've added some new features to your wonderful program, which I too am releasing under the GPL. I call it:

    "Breaking in to the Neighbor's House to steal a Movie".

    Oh yeah, I got it in 2 lines of shell: (Score:5, Funny)
    by Anonymous Coward on Wednesday December 15, @01:10PM (#11096822)
    #!/bin/bash
    ### ToDo: Write P2P app here

    There goes my argument that Python promotes readable code....

    Matthew Scala, a reader of Freedom to Tinker, has responded with the 9 line MoleSter, written in Perl.

    There have been discussions recently about potential employers doing a Google search on job applicants, so the way I see it Mr. Scala's either very smart or very stupid.

    Very stupid, for the fact a lot of searches will put "Matthew Scala" and "molester" together on the same page.

    Very smart, because this tactic will bury any evidence of his pedophilia under a pile of MoleSter links and pages.

    =P
    --
    ± 23 dB
    • by hkb (777908)
      Always the hacker, I've ported your 2 line Perl program to sh:

      #!/bin/sh
      wget http://www.filefront.com/?filepath=/gnutelliums/gt k-gnutella/gtk-gnutella-0.92.1c.tar.gz

      You'll notice that it weighs in at significantly fewer bytes than your original Perl program.
    • by hkb (777908)
      Version 2.0:

      #!/bin/sh
      wget http://tinyurl.com/3t8mj
  • I can kill someone with as much simplicity as a bullet to the head. Does that make murder laws silly?
  • I don't understand this. Yeah, it's pretty cool to write a fifteen line P2P app, but just because the concept is simple to implement doesn't mean it's unworthy to ban. Not that I'm arguing for banning P2P apps, I'm just critiquing the logic used here. It's also fairly easy to write a simple virus or trojan. Should law enforcement give up pursuing computer criminals who write viruses and such as a result? Better put: shouldn't the amount of damage to society be the valuation for enacting a ban or chasing criminals, not the ease with which criminals obtain or create their tools of trade? Maybe his original statement was taken out of context or more nuanced than the quoted text... --M
    • The logic is more along the lines of the government attempting to ban salt. You really cannot ban something that is totally beyond your ability to control.

    • A virus is a program that is presumably unwanted by its recipient. A P2P program is unwanted by a small but wealthly and potentially controlling segment of our society that doesn't want _anyone_ to have them.

      Further, you might note that it's not a crime to teach someone how to write a virus, or even a crime to give people virus code, it is only criminal when the recipients of the virus are unwilling to receive it.

  • Sawed-off shotguns are easy to make, too. Doesn't seem to stop them being illegal.

    My question is, what is with this need for geeks to "prove" something is innocuous based on the number of lines of code? It's just so stupid. Viruses are easy to write, too (I'm sure someone can do it in 15 lines), but that doesn't mean we shouldn't make those illegal.

    Makes me weep for the future when I see college professors being so blind to what the real issues are here.

    • Comparing p2p applications with sawed-off shotguns and virus code?

      Why not just ban TCP/IP networking, and IPX (just in case)?

      The application is not the problem. Jackasses trading in copyrighted material is. Get over it.
  • by dstone (191334) on Thursday January 06, 2005 @08:58PM (#11283285) Homepage
    Code is left intact, but here is the whitespace massaged into a more widely-accepted (and readable) convention. You see, Python isn't -that- sensitive to whitespace! ;-)
    # tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)

    impo rt sys, os, SimpleXMLRPCServer, xmlrpclib, re, hmac # (C) 2004, E.W. Felten

    ar, pw, res = (
    sys.argv,
    lambda u:hmac.new(sys.argv[1], u).hexdigest(),
    re.search)
    pxy, xs = (
    xmlrpclib.ServerProxy,
    SimpleXMLRPCServer.SimpleXMLRPCServer)

    def ls(p=""):
    return filter(
    lambda n: (p == "") or res(p, n),
    os.listdir(os.getcwd()))

    if ar[2] != "client": # license: http://creativecommons.org/licenses/by-nc-sa/2.0
    myU, prs, srv = (
    "http://"+ar[3]+":"+ar[4],
    ar[5:],
    lambda x:x.serve_forever())

    def pr(x=[]):
    return ([(y in prs) or prs.append(y) for y in x] or 1) and prs

    def c(n):
    return ((lambda f: (f.read(), f.close()))(file(n)))[0]

    f = lambda p, n, a: \
    (p == pw(myU)) and \
    (((n == 0) and pr(a)) or ((n == 1) and [ls(a)]) or c(a))

    def aug(u):
    return ((u == myU) and pr()) or pr(pxy(u).f(pw(u), 0, pr([myU])))

    pr() and [aug(s) for s in aug(pr()[0])]

    (lambda sv: sv.register_function(f, "f") or
    srv(sv))(xs((ar[3], int(ar[4]))))

    for url in pxy(ar[3]).f(pw(ar[3]), 0, []):
    for fn in filter(lambda n:
    not n in ls(),
    (pxy(url).f(pw(url), 1, ar[4]))[0]):
    (lambda fi: fi.write(pxy(url).f(pw(url), 2, fn)) or
    fi.close())(file(fn, "wc"))
  • by dustinbarbour (721795) on Thursday January 06, 2005 @08:58PM (#11283290) Homepage
    It's about file size or byte count. That's it. Why there is such a hoopla over the number of lines I don't know.. It's an arbitray definition.
  • People pointing out that you could write a web server in x lines of perl ( usually in the low 2 digits ) and people talking about the smallest embedded web server (including the networking stack) in the low double digit K bytes (as in 12 - 19 K bytes)

    Can you even boot a modern OS with less than 1 MB ram these days ?

  • by revery (456516) <charles@nOsPAM.cac2.net> on Thursday January 06, 2005 @09:02PM (#11283328) Homepage
    I wrote a 2 line p2p app in python:

    import modified_tinyp2p, sys
    modified_tinyp2p(sys.argv[1])

    dependent libraries? what dependent libraries?!

  • and thus banning them (a la the INDUCE Act) is pointless and silly.

    By this reasoning, you could also argue that manufacturing illegal drugs is also too easy and outlawing them is pointless and silly. Oh wait..it is :p
  • by Indy Media Watch (823624) on Thursday January 06, 2005 @09:24PM (#11283512) Homepage
    In response to development of the World's shortest P2P Application, the RIAA has weighed-in with the World's shortest lawsuit, coming in at a mere 2 lines:

    #1 You are fucked.
    #2 See you in court.
  • by hummassa (157160) on Thursday January 06, 2005 @09:25PM (#11283525) Homepage Journal
    At http://ansuz.sooke.bc.ca/software/molester/ [sooke.bc.ca]:
    $/=$_;$,=shift;$w=$a=shift;$k{+shift}=1;socket S,2,1,6;bind S,for(listen S,5;$SIG{ALRM}=\m! (\S+) ([e-i])([^/]*)/!s&&($k{$w=$1}=$,eq$`)&&&$2){alarm 9;(accept(C,S),alarm 0)?read C,$_,1e6:($_="$, $a f".shift)}sub i{}sub t{socket C,2,1,6;$k{$w}&&=(connect C,&a)?print C"$, ".pop:0;close C}sub h{t"$_ i/"for keys%k}sub a{$w=~/:/;pack'CxnC4x8',2,$',split'\.',$`}sub f{$w=$_,t"$1 $3/"for keys%k}sub e{open C,'>',$3;print C $'}sub g{open(C,';&h}

Last yeer I kudn't spel Engineer. Now I are won.

Working...