!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: nginx/1.23.4. PHP/5.6.40-65+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux foro-restaurado-2 5.15.0-1040-oracle #46-Ubuntu SMP Fri Jul 14 21:47:21 UTC 2023
aarch64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/lib/python3/dist-packages/twisted/pair/test/   drwxr-xr-x
Free 83.21 GB of 96.73 GB (86.02%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_ethernet.py (7.75 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from zope.interface import implementer

from twisted.pair import ethernet, raw
from twisted.python import components
from twisted.trial import unittest


@implementer(raw.IRawPacketProtocol)
class MyProtocol:
    def __init__(self, expecting):
        self.expecting = list(expecting)

    def addProto(self, num, proto):
        """
        Not implemented
        """

    def datagramReceived(self, data, partial, dest, source, protocol):
        assert self.expecting, "Got a packet when not expecting anymore."
        expect = self.expecting.pop(0)
        localVariables = locals()
        params = {
            "partial": partial,
            "dest": dest,
            "source": source,
            "protocol": protocol,
        }
        assert expect == (data, params), "Expected {!r}, got {!r}".format(
            expect, (data, params)
        )


class EthernetTests(unittest.TestCase):
    def testPacketParsing(self):
        proto = ethernet.EthernetProtocol()
        p1 = MyProtocol(
            [
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0800,
                    },
                ),
            ]
        )
        proto.addProto(0x0800, p1)

        proto.datagramReceived(b"123456987654\x08\x00foobar", partial=0)

        assert not p1.expecting, (
            "Should not expect any more packets, but still want %r" % p1.expecting
        )

    def testMultiplePackets(self):
        proto = ethernet.EthernetProtocol()
        p1 = MyProtocol(
            [
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0800,
                    },
                ),
                (
                    b"quux",
                    {
                        "partial": 1,
                        "dest": b"012345",
                        "source": b"abcdef",
                        "protocol": 0x0800,
                    },
                ),
            ]
        )
        proto.addProto(0x0800, p1)

        proto.datagramReceived(b"123456987654\x08\x00foobar", partial=0)
        proto.datagramReceived(b"012345abcdef\x08\x00quux", partial=1)

        assert not p1.expecting, (
            "Should not expect any more packets, but still want %r" % p1.expecting
        )

    def testMultipleSameProtos(self):
        proto = ethernet.EthernetProtocol()
        p1 = MyProtocol(
            [
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0800,
                    },
                ),
            ]
        )

        p2 = MyProtocol(
            [
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0800,
                    },
                ),
            ]
        )

        proto.addProto(0x0800, p1)
        proto.addProto(0x0800, p2)

        proto.datagramReceived(b"123456987654\x08\x00foobar", partial=0)

        assert (
            not p1.expecting
        ), "Should not expect any more packets, " "but still want {!r}".format(
            p1.expecting
        )
        assert (
            not p2.expecting
        ), "Should not expect any more packets," " but still want {!r}".format(
            p2.expecting
        )

    def testWrongProtoNotSeen(self):
        proto = ethernet.EthernetProtocol()
        p1 = MyProtocol([])
        proto.addProto(0x0801, p1)

        proto.datagramReceived(b"123456987654\x08\x00foobar", partial=0)
        proto.datagramReceived(b"012345abcdef\x08\x00quux", partial=1)

    def testDemuxing(self):
        proto = ethernet.EthernetProtocol()
        p1 = MyProtocol(
            [
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0800,
                    },
                ),
                (
                    b"quux",
                    {
                        "partial": 1,
                        "dest": b"012345",
                        "source": b"abcdef",
                        "protocol": 0x0800,
                    },
                ),
            ]
        )
        proto.addProto(0x0800, p1)

        p2 = MyProtocol(
            [
                (
                    b"quux",
                    {
                        "partial": 1,
                        "dest": b"012345",
                        "source": b"abcdef",
                        "protocol": 0x0806,
                    },
                ),
                (
                    b"foobar",
                    {
                        "partial": 0,
                        "dest": b"123456",
                        "source": b"987654",
                        "protocol": 0x0806,
                    },
                ),
            ]
        )
        proto.addProto(0x0806, p2)

        proto.datagramReceived(b"123456987654\x08\x00foobar", partial=0)
        proto.datagramReceived(b"012345abcdef\x08\x06quux", partial=1)
        proto.datagramReceived(b"123456987654\x08\x06foobar", partial=0)
        proto.datagramReceived(b"012345abcdef\x08\x00quux", partial=1)

        assert not p1.expecting, (
            "Should not expect any more packets, but still want %r" % p1.expecting
        )
        assert not p2.expecting, (
            "Should not expect any more packets, but still want %r" % p2.expecting
        )

    def testAddingBadProtos_WrongLevel(self):
        """Adding a wrong level protocol raises an exception."""
        e = ethernet.EthernetProtocol()
        try:
            e.addProto(42, "silliness")
        except components.CannotAdapt:
            pass
        else:
            raise AssertionError("addProto must raise an exception for bad protocols")

    def testAddingBadProtos_TooSmall(self):
        """Adding a protocol with a negative number raises an exception."""
        e = ethernet.EthernetProtocol()
        try:
            e.addProto(-1, MyProtocol([]))
        except TypeError as e:
            if e.args == ("Added protocol must be positive or zero",):
                pass
            else:
                raise
        else:
            raise AssertionError("addProto must raise an exception for bad protocols")

    def testAddingBadProtos_TooBig(self):
        """Adding a protocol with a number >=2**16 raises an exception."""
        e = ethernet.EthernetProtocol()
        try:
            e.addProto(2 ** 16, MyProtocol([]))
        except TypeError as e:
            if e.args == ("Added protocol must fit in 16 bits",):
                pass
            else:
                raise
        else:
            raise AssertionError("addProto must raise an exception for bad protocols")

    def testAddingBadProtos_TooBig2(self):
        """Adding a protocol with a number >=2**16 raises an exception."""
        e = ethernet.EthernetProtocol()
        try:
            e.addProto(2 ** 16 + 1, MyProtocol([]))
        except TypeError as e:
            if e.args == ("Added protocol must fit in 16 bits",):
                pass
            else:
                raise
        else:
            raise AssertionError("addProto must raise an exception for bad protocols")

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by HackingTool | HackingTool | Generation time: 0.0049 ]--