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

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/lib/python3.6/site-packages/tracer/tests/   drwxr-xr-x
Free 303.04 GB of 429.69 GB (70.52%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_processes.py (2.38 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
from .__meta__ import *
from tracer.resources.processes import Processes, Process, ProcessWrapper
from tracer.resources.SystemdDbus import SystemdDbus
from tracer.resources.collections import ProcessesCollection
import os
import subprocess


class TestProcesses(unittest.TestCase):

    @unittest.skipIf(True, "@TODO Create Mock for Processes class")
    def test_children(self):
        process = Processes.all()[0]
        children = process.children()
        self.assertIsInstance(children, ProcessesCollection)

        for child in children:
            self.assertIsInstance(child, Process)

    @unittest.skipIf(True, "@TODO Create Mock for Processes class")
    def test_unique_process(self):
        process = Process(os.getpid())
        parent = Process(os.getppid())

        self.assertIs(process, Process(os.getpid()))
        self.assertIs(parent, process.parent())
        self.assertIn(process, parent.children())

        Process.reset_cache()
        process2 = Process(os.getpid())
        self.assertEqual(process, process2)
        self.assertIsNot(process, process2)

    @unittest.skipIf(True, "@TODO Create Mock for Processes class")
    def test_process_caching(self):
        process = Process(os.getpid())

        # Populate the cache entry for children
        process.children()

        child = subprocess.Popen(os.sys.executable, stdin=subprocess.PIPE)
        self.assertEqual(0, len(process.children()))

        process.rebuild_cache()
        self.assertEqual(1, len(process.children()))

        child.terminate()

    def test_name_sshd(self):
        p1 = ProcessMock()
        p1.data = {"name": "sshd",
               "exe": "/usr/sbin/sshd",
               "cmdline": ["/usr/sbin/sshd", "-D", "foo", "bar"]}
        assert p1.name() == "sshd"

        p2 = ProcessMock()
        p2.data = {"name": "sshd",
               "exe": "/usr/sbin/sshd",
               "cmdline": ["some", "thing", "and", "arguments", "idk", "what"]}
        assert p2.name() == "ssh-thing-session"

        # I don't know what case this is in a real life but see #129 and #125
        p3 = ProcessMock()
        p3.data = {"name": "sshd", "exe": "/usr/sbin/sshd",
               "cmdline": ["withoutparams"]}
        assert p3.name() == "sshd"

    @unittest.skipIf(True, "@TODO Create Mock for Processes class")
    def test_dbus(self):
        dbus = SystemdDbus()
        pids = Processes.pids()
        nonexisting = max(pids) + 999
        assert dbus.has_service_property_from_pid(1, "PAMName") is False
        assert dbus.has_service_property_from_pid(nonexisting, "PAMName") is False


class ProcessMock(ProcessWrapper):
    def __init__(self):
        self.data = {}

    def _attr(self, name):
        return self.data[name]

:: 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 KaizenLouie | C99Shell Github | Generation time: 0.0046 ]--