CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/root/usr/local/ssl/local/rvglobalsoft/rvsitebuilder7/bin/
Upload File :
Current File : //proc/2/root/usr/local/ssl/local/rvglobalsoft/rvsitebuilder7/bin/rvcrypt

#!/usr/bin/env php
<?php
if (PHP_SAPI != "cli") {
    exit;
}

// $option = getopt("c:cm:k:d:m:iv:h::", array('help::', 'crypt:', 'cm:', 'key:', 'data:', 'mode:', 'iv:'));

if (isset($option['h']) || isset($option['help'])) {	
    print "Encrypts/Decrypts text/crypttext with given parameters\n";
	print "Usage: " . basename(__FILE__) . " [options] -p -c <Decrypt|Encrypt> -cm <cipher> -k <key> -m <mode> -iv <iv> -d <crypttext/text>\n";
	print "\n";
	print "\t--crypt=<decrypt|encrypt>\t\"decrypt\" or \"encrypt\" command\n";
	print "\t--cipher=<cipher>\tOne of the MCRYPT_ciphername constants, or the name of the algorithm as string\n";
	print "\t--key=<key>\tThe key with which the data was encrypted. If it's smaller than the required keysize, it is padded with '\0'. \n";
	print "\t--data=<crypttext/text>\tThe data that will be decrypted with the given cipher and mode. If the size of the data is not n * blocksize, the data will be padded with '\0'. \n";
	print "\t--mode=<mode>\tOne of the MCRYPT_MODE_modename constants, 
	or one of the following strings: \"ecb\", \"cbc\", \"cfb\", \"ofb\", \"nofb\" or \"stream\". \n";
	
	print "\t--iv=<iv>\tThe iv parameter is used for the initialization in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. If you do not supply an IV, while it is needed for an algorithm, the function issues a warning and uses an IV with all its bytes set to '\0'. \n";
	print "\t-h , --help\tdisplay this help and exit\n"; 
	exit;
}

if (isset($option['crypt'])) 
	$cryptType = $option['crypt'];
elseif (isset($_SERVER['RCRYPT_CMD']))
	$cryptType = getenv('RCRYPT_CMD');
else 
	$cryptType = 'encrypt';

$cryptType = strtolower($cryptType);

if ($cryptType != 'decrypt' && $cryptType != 'encrypt') {
	print "You can usage \"decrypt\" or \"encrypt\" in option -c or --crypt\n";
	print $cryptType . "\n";
	print_r($option);
	exit;
}

if (isset($option['cipher']))
	$cipher = $option['cipher'];
elseif (isset($_SERVER['RCRYPT_CIPHET']))
	$cipher = getenv('RCRYPT_CIPHET');
else 
	$cipher = MCRYPT_BLOWFISH;


if (isset($option['k'])) 
	$key = $option['k'];
elseif(isset($option['key']))
    $key = $option['key'];
elseif (isset($_SERVER['RCRYPT_KEY']))
	$key = getenv('RCRYPT_KEY');
else 
	$key =  '\0';
			
if (isset($option['d'])) 
	$data = $option['d'];
elseif (isset($option['data'])) 
	$data = $option['data'];
elseif (isset($_SERVER['RCRYPT_DATA']))
		$data = getenv('RCRYPT_DATA');
else 
	$data = '\0';



if (isset($option['m']))
	$mode = $option['m'];
elseif (isset($option['mode']))
	$mode = $option['mode'];
elseif (isset($_SERVER['RCRYPT_MODE']))
	$mode = getenv('RCRYPT_MODE');
else 
	$mode = MCRYPT_MODE_CBC;

switch (strtoupper($mode)) {
	case 'MCRYPT_MODE_ECB': $mode = MCRYPT_MODE_ECB; break;
	case 'MCRYPT_MODE_CBC': $mode = MCRYPT_MODE_CBC; break; 
	case 'MCRYPT_MODE_CFB': $mode = MCRYPT_MODE_CFB; break; 
	case 'MCRYPT_MODE_OFB': $mode = MCRYPT_MODE_OFB; break; 
	case 'MCRYPT_MODE_NOFB' : $mode = MCRYPT_MODE_NOFB; break; 
	case 'MCRYPT_MODE_STREAM' : $mode = MCRYPT_MODE_STREAM; break;
}

if (isset($option['iv'])) 
	$iv = $option['iv'];
elseif (isset($_SERVER['RCRYPT_IV'])) 
	$iv = getenv('RCRYPT_IV');
else 
	$iv = '\0';

if ($cryptType == 'decrypt') {
	try {
		echo mcrypt_decrypt($cipher, $key, base64_decode($data), $mode, $iv);
	} catch (Exception $e) {
    	echo 'Caught exception: ',  $e->getMessage(), "\n";
	}
} else {
	try {
		echo base64_encode(mcrypt_encrypt($cipher, $key, $data, $mode, $iv));
	} catch (Exception $e) {
    	echo 'Caught exception: ',  $e->getMessage(), "\n";
	}
}

Copyright 2K16 - 2K18 Indonesian Hacker Rulez