Activity Stream
48,167 MEMBERS
63050 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1.     
    #1
    Member
    Website's:
    Wrestle-Zone.net Media-Zone.net

    Default Backing up your MYSQL Database to Rapidshare (Linux)

    Two Files Involved.

    1 - Rapidshare Linux Api
    2 - Backup bash script.

    Put them in both in same directory.

    {---} -- Replace it with the actual filepath

    Code: 
    #!/bin/bash
    #
    
    date=$(date +%T@%F)
    backupdir={---}
    
    cd $backupdir
    /usr/bin/mysqldump -u username -p pass --databases db_name > DB_$date.sql
    gzip -c {---}DB_$date.sql
    perl rsapi.pl DB_$date.sql.gz
    perl rsapi.pl DB_$date.sql

    RS API.
    Input ur login details.

    Code: 
    
    #!/usr/bin/perl
    
    # RapidShare AG OpenSource Perl Uploader V1.0. For non-commercial use only. All rights reserved.
    # Included: Uploading to free, collector's and premium-zone. The MD5-check after uploads checks if the upload worked.
    # NOT included in this version: Upload-resume via new RS API.
    # This is a PERL script written for experts and for coders wanting to know how to write own upload programs.
    # Tested under Linux and Linux only.
    # If you write your own upload-tools, please look at our rsapi.cgi calls. You need them to have fun.
    #
    # To upload a file, put this script on a machine with perl installed and use the following syntax:
    # perl rsapi.pl free mytestfile.rar        (this uploads mytestfile.rar as a free user)
    # perl rsapi.pl prem archive.rar 334 test  (this uploads archive.rar to the premium-zone of login 334 with password test)
    # perl rsapi.pl col a.rar testuser mypw    (this uploads a.rar to the collector's-zone of login testuser with password mypw)
    #
    # We will publish another version with upload resume enabled soon, but this script actually works and we actually
    # want you to understand how it works and upload resume would make this script even more complex.
    
    use strict;
    use warnings;
    use Digest::MD5("md5_hex");
    use Fcntl;
    use IO::Socket;
    
    my ($file, $filename, $uploadpath, $size, $socket, $uploadserver, $cursize, $fh, $bufferlen, $buffer, $boundary, $header, $contentheader,
    $contenttail, $contentlength, $result, $maxbufsize, $md5hex, $filecontent, $size2, %key_val, $login, $password, $zone);
    
    
    
    # This chapter sets some vars and parses some vars.
    $/ = undef;
    $file = $ARGV[0] || die "Syntax: $0 <filename to upload> <free|prem|col> [login] [password]\n";
    $zone = $ARGV[1] || "prem";
    $login =  "RS LOGIN";
    $password = "RS PASS";
    $maxbufsize = 64000;
    $uploadpath = "l3";
    $cursize = 0;
    $size = -s $file || die "File $file is empty or does not exist!\n";
    $filename = $file =~ /[\/\\]([^\/\\]+)$/ ? $1 : $file;
    
    
    
    # This chapter checks the file and calculates the MD5HEX of the existing local file.
    print "File $file has $size bytes. Calculating MD5HEX...\n";
    open(FH, $file) || die "Unable to open file: $!\n";
    $filecontent = <FH>;
    close(FH);
    $md5hex = uc(md5_hex($filecontent));
    $size2 = length($filecontent);
    print "MD5HEX is $md5hex ($size2 bytes analyzed.)\n";
    unless ($size == $size2) { die "Strange error: $size bytes found, but only $size2 bytes analyzed?\n" }
    
    
    
    # This chapter finds out which upload server is free for uploading our file by fetching http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1
    if ($login and $password) { print "Trying to upload to your premium account.\n" } else { print "Uploading as a free user.\n" }
    print "Uploading as filename '$filename'. Getting upload server infos.\n";
    $socket = IO::Socket::INET->new(PeerAddr => "rapidshare.com:80") || die "Unable to open port: $!\n";
    print $socket qq|GET /cgi-bin/rsapi.cgi?sub=nextuploadserver_v1 HTTP/1.0\r\n\r\n|;
    ($uploadserver) = <$socket> =~ /\r\n\r\n(\d+)/;
    unless ($uploadserver) { die "Uploadserver invalid? Internal error!\n" }
    print "Uploading to rs$uploadserver$uploadpath.rapidshare.com\n";
    
    
    
    # This chapter opens our file and the TCP socket to the upload server.
    sysopen($fh, $file, O_RDONLY) || die "Unable to open file: $!\n";
    $socket = IO::Socket::INET->new(PeerAddr => "rs$uploadserver$uploadpath.rapidshare.com:80") || die "Unable to open port: $!\n";
    
    
    
    # This chapter constructs a (somewhat RFC valid) HTTP header. See how we pass rsapi_v1=1 to the server to get a program-friendly output.
    $boundary = "---------------------632865735RS4EVER5675865";
    $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="rsapi_v1"\r\n\r\n1\r\n|;
    
    if ($zone eq "prem" and $login and $password) {
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="login"\r\n\r\n$login\r\n|;
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
    }
    
    if ($zone eq "col" and $login and $password) {
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="freeaccountid"\r\n\r\n$login\r\n|;
      $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="password"\r\n\r\n$password\r\n|;
    }
    
    $contentheader .= qq|$boundary\r\nContent-Disposition: form-data; name="filecontent"; filename="$filename"\r\n\r\n|;
    $contenttail = "\r\n$boundary--\r\n";
    $contentlength = length($contentheader) + $size + length($contenttail);
    $header = qq|POST /cgi-bin/upload.cgi HTTP/1.0\r\nContent-Type: multipart/form-data; boundary=$boundary\r\nContent-Length: $contentlength\r\n\r\n|;
    
    
    
    #This chapter actually sends all the data, header first, to the upload server.
    print $socket "$header$contentheader";
    
    while ($cursize < $size) {
      $bufferlen = sysread($fh, $buffer, $maxbufsize, 0) || 0;
      unless ($bufferlen) { die "Error while sending data: $!\n" }
      print "$cursize of $size bytes sent.\n";
      $cursize += $bufferlen;
      print $socket $buffer;
    }
    
    print $socket $contenttail;
    
    
    
    # OK, all is sent. Now lets fetch the server's reponse and analyze it.
    print "All $size bytes sent to server. Fetching result:\n";
    ($result) = <$socket> =~ /\r\n\r\n(.+)/s;
    unless ($result) { die "Ooops! Did not receive any valid server results?\n" }
    print "$result >>> Verifying MD5...\n";
    
    foreach (split(/\n/, $result)) {
      if ($_ =~ /([^=]+)=(.+)/) { $key_val{$1} = $2 }
    }
    
    # Now lets check if the result contains (and it should contain) the MD5HEX of the uploaded file and check if its identical to our MD5HEX.
    unless ($key_val{"File1.4"}) { die "Ooops! Result did not contain MD5? Maybe you entered invalid login data.\n" }
    if ($md5hex ne $key_val{"File1.4"}) { die qq|Upload FAILED! Your MD5HEX is $md5hex, while the uploaded file has MD5HEX $key_val{"File1.4"}!\n| }
    print "MD5HEX value correct. Upload completed without errors. Saving links to rsulres.txt\n\n\n";
    
    
    
    # Maybe you want the links saved to a logfile? Here we go.
    #open(O, ">>rsulres.txt");
    #print O $result . "\n";
    #close(O);
    
    exit;
    Will add some eye candy later.
    EvilGenius Reviewed by EvilGenius on . Backing up your MYSQL Database to Rapidshare (Linux) Two Files Involved. 1 - Rapidshare Linux Api 2 - Backup bash script. Put them in both in same directory. {---} -- Replace it with the actual filepath #!/bin/bash Rating: 5
    wWw.Wrestle-Zone.net
    WrestlinG & WareZ

    A$$HOLE: To0

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    eih.bz pornDDL.me sexytattoochicks.tumblr.com
    Thanks mate.

  4.     
    #3
    Member
    great share, is it secure ?

  5.     
    #4
    Member
    Website's:
    iHacksRepo.Com WatchDDR.Com
    anyone tested ?


    Need Help Regarding Jailbreaks And Unlocks ? PM ME ;)

    iDevice : iPhone 3Gs 16GB White (Factory Unlocked) Updated To iOS5 !

  6.     
    #5
    Banned
    Website's:
    KWWHunction.com
    Meh. Id never do this

    @ II AnDo II

    Nothing is ever secure

  7.     
    #6
    Member
    Website's:
    fsdwarez.org
    Come on guyz, take backup, manually, use putty , or mysql dumper, are you that lazzy?
    you can't always depend on the script
    i wont use this

  8.     
    #7
    Member
    I have not tried this.

    But by referring to the RS api, the script will upload the database to Rapidshare and output the download link in a text file

    There has been an update in the api since he has posted this.
    http://images.rapidshare.com/software/rsapiresume.pl

  9.     
    #8
    Member
    Website's:
    fsdwarez.org
    yes, and some one smart can get the link of DB, and then you know what happens.....

  10.     
    #9
    Member
    True, someone can get access to this file and download your db.

    But you can edit the api for it not to output the download link in the text file. It's quite secure now, what do you think?

    obviously, the following line is doing this output (it's for the updated api):
    PHP Code: 
    open(O,">>rsapiuploads.txt") or die "Unable to save to rsapiuploads.txt: $!\n"
    he should also add a command to delete the backup db on the server after uploading it else those backup would take lot of disk space

  11.     
    #10
    Member
    Website's:
    wrzscene.info watchfreetvseriesonline.com
    or you can create a free hotfile account and make a cron job on your cpanel which uploads to hotfile ftp server using your account....and as hotfile has no storage limit you will be good to go for a long time

    just my 2 cents

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MySql Database To Large
    By Kat in forum Webmaster Discussion
    Replies: 16
    Last Post: 14th Dec 2011, 10:59 PM
  2. mysql query to export database
    By lenney in forum IP.Board
    Replies: 4
    Last Post: 7th May 2011, 03:43 PM
  3. WTB method of backing up a large forum database?
    By DoctorX in forum Technical Help Desk Support
    Replies: 11
    Last Post: 11th Apr 2011, 02:17 PM
  4. Mysql(Database)host
    By Mit1mit2 in forum Hosting Discussion
    Replies: 1
    Last Post: 19th Sep 2010, 07:03 PM
  5. Backing up database problem
    By pspuser007 in forum vBulletin
    Replies: 7
    Last Post: 21st Nov 2009, 11:09 AM

Tags for this Thread

BE SOCIAL