- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 3.138.34.93
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/cloudinit/distros/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/cloudinit/distros//openbsd.py
# Copyright (C) 2019-2020 Gonéri Le Bouder
#
# This file is part of cloud-init. See LICENSE file for license information.

import logging
import os

import cloudinit.distros.netbsd
from cloudinit import subp, util

LOG = logging.getLogger(__name__)


class Distro(cloudinit.distros.netbsd.NetBSD):
    hostname_conf_fn = "/etc/myname"
    init_cmd = ["rcctl"]

    def _read_hostname(self, filename, default=None):
        return util.load_file(self.hostname_conf_fn)

    def _write_hostname(self, hostname, filename):
        content = hostname + "\n"
        util.write_file(self.hostname_conf_fn, content)

    def _get_add_member_to_group_cmd(self, member_name, group_name):
        return ["usermod", "-G", group_name, member_name]

    @classmethod
    def manage_service(cls, action: str, service: str, *extra_args, rcs=None):
        """
        Perform the requested action on a service. This handles OpenBSD's
        'rcctl'.
        May raise ProcessExecutionError
        """
        init_cmd = cls.init_cmd
        cmds = {
            "stop": ["stop", service],
            "start": ["start", service],
            "enable": ["enable", service],
            "disable": ["disable", service],
            "restart": ["restart", service],
            "reload": ["restart", service],
            "try-reload": ["restart", service],
            "status": ["check", service],
        }
        cmd = list(init_cmd) + list(cmds[action])
        return subp.subp(cmd, capture=True, rcs=rcs)

    def lock_passwd(self, name):
        try:
            subp.subp(["usermod", "-p", "*", name])
        except Exception:
            util.logexc(LOG, "Failed to lock user %s", name)
            raise

    def unlock_passwd(self, name):
        pass

    def _get_pkg_cmd_environ(self):
        """Return env vars used in OpenBSD package_command operations"""
        e = os.environ.copy()
        return e

Youez - 2016 - github.com/yon3zu
LinuXploit