1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Megaupload shell uploader

Discussion in 'Programming' started by Kaizoku, Jan 7, 2010.

  1. cakehouse

    cakehouse Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Do you know why I get this error when I try to upload?

    ...curl: no URL specified!
    curl: try 'curl --help' or 'curl --manual' for more information
    Done!
     
    cakehouse, Jun 19, 2010 IP
  2. cakehouse

    cakehouse Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Nevermind. It's probably a network problem. It works with my other server.
     
    cakehouse, Jun 19, 2010 IP
  3. shearerc

    shearerc Active Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #23
    thanks pal for making this freely available

    Also if u upload to prem acc, it may take a few mins to show up in File Manager.
     
    Last edited: Sep 9, 2010
    shearerc, Sep 9, 2010 IP
  4. Meltedfusion

    Meltedfusion Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Hey thanks for this, I am really looking forward to using it...
    One big problem is that i am a complete noob to scripting, that being said please help cause i am getting confused and kinda frustrated -_-#
    I am assuming that I would copy and paste it to something like skite or gedit, but what would i save it as, mgupldscript._??
    I typed javascript:document.write(document.cookie); into the address bar after i logged into megaupload premium and nothing loaded. I am guesing i did something wrong. Also where would I make the reference for the file/files i want to upload to my account..

    Sorry for the dumb questions, any and all help would be appreciated. Thanks in advance.
    Em
     
    Meltedfusion, Sep 16, 2010 IP
  5. m1n1ng

    m1n1ng Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    mu had an update so the script has stop working
    anyone has a fix for it? Thanks
     
    m1n1ng, Nov 30, 2010 IP
  6. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #26
    Looks like packet sniffing and/or swf decompiling is required to reverse engineer this.
     
    Kaizoku, Nov 30, 2010 IP
  7. m1n1ng

    m1n1ng Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    yeah, it's a headache
    why they keep using flash :(
     
    m1n1ng, Nov 30, 2010 IP
  8. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #28
    I can only do this with php, as bash is very low level. This is only script based for now. When I have time, will make it shell based.

    
    <?php
    /* place your megaupload cookie string here
    to obtain one, all you need to do is login to megaupload
    type the following in address bar
    javascript:document.write(document.cookie);
    your string is user=(something); */
    $muser = 'MY_COOKIE_STRING';
    
    // example usage
    submit_megaupload('/path/to/my/file');
    
    function submit_megaupload($file, $description = 'My Description') {
    	global $muser;
    	$postData = array();
    	$postData['file'] = '@'.$file;
    	$postData['message'] = $description;
    	$postData['password'] = "";
    	$postData['trafficurl'] = "";
    	$postData['toemail'] = "";
    	$postData['fromemail'] = "";
    	$postData['multiemail'] = "";
    	$postData['password'] = "";
    	$postData['user'] = $muser;
    	$postData['hotlink'] = "";
    	// I could have broken it up here, but I like to do everything on one line.
    	return between("http://www.megaupload.com/?d=", "'", httpSend(between('flashvars.server = "', '";', httpSend("http://www.megaupload.com/", FALSE, "user={$muser}")).'upload_done.php?UPLOAD_IDENTIFIER='.generateRandomID(32).'&user='.$muser.'&s='.filesize($file), TRUE, "user={$muser}", FALSE, $postData));
    }
    
    // generic curl operations
    function httpSend($url, $isPOST = false, $cookie = false, $isFollow = FALSE, $postData = array(), $timeout = FALSE) {
    	$ch = curl_init($url);
    	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0");
    	if (!$cookie) {
    		curl_setopt($ch, CURLOPT_COOKIEFILE, "c.txt");
    		curl_setopt($ch, CURLOPT_COOKIEJAR, "c.txt");
    	} else {
    		curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    	}
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    	if ($isFollow) {
    		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    		curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    	}
    	if ($isPOST) {
    		curl_setopt($ch, CURLOPT_POST, TRUE);
    		curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    	}
    	if ($timeout) {
    		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    		curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    	}
    	$data = curl_exec($ch);
    	curl_close($ch);
    	return $data;
    }
    
    $nums = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
    // Converted from disassembled flash http://wwwstatic.megaupload.com/flash/ru.swf
    function generateRandomID($m) {
    	global $nums;
    	$id = '1'.millitime();
    	$diff = $m - strlen($id);
    	for ($test = 1; $test <= $diff; ++$test) {
    		$id .= $nums[mt_rand(0, 9)];
    	}
    	
    	return $id;
    }
    
    // This custom function replaces regex
    function between($start, $end, $source) {
    	$s = strpos($source, $start) + strlen($start);
    	return substr($source, $s, strpos($source, $end, $s) - $s);
    }
    
    // Php does not have native support for milliseconds
    function millitime() {
    	return round(microtime(TRUE) * 1000);
    }
    ?>
    
    PHP:
     
    Last edited: Nov 30, 2010
    Kaizoku, Nov 30, 2010 IP
  9. m1n1ng

    m1n1ng Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #29
    how can i use the script in shell
    is it adding #!/usr/bin/php (by googling)
    but it doesn't seems to work for me, missing php interpreter apparently
    i have try
    apt-get install php5
    Code (markup):
    any other package needed?

    Thank you for your effort
    really appreciate it :)
     
    m1n1ng, Dec 1, 2010 IP
  10. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #30
    This does not work on shell, you cannot pass parameters on files.

    To execute just do

    php file.php
     
    Kaizoku, Dec 1, 2010 IP
  11. xendatious

    xendatious Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #31
    Do you think you'll be able to get it working through shell again? I've been using it for a few weeks and it was great :(

    The php s cript doesn't seem to be working with spaces in the filename
     
    Last edited: Dec 1, 2010
    xendatious, Dec 1, 2010 IP
  12. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #32
    I will try to get it working on bash, also trying to figure out a way to get hash checking working. When you upload a file already on megaupload server, it finishes instantly.
     
    Kaizoku, Dec 1, 2010 IP
  13. xendatious

    xendatious Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #33
    Oh wow, hash checking would be great yep >.<

    Anyway, thanks for the php s cript , gotten it working the way i want it for now :)
     
    xendatious, Dec 1, 2010 IP
  14. m1n1ng

    m1n1ng Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #34
    that would be a good feature :D
     
    m1n1ng, Dec 1, 2010 IP
  15. root2

    root2 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #35
    some small change in the src on line 10
    
    submit_megaupload($argv[1]);
    //submit_megaupload('/path/to/my/file');
    
    PHP:
    probably you have to make some loops to read more than one parameter

    call like


    php -f <script> <path to file>

    works fine for me at ubuntu 10.10
     
    root2, Dec 2, 2010 IP
  16. shearerc

    shearerc Active Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #36
    Anyone know how to accomodate spaces in filename?
     
    shearerc, Dec 4, 2010 IP
  17. shearerc

    shearerc Active Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #37
    you only need to install php5-cli and php5-curl
     
    shearerc, Dec 6, 2010 IP
  18. Eka Ariyasa

    Eka Ariyasa Banned

    Messages:
    182
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    48
    #38
    i very lazy in waiting.. many good file on megaupload.. but i think feature not good with bandwidth limitation
     
    Eka Ariyasa, Dec 6, 2010 IP
  19. m1n1ng

    m1n1ng Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #39
    i just discovered that the shell script still usable if you change the url to
    http://multifetch.megaupload.com/
    Code (markup):
     
    m1n1ng, Dec 7, 2010 IP
  20. moshecogan

    moshecogan Active Member

    Messages:
    265
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #40
    Thanks for sharing this script.
     
    moshecogan, Dec 8, 2010 IP