Exemplo n.º 1
0
    def generate(self):
        data = util.generateBytes(HANDSHAKE_LENGTH - CHALLENGE_DIGEST_LENGTH)

        if self.requestDigest and self.challengeKey:
            #Here be the evil:
            hash1 = getDigest(self.challengeKey, self.requestDigest)
            hash2 = getDigest(hash1, data)

            data += hash2
        else:
            data += util.generateBytes(CHALLENGE_DIGEST_LENGTH)

        return data
Exemplo n.º 2
0
    def buildClient(self, protocol, params, *args):
        """
        Create an instance of a subclass of L{Client}. Override this method to
        alter how L{Client} instances are created.

        @param protocol: The L{rtmp.ServerProtocol} instance.
        @param params: The connection parameters sent from the client, this
            includes items such as the connection url, and user agent
        @type params: C{dict}
        @param args: The client supplied arguments to NetConnection.connect()
        """
        c = self.client(protocol)
        c.id = util.generateBytes(9, readable=True)

        # Inject properties into the client object
        # TODO: Evaluate if these should be defined with @property in the
        #  Client class itself.
        c.application = self

        try:
            c.ip = c.nc.transport.getPeer().host
        except AttributeError:
            c.ip = None

        tcUrl = params.get('tcUrl', '')
        c.protocol = urlparse.urlparse(tcUrl)[0]
        if c.protocol == '':
            c.protocol = None

        c.pageUrl = params.get('pageUrl', None)
        c.uri = params.get('tcUrl', None)
        c.agent = params.get('flashVer', None)

        return c
Exemplo n.º 3
0
    def buildClient(self, protocol, params, *args):
        """
        Create an instance of a subclass of L{Client}. Override this method to
        alter how L{Client} instances are created.

        @param protocol: The L{rtmp.ServerProtocol} instance.
        @param params: The connection parameters sent from the client, this
            includes items such as the connection url, and user agent
        @type params: C{dict}
        @param args: The client supplied arguments to NetConnection.connect()
        """
        c = self.client(protocol)
        c.id = util.generateBytes(9, readable=True)

        # Inject properties into the client object
        # TODO: Evaluate if these should be defined with @property in the
        #  Client class itself.
        c.application = self

        try:
            c.ip = c.nc.transport.getPeer().host
        except AttributeError:
            c.ip = None

        tcUrl = params.get('tcUrl', '')
        c.protocol = urlparse.urlparse(tcUrl)[0]
        if c.protocol == '':
            c.protocol = None

        c.pageUrl = params.get('pageUrl', None)
        c.uri = params.get('tcUrl', None)
        c.agent = params.get('flashVer', None)

        return c
Exemplo n.º 4
0
    def generate(self):
        """
        """
        d = self.buffer = BufferedByteStream()

        d.write_ulong(self.uptime)
        d.write_ulong(self.version)
        d.write(util.generateBytes(HANDSHAKE_LENGTH - 8))

        self._generateChallenge()

        return d.getvalue()
Exemplo n.º 5
0
def _generate_payload():
    return util.generateBytes(handshake.HANDSHAKE_LENGTH - 8)
Exemplo n.º 6
0
def _generate_payload():
    return util.generateBytes(handshake.HANDSHAKE_LENGTH - 8)