Пример #1
0
        self._protocol._queue_write("PS00000000000006l201234567890123456789")
        gobject.timeout_add(1000, self.try_sending_again)

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


class TestGiberringCommandClientNoPacketSize(TestGiberringCommandClient):
    def send_hello(self, challenge_response=None):
        hello = self.make_hello(challenge_response)
        self._protocol._queue_write(bencode(["hello", hello]))

        def send_gibberish():
            self._protocol._queue_write("01234567890123456789")

        gobject.timeout_add(1000, send_gibberish)
        gobject.timeout_add(3000, self.try_sending_again)

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS

    # test_DoS(TestGiberringCommandClient, sys.argv)
    test_DoS(TestGiberringCommandClientNoPacketSize, sys.argv)
Пример #2
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS

    test_DoS(TestIllegalCommandClient, sys.argv)
Пример #3
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    #test_DoS(TestGiberringCommandClient, sys.argv)
    test_DoS(TestGiberringCommandClientNoPacketSize, sys.argv)
Пример #4
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestIllegalCommandClient, sys.argv)
Пример #5
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    #test_DoS(TestGiberringCommandClient, sys.argv)
    test_DoS(TestGiberringCommandClientNoPacketSize, sys.argv)
Пример #6
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestTimeoutClient, sys.argv)
Пример #7
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestTimeoutClient, sys.argv)
Пример #8
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestMemoryClient, sys.argv)
Пример #9
0
def main():
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestMemoryClient, sys.argv)
Пример #10
0
        GLibXpraClient.send_hello(self, challenge_response)
        self._protocol._queue_write("PS00000000000006l201234567890123456789")
        gobject.timeout_add(1000, self.try_sending_again)

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


class TestGiberringCommandClientNoPacketSize(TestGiberringCommandClient):
    def send_hello(self, challenge_response=None):
        hello = self.make_hello(challenge_response)
        self._protocol._queue_write(bencode(["hello", hello]))

        def send_gibberish():
            self._protocol._queue_write("01234567890123456789")

        gobject.timeout_add(1000, send_gibberish)
        gobject.timeout_add(3000, self.try_sending_again)

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    #test_DoS(TestGiberringCommandClient, sys.argv)
    test_DoS(TestGiberringCommandClientNoPacketSize, sys.argv)
Пример #11
0
from xpra.client_base import XpraClientBase, GLibXpraClient

class TestMemoryClient(GLibXpraClient):
    """
        Try to exhaust server memory without authenticating by sending an overly large packet.
    """

    def __init__(self, conn, opts):
        GLibXpraClient.__init__(self, conn, opts)
        def check_connection_dead(*args):
            self.send(["irrelevant"])
        gobject.timeout_add(1000, check_connection_dead)
        def check_connection_timeout(*args):
            log.error("BUG: packet size failsafe did not fire: we are still connected!")
            self.quit()
        gobject.timeout_add(20*1000, check_connection_timeout)

    def make_hello(self, challenge_response=None):
        capabilities = XpraClientBase.make_hello(self, challenge_response)
        capabilities["waste_of_space"] = "\0" * (32*1024)
        return capabilities

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)

if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestMemoryClient, sys.argv)
Пример #12
0
from wimpiggy.log import Logger
log = Logger()

from xpra.client_base import GLibXpraClient

class TestIllegalCommandClient(GLibXpraClient):
    """
        Sending an illegal command should get us kicked out
    """

    def __init__(self, conn, opts):
        GLibXpraClient.__init__(self, conn, opts)
        def check_kicked_out(*args):
            log.error("BUG: illegal command did not get us kicked out: we are still connected!")
            self.quit()
        gobject.timeout_add(5*1000, check_kicked_out)

    def send_hello(self, challenge_response=None):
        #we should not be able to do this before hello:
        for i in range(1, 10):
            self.send(["close-window", i])

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)

if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestIllegalCommandClient, sys.argv)
Пример #13
0
    def __init__(self, conn, opts):
        GLibXpraClient.__init__(self, conn, opts)

        def check_connection_dead(*args):
            self.send(["irrelevant"])

        gobject.timeout_add(1000, check_connection_dead)

        def check_connection_timeout(*args):
            log.error(
                "BUG: packet size failsafe did not fire: we are still connected!"
            )
            self.quit()

        gobject.timeout_add(20 * 1000, check_connection_timeout)

    def make_hello(self, challenge_response=None):
        capabilities = XpraClientBase.make_hello(self, challenge_response)
        capabilities["waste_of_space"] = "\0" * (32 * 1024)
        return capabilities

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestMemoryClient, sys.argv)
Пример #14
0
class TestIllegalCommandClient(GLibXpraClient):
    """
        Sending an illegal command should get us kicked out
    """

    def __init__(self, conn, opts):
        GLibXpraClient.__init__(self, conn, opts)

        def check_kicked_out(*args):
            log.error("BUG: illegal command did not get us kicked out: we are still connected!")
            self.quit()

        gobject.timeout_add(5 * 1000, check_kicked_out)

    def send_hello(self, challenge_response=None):
        # we should not be able to do this before hello:
        for i in range(1, 10):
            self.send(["close-window", i])

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)


if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS

    test_DoS(TestIllegalCommandClient, sys.argv)
Пример #15
0
class TestTimeoutClient(GLibXpraClient):
    """
        Use this test against a password protected server.
        The server should kick us within 10 seconds out as we aren't replying
        to its challenge request.
    """

    def __init__(self, conn, opts):
        GLibXpraClient.__init__(self, conn, opts)
        def check_connection_timeout(*args):
            log.error("BUG: timeout did not fire: we are still connected!")
            self.quit()
        gobject.timeout_add(20*1000, check_connection_timeout)

    def _process_challenge(self, packet):
        log.info("got challenge - which we shall ignore!")

    def _process_hello(self, packet):
        log.error("cannot try to DoS this server: it has no password protection!")
        self.quit()

    def quit(self, *args):
        log.info("server correctly terminated the connection")
        GLibXpraClient.quit(self)

if __name__ == "__main__":
    import sys
    from tests.xpra.test_DoS_client import test_DoS
    test_DoS(TestTimeoutClient, sys.argv)