mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
hybrid, p10, ts6, unreal: track SSL/TLS status of remote users (#169)
This commit is contained in:
parent
e0cc238001
commit
8ee0f3fdab
@ -112,6 +112,9 @@ class User(TSObject):
|
|||||||
# Stores service bot name if applicable
|
# Stores service bot name if applicable
|
||||||
self.service = None
|
self.service = None
|
||||||
|
|
||||||
|
# Whether the user is using SSL/TLS (None = unknown)
|
||||||
|
self.ssl = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def nick(self):
|
def nick(self):
|
||||||
return self._nick
|
return self._nick
|
||||||
|
@ -211,6 +211,9 @@ class HybridProtocol(TS6Protocol):
|
|||||||
# Call the OPERED UP hook if +o is being added to the mode list.
|
# Call the OPERED UP hook if +o is being added to the mode list.
|
||||||
self._check_oper_status_change(uid, parsedmodes)
|
self._check_oper_status_change(uid, parsedmodes)
|
||||||
|
|
||||||
|
# Track SSL/TLS status
|
||||||
|
self.users[uid].ssl = ('+S', None) in parsedmodes
|
||||||
|
|
||||||
# Set the account name if present
|
# Set the account name if present
|
||||||
if account:
|
if account:
|
||||||
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
||||||
|
@ -935,6 +935,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
ident, host, realname, realhost, ip)
|
ident, host, realname, realhost, ip)
|
||||||
|
|
||||||
uobj = self.users[uid] = User(self, nick, ts, uid, source, ident, host, realname, realhost, ip)
|
uobj = self.users[uid] = User(self, nick, ts, uid, source, ident, host, realname, realhost, ip)
|
||||||
|
uobj.ssl = False
|
||||||
self.servers[source].users.add(uid)
|
self.servers[source].users.add(uid)
|
||||||
|
|
||||||
# https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L708
|
# https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L708
|
||||||
@ -952,6 +953,9 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
accountname = modepair[1].split(':', 1)[0]
|
accountname = modepair[1].split(':', 1)[0]
|
||||||
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
||||||
|
|
||||||
|
elif modepair[0][-1] == self.umodes.get('ssl'): # track SSL status where available
|
||||||
|
uobj.ssl = True
|
||||||
|
|
||||||
# Call the OPERED UP hook if +o is being added to the mode list.
|
# Call the OPERED UP hook if +o is being added to the mode list.
|
||||||
self._check_oper_status_change(uid, parsedmodes)
|
self._check_oper_status_change(uid, parsedmodes)
|
||||||
|
|
||||||
|
@ -605,6 +605,10 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
if accountname != "*":
|
if accountname != "*":
|
||||||
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
||||||
|
|
||||||
|
# charybdis and derivatives have a usermode (+Z) to mark SSL connections
|
||||||
|
# ratbox doesn't appear to have this
|
||||||
|
self.users[uid].ssl = ('+%s' % self.umodes.get('ssl'), None) in parsedmodes
|
||||||
|
|
||||||
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
|
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
|
||||||
|
|
||||||
def handle_uid(self, numeric, command, args):
|
def handle_uid(self, numeric, command, args):
|
||||||
|
@ -507,6 +507,9 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
if ('+r', None) in parsedmodes and accountname.isdigit():
|
if ('+r', None) in parsedmodes and accountname.isdigit():
|
||||||
accountname = nick
|
accountname = nick
|
||||||
|
|
||||||
|
# Track SSL/TLS status
|
||||||
|
self.users[uid].ssl = ('+z', None) in parsedmodes
|
||||||
|
|
||||||
if not accountname.isdigit():
|
if not accountname.isdigit():
|
||||||
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
self.call_hooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user