toonbase: Remove unnecessary Disney hack check

This commit is contained in:
John Cote 2021-07-06 13:46:30 -04:00
parent fc6572b8fa
commit 0c17ea7c55
5 changed files with 0 additions and 166 deletions

View file

@ -616,7 +616,6 @@ dclass DistributedToon : DistributedPlayer {
setPartyStatus(uint64, uint8) ownrecv airecv; setPartyStatus(uint64, uint8) ownrecv airecv;
announcePartyStarted(uint64) ownrecv; announcePartyStarted(uint64) ownrecv;
setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv; setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv;
setModuleInfo(string []) airecv clsend;
setDISLname(string) ram; setDISLname(string) ram;
setDISLid(uint32) ram db airecv; setDISLid(uint32) ram db airecv;
flagAv(uint32, uint16, string []) airecv ownsend; flagAv(uint32, uint16, string []) airecv ownsend;

View file

@ -45,7 +45,6 @@ from toontown.toonbase import ToontownAccessAI
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.catalog import CatalogAccessoryItem from toontown.catalog import CatalogAccessoryItem
from toontown.minigame import MinigameCreatorAI from toontown.minigame import MinigameCreatorAI
from . import ModuleListAI
from functools import reduce from functools import reduce
if simbase.wantPets: if simbase.wantPets:
from toontown.pets import PetLookerAI, PetObserve from toontown.pets import PetLookerAI, PetObserve
@ -213,7 +212,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.hostedParties = [] self.hostedParties = []
self.partiesInvitedTo = [] self.partiesInvitedTo = []
self.partyReplyInfoBases = [] self.partyReplyInfoBases = []
self.modulelist = ModuleListAI.ModuleList()
self._dbCheckDoLater = None self._dbCheckDoLater = None
return return
@ -4194,31 +4192,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
else: else:
self.air.writeServerEvent('suspicious', self.doId, '$ found in toon name') self.air.writeServerEvent('suspicious', self.doId, '$ found in toon name')
def setModuleInfo(self, info):
avId = self.air.getAvatarIdFromSender()
key = 'outrageous'
self.moduleWhitelist = self.modulelist.loadWhitelistFile()
self.moduleBlacklist = self.modulelist.loadBlacklistFile()
for obfuscatedModule in info:
module = ''
p = 0
for ch in obfuscatedModule:
ic = ord(ch) ^ ord(key[p])
p += 1
if p >= len(key):
p = 0
module += chr(ic)
if module not in self.moduleWhitelist:
if module in self.moduleBlacklist:
self.air.writeServerEvent('suspicious', avId, 'Black List module %s loaded into process.' % module)
if simbase.config.GetBool('want-ban-blacklist-module', False):
commentStr = 'User has blacklist module: %s attached to their game process' % module
dislId = self.DISLid
simbase.air.banManager.ban(self.doId, dislId, commentStr)
else:
self.air.writeServerEvent('suspicious', avId, 'Unknown module %s loaded into process.' % module)
def teleportResponseToAI(self, toAvId, available, shardId, hoodId, zoneId, fromAvId): def teleportResponseToAI(self, toAvId, available, shardId, hoodId, zoneId, fromAvId):
if not self.WantTpTrack: if not self.WantTpTrack:
return return

View file

@ -1,99 +0,0 @@
import os
class ModuleList:
serverDataFolder = simbase.config.GetString('server-data-folder', '')
def __init__(self):
self.moduleWhitelistFilename = self.getWhitelistFilename()
self.moduleBlacklistFilename = self.getBlacklistFilename()
self.loadBlacklistFile()
self.loadWhitelistFile()
def getWhitelistFilename(self):
result = '%s.moduleWhiteList' % self.serverDataFolder
return result
def getBlacklistFilename(self):
result = '%s.moduleBlackList' % self.serverDataFolder
return result
def loadBlacklistFile(self):
try:
file = open(self.moduleBlacklistFilename + '.bu', 'r')
if os.path.exists(self.moduleBlacklistFilename):
os.remove(self.moduleBlacklistFilename)
except IOError:
try:
file = open(self.moduleBlacklistFilename, 'r')
except IOError:
return set()
file.seek(0)
moduleFile = self.loadFrom(file)
file.close()
result = self.loadFrom(moduleFile)
self.moduleBlacklist = result
return result
def loadWhitelistFile(self):
try:
file = open(self.moduleWhitelistFilename + '.bu', 'r')
if os.path.exists(self.moduleWhitelistFilename):
os.remove(self.moduleWhitelistFilename)
except IOError:
try:
file = open(self.moduleWhitelistFilename, 'r')
except IOError:
return set()
file.seek(0)
moduleFile = self.loadFrom(file)
file.close()
result = self.loadFrom(moduleFile)
self.moduleWhitelist = result
return result
def loadFrom(self, file):
result = set()
try:
for module in file:
module = module.strip()
if module:
result.add(module)
except EOFError:
pass
return result
def updateWhitelistFile(self):
try:
backup = self.getWhitelistFilename() + '.bu'
if os.path.exists(self.getWhitelistFilename()):
os.rename(self.getWhitelistFilename(), backup)
file = open(self.getWhitelistFilename(), 'w')
file.seek(0)
for whiteModule in self.moduleWhitelist:
file.write(whiteModule + '\n')
file.close()
if os.path.exists(backup):
os.remove(backup)
except EnvironmentError:
self.notify.warning(str(sys.exc_info()[1]))
def updateBlacklistFile(self):
try:
backup = self.getBlacklistFilename() + '.bu'
if os.path.exists(self.getBlacklistFilename()):
os.rename(self.getBlacklistFilename(), backup)
file = open(self.getBlacklistFilename(), 'w')
file.seek(0)
for blackModule in self.moduleBlacklist:
file.write(blackModule + '\n')
file.close()
if os.path.exists(backup):
os.remove(backup)
except EnvironmentError:
self.notify.warning(str(sys.exc_info()[1]))

View file

@ -335,7 +335,6 @@ class ToonBase(OTPBase.OTPBase):
cr.loginFSM.request('connect', [serverList]) cr.loginFSM.request('connect', [serverList])
self.ttAccess = ToontownAccess.ToontownAccess() self.ttAccess = ToontownAccess.ToontownAccess()
self.ttAccess.initModuleInfo()
def removeGlitchMessage(self): def removeGlitchMessage(self):
self.ignore('InputState-forward') self.ignore('InputState-forward')
@ -367,8 +366,6 @@ class ToonBase(OTPBase.OTPBase):
except: except:
pass pass
if hasattr(self, 'ttAccess'):
self.ttAccess.delete()
if self.cr.timeManager: if self.cr.timeManager:
self.cr.timeManager.setDisconnectReason(ToontownGlobals.DisconnectCloseWindow) self.cr.timeManager.setDisconnectReason(ToontownGlobals.DisconnectCloseWindow)
base.cr._userLoggingOut = False base.cr._userLoggingOut = False

View file

@ -1,44 +1,8 @@
#from pandac.PandaModules import listProcessModules
from direct.task import Task
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
class ToontownAccess: class ToontownAccess:
def __init__(self):
self.startupModules = []
def initModuleInfo(self):
self.startupModules = self.getModuleList()
taskMgr.doMethodLater(300, self.checkModuleInfo, 'moduleListTask')
def delete(self):
taskMgr.remove('moduleListTask')
del self.startupModules
def checkModuleInfo(self, task):
currentModuleList = self.getModuleList()
newModules = []
for module in currentModuleList:
if module not in self.startupModules:
self.startupModules.insert(0, module)
newModules.insert(0, module)
self.sendUpdate('setModuleInfo', [newModules])
return task.again
def getModuleList(self):
moduleString = '' #listProcessModules()
moduleList = []
if moduleString:
moduleList = moduleString.split(',')
return moduleList
def sendUpdate(self, fieldName, args = [], sendToId = None):
if base.cr and hasattr(base, 'localAvatar'):
dg = base.localAvatar.dclass.clientFormatUpdate(fieldName, sendToId or base.localAvatar.doId, args)
base.cr.send(dg)
def canAccess(self, zoneId = None): def canAccess(self, zoneId = None):
if base.cr.isPaid(): if base.cr.isPaid():
return True return True