Exemplo n.º 1
0
def ReceiveComponent(self, data):
    # TODO: If allowed = 1, add player to active players

    EGRSPacket = PacketEncoder.SetVar('TID', self.PacketID)
    EGRSPacket = PacketEncoder.encode('EGRS', EGRSPacket, 0x0, 0)

    self.transport.getHandle().sendall(EGRSPacket)
Exemplo n.º 2
0
def ReceiveComponent(self, data):
    LoginKey = PacketDecoder.decode(data).GetVar('LKEY')

    ClientsCount = len(Globals.Clients)

    # Check if user are already logged in FESL
    loop = 0
    while ClientsCount != loop:
        CurrentLoginKey = Globals.Clients[loop].LoginKey
        self.GAMEOBJ = Globals.Clients[loop]
        self.GAMEOBJ.TheaterNetworkInt = self.transport

        if CurrentLoginKey != LoginKey:
            CorrectlyLoggedIn = False
            loop += 1
            continue
        else:
            CorrectlyLoggedIn = True
            self.GAMEOBJ = Globals.Clients[loop]
            break

    if CorrectlyLoggedIn == True:
        self.GAMEOBJ.EXTIP, self.GAMEOBJ.INTPORT = self.transport.client
        USERPacket = PacketEncoder.SetVar('TID', self.PacketID)
        USERPacket += PacketEncoder.SetVar('NAME', self.GAMEOBJ.Name)
        USERPacket += PacketEncoder.SetVar('CID', '', True)

        USERPacket = PacketEncoder.encode('USER', USERPacket, 0x0, 0)
        self.transport.getHandle().sendall(USERPacket)
Exemplo n.º 3
0
def ReceiveComponent(self, data):
    print ConsoleColor('Info') + '[TheaterManager][ECNL] Client disconnected from server....' + ConsoleColor('End')
    ECHLPacket = PacketEncoder.SetVar('LID', PacketDecoder.decode(data).GetVar('LID'))
    ECHLPacket += PacketEncoder.SetVar('GID', PacketDecoder.decode(data).GetVar('GID'))
    ECHLPacket += PacketEncoder.SetVar('TID', self.PacketID, True)
    ECHLPacket = PacketEncoder.encode('ECHL', ECHLPacket, 0x0, 0)
    self.transport.getHandle().sendall(ECHLPacket)
Exemplo n.º 4
0
def ReceiveComponent(self, data):
    UBRAPacket = PacketEncoder.SetVar('TID', self.PacketID)
    UBRAPacket = PacketEncoder.encode('UBRA', UBRAPacket, 0x0, 0)
    self.transport.getHandle().sendall(UBRAPacket)

    if data.find('UGAM') != -1:
        data = data.split('UGAM')[1]
        UGAM.ReceiveComponent(self, data)
Exemplo n.º 5
0
def ReceiveComponent(self, data):
    ConnPacket = PacketEncoder.SetVar('TID', self.PacketID)
    ConnPacket += PacketEncoder.SetVar('TIME', str(time.time()).split('.')[0])
    ConnPacket += PacketEncoder.SetVar('activityTimeoutSecs', 3600)
    ConnPacket += PacketEncoder.SetVar(
        'PROT',
        PacketDecoder.decode(data).GetVar('PROT'))

    ConnPacket = PacketEncoder.encode('CONN', ConnPacket, 0x0, 0)
    self.transport.getHandle().sendall(ConnPacket)
Exemplo n.º 6
0
def ReceiveComponent(self, data):
    # Update server info

    if data.find('UBRA@') != -1:
        data = data.split('UBRA@')[0]
        UBRAPacket = PacketEncoder.SetVar('TID', self.PacketID)
        UBRAPacket = PacketEncoder.encode('UBRA', UBRAPacket, 0x0, 0)
        self.transport.getHandle().sendall(UBRAPacket)

    NewData = data.replace('UGAM', '')[8:]
    NewData = NewData.replace('\x00', '').split('\n')

    NewValues = len(NewData) - 1

    loop = 0
    NewKeysNames = []
    NewKeysValues = []
    while loop != NewValues:
        NewKeysNames.append(NewData[loop].split('=')[0])
        NewKeysValues.append(NewData[loop].split('=')[1])
        loop += 1

    loop = 0

    while loop != len(NewKeysNames):
        if NewKeysNames[loop] in self.GAMEOBJ.AttrNames:
            AttrId = self.GAMEOBJ.AttrNames.index(NewKeysNames[loop])
            self.GAMEOBJ.AttrData[AttrId] = NewKeysValues[loop]
        else:
            self.GAMEOBJ.AttrNames.append(NewKeysNames[loop])
            self.GAMEOBJ.AttrData.append(NewKeysValues[loop])
        loop += 1

    print ConsoleColor(
        'Success'
    ) + '[TheaterServer][UGAM] Successfully updated game info!' + ConsoleColor(
        'End')
Exemplo n.º 7
0
def ReceiveComponent(self, data):
    # Create game

    # Get all game data
    NewData = data.replace('UGAM', '')[12:]
    NewData = NewData.replace('\x00', '').split('\n')
    NewValues = len(NewData) - 1

    loop = 0

    while loop != NewValues:
        self.GAMEOBJ.AttrNames.append(NewData[loop].split('=')[0])
        self.GAMEOBJ.AttrData.append(NewData[loop].split('=')[1])
        loop += 1

    # Get Required data
    self.GAMEOBJ.EXTPort = self.GAMEOBJ.GetData('PORT')
    self.GAMEOBJ.INTPort = self.GAMEOBJ.GetData('INT-PORT')
    self.GAMEOBJ.INTIP = self.GAMEOBJ.GetData('INT-IP')

    GameID = Globals.CurrentGameID
    self.GAMEOBJ.GameID = GameID
    CGAMPacket = PacketEncoder.SetVar('TID', self.PacketID)
    CGAMPacket += PacketEncoder.SetVar('LID', 1)
    CGAMPacket += PacketEncoder.SetVar('UGID', PacketDecoder.decode(data).GetVar('UGID'))
    CGAMPacket += PacketEncoder.SetVar('MAX-PLAYERS', PacketDecoder.decode(data).GetVar('MAX-PLAYERS'))
    CGAMPacket += PacketEncoder.SetVar('EKEY', 'O65zZ2D2A58mNrZw1hmuJw%3d%3d') # TODO: Generate this
    CGAMPacket += PacketEncoder.SetVar('SECRET', 2587913) # TODO: Generate this
    CGAMPacket += PacketEncoder.SetVar('JOIN', PacketDecoder.decode(data).GetVar('JOIN'))
    CGAMPacket += PacketEncoder.SetVar('J', PacketDecoder.decode(data).GetVar('JOIN'))
    CGAMPacket += PacketEncoder.SetVar('GID', GameID, True)
    Globals.CurrentGameID += 1
    CGAMPacket = PacketEncoder.encode('CGAM', CGAMPacket, 0x0, 0)
    self.transport.getHandle().sendall(CGAMPacket)

    print ConsoleColor('Success') + '[TheaterServer][CGAM] Successfully created new game!' + ConsoleColor('End')
Exemplo n.º 8
0
def ReceiveComponent(self, data):
    # Remove player from server
    print ConsoleColor(
        'Info'
    ) + '[TheaterServer][PLVT] Client has been kicked from game!' + ConsoleColor(
        'End')

    KICKPacket = PacketEncoder.SetVar('PID', 1)  # TODO: Make it non-static
    KICKPacket += PacketEncoder.SetVar('LID', 1)  # LobbyID
    KICKPacket += PacketEncoder.SetVar('GID', self.GAMEOBJ.GameID, True)
    KICKPacket = PacketEncoder.encode('KICK', KICKPacket, 0x0, 0)
    self.transport.getHandle().sendall(KICKPacket)

    PLVTPacket = PacketEncoder.SetVar('TID', self.PacketID, True)
    PLVTPacket = PacketEncoder.encode('PLVT', PLVTPacket, 0x0, 0)
    self.transport.getHandle().sendall(PLVTPacket)
Exemplo n.º 9
0
def ReceiveComponent(self, data, txn):
    if txn == 'Start':
        print ConsoleColor(
            'Info'
        ) + '[FESLClient][Matchmatching] Started matchmatching...' + ConsoleColor(
            'End')

        StartPacket = PacketEncoder.SetVar('TXN', 'Start')
        StartPacket += PacketEncoder.SetVar('id.id', 1)
        StartPacket += PacketEncoder.SetVar('id.partition',
                                            '/eagames/bfwest-dedicated', True)
        StartPacket = PacketEncoder.encode('pnow', StartPacket, 0xC0000000,
                                           self.PacketID)
        self.transport.getHandle().sendall(StartPacket)

        StatusPacket = PacketEncoder.SetVar('TXN', 'Status')
        StatusPacket += PacketEncoder.SetVar('id.id', 1)
        StatusPacket += PacketEncoder.SetVar('id.partition',
                                             '/eagames/bfwest-dedicated')
        StatusPacket += PacketEncoder.SetVar('sessionState', 'COMPLETE')
        StatusPacket += PacketEncoder.SetVar('props.{}.[]', 2)
        StatusPacket += PacketEncoder.SetVar('props.{resultType}', 'JOIN')

        if len(Globals.Servers) != 0:
            # Return latest server #TODO: Do it better
            print ConsoleColor(
                'Success'
            ) + '[FESLClient][Matchmatching] Game found!' + ConsoleColor('End')
            StatusPacket += PacketEncoder.SetVar('props.{games}.0.lid', 1)
            StatusPacket += PacketEncoder.SetVar('props.{games}.0.fit', 1001)
            StatusPacket += PacketEncoder.SetVar('props.{games}.0.gid',
                                                 Globals.CurrentGameID - 1)
            StatusPacket += PacketEncoder.SetVar('props.{games}.[]', 1)
        else:
            print ConsoleColor(
                'Warning'
            ) + '[FESLClient][Matchmatching] No games found!' + ConsoleColor(
                'End')
            StatusPacket += PacketEncoder.SetVar('props.{games}.[]', 0)

        StatusPacket = PacketEncoder.encode('pnow', StatusPacket, 0x80000000,
                                            0)
        self.transport.getHandle().sendall(StatusPacket)
Exemplo n.º 10
0
def ReceiveComponent(self, data, txn):
    if txn == 'NuLogin':
        SessionID = PacketDecoder.decode(data).GetVar('encryptedInfo')

        # Basic login data retrieve system, (Get AccountID, username and email from Database), if that data are missing return error to game
        try:
            AccountID = str(GetWebSession(SessionID)[0])
            Username = GetUserName(AccountID)
            email = GetEmail(AccountID)
        except:
            AccountID = None
            Username = None
            email = None
        # Save client connection info
        if self.GAMEOBJ == None:
            self.GAMEOBJ = DataClass.BF2Client()
            self.GAMEOBJ.FESLNetworkInt = self.transport
            Globals.Clients.append(self.GAMEOBJ)

        self.GAMEOBJ.IsOnline = True

        self.GAMEOBJ.SessionID = SessionID
        self.GAMEOBJ.Username = Username
        self.GAMEOBJ.UserID = AccountID
        self.GAMEOBJ.EMail = email


        if AccountID == None or Username == None or email == None:
            print ConsoleColor('Warning') + '[FESLClient][acct] User tryed to login using dead or incorrect SessionID! Ignoring...' + ConsoleColor('End')
            LoginPacket = PacketEncoder.SetVar('TXN', 'NuLogin')
            LoginPacket += PacketEncoder.SetVar('localizedMessage', '"The user is not entitled to access this game"')
            LoginPacket += PacketEncoder.SetVar('errorContainer.[]', 0)
            LoginPacket += PacketEncoder.SetVar('errorCode', 120, True)
            LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000, self.PacketID)
            self.transport.getHandle().sendall(LoginPacket)
            self.transport.loseConnection()

        else:
            print ConsoleColor(
                'Success') + '[FESLClient][acct] User ' + Username + ' Successfully logged in!' + ConsoleColor(
                'End')
            self.GAMEOBJ.LoginKey = RandomStringGenerator.Generate(24)

            LoginPacket = PacketEncoder.SetVar('TXN', 'NuLogin')
            LoginPacket += PacketEncoder.SetVar('profileId', AccountID)
            LoginPacket += PacketEncoder.SetVar('userId', AccountID)
            LoginPacket += PacketEncoder.SetVar('nuid', Username)
            LoginPacket += PacketEncoder.SetVar('lkey', self.GAMEOBJ.LoginKey, True)
            LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000, self.PacketID)
            self.transport.getHandle().sendall(LoginPacket)

    elif txn == 'NuGetPersonas':
        # Get User Soldiers

        GetPersonasPacket = PacketEncoder.SetVar('TXN', 'NuGetPersonas')

        # For now I'm using static variables.
        HeroCount = len(GetHeroes(self.GAMEOBJ.UserID))
        Heroes = GetHeroes(self.GAMEOBJ.UserID)
        loop = 0

        while loop != HeroCount:
            CurrentHero = Heroes[loop]
            HeroName = CurrentHero[2]
            GetPersonasPacket += PacketEncoder.SetVar('personas.' + str(loop), HeroName)
            loop += 1
        GetPersonasPacket += PacketEncoder.SetVar('personas.[]', len(GetHeroes(self.GAMEOBJ.UserID)), True)
        GetPersonasPacket = PacketEncoder.encode('acct', GetPersonasPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(GetPersonasPacket)

    elif txn == 'NuGetAccount':
        # Get Account data

        GetAccountPacket = PacketEncoder.SetVar('TXN', 'NuGetAccount')

        GetAccountPacket += PacketEncoder.SetVar('heroName', self.GAMEOBJ.Username)
        GetAccountPacket += PacketEncoder.SetVar('nuid', self.GAMEOBJ.EMail)

        # Birthday date
        Birthday = GetBirthday(self.GAMEOBJ.UserID).split('-')
        GetAccountPacket += PacketEncoder.SetVar('DOBDay', Birthday[0])
        GetAccountPacket += PacketEncoder.SetVar('DOBMonth', Birthday[1])
        GetAccountPacket += PacketEncoder.SetVar('DOBYear', Birthday[2])

        GetAccountPacket += PacketEncoder.SetVar('userId', self.GAMEOBJ.UserID)

        # Not sure what is this
        GetAccountPacket += PacketEncoder.SetVar('globalOptin', 0)
        GetAccountPacket += PacketEncoder.SetVar('thidPartyOptin', 0)

        # Other required data
        GetAccountPacket += PacketEncoder.SetVar('language', 'enUS')
        GetAccountPacket += PacketEncoder.SetVar('country', 'US', True)
        GetAccountPacket = PacketEncoder.encode('acct', GetAccountPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(GetAccountPacket)

    elif txn == 'NuLookupUserInfo':
        # Load Soldiers info
        RequestedPersonas = int(PacketDecoder.decode(data).GetVar('userInfo.[]'))

        loop = 0

        LookupUserInfoPacket = PacketEncoder.SetVar('TXN', 'NuLookupUserInfo')

        while loop != RequestedPersonas:
            CurrentHero = PacketDecoder.decode(data).GetVar('userInfo.' + str(loop) + '.userName')
            HeroID = GetHeroIDByName(CurrentHero)
            if HeroID == False:
                HeroID = 0
            LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.' + str(loop) + '.userName', CurrentHero)
            LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.' + str(loop) + '.userId', HeroID)
            LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.' + str(loop) + '.masterUserId', HeroID)
            LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.' + str(loop) + '.namespace', 'MAIN')
            LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.' + str(loop) + '.xuid', 24)
            loop += 1

        LookupUserInfoPacket += PacketEncoder.SetVar('userInfo.[]', RequestedPersonas, True)

        LookupUserInfoPacket = PacketEncoder.encode('acct', LookupUserInfoPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(LookupUserInfoPacket)

    elif txn == 'NuLoginPersona':
        # For now - Always login
        self.GAMEOBJ.LoginKey = RandomStringGenerator.Generate(24)
        LoginPersonaPacket = PacketEncoder.SetVar('TXN', 'NuLoginPersona')
        LoginPersonaPacket += PacketEncoder.SetVar('lkey', self.GAMEOBJ.LoginKey)
        LoginPersonaPacket += PacketEncoder.SetVar('profileId', self.GAMEOBJ.UserID)
        LoginPersonaPacket += PacketEncoder.SetVar('userId', self.GAMEOBJ.UserID)
        self.GAMEOBJ.Name = GetUserName(self.GAMEOBJ.UserID)

        LoginPersonaPacket = PacketEncoder.encode('acct', LoginPersonaPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(LoginPersonaPacket)
    else:
        print ConsoleColor('Warning') + '[FESLClient][acct] Got unknown TXN (' + txn + ')' + ConsoleColor('End')
Exemplo n.º 11
0
def ReceiveComponent(self, txn):
    if txn == 'Hello':
        MemCheckPacket = PacketEncoder.SetVar('TXN', 'MemCheck')
        MemCheckPacket += PacketEncoder.SetVar('memcheck.[]', 0)
        MemCheckPacket += PacketEncoder.SetVar('salt', 5, True)

        MemCheckPacket = PacketEncoder.encode('fsys', MemCheckPacket,
                                              0xC0000000, self.PacketID)

        GetSessionIdPacket = PacketEncoder.SetVar('TXN', 'GetSessionId', True)
        GetSessionIdPacket = PacketEncoder.encode('gsum', GetSessionIdPacket,
                                                  0x0, 0)

        self.PacketID += 1
        CurrentTime = strftime('%b-%d-%Y %H:%M:%S UTC')
        HelloPacket = PacketEncoder.SetVar('curTime', CurrentTime)
        HelloPacket += PacketEncoder.SetVar('messengerIp', Globals.ServerIP)
        HelloPacket += PacketEncoder.SetVar('messengerPort', 13505)
        HelloPacket += PacketEncoder.SetVar('TXN', 'Hello')
        HelloPacket += PacketEncoder.SetVar('domainPartition.subDomain',
                                            'bfwest-dedicated')
        HelloPacket += PacketEncoder.SetVar('theaterIp', Globals.ServerIP)
        HelloPacket += PacketEncoder.SetVar('theaterPort', TheaterClientPort)
        HelloPacket += PacketEncoder.SetVar('domainPartition.domain',
                                            'eagames')
        HelloPacket += PacketEncoder.SetVar('activityTimeoutSecs', 3600, True)
        HelloPacket = PacketEncoder.encode('fsys', HelloPacket, 0xC0000000,
                                           self.PacketID)

        self.transport.getHandle().sendall(MemCheckPacket)
        self.transport.getHandle().sendall(GetSessionIdPacket)
        self.transport.getHandle().sendall(HelloPacket)

    elif txn == 'MemCheck':
        # Unneeded
        pass

    elif txn == 'Goodbye':
        # Unneeded
        pass

    elif txn == 'GetPingSites':
        self.PacketID += 1
        GetPingSitesPacket = PacketEncoder.SetVar('TXN', 'GetPingSites')
        GetPingSitesPacket += PacketEncoder.SetVar('minPingSitesToPing', 2)
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.[]', 2)
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.0.addr',
                                                   Globals.ServerIP)
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.0.name', 'gva')
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.0.type', 0)
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.1.addr',
                                                   Globals.ServerIP)
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.1.name', 'nrt')
        GetPingSitesPacket += PacketEncoder.SetVar('pingSites.1.type', 0)
        GetPingSitesPacket += PacketEncoder.encode('fsys', GetPingSitesPacket,
                                                   0xC0000000, self.PacketID)
    else:
        print ConsoleColor(
            'Warning'
        ) + '[FESLClient][fsys] Got unknown TXN (' + txn + ')' + ConsoleColor(
            'End')
Exemplo n.º 12
0
def ReceiveComponent(self, data, txn):
    if txn == 'GetStats':
        # Get Account Stats (info)

        OwnerID = PacketDecoder.decode(data).GetVar('owner')
        OwnerType = PacketDecoder.decode(data).GetVar('ownerType')

        GetStatsPacket = PacketEncoder.SetVar('TXN', 'GetStats')
        GetStatsPacket += PacketEncoder.SetVar('ownerId', OwnerID)
        GetStatsPacket += PacketEncoder.SetVar('ownerType', OwnerType)

        RequestedKeysNumber = int(PacketDecoder.decode(data).GetVar('keys.[]'))

        # Get all requested keys names

        loop = 0
        RequestedKeysNames = []

        while loop != RequestedKeysNumber:
            RequestedKeyName = PacketDecoder.decode(data).GetVar('keys.' + str(loop))
            RequestedKeysNames.append(RequestedKeyName)
            loop += 1

        loop = 0

        # Get and return requested keys values

        while loop != RequestedKeysNumber:
            # For now everything is static
            GetStatsPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.key', RequestedKeysNames[loop])
            GetStatsPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.value', GetStat(OwnerID, RequestedKeysNames[loop]))
            GetStatsPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.text', GetText(OwnerID, RequestedKeysNames[loop]))
            loop += 1

        GetStatsPacket += PacketEncoder.SetVar('stats.[]', RequestedKeysNumber)

        GetStatsPacket = PacketEncoder.encode('acct', GetStatsPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(GetStatsPacket)

    elif txn == 'GetStatsForOwners':
        # Get Soldier Stats
        # Requested soldiers
        Owners = int(PacketDecoder.decode(data).GetVar('owners.[]'))

        OwnerIDs = []
        OwnerTypes = []

        loop = 0

        while loop != Owners:
            OwnerID = PacketDecoder.decode(data).GetVar('owners.' + str(loop) + '.ownerId')
            OwnerType = PacketDecoder.decode(data).GetVar('owners.' + str(loop) + '.ownerType')

            OwnerIDs.append(OwnerID)
            OwnerTypes.append(OwnerType)

            loop += 1

        GetStatsForOwnersPacket = PacketEncoder.SetVar('TXN', 'GetStats')

        # Get all requested keys names
        RequestedKeysNumber = int(PacketDecoder.decode(data).GetVar('keys.[]'))
        loop = 0
        RequestedKeysNames = []

        while loop != RequestedKeysNumber:
            RequestedKeyName = PacketDecoder.decode(data).GetVar('keys.' + str(loop))
            RequestedKeysNames.append(RequestedKeyName)
            loop += 1

        loop = 0

        while loop != Owners:
            GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.ownerId', OwnerIDs[loop])
            GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.ownerType', OwnerTypes[loop])

            key = 0
            while key != RequestedKeysNumber:
                GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.stats.' + str(key) + '.key', RequestedKeysNames[key])
                GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.stats.' + str(key) + '.value', GetStat(OwnerIDs[loop], RequestedKeysNames[key]))
                GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.stats.' + str(key) + '.text', GetText(OwnerIDs[loop], RequestedKeysNames[key]))
                key += 1

            GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.' + str(loop) + '.stats.[]', RequestedKeysNumber)

            loop += 1

        GetStatsForOwnersPacket += PacketEncoder.SetVar('stats.[]', Owners)

        GetStatsForOwnersPacket = PacketEncoder.encode('acct', GetStatsForOwnersPacket, 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(GetStatsForOwnersPacket)

    elif txn == 'UpdateStats':
        UpdateUsers = int(PacketDecoder.decode(data).GetVar('u.[]'))
        loop = 0

        while loop != UpdateUsers:
            UpdateKeys = int(PacketDecoder.decode(data).GetVar('u.' + str(loop) + '.s.[]'))

            loop_in_loop = 0
            while loop_in_loop != UpdateKeys:
                HeroID = PacketDecoder.decode(data).GetVar('u.' + str(loop) + '.o')
                KeyName = PacketDecoder.decode(data).GetVar('u.' + str(loop) + '.s.' + str(loop_in_loop) + '.k')
                KeyValue = PacketDecoder.decode(data).GetVar('u.' + str(loop) + '.s.' + str(loop_in_loop) + '.v')
                KeyText = PacketDecoder.decode(data).GetVar('u.' + str(loop) + '.s.' + str(loop_in_loop) + '.t')

                UpdateStat(HeroID, KeyName, KeyValue, KeyText)
                loop_in_loop += 1

            loop += 1
        UpdateStatsPacket = PacketEncoder.encode('rank', PacketEncoder.SetVar('TXN', 'UpdateStats'), 0xC0000000, self.PacketID)
        self.transport.getHandle().sendall(UpdateStatsPacket)
    else:
        print ConsoleColor('Warning') + '[FESLClient][rank] Got unknown TXN (' + txn + ')' + ConsoleColor('End')
Exemplo n.º 13
0
def ReceiveComponent(self, txn):
    if txn == 'Hello':
        MemCheckPacket = PacketEncoder.SetVar('TXN', 'MemCheck')
        MemCheckPacket += PacketEncoder.SetVar('memcheck.[]', 0)
        MemCheckPacket += PacketEncoder.SetVar('salt', 5, True)

        MemCheckPacket = PacketEncoder.encode('fsys', MemCheckPacket,
                                              0xC0000000, self.PacketID)

        self.PacketID += 1
        CurrentTime = strftime('%b-%d-%Y %H:%M:%S UTC')
        HelloPacket = PacketEncoder.SetVar('curTime', CurrentTime)
        HelloPacket += PacketEncoder.SetVar('messengerIp', Globals.ServerIP)
        HelloPacket += PacketEncoder.SetVar('messengerPort', 13505)
        HelloPacket += PacketEncoder.SetVar('TXN', 'Hello')
        HelloPacket += PacketEncoder.SetVar('domainPartition.subDomain',
                                            'bfwest-server')
        HelloPacket += PacketEncoder.SetVar('theaterIp', Globals.ServerIP)
        HelloPacket += PacketEncoder.SetVar('theaterPort', TheaterServerPort)
        HelloPacket += PacketEncoder.SetVar('domainPartition.domain',
                                            'eagames')
        HelloPacket += PacketEncoder.SetVar('activityTimeoutSecs', 3600, True)
        HelloPacket = PacketEncoder.encode('fsys', HelloPacket, 0xC0000000,
                                           self.PacketID)

        self.transport.getHandle().sendall(MemCheckPacket)
        self.transport.getHandle().sendall(HelloPacket)

    elif txn == 'MemCheck':
        # Unneeded
        pass

    elif txn == 'Goodbye':
        # Unneeded
        pass

    else:
        print ConsoleColor(
            'Warning'
        ) + '[FESLServer][fsys] Got unknown TXN (' + txn + ')' + ConsoleColor(
            'End')
Exemplo n.º 14
0
from Config import ConsoleColor
from Utils import PacketEncoder, PacketDecoder


def ReceiveComponent(self, data, (host, port)):
    ECHOPacket = PacketEncoder.SetVar('TID', self.PacketID)
    ECHOPacket += PacketEncoder.SetVar('TXN', '')
    ECHOPacket += PacketEncoder.SetVar('IP', host)
    ECHOPacket += PacketEncoder.SetVar('PORT', port)
    ECHOPacket += PacketEncoder.SetVar('ERR', 0)
    ECHOPacket += PacketEncoder.SetVar('TYPE', 1)
    ECHOPacket = PacketEncoder.encode('ECHO', ECHOPacket, 0x0, 0)
    self.transport.write(ECHOPacket, (host, port))
Exemplo n.º 15
0
def ReceiveComponent(self, data):

    try:
        self.ServerGAMEOBJ
    except:
        return ''

    if self.ServerGAMEOBJ != None:
        self.ServerGAMEOBJ.ClientTheaterNetworkInt = self.transport
        EGAMPacket = PacketEncoder.SetVar(
            'LID',
            PacketDecoder.decode(data).GetVar('LID'))
        EGAMPacket += PacketEncoder.SetVar(
            'GID',
            PacketDecoder.decode(data).GetVar('GID'))
        EGAMPacket += PacketEncoder.SetVar('TID', self.PacketID, True)
        EGAMPacket = PacketEncoder.encode('EGAM', EGAMPacket, 0x0, 0)

        # This packet gets sent to the SERVER the client connects to, it contains information about the client
        ServerEGRQPacket = PacketEncoder.SetVar('TID', 0)
        ServerEGRQPacket += PacketEncoder.SetVar('NAME', self.GAMEOBJ.Name)
        ServerEGRQPacket += PacketEncoder.SetVar(
            'UID', self.GAMEOBJ.UserID)  # this has to be persona_id
        ServerEGRQPacket += PacketEncoder.SetVar('PID', self.GAMEOBJ.UserID)
        ServerEGRQPacket += PacketEncoder.SetVar(
            'TICKET', 2018751182)  # TODO: generate this
        ServerEGRQPacket += PacketEncoder.SetVar('IP', self.GAMEOBJ.EXTIP)
        ServerEGRQPacket += PacketEncoder.SetVar('PORT', self.GAMEOBJ.INTPORT)
        ServerEGRQPacket += PacketEncoder.SetVar(
            'INT-IP',
            PacketDecoder.decode(data).GetVar('R-INT-IP'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'INT-PORT',
            PacketDecoder.decode(data).GetVar('R-INT-PORT'))

        ServerEGRQPacket += PacketEncoder.SetVar(
            'PTYPE',
            PacketDecoder.decode(data).GetVar('PTYPE'))
        ServerEGRQPacket += PacketEncoder.SetVar('R-USER', self.GAMEOBJ.Name)
        ServerEGRQPacket += PacketEncoder.SetVar('R-UID', self.GAMEOBJ.UserID)
        ServerEGRQPacket += PacketEncoder.SetVar('R-U-accid',
                                                 self.GAMEOBJ.UserID)
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-elo', GetStat(self.GAMEOBJ.UserID, 'elo'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-team', GetStat(self.GAMEOBJ.UserID, 'c_team'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-kit', GetStat(self.GAMEOBJ.UserID, 'c_kit'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-lvl', GetStat(self.GAMEOBJ.UserID, 'level'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-dataCenter', self.ServerGAMEOBJ.GetData('B-U-data_center'))
        ServerEGRQPacket += PacketEncoder.SetVar('R-U-externalIp',
                                                 self.GAMEOBJ.EXTIP)
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-internalIp',
            PacketDecoder.decode(data).GetVar('R-INT-IP'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-U-category',
            PacketDecoder.decode(data).GetVar('R-U-category'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-INT-IP',
            PacketDecoder.decode(data).GetVar(
                'R-INT-IP'))  # internal ip where the CLIENT is hosted
        ServerEGRQPacket += PacketEncoder.SetVar(
            'R-INT-PORT',
            PacketDecoder.decode(data).GetVar('R-INT-PORT'))

        ServerEGRQPacket += PacketEncoder.SetVar('XUID', 24)
        ServerEGRQPacket += PacketEncoder.SetVar('R-XUID', 24)

        ServerEGRQPacket += PacketEncoder.SetVar(
            'LID',
            PacketDecoder.decode(data).GetVar('LID'))
        ServerEGRQPacket += PacketEncoder.SetVar(
            'GID',
            PacketDecoder.decode(data).GetVar('GID'), True)

        ServerEGRQPacket = PacketEncoder.encode('EGRQ', ServerEGRQPacket, 0x0,
                                                0)
        print repr(ServerEGRQPacket)

        ClientEGEGPacket = PacketEncoder.SetVar('TID', self.PacketID)
        ClientEGEGPacket += PacketEncoder.SetVar('PL', 'PC')
        ClientEGEGPacket += PacketEncoder.SetVar('TICKET', 2018751182)

        ClientEGEGPacket += PacketEncoder.SetVar('PID', 1)
        ClientEGEGPacket += PacketEncoder.SetVar('I', self.ServerGAMEOBJ.EXTIP)
        ClientEGEGPacket += PacketEncoder.SetVar('P',
                                                 self.ServerGAMEOBJ.INTPort)
        ClientEGEGPacket += PacketEncoder.SetVar('HUID', 1)
        ClientEGEGPacket += PacketEncoder.SetVar(
            'EKEY', 'O65zZ2D2A58mNrZw1hmuJw%3d%3d')
        ClientEGEGPacket += PacketEncoder.SetVar('INT-IP',
                                                 self.ServerGAMEOBJ.INTIP)
        ClientEGEGPacket += PacketEncoder.SetVar('INT-PORT',
                                                 self.ServerGAMEOBJ.INTPort)
        ClientEGEGPacket += PacketEncoder.SetVar('SECRET', 2587913)
        ClientEGEGPacket += PacketEncoder.SetVar('UGID', 'BFHeroesServerPC')
        ClientEGEGPacket += PacketEncoder.SetVar(
            'LID',
            PacketDecoder.decode(data).GetVar('LID'))
        ClientEGEGPacket += PacketEncoder.SetVar(
            'GID',
            PacketDecoder.decode(data).GetVar('GID'), True)
        ClientEGEGPacket = PacketEncoder.encode('EGEG', ClientEGEGPacket, 0x0,
                                                0)
        print repr(ClientEGEGPacket)

        self.transport.getHandle().sendall(EGAMPacket)
        self.ServerGAMEOBJ.TheaterNetworkInt.getHandle().sendall(
            ServerEGRQPacket)
        self.transport.getHandle().sendall(ClientEGEGPacket)
Exemplo n.º 16
0
def ReceiveComponent(self, data):
    RequestedGID = PacketDecoder.decode(data).GetVar('GID')

    loop = 0
    ServersOnline = len(Globals.Servers)

    while loop != ServersOnline:

        if Globals.Servers[loop].GameID == int(RequestedGID):
            completed = True
            break
        else:
            completed = False
            loop += 1
            continue

    if completed == True:
        self.ServerGAMEOBJ = Globals.Servers[loop]


        GDATPacket = PacketEncoder.SetVar('TID', self.PacketID)

        # Basic stuff
        GDATPacket += PacketEncoder.SetVar('IP', self.ServerGAMEOBJ.EXTIP)
        GDATPacket += PacketEncoder.SetVar('PORT', self.ServerGAMEOBJ.GetData('PORT'))
        GDATPacket += PacketEncoder.SetVar('INT-IP', self.ServerGAMEOBJ.GetData('INT-IP'))
        GDATPacket += PacketEncoder.SetVar('INT-PORT', self.ServerGAMEOBJ.GetData('INT-PORT'))
        GDATPacket += PacketEncoder.SetVar('LID', self.ServerGAMEOBJ.GetData('LID')) # LobbyID
        GDATPacket += PacketEncoder.SetVar('GID', self.ServerGAMEOBJ.GetData('GID')) # GameID
        GDATPacket += PacketEncoder.SetVar('UGID', self.ServerGAMEOBJ.GetData('UGID'))
        GDATPacket += PacketEncoder.SetVar('MAX-PLAYERS', self.ServerGAMEOBJ.GetData('MAX-PLAYERS'))
        GDATPacket += PacketEncoder.SetVar('AP', 0) # Active Players. #TODO: Count it
        GDATPacket += PacketEncoder.SetVar('NAME', self.ServerGAMEOBJ.GetData('NAME').replace('"', '')) # Server Name
        GDATPacket += PacketEncoder.SetVar('SECRET', self.ServerGAMEOBJ.GetData('SECRET'))
        GDATPacket += PacketEncoder.SetVar('QLEN', self.ServerGAMEOBJ.GetData('QLEN')) # Queue Length
        GDATPacket += PacketEncoder.SetVar('QUEUE-LENGTH', 0) # TODO: Check diffirence between that and QLEN
        GDATPacket += PacketEncoder.SetVar('DISABLE-AUTO-DEQUEUE', self.ServerGAMEOBJ.GetData('DISABLE-AUTO-DEQUEUE'))

        # Server info
        GDATPacket += PacketEncoder.SetVar('B-maxObservers', self.ServerGAMEOBJ.GetData('B-maxObservers'))
        GDATPacket += PacketEncoder.SetVar('B-numObservers', self.ServerGAMEOBJ.GetData('B-numObservers'))
        GDATPacket += PacketEncoder.SetVar('B-version', self.ServerGAMEOBJ.GetData('B-version'))

        GDATPacket += PacketEncoder.SetVar('B-U-alwaysQueue', self.ServerGAMEOBJ.GetData('B-U-alwaysQueue'))
        GDATPacket += PacketEncoder.SetVar('B-U-army_balance', self.ServerGAMEOBJ.GetData('B-U-army_balance'))
        GDATPacket += PacketEncoder.SetVar('B-U-army_distribution', self.ServerGAMEOBJ.GetData('B-U-army_distribution').replace('"', ''))
        GDATPacket += PacketEncoder.SetVar('B-U-avail_slots_national', self.ServerGAMEOBJ.GetData('B-U-avail_slots_national'))
        GDATPacket += PacketEncoder.SetVar('B-U-avail_slots_royal', self.ServerGAMEOBJ.GetData('B-U-avail_slots_royal'))
        GDATPacket += PacketEncoder.SetVar('B-U-avail_vips_national', self.ServerGAMEOBJ.GetData('B-U-avail_vips_national'))
        GDATPacket += PacketEncoder.SetVar('B-U-avail_vips_royal', self.ServerGAMEOBJ.GetData('B-U-avail_vips_royal'))
        GDATPacket += PacketEncoder.SetVar('B-U-avg_ally_rank', self.ServerGAMEOBJ.GetData('B-U-avg_ally_rank'))
        GDATPacket += PacketEncoder.SetVar('B-U-avg_axis_rank', self.ServerGAMEOBJ.GetData('B-U-avg_axis_rank'))
        GDATPacket += PacketEncoder.SetVar('B-U-community_name', self.ServerGAMEOBJ.GetData('B-U-community_name'))
        GDATPacket += PacketEncoder.SetVar('B-U-data_center', self.ServerGAMEOBJ.GetData('B-U-data_center'))
        GDATPacket += PacketEncoder.SetVar('B-U-elo_rank', self.ServerGAMEOBJ.GetData('B-U-elo_rank'))
        GDATPacket += PacketEncoder.SetVar('B-U-easyzone', self.ServerGAMEOBJ.GetData('B-U-easyzone'))
        GDATPacket += PacketEncoder.SetVar('B-U-lvl_sdv', self.ServerGAMEOBJ.GetData('B-U-lvl_sdv'))
        GDATPacket += PacketEncoder.SetVar('B-U-lvl_avg', self.ServerGAMEOBJ.GetData('B-U-lvl_avg'))
        GDATPacket += PacketEncoder.SetVar('B-U-map', self.ServerGAMEOBJ.GetData('B-U-map'))
        GDATPacket += PacketEncoder.SetVar('B-U-map_name', self.ServerGAMEOBJ.GetData('B-U-map_name'))
        GDATPacket += PacketEncoder.SetVar('B-U-punkb', self.ServerGAMEOBJ.GetData('B-U-punkb'))
        GDATPacket += PacketEncoder.SetVar('B-U-percent_full', self.ServerGAMEOBJ.GetData('B-U-percent_full'))
        GDATPacket += PacketEncoder.SetVar('B-U-ranked', self.ServerGAMEOBJ.GetData('B-U-ranked'))
        GDATPacket += PacketEncoder.SetVar('B-U-server_ip', self.ServerGAMEOBJ.GetData('B-U-server_ip'))
        GDATPacket += PacketEncoder.SetVar('B-U-server_state', self.ServerGAMEOBJ.GetData('B-U-server_state'))
        GDATPacket += PacketEncoder.SetVar('B-U-server_port', self.ServerGAMEOBJ.GetData('B-U-server_port'))
        GDATPacket += PacketEncoder.SetVar('B-U-servertype', self.ServerGAMEOBJ.GetData('B-U-servertype'))

        # Unknown data
        GDATPacket += PacketEncoder.SetVar('HXFR', self.ServerGAMEOBJ.GetData('HXFR'))
        GDATPacket += PacketEncoder.SetVar('HTTYPE', self.ServerGAMEOBJ.GetData('HTTYPE'))
        GDATPacket += PacketEncoder.SetVar('JOIN', self.ServerGAMEOBJ.GetData('JOIN'))
        GDATPacket += PacketEncoder.SetVar('RESERVE-HOST', self.ServerGAMEOBJ.GetData('RESERVE-HOST'))
        GDATPacket += PacketEncoder.SetVar('RT', self.ServerGAMEOBJ.GetData('RT'))
        GDATPacket += PacketEncoder.SetVar('TYPE', self.ServerGAMEOBJ.GetData('TYPE'), True)

        GDATPacket = PacketEncoder.encode('GDAT', GDATPacket, 0x0, 0)
        self.transport.getHandle().sendall(GDATPacket)

        print ConsoleColor('Success') + '[TheaterClient][GDAT] Client joining to game... (' + str(RequestedGID) + ')' + ConsoleColor('End')
    else:
        self.ServerGAMEOBJ = None
        print ConsoleColor('Error') + '[TheaterClient][GDAT] Cannot find requested game!' + ConsoleColor('End')
Exemplo n.º 17
0
def ReceiveComponent(self, data, txn):
    if txn == 'NuLogin':
        try:
            ServerPassword = PacketDecoder.decode(data).GetVar('password')
        except:
            ServerPassword = None

        # Save client connection info
        if self.GAMEOBJ == None:
            self.GAMEOBJ = DataClass.BF2Server()
            self.GAMEOBJ.FESLNetworkInt = self.transport
            Globals.Servers.append(self.GAMEOBJ)

        if ServerPassword == None:
            print ConsoleColor(
                'Warning'
            ) + '[FESLServer][acct] Server didnt send password! Disconnecting...' + ConsoleColor(
                'End')
            LoginPacket = PacketEncoder.SetVar('TXN', 'NuLogin')
            LoginPacket += PacketEncoder.SetVar(
                'localizedMessage',
                '"The password the user specified is incorrect"')
            LoginPacket += PacketEncoder.SetVar('errorContainer.[]', 0)
            LoginPacket += PacketEncoder.SetVar('errorCode', 122, True)
            LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000,
                                               self.PacketID)
            self.transport.getHandle().sendall(LoginPacket)
            self.transport.loseConnection()

        if CheckServerPassword(ServerPassword) == True:
            print ConsoleColor(
                'Success'
            ) + '[FESLServer][acct] Server successfully logged in!' + ConsoleColor(
                'End')
            self.GAMEOBJ.LoginKey = RandomStringGenerator.Generate(24)
            self.GAMEOBJ.UserID = CheckServerPassword(ServerPassword)

            LoginPacket = PacketEncoder.SetVar('TXN', 'NuLogin')
            LoginPacket += PacketEncoder.SetVar('lkey', self.GAMEOBJ.LoginKey)
            LoginPacket += PacketEncoder.SetVar(
                'nuid',
                GetServerAuthData(self.GAMEOBJ.UserID)[1])
            LoginPacket += PacketEncoder.SetVar('profileId',
                                                self.GAMEOBJ.UserID)
            LoginPacket += PacketEncoder.SetVar('userId', self.GAMEOBJ.UserID)
            LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000,
                                               self.PacketID)
            self.transport.getHandle().sendall(LoginPacket)
        else:
            print ConsoleColor(
                'Warning'
            ) + '[FESLServer][acct] Server specified wrong password! Disconnecting...' + ConsoleColor(
                'End')
            LoginPacket = PacketEncoder.SetVar('TXN', 'NuLogin')
            LoginPacket += PacketEncoder.SetVar(
                'localizedMessage',
                '"The password the user specified is incorrect"')
            LoginPacket += PacketEncoder.SetVar('errorContainer.[]', 0)
            LoginPacket += PacketEncoder.SetVar('errorCode', 122, True)
            LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000,
                                               self.PacketID)
            self.transport.getHandle().sendall(LoginPacket)
            self.transport.loseConnection()

    elif txn == 'NuGetPersonas':
        PersonaPacket = PacketEncoder.SetVar('TXN', 'NuGetPersonas')
        PersonaPacket += PacketEncoder.SetVar('personas.[]', 0)
        PersonaPacket = PacketEncoder.encode('acct', PersonaPacket, 0xC0000000,
                                             self.PacketID)
        self.transport.getHandle().sendall(PersonaPacket)

    elif txn == 'NuGetAccount':
        AccountPacket = PacketEncoder.SetVar('TXN', 'NuGetAccount')
        AccountPacket += PacketEncoder.SetVar(
            'heroName',
            GetServerAuthData(self.GAMEOBJ.UserID)[1])
        AccountPacket += PacketEncoder.SetVar(
            'nuid',
            GetServerAuthData(self.GAMEOBJ.UserID)[1])
        AccountPacket += PacketEncoder.SetVar('DOBDay', 01)
        AccountPacket += PacketEncoder.SetVar('DOBMonth', 01)
        AccountPacket += PacketEncoder.SetVar('DOBYear', 1970)
        AccountPacket += PacketEncoder.SetVar('userId', self.GAMEOBJ.UserID)
        AccountPacket += PacketEncoder.SetVar('globalOptin', 0)
        AccountPacket += PacketEncoder.SetVar('thidPartyOptin', 0)
        AccountPacket += PacketEncoder.SetVar('language', 'enUS')
        AccountPacket += PacketEncoder.SetVar('country', 'US')
        AccountPacket = PacketEncoder.encode('acct', AccountPacket, 0xC0000000,
                                             self.PacketID)
        self.transport.getHandle().sendall(AccountPacket)

    elif txn == 'NuLoginPersona':
        LoginPacket = PacketEncoder.SetVar('TXN', 'NuLoginPersona')
        LoginPacket += PacketEncoder.SetVar('lkey', self.GAMEOBJ.LoginKey)
        LoginPacket += PacketEncoder.SetVar('profileId', self.GAMEOBJ.UserID)
        LoginPacket += PacketEncoder.SetVar('userId', self.GAMEOBJ.UserID)
        LoginPacket = PacketEncoder.encode('acct', LoginPacket, 0xC0000000,
                                           self.PacketID)
        self.transport.getHandle().sendall(LoginPacket)

    elif txn == 'NuLookupUserInfo':
        LookupPacket = PacketEncoder.SetVar('TXN', 'NuLookupUserInfo')
        LookupPacket += PacketEncoder.SetVar(
            'userInfo.0.userName',
            GetServerAuthData(self.GAMEOBJ.UserID)[1])
        LookupPacket += PacketEncoder.SetVar('userInfo.0.userId',
                                             self.GAMEOBJ.UserID)
        LookupPacket += PacketEncoder.SetVar('userInfo.0.masterUserId',
                                             self.GAMEOBJ.UserID)
        LookupPacket += PacketEncoder.SetVar('userInfo.0.namespace', 'MAIN')
        LookupPacket += PacketEncoder.SetVar('userInfo.0.xuid', 24)
        LookupPacket += PacketEncoder.SetVar('userInfo.0.cid',
                                             self.GAMEOBJ.UserID)
        LookupPacket += PacketEncoder.SetVar('userInfo.[]', 1)
        LookupPacket = PacketEncoder.encode('acct', LookupPacket, 0xC0000000,
                                            self.PacketID)
        self.transport.getHandle().sendall(LookupPacket)
    else:
        print ConsoleColor(
            'Warning'
        ) + '[FESLServer][acct] Got unknown TXN (' + txn + ')' + ConsoleColor(
            'End')