Skip to content

Commit

Permalink
Censor staff passwords In IC and OOC. (#45)
Browse files Browse the repository at this point in the history
* Censor staff passwords in IC and OOC.

* Remove redundant passwords attribute in aoprotocol.py.

* Censor passwords only after a login command.

* Update internal version with correct date

Co-authored-by: Chrezm <42015761+Chrezm@users.noreply.github.com>
  • Loading branch information
RaveMaster073 and Chrezm authored Apr 11, 2020
1 parent 4a342fb commit ef0fcd0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions server/aoprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ def net_cmd_ms(self, args):
.format(self.client.displayname, raw_msg),
is_zstaff_flex=True, in_area=True)

# Censor passwords if login command accidentally typed in IC
for password in self.server.config['passwords']:
for login in ['login ', 'logincm ', 'loginrp ']:
if login + password in msg:
msg = msg.replace(password, '[CENSORED]')

if pargs['evidence']:
evidence_position = self.client.evi_list[pargs['evidence']] - 1
if self.client.area.evi_list.evidences[evidence_position].pos != 'all':
Expand Down Expand Up @@ -617,13 +623,19 @@ def net_cmd_ct(self, args):
except TsuserverException as ex:
self.client.send_ooc(ex)
else:
# Censor passwords if accidentally said without a slash in OOC
for password in self.server.config['passwords']:
for login in ['login ', 'logincm ', 'loginrp ']:
if login + password in args[1]:
args[1] = args[1].replace(password, '[CENSORED]')
if self.client.disemvowel: #If you are disemvoweled, replace string.
args[1] = Constants.disemvowel_message(args[1])
if self.client.disemconsonant: #If you are disemconsonanted, replace string.
args[1] = Constants.disemconsonant_message(args[1])
if self.client.remove_h: #If h is removed, replace string.
args[1] = Constants.remove_h_message(args[1])


self.client.area.send_command('CT', self.client.name, args[1])
self.client.last_ooc_message = args[1]
logger.log_server('[OOC][{}][{}][{}]{}'
Expand Down
10 changes: 8 additions & 2 deletions server/tsuserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def __init__(self, protocol=None, client_manager=None, in_test=False):
self.release = 4
self.major_version = 3
self.minor_version = 0
self.segment_version = 'a23'
self.internal_version = 'M200327a'
self.segment_version = 'a24'
self.internal_version = 'M200410a'
version_string = self.get_version_string()
self.software = 'TsuserverDR {}'.format(version_string)
self.version = 'TsuserverDR {} ({})'.format(version_string, self.internal_version)
Expand Down Expand Up @@ -242,6 +242,12 @@ def load_config(self):
with Constants.fopen('config/config.yaml', 'r', encoding='utf-8') as cfg:
self.config = Constants.yaml_load(cfg)
self.config['motd'] = self.config['motd'].replace('\\n', ' \n')
self.config['passwords'] = []
passwords = ['modpass', 'cmpass', 'gmpass']
for i in range(1, 8):
passwords.append('gmpass{}'.format(i))
for password in passwords:
self.config['passwords'].append(self.config[password])

for i in range(1, 8):
daily_gmpass = 'gmpass{}'.format(i)
Expand Down

0 comments on commit ef0fcd0

Please sign in to comment.