You are not logged in.
Dear visitor, welcome to Aqua Computer Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# tinyp2p.py 1.0 (documentation at [url]http://freedom-to-tinker.com/tinyp2p.html)[/url]
# (C) 2004, E.W. Felten
# license: http://creativecommons.org/licenses/by-nc-sa/2.0
# python tinyp2p.py password server hostname portnum [otherurl]
import sys
import os
import SimpleXMLRPCServer
import xmlrpclib
import re
import hmac
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':
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'))
|
-