;ò = ÄDc@s!dkiZdkiZdkiZdkiZdkTdk i Z dk i Z dk iZdkiZdkiZdkZdkZdkZdkZdklZeieddƒƒeeƒGHdkl Zd„Zd„Z e!de ƒe!d eƒd ei"fd „ƒYZ#e#Z$dS( N(s*(slogs/home/ali/stlogsw(spluginscCsD|iidƒ}ti|i|ƒ o|i |dt ƒndS(Ns capabilitysRaise( sstatescbs registryValues capabilitysircdbscheckCapabilitysmsgsprefixsircserrorNoCapabilitysTrue(sircsmsgsargssstates capability((s./Gateway/plugin.pysgatewayCapable3scCs;|i}|o|ii|ƒn|iddtƒdS(Ns8This command may only be called from Gateway connectionssRaise( smsgs fromGatewaysconsstatesargssappendsircserrorsTrue(sircsmsgsargssstatescon((s./Gateway/plugin.pys gatewaySource9s   s gatewaySourcesgatewayCapablesGatewaycBs|tZdZd„Zd„Zd„Zd„ZeedgƒZd„Zeeddd gƒZd „Z ee dd gƒZ d „Z ee dgƒZ d „Z ee dgƒZ d „Z ee dde dƒgƒZ d„ZeeddgƒZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZeiiiiZRS(s‡Gateway allows users to connect to the bot via various network protocols. Please read the README.txt file if you are the bot owner.cCsWtii||ƒh|_h|_tid|_|i ƒ|i ƒ|i ƒdS(Ni( s callbackssPrivmsgs__init__sselfsircs _availables datapathssworldsircsscreateDirectoriessimportProtocolss autoStart(sselfsirc((s./Gateway/plugin.pys__init__Js    cCsb|ioP|iio;|ii}|i|id|iidd|ƒtSq^|Sn|SdS(Nismsg(smsgs inReplyTos fromGatewayscons sendReplysargssNone(sselfsircsmsgscon((s./Gateway/plugin.pys outFilterSs    cCs)x"|iD]}|i|iƒq WdS(N(sselfs _availablesps stopListening(sselfsp((s./Gateway/plugin.pysdie_s cCs|iiƒ|iƒdS(sqtakes no arguments Log out of a gateway session. This may only be called from a gateway session.N(sconsusers clearAuthsclose(sselfsircsmsgsargsscon((s./Gateway/plugin.pyslogoutcs s gatewaySourcec Csµt} |i|ƒ} xw|iD]l}|i|}|i oOxL|i D]=}|i i |jo$|id| |fdƒt} qFqFWqqW| o|iƒn|idƒdS(su Say to , where is the username of a user connected to the gateway.s from %s: %sssays$User is not connected to the gatewayN(sFalsesfoundsselfs getMsgNicksmsgsnicks _availablespsprsports _connectionsscsusersnames sendReplystextsTruesircs replySuccesss replyError( sselfsircsmsgsargssuserstextsprscspsnicksfound((s./Gateway/plugin.pyssayos    sgatewayCapables somethingstextc Csž|i|ƒ}t} x`|iD]U}|i|}|i o8x5|i D]&}|i d||fdƒt} qFWqqW| o|iƒn|idƒdS(sA Say to all users connected to the Gateway.s from %s: %sswalls,There are no users connected to the Gateway.N(sselfs getMsgNicksmsgsnicksFalsesfounds _availablespsprsports _connectionsscs sendReplystextsTruesircs replySuccesss replyError( sselfsircsmsgsargsstextsprscspsnicksfound((s./Gateway/plugin.pyswall„s    cCsMgi}|iiƒD]}||iƒq~}|i t d|ƒƒdS(sJtakes no arguments Returns a list of supported network protocols.s%LN( sappends_[1]sselfs _availablesvaluessssPROTOCOLsLsircsreplysformat(sselfsircsmsgsargssLs_[1]ss((s./Gateway/plugin.pys available—s3cCsgi}|iiƒD].}|io|d|i|ifƒqq~}t |ƒo|i t d|ƒƒn|i t ddƒƒdS(sWtakes no arguments Returns a list of running network daemons, and their ports.s%s on %ss%Ls%ssThere are no running gateways.N( sappends_[1]sselfs _availablesvaluessssportsPROTOCOLsLslensircsreplysformat(sselfsircsmsgsargssLs_[1]ss((s./Gateway/plugin.pysrunning s N cCs|}||ijog|i|i oD| o|i|idƒ}n|i|i|ƒ|iƒq}|i dƒndS(s@ Start the server named by .s defaultPortsError: Already runningN( sprotocolspsselfs _availablesportspersonalRegistryValuesstartListeningsircs replySuccesssreply(sselfsircsmsgsargssprotocolsportsp((s./Gateway/plugin.pysstart­ssownersintcCsDx=|iD]2}||jo|i|iƒ|iƒq q WdS(s8 Stop the server named by .N(sselfs _availablespsprotocols stopListeningsircs replySuccess(sselfsircsmsgsargssprotocolsp((s./Gateway/plugin.pysstop¿s   c Cs×g} x–|iD]‹}|i|}|iont|iƒ}g}x$|iD]}|i |i i ƒqLW|o'| i d||td|ƒfƒq›qqWt| ƒo|itd| ƒƒn|idƒdS(sMtakes no arguments Returns a list of users connected to the gateway.s %s %s (%s)s%Ls#Users connected to the gateway: %L.s,There are no users connected to the gateway.N(srlsselfs _availablespsprsportslens _connectionssncshmlsisappendsusersnamesformatsircsreply( sselfsircsmsgsargssprsncspsishmlsrl((s./Gateway/plugin.pysusersËs     / cCsw|iƒ}|iid||iƒ|iƒ}t i |iƒ||iƒ}|i d|ƒt idi|ƒdS(s handle a single command sReceived command %s from %s.s fromGatewayiN(scmdsstripsselfslogsdebugsconshostmasksgetNickstosircmsgssprivmsgsmstagsworldsircssfeedMsg(sselfscmdsconsmsto((s./Gateway/plugin.pysreceivedCommandÞs    cKsd|jo td‚npt}d|jo td‚nytii|dƒ}Wntj o tSnX|i dƒ}|i d|dƒ}|o$ti |d|ƒ otSq¿n|o$ti |d|ƒ otSqênd|jo!|i |dƒ otSqQn:d|jo(|i|d|dƒ otSqQntS|i|d|d|d ƒ|_|i|iƒ|Sd S( sJ will return a user object tagged with a hostmask for use or None sprotocolsNeed a protocol namesusernamesNeed a usernames capabilitys %s.capabilityspasswordsblobspeerN(skwsKeyErrorsNonesusersircdbsuserssgetUsersFalsesselfs registryValuescapspcapscheckCapabilitys checkPasswordscheckKeys buildHostmasksgwhmsaddAuth(sselfskwscapsuserspcap((s./Gateway/plugin.pysgetUserës:           cCsód|idti|f}ti|tiƒ o|ii dƒt Sn¤t |ƒ}x|D]ˆ}|iidƒ|iƒ}t|ƒdjoSy6ti|dƒ|jo|iidƒdSnWqçtij oqçXq_q_WdSdS( Ns%s%s%sskeys.ssh.authorizedsNo key file for users doing a lineiisYes!i(sselfs datapathssosssepsunskeypathsaccesssF_OKslogsdebugsFalsesopensfslinescriticalssplitslslensbase64s decodestringsblobsbinasciisError(sselfsunsblobsfslslineskeypath((s./Gateway/plugin.pyscheckKey s"    cCs"d|tiƒd ||fSdS(s2 build a new partly random hostmask and return it s %s%s!%s@%si N(sprotocolsutilssmktempsunspeer(sselfsunsprotocolspeer((s./Gateway/plugin.pys buildHostmask#scCs|id||ƒSdS(Ns Anonymous(sselfs buildHostmasksprotocolspeer(sselfsprotocolspeer((s./Gateway/plugin.pysbuildAnonymousHostmask'scCstidiSdS(Ni(sworldsircssnick(sself((s./Gateway/plugin.pysgetNick*scCsFtiiiidƒ|id<|i|idƒd|idti df|id<|i|idƒd|idti f|id<|i|idƒd|idti f|id<|i|idƒd |idti f|id <|i|id ƒd|idti d f|id <|i|id ƒdS( NsGatewaysroots%s%s%sskeyss%s%ssslskeys.ssls%s%ssshskeys.sshs%s%sauthorizedskeys.ssh.authorizeds protocols( sconfssupybots directoriessdatasdirizesselfs datapathsscreateIfNotExistingDirsosssep(sself((s./Gateway/plugin.pyscreateDirectories-s$!!!$cCs,ti|tiƒ oti|ƒndS(N(sossaccessspathsF_OKsmkdir(sselfspath((s./Gateway/plugin.pyscreateIfNotExistingDir<scCs7|i}d}|o|ii}n |i}|SdS(Ns(smsgs fromGatewaysconsnicksusersname(sselfsmsgsnickscon((s./Gateway/plugin.pys getMsgNick@s   cCsqxjtD]b}|i}||ƒ|i|           "        (%s supybot.confsconfs supybot.ircdbsircdbs supybot.utilssutilss supybot.worldsworldssupybot.commandsssupybot.pluginsspluginsssupybot.ircmsgssircmsgsssupybot.ircutilssircutilsssupybot.registrysregistryssupybot.callbackss callbackssbase64sbinasciisossinspectstwisted.pythonslogstlogs startLoggingsfilesdirs gwpluginss PLUGINLISTsgatewayCapables gatewaySources addConvertersPrivmsgsGatewaysClass(sircdbsconfsutilssircmsgss PLUGINLISTspluginssbase64sbinasciisClasssinspects gatewaySources callbackssregistrysworldstlogsgatewayCapablesossGatewaysircutils((s./Gateway/plugin.pys?s.                 ÿ#