[PHP][Upload] Ultramegabit.com Rapidleech Plugin

Status
Not open for further replies.

Halcyon

Active Member
1,306
2009
343
15
The same code can also be accessed from here: http://site.sborg.us/2012/10/upload-ultramegabit-com-rapidleech-plugin/

Ultramegabit.com.index.php
PHP:
<?php 
$upload_services[] = "ultramegabit.com";
$max_file_size["ultramegabit.com"] = 1024;
$page_upload["ultramegabit.com"] = "ultramegabit.com.php";
?>
Ultramegabit.com.php
PHP:
<?php
####### Account Info. ###########
$ultramegabit_login = ""; //Set you username
$ultramegabit_pass = ""; //Set your password
$ultramegabit_folder = ""; //Set your upload folder
$ultramegabit_description = ""; //Set your description
##############################

$not_done = true;
$continue_up = false;
if ($ultramegabit_login & $ultramegabit_pass) {
    $_REQUEST['my_login'] = $ultramegabit_login;
    $_REQUEST['my_pass'] = $ultramegabit_pass;
    $_REQUEST['my_folder'] = $ultramegabit_folder;
    $_REQUEST['my_description'] = $ultramegabit_description;
    $_REQUEST['action'] = "FORM";
    echo "<b><center>Using Default login/pass.</center></b>\n";
}
if ($_REQUEST['action'] == "FORM")
    $continue_up = true;
else {

    ?>
    <form method=post>
        <input type=hidden name=action value='FORM' />
        <table style="width:270px; border: 0; cellspacing:0; margin: auto">
            <tr><td>&nbsp;Email*<td>&nbsp;<input type=text name=my_login value='' style="width:160px;" />&nbsp;</tr>
            <tr><td>&nbsp;Password*<td>&nbsp;<input type=password name=my_pass value='' style="width:160px;" />&nbsp;</tr>
            <tr><td>&nbsp;Upload Folder*<td>&nbsp;<input type=text name=my_folder value='' style="width:160px;" />&nbsp;</tr>
            <tr><td>&nbsp;Description*<td>&nbsp;<input type=text name=my_description value='' style="width:160px;" />&nbsp;</tr>
            <tr><td colspan=2 style="text-align: center"><input type=submit value='Upload' /></tr>
            <tr><td colspan=2 style="text-align: center"><small>*You can set it as default in <b><?php echo $page_upload["ultramegabit.com"]; ?></b></small></tr>
        </table>
    </form>
    <?php
}

if ($continue_up) {
    $not_done = false;

    ?>
    <table style="margin: auto; width: 600">
        <tr><td>
                <script>document.getElementById('login').style.display='none';</script>
                <div id=info style="width:100%; align:center">Retrieve upload ID</div>
                <?php
                // Lets get the unique ID
                // Create a temp cookie
                $cookie = "csrf_cookie=" . GRC(20);
                $page = geturl("ultramegabit.com", 80, "/folder/add", 0, $cookie);
                $redir = getRedirector($page);

                is_page($page);
                $cookie = GetCookies($page);

                $url = parse_url($redir);
                $page = geturl($url['host'], 80, $url['path'], $redir, $cookie);
                $csrf_token = cut_str($page, 'name="csrf_token" value="', '"');

                if (empty($csrf_token))
                    html_error("Unable to retrieve csrf_token - Plugin broken - Contact Abhi on sBorg forums");

                echo '<div id=login style="width:100%; align:center">Login to Ultramegabit</div>';

                // Awrite lets proceed with login
                $post = array ();
                $post['csrf_token'] = $csrf_token;
                $post['return_url'] = urlencode($redir);
                $post['submit'] = 'Login';
                $post['username'] = $_REQUEST['my_login'];
                $post['password'] = $_REQUEST['my_pass'];
                $page = geturl("ultramegabit.com", 80, "/login", $redir, $cookie, $post);

                is_present($page, "Form validation errors found", "Incorrect Login or Password");

                // Goto folder/add page to get the new unique ID
                $page = geturl("ultramegabit.com", 80, "/folder/add", $redir, $cookie);
                $redir = getRedirector($page);

                // Get the folder link if specified
                if (!empty($_REQUEST['my_folder'])) {
                    $url = parse_url($redir);
                    $page = geturl($url["host"], $url["port"] ? $url["port"] : 80, $url["path"] . ($url["query"] ? "?" . $url["query"] : ""), $redir, $cookie);

                    $folder = $_REQUEST['my_folder'];
                    preg_match("#id=\"folder_copy_link_(.*)?\" name=\"$folder\"#", $page, $match);
                    // If match is found => hurray!
                    // else the file will be uploaded to the most recently used folder
                    if (!empty($match[1]))
                        $redir = str_ireplace(basename($redir), $match[1], $redir);
                }

                $url = parse_url(str_ireplace("/add/", "/upload_file_post/", $redir));

                is_page($page);
                echo "<script>document.getElementById('info').style.display='none';</script>";

                $post = array ();
                $post['csrf_token'] = $csrf_token;
                $post['name'] = $_REQUEST['my_folder'];
                $post['description'] = $_REQUEST['my_description'];

                $upfiles = upfile($url["host"], $url["port"] ? $url["port"] : 80, $url["path"] . ($url["query"] ? "?" . $url["query"] : ""), $redir, $cookie, $post, $lfile, $lname, "file");

                echo "<script>document.getElementById('progressblock').style.display='none';</script>";

                is_page($upfiles);

                $download_link = stripslashes(trim(cut_str($upfiles, '"url":"', '"')));

                if (empty($download_link)) {
                    html_error("Finished, Go to your account to see Download-URL.", 0);
                }

                ?>
            </td></tr>
    </table>
    <?php
}

function getRedirector($page) {
    preg_match('/Location: ([^\r|\n]+)/i', $page, $redir);
    return $redir[1];

}

function GRC($length = 32, $letters = 'abcdefklmnoupqrstvx') {
    $s = '';
    $lettersLength = strlen($letters) - 1;
    for ($i = 0; $i < $length; $i++) {
        $s .= $letters[rand(0, $lettersLength)];
    }
    return $s;

}

/**
 *  Author        : Halcyon aka Abhi
 *  Description   : Rapidleech plugin for Ultramegabit.com
 *  Date          : 17-Oct-2012
 *  URL           : site.sborg.us
 */

?>
 
Status
Not open for further replies.
Back
Top