Jump to content
UBot Underground

Http File Post & Save


Recommended Posts

I am trying to get one of my posts to simply post cvs files to my server and then have my server save them. I am using HTTP Post and the $http upload command and php on my server to handle the saving.

 

But no mater how much i simplify the code it never works. At this point I need a second pair of eyes on the problem so I can stop hitting my head into the wall. 

 

Here is the uBot Code

set(#uploadFile,$plugin function("HTTP post.dll", "$http upload", "http://www.mysite.com/upload.php", "", $plugin function("File Management.dll", "$open file dialog"), "rawData", "file", "", "", "", ""),"Global")

Here is the upload.php on the server

<?php

$currentdir = getcwd();
$target = $currentdir .'/upload/' . basename($_FILES['rawData']['name']);
move_uploaded_file($_FILES['rawData']['tmp_name'], $target);

?>

Has anyone else done this and had success? Could it be something server side causing the problems?

 

Thanks guys.

Link to post
Share on other sites

Use this php code for debugging

echo '<pre>';
if (move_uploaded_file($_FILES['rawData']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

Also, use fiddler to check the data you are sending to the server. It will help u to understand the error.

Link to post
Share on other sites

Fiddler captures no data from the $http upload the log is always blank.

 

And the Debugging info is always empty as seen below.

 

<pre>Here is some more debugging info:Array

(
)
Link to post
Share on other sites

OK, so basically you are not using the Upload Function Properly.  Please use the code below. You are sending wrong content type.

set(#uploadFile,$plugin function("HTTP post.dll", "$http upload", "https://httpbin.org/post", "", $plugin function("File Management.dll", "$open file dialog"), "rawData", "image/jpeg", "", "", "", 120),"Global")

Content Type:

 

JPG Image: image/jpeg

GIF Image: mage/gif

PNG Image: mage/png

TEXT File: text/plain

CSV File: text/csv
JSON File: application/json
HTML File: text/html
XML File: 
application/xml

Link to post
Share on other sites

Still does not work. Nothing uploaded via $http upload gets accepted or has any data in the $_FILES array. I have sent Aymen a support ticket and sent him the link to this topic. Maybe he will be able to help.

 

If I use a simple html page to post files to the php script everything works fine. Its just that any data sent via $http upload is just empty. Below is the simple html code to send files. 

<!DOCTYPE html>
<html>
<body>

<form action="upload.php" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="rawData" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>

</body>
</html>

I tried the $http upload code with the following content types

 

"application/vnd.ms-excel"

"text/csv"

"multipart/form-data"

and

"image/jpeg" when trying to upload a jpg instead.

 

Full php script that accepts the files with debuging is below 

<?php
$uploaddir = realpath('./') . '/uploads/';
$uploadfile = $uploaddir . basename($_FILES['rawData']['name']);
echo '<pre>';
	print_r($uploaddir);
	echo "\n<hr />\n";
	print_r($uploadfile);
	echo "\n<hr />\n";
	if (move_uploaded_file($_FILES['rawData']['tmp_name'], $uploadfile)) {
	    echo "File is valid, and was successfully uploaded.\n";
	} else {
	    echo "Possible file upload attack!\n";
	}
	echo "\n<hr />\n";
	echo 'Here is some more debugging info:';
	print_r($_FILES);
	echo "\n<hr />\n";
	print_r($_POST);
        print "</pr" . "e>\n";
?>
Link to post
Share on other sites

Well Aymen sent me a screen cast of him using my exact code and everything worked fine. I can only assume at this point that I might have some sort of conflict with my setup in general that breaks it. So if anyone else wants working code to do this its in this topic.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...