Hello There, Guest! Login Register
Logo
Dismiss this notice
MaDLeeTs is not responsible for any attacks that are carried out on networks, websites or servers.
MaDLeeTs staff members cannot be held responsible.
All information on this forum is for educational purposes only.


Backup Script

  • 1 Vote(s) - 5 Average


10-19-2014, 07:57 AM #1
T3N38R15 Offline ? lawless-coder *****
Moderators
Posts:812 Threads:48 Joined:Jan 2014 Reputation: 126
Mood: Fine
Hallo Mads,
today i want to share a little backup script maked by me wink
PHP Code:
<?php
ini_set
('memory_limit''64M');ignore_user_abort(true);set_time_limit(0);
Zip($_SERVER['DOCUMENT_ROOT'],$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR "backup-"time() .".zip");
echo 
"finish";
function 
Zip($source$destination){
    if (
extension_loaded('zip') === true){
        if (
file_exists($source) === true){
            
$zip = new ZipArchive();
            if (
$zip->open($destinationZIPARCHIVE::CREATE) === true){
                
$source realpath($source);
                if (
is_dir($source) === true){
                    
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
                    foreach (
$files as $file){
                        
$file realpath($file);
                        if (
is_dir($file) === true){
                            
$zip->addEmptyDir(str_replace($source DIRECTORY_SEPARATOR''$file DIRECTORY_SEPARATOR));
                        }else if (
is_file($file) === true){
                           
$zip->addFromString(str_replace($source DIRECTORY_SEPARATOR''$file), file_get_contents($file));
                        }
                    }
                }else if (
is_file($source) === true){
                    
$zip->addFromString(basename($source), file_get_contents($source));
                }
            }
            return 
$zip->close();
        }
    }
    return 
false;
}
?>
it backup all files in the ROOTDIR into a backup-%time%.zip
wink have fun with it Smiley1

[Image: xodhvlpa.jpg]
[Image: test.php]

10-19-2014, 08:10 AM #2
loyal_learner Offline MaDLeeTs LoVer *****
MaDLeeTs LoVer
Posts:7 Threads:3 Joined:Jun 2014 Reputation: 0
Mood: None
Neat. Keep up the nice work.

10-19-2014, 10:23 AM #3
SickSpawn Offline You have an error in your SQL syntax; ***
TeaM MaDLeeTs
Posts:85 Threads:28 Joined:Sep 2014 Reputation: 2
Mood: Hacker
good job man Smiley1

[#] Twitter: sickspawnhy
[#] Jabber : [email protected]

10-19-2014, 12:32 PM #4
Altair Offline MadLeets Lover *****
MaDLeeTs LoVer
Posts:94 Threads:8 Joined:May 2014 Reputation: 8
Mood: Tired
thanks very good Smiley1

i try it, successfull

Telegram Chat room for MaDLeeTs members
https://t.me/joinchat/AAAAAAw32DdRbrjMJYstlg          


10-19-2014, 06:36 PM #5
T3N38R15 Offline ? lawless-coder *****
Moderators
Posts:812 Threads:48 Joined:Jan 2014 Reputation: 126
Mood: Fine
thanks Smiley1
if someone miss a function on that tool just say it to me Smiley1

[Image: xodhvlpa.jpg]
[Image: test.php]

10-19-2014, 10:42 PM #6
Ninja Offline Junior Member **
Registered
Posts:29 Threads:2 Joined:Oct 2014 Reputation: 4
Mood: Speechless
Nice. You can make an small change. From which ever directory we run this script it will zip all the files from that directory. File extension we will input.

This will help when we get lots of symlink .txt extension configs Smiley1

# Knowledge Must Be free
# Anyone needs any C++/ASM programming help then contact me.
# Need help compiling your local roots,i will do that too.
http://www.madleets.com

10-20-2014, 04:27 AM #7
T3N38R15 Offline ? lawless-coder *****
Moderators
Posts:812 Threads:48 Joined:Jan 2014 Reputation: 126
Mood: Fine
which extension did you wish ?

[Image: xodhvlpa.jpg]
[Image: test.php]

10-21-2014, 03:01 PM #8
Ninja Offline Junior Member **
Registered
Posts:29 Threads:2 Joined:Oct 2014 Reputation: 4
Mood: Speechless
"*.txt" .It can be any.We can define it any according to situation Smiley1

# Knowledge Must Be free
# Anyone needs any C++/ASM programming help then contact me.
# Need help compiling your local roots,i will do that too.
http://www.madleets.com

10-21-2014, 05:14 PM #9
Posts:34 Threads:5 Joined:Oct 2014 Reputation: 11
Mood: Zombie
Nice Share Bro


1337X

Facebook: facebook.com/moinahmad1998

maDleets

10-21-2014, 06:22 PM #10
planket Offline Member ***
Registered
Posts:208 Threads:101 Joined:Feb 2013 Reputation: 0
Mood: None
@T3N38R15 : we just need to run it and it will automatically backup the files?






Forum Jump:


Users browsing this thread:1 Guest(s)