Ming the Mechanic:
World's Smallest P2P Application

The NewsLog of Flemming Funch
 World's Smallest P2P Application2004-12-18 16:48
16 comments
by Flemming Funch

To demonstrate how simply it could be done, Ed Felten wrote a tiny peer-to-peer file-sharing program. Fifteen lines of Python:

# tinyp2p.py 1.0 (documentation at freedom-to-tinker.com/tinyp2p.html)
import 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: 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"))


And it can both be a client and a server. Of course this isn't going to run any network with 100s of thousands of users. But it shows how impossible it is for the enemies of file sharing to stop it.


[< Back] [Ming the Mechanic]

Category:  

16 comments

18 Dec 2004 @ 19:31 by Paul Hughes @24.205.216.166 : 6 lines of code
Someone has now done it in 6 lines of code:

require'drb';F,D,C,P,M,U,*O=File,Class,Dir,*ARGV;def s(p)F.split(p[/[^|].*/])[-1
]end;def c(u);DRbObject.new((),u)end;def x(u)[P,u].hash;end;M=="client"&&c(U).f(
x(U)).eachn-D["*"]).each{|f|F.open(f,
"w"){|o|o  



18 Dec 2004 @ 19:32 by Paul Hughes @24.205.216.166 : comment mangled
Not sure why the last half of my comment was cut off, but I listed the 6 lines of code.

Here is the source link: [link]  



19 Dec 2004 @ 03:14 by ming : Code
Darn, reminds me of my computer youth where people would write one-line APL programs, which nobody could understand, but which did a whole lot.  


21 Dec 2004 @ 15:21 by Qumana Blog @216.40.34.103 : RAP (Rapid Assembly Posting) - the Blogg
[trackback]: Hugh Macleod of Gaping Void gets into one of the most interesting areas of impact the Web has on the ...  


2 Dec 2015 @ 08:54 by jlgg @23.249.187.200 : jlgg
http://www.prada-purses.us Prada Clearance Sale
[link] ugg kids sale
[link] ugg women's classic short boot
[link] gucci messenger bag for women
[link] MCM Handbags
[link] michael kors clutch 2015
[link] prada crossbody bags
[link] Authentic Louis Vuitton Neverfull
[link] chanel tote bag
[link] mcm duffle bag
[link] Burberry Wallets Women
[link] louis vuitton shoes men
[link] mcm backpack
[link] ugg kids boots
[link] Coach Outlet
[link] michael kors purses outlet
[link] trx band workouts
[link] michael kors purse outlet
[link] michael kors crossbody bag
[link] gucci purses
[link] louis vuitton artsy handbag
[link] free shoes
[link] ugg snow boots store
[link] chanel diaper bag
[link] cheap louis vuitton speedy
[link] Longchamp Factory Outlet Online
[link] Cheap Real Gucci Belts for Men
[link] longchamp backpack
[link] prada purses
[link] burberry wallets for women
[link] MCM Factory Outlet
[link] ugg for cheap
[link] chanel tote bag 2015
[link] Chanel Wallet on Chain 2015
[link] longchamp sale
[link] louis vuitton mens wallets cheap
[link] Louis Vuitton Damier Azur
[link] birkin bag hermes cost
[link] ugg outlet online
[link] cheap coach purses
[link] chanel crossbody bag
[link] burberry for men cologne
[link] chanel wallet on a chain caviar
[link] Longchamp Tote Bag Outlet
[link] burberry men's wallet
[link] cheap louis vuitton handbags
[link] burberry men cologne
[link] michael kors handbags
[link] burberry shoes
[link] hermes birkin price list
[link] burberry crossbody bag
[link] ugg sheepskin boots
[link] michael kors store online
[link] michael kors bags
[link] coach sunglasses for women
[link] chanel diaper bag price
[link] burberry shoes for men
[link] burberry bags on sale online
[link] trx for sale
[link] Gucci Luggage Outlet
[link] burberry purses outlet
[link] Prada Shopper Tote
[link] burberry purses
[link] longchamp sale outlet
[link] coach diaper bag
[link] burberry belts
[link] discount louis vuitton purses outlet
[link] louis vuitton tote bag
[link] MCM Cheap Duffle Bags
[link] trx exercises
[link] Louis Vuitton Outlet Online Store Authentic
[link] prada messenger bag
[link] burberry bags on sale
[link] michael kors hobo bag
[link] prada loafers women
[link] sheepskin boots on sale
[link] trx ab workouts
[link] chanel clutch bag
[link] burberry purses outlet
[link] sheepskin boots for women
[link] longchamp bags macy's
[link] louis vuitton artsy mm
[link] michael kors crossbody
[link] Prada Outlet
[link] discount ugg boots for women
[link] Prada Handbags Outlet
[link] cheap ugg boots from china
[link] Gucci Crossbody Handbags
[link] longchamp tote bag outlet
[link] coach purses on sale macy's
[link] uggs clearence
[link] coach crossbody
[link] chanel flap bag price
[link] Prada Nylon Messenger Bag
[link] Louis Vuitton Monogram Tote
[link] burberry bags
[link] longchamp bags
[link] michael kors handbags on sale
[link] cheap ugg boots for women
[link] coach purses on sale
[link] chanel bags outlet
[link] michael kors tote
[link] chanel bags prices fall winter 2015
[link] Louis Vuitton Bags
[link] uggs for women
[link] black chanel bag with gold chain
[link] coach wallets
[link] louis vuitton damier
[link] michael kors clutch
[link] black uggs on sale
[link] Prada Women's Loafers
[link] MCM Clutch Bag
[link] burberry bags on sale
[link] Longchamp Bags Macy's
[link] mcm tote bag
[link] Burberry Handbags Outlet Online
[link] Coach Wallets on Sale Outlet
[link] louis vuitton watllets
[link] louis vuitton wallets for men
[link] ugg leather shoes
[link] Prada Totes
[link] gucci handbags outlet
[link] michael kors purses outlet
[link] Prada Cross Body Nylon Bags
[link] burberry diaper bag
[link] hermes belt price
[link] chanel bags outlet authentic
[link] Chanel Tote Bag 2015
[link] louis vuitton diaper bag
[link] Prada Factory Outlet Store
[link] Burberry Wallets Women
[link] Louis Vuitton Diaper Bag
[link] coach diaper bags
[link] MCM Bags at Macy's
[link] ugg slippers womens
[link] gucci cross body bag
[link] michael kors black purse
[link] louis vuitton belt price
[link] hermes purses
[link] louis vuitton speedy 25
[link] burberry handbag
[link] gucci diaper bag
[link] gucci luggage outlet
[link] michael kors bags on sale
[link] michael kors factory outlet online
[link] louis vuitton tote
[link] louis vuitton artsy mm
[link] cheap michael kors satchel
[link] coach wallets on sale outlet
[link] gucci bags
[link] trx workout
[link] black chanel bag
[link] black ugg sheepskin boots
[link] mcm handbags at bloomingdale's
[link] Classic Black Chanel Bag
[link] Chanel Factory Outlet
[link] ugg for sale
[link] burberry wallets
[link] Burberry Shoes Sale Women
[link] uggs australia
[link] louis vuitton purses
[link] longchamp tote
[link] uggs australia boots
[link] burberry for men
[link] Gucci Belt
[link] cheap michael kors purses outlet
[link] chanel clutch
[link] mcm bags
[link] gucci sunglasses for women
[link] cheap louis vuitton speedy
[link] louis vuitton artsy
[link] Louis Vuitton Damier Ebene bag
[link] Cheap Purses Michael Kors
[link] chanel wallet on a chain
[link] vintage chanel bags for sale
[link] louis vuitotn speedy
[link] Fendi Belt
[link] coach diaper bags on sale
[link] discount michael kors tote
[link] burberry tote sale
[link] mcm bags at macy's
[link] burberry bags
[link] Coach Handbags Sale Outlet
[link] coach handbags sale
[link] prada belts
[link] gucci cross body bag messenger
[link] burberry men's wallet sale
[link] longchamp backpack purse
[link] coach backpack
[link] prada outlet online usa
[link] louis vuitton neverfull
[link] louis vuitton belts for men
[link] ugg women boots
[link] Hermes Outlet
[link] burberry handbag sale
[link] mcm clutch bag
[link] coach tote bags outlet
[link] chanel classic flap bag
[link] Burberry Outlet Locations
[link] authentic louis vuitton duffle bag
[link] cheap louis vuitton tote
[link] mcm bag
[link] cheap girls uggs
[link] Coach Sunglasses Outlet
[link] cheap coach purses from china
[link] prada messenger bag in nylon
[link] Burberry Handbags On Sale
[link] michael kors factory outlet
[link] louis vuitton belt
[link] Chanel Clutch Bags
[link] chanel flap bag
[link] louis vuitton speedy 35
[link] michael kors handbags cheap
[link] gucci backpack
[link] Louis Vuitton Shoulder Bag Tote
[link] coach hobo bags outlet
[link] gucci luggage
[link] Prada Clutches on Sale
[link] coach crossbody bags
[link] louis vuitton zippy wallet
[link] Coach Factory Outlet Online
[link] prada outlet
[link] trx for sale
[link] michael kors purses
[link] chanel tote bag
[link] trx workouts
[link] louis vuitton diaper cheap
[link] mcm purses
[link] michael kors handbags
[link] cheap uggs clearence
[link] Coach Factory Outlet 85% Off
[link] black uggs
[link] cheap ugg boots 80% off
[link] Louis Vuitton Messenger Bag
[link] uggs on sale for women
[link] chanel crossbody
[link] uggs on sale
[link] hermes birkin price
[link] ugg leather boots
[link] Burberry Clearance Outlet
[link] michael kors black handbags
[link] discount uggs
[link] Chanel Flap Bag Price
[link] Louis Vuitton Neverfull GM
[link] Coach Outlet Diaper Bag
[link] free ugg
[link] Hermes Birkin Price 2015
[link] uggs clearence sale
[link] hermes purses prices
[link] gucci purses and handbags
[link] prada bags on sale
[link] louis vuitton travel bag men
[link] louis vuitton alma
[link] coach tote bags
[link] ugg boots for women
[link] MCM Factory Outlet
[link] MCM Bags at Macy's
[link] trx for sale
[link] louis vuitton zippy
[link] Longchamp Medium Shoulder Tote
[link] michael kors purse
[link] coach backpacks on sale
[link] trx straps
[link] burberry store chicago
[link] louis vuitton travel bag replica
[link] michael kors purses on sale
[link] ugg boots for men
[link] cheap trx straps
[link] prada handbags sale
[link] cheap louis vuitton belts
[link] sheepskin boots
[link] Hermes Belts for Cheap
[link] burberry crossbody bag sale
[link] cheap uggs on sale
[link] michael kors tote
[link] burberry belt men
[link] michael kors satchel
[link] ugg bailey button
[link] ugg kids
[link] Chanel Diaper Bags Sale
[link] Authentic Louis Vuitton Neverfull bag
[link] burberry bags on sale
[link] louis vuitton belts
[link] longchamp le pliage large tote
[link] louis vuitton shoulder bag
[link] coach messenger bag
[link] cheap ugg boots
[link] michael kors outlet
[link] louis vuitton neverfull
[link] discount louis vuitton purses
[link] discount michael kors satchel
[link] cheap michael kors purses
[link] ugg snow boots for women
[link] michael kors bag
[link] uggs for cheap
[link] Burberry Handbags Outlet
[link] prada tote bag black
[link] uggs for sale
[link] louis vuitton neverfull mm
[link] Burberry Men's Shirts
[link] Gucci on Sale from Factory
[link] michael kors hamilton tote
[link] cheap louis vuitton shoes
[link] michael kors tote
[link] trx
[link] burberry crossbody
[link] louis vuitton messenger
[link] gucci clutch purse
[link] free ugg boots
[link] michael kors tote bag
[link] Burberry Men's Wallet Outlet
[link] michael kors handbags sale
[link] Gucci Sunglasses for Women on Sale
[link] burberry sale outlet
[link] coach hobo bag
[link] Coach Crossbody Sale
[link] hermes belt
[link] Chanel Clutch
[link] burberry sale
[link] longchamp le pliage large tote sale
[link] prada loafers
[link] longchamp le pliage medium
[link] prada backpack purse
[link] louis vuitton travel bag
[link] cheap gucci belts for men
[link] Outlet Michael Kors Handbags
[link] louis vuitton wallet cheap
[link] mcm tote
[link] burberry belts for men
[link] ugg online shop
[link] chanel bags prices
[link] ugg outlet sale 2015
[link] prada clutch bag
[link] prada belts for men
[link] burberry belt
[link] cheap ugg boots
[link] mcm backpack price
[link] Burberry Cologne for Men
[link] cheap michael kors clutch
[link] Vintage Chanel Handbags
[link] Coach Bags
[link] Coach Purse Outlet Online 80% Off
[link] louis vuitton messenger bag
[link] mcm duffle bag for sale
[link] Michael Kors Purses
[link] burberry wallets for women
[link] mcm clutch
[link] Chanel Classic Flap Bag Price
[link] coach crossbody bags on sale
[link] burberry diaper bag on sale
[link] Coach Outlet Store Online
[link] coach purse outlet online 80% off
[link] coach bags on sale factory outlet
[link] mcm tote bag under 100
[link] prada crossbody bags on sale
[link] ugg sheepskin boots sale
[link] michael kors tote bags
[link] louis vuitton wallet for women
[link] vintage chanel bags
[link] prada tote
[link] cheap louis vuitton wallet
[link] Prada Nylon Backpack
[link] ugg slippers
[link] chanel classic flap bag price
[link] Louis Vuitton Monogram Canvas
[link] cheap michael kors handbags
[link] michael kors on sale
[link] coach purse outlet
[link] mcm handbags
[link] prada clutch
[link] gucci messenger bag
[link] ugg snow boots
[link] Burberry Outlet Online
[link] prada tote bag
[link] discount ugg boots
[link] michael kors black handbags
[link] Burberry Crossbody Sale
[link] mcm bags
[link] Burberry Crossbody Bags
[link] Louis Vuitton Tote Bags
[link] prada-crossbody
[link] louis vuitton artsy handbag
[link] Coach Purses Outlet Online
[link] girls ugg boots
[link] Louis Vuitton Diaper Bags
[link] louis vuitton belt for men
[link] discount michael kors bags
[link] chanel tote
[link] Burberry Tote Bags
[link] ugg bailey button triplet
[link] michael kors hamilton
[link] burberry tote
[link] gucci clutch
[link] Gucci Belt
[link] Burberry Backpack for Women
[link] louis vuitton handbags sale
[link] prada backpack
[link] cheap michael kors tote
[link] cheap uggs
[link] gucci backpack for men
[link] Price of Hermes Purses
[link] michael kors outlet store
[link] michael kors crossbody handbag
[link] louis vuitotn speedy
[link] black uggs for women
[link] Louis Vuitton Red Alma
[link] mcm purses handbags
[link] louis vuitton shoes
[link] ugg online sale
[link] Gucci Backpack for Sale
[link] ugg on sale for women
[link] Louis Vuitton Eva Clutch Bag
[link] Coach Outlet Store Online
[link] gucci sunglasses for women on sale
[link] MCM Bags at Macy's
[link] louis vuitton wallet
[link] ugg boots for sale
[link] michael kors purses
[link] gucci handbags outlet authentic
[link] coach handbags sale outlet
[link] Chanel Bag Prices 2014
[link] louis vuitton alma bag
[link] cheap louis vuitton speedy
[link] discount louis vuitton diaper bag sale
[link] louis vuitton monogram
[link] cheap gucci belts
[link] burberry store
[link] Burberry Outlet Online
[link] ugg bailey button boots
[link] Chanel Cross Body Bag
[link] burberry men
[link] uggs australia outlet
[link] louis vuitton handbags on sale
[link] michael kors black handbags
[link] Coach Laptop Bag
[link] ugg outlet
[link] louis vuitton purses on sale
[link] burberry purses
[link] MCM Bags at Macy's
[link] burberry wallet
[link] burberry crossbody bag sale
[link] louis vuitton artsy
[link] coach messenger bag for women
[link] ugg leather short boot
[link] louis vuitton duffle bag
[link] Chanel Tote Bag 2015
[link] prada bags
[link] coach crossbody handbags
[link] prada purses and handbags
[link] louis vuitotn speedy
[link] mcm tote bag
[link] longchamp le pliage medium shoulder tote
[link] trx straps
[link] Longchamp Backpacks Nylon
[link] birkin bag hermes
[link] Coach Purses Outlet Online
[link] Authentic Louis Vuitton Eva Clutch
[link] Longchamp Le Pliage Sale
[link] coach bags on sale
[link] gucci bags outlet
[link] gucci diaper bag on sale
[link] burberry backpack
[link] coach sunglasses
[link] burberry backpack for women
[link] prada handbags sale online
[link] coach diaper bags on sale
[link] cheap louis vuitton purses
[link] louis vuitton speedy 30
[link] louis vuitton purses
[link] louis vuitton eva clutch
[link] Burberry Handbags
[link] ugg for men
[link] louis vuitton duffle bag for men
[link] Gucci Handbags Outlet
[link] ugg womens
[link]
http://www.uggslippers.org ugg slippers for men
[link] uggs girls  



21 Apr 2016 @ 11:13 by Morey @188.143.232.27 : IBlUvICJVcWbmQJX
Unrpeallelad accuracy, unequivocal clarity, and undeniable importance!  


21 Apr 2016 @ 17:30 by Lolly @188.143.232.32 : rkgwVrsmKwYDQxbY
Too many comlpiments too little space, thanks! [link] [url=http://eslhpivr.com]eslhpivr[/url] [link=http://qmaefj.com]qmaefj[/link]  


23 Apr 2016 @ 03:38 by Sunny @188.143.232.32 : NzwEjHWykraSdzEecPe
[link] http://carinsurancequotesiur.top/FL/Kissimmee/full-coverage-car-insurance/ [link] http://carinsurancequotegeh.info/GA/Stockbridge/free-car-insurance-quotes/ [link] http://autoinsuranceocq.top/TN/list-of-car-insurances-in/ [link] http://carinsurancequoteyxn.top/WA/Olympia/cheapest-auto-insurance-in/  


25 Apr 2016 @ 06:05 by Ladainian @188.143.232.32 : LNaUNVLbPWwcyXwAcok
[link] http://autoinsurancequoteupp.top/UT/South-Jordan/auto-insurance-quotes/ [link]  


10 May 2016 @ 15:01 by Kiona @188.143.232.32 : oHHpgYMUSkhKXypUHUs
[link] http://autoinsurancequotezna.top/IN/Jeffersonville/best-auto-insurance-in/ [link] http://autoinsurancequotesbu.pw/TX/Corsicana/low-income-car-insurance/ [link] http://carinsurancequoteski.top/MN/Maple-Grove/car-insurance-with-no-license-in/  


16 May 2016 @ 17:27 by Chamomile @188.143.232.27 : sfMIhQEjUzeDQxYq
use [link] knowledge good sense-by [link] pay varies saving money [link] insurance companies go [link] ages gas being [link] should take taking [link] liability auto  


23 May 2016 @ 23:16 by Eloise @188.143.232.32 : fJuHFvGTQZwXfpAZhBlV
[link] http://pollexprint.us/general-auto-insurance-customer-service-phone-number.html [link] http://threadsofthecity.com/what-is-the-definition-of-automobile.html [link] http://threadsofthecity.com/does-aaa-sell-car-insurance.html  


6 Jun 2016 @ 10:26 by fain @180.251.33.55 : sfgbvgh
jghiojjopjy www.pelangsingbiolo.com
[link] hghikhl
[link] cjbfjkdxfnjxdhjkll
[link] sfgk
[link] cvhkll
[link] dfjkl
[link] hjlop
[link] vjiop
[link] wrkv
[link] advh
[link] yerg
www.purwonowono9.wordpress.com/tag/tukang-taman-surabaya/ huoof
[link] ghjklo
[link] gchjkh
[link] kdej
[link] gotjg
[link] merty
[link] dfyhklj
[link] fyuik
[link] ftyhk
[link] chjukilo
[link] cghiio
[link] wergv
[link] ellyn
[link] rylng
[link] hdfghj
[link] fsfyio
[link] dgwsh
[link] gkol
[link] rghjhn
[link] sfhjl
[link] dghml
[link] rttluy
[link] hjihiiy
www.bersosial.com/threads/lapak-jasa-seo-ditertibkan-satpol-pp.22468/ dxffuo
[link] fioom
[link] etyiioo
[link] ryin
[link] sryuik
[link] tyiklm
[link] srtuoop
[link] sryii
[link] hiooofrt
[link] gdugop
[link] yuiop
[link] guiolm
[link] ertyu
www.grosir-sextoys.com uoohl
ausis.edu.au/forum/showthread.php?tid=19003&pid=20713#pid20713 sjdfbsdjkbfsd
www.humbox.ac.uk/profile/4719 sdlfknsdjkfdsn  



21 Jun 2016 @ 16:01 by Boomer @188.143.232.32 : DVAPRtlAoJ
[link] http://goodpetservice.com/cheap-car-insurance-older-drivers.html [link] http://dmitryillustration.com/fiesta-auto-insurance-turlock-ca.html [link]  


28 Aug 2016 @ 08:51 by Adelphia @188.143.232.32 : qPhtzWTZrj
[link] http://www.bestmedicines.pw/html/viagra-for-all-ages.html [link] http://www.buyautoinsuranceonline.pw/ [link] http://www.getcarinsuranceratesonline.pw/html/cheap-car-insurance-and-model.html [link]  


29 Aug 2016 @ 05:24 by Sonny @188.143.232.27 : rfnBnJUXBPJlp
[link] http://www.edpackagesonline.men/ [link] http://www.eddrugs.men/ [link] http://www.edmeds.men/ [link]  


Your Name:
Your URL: (or email)
Subject:       
Comment:
For verification, please type the word you see on the left:


Other stories in
2014-11-01 17:33: The conversation of work
2007-02-24 14:20: Writing books in HTML/CSS
2007-02-05 15:21: Software is hard
2006-11-19 21:30: Thingamy
2005-12-14 15:15: Ruby on Rails
2005-03-19 16:04: Comment and Refererrer Spam
2005-02-23 21:34: Wikipedia
2005-02-22 17:32: Mail
2005-02-10 16:00: More Google wizardry
2005-02-04 15:14: The Six Laws of the New Software



[< Back] [Ming the Mechanic] [PermaLink]? 


Link to this article as: http://ming.tv/flemming2.php/__show_article/_a000010-001442.htm
Main Page: ming.tv