Jump to content

send data from pineapple to host trough socket


TheB

Recommended Posts

Hi all,

I'm pulling my hair out to get this working, it's probably something obvious im missing.. So i could use some extra eyes!

I'm trying to send data from the urlsnarf infusion to an application running on the host machine. The application is made in Open Frameworks and listens to udp data on port 11999. I've copied and altered the urlsnarf infusion to properly work besides the original without conflicting. Now where i'm getting stuck at is creating the connection.

$socket = stream_socket_server("udp://172.16.42.42:11999", $errno, $errstr);
			
if (!$socket) {
     echo "Goddamn no socket! at $connection $errno, $errstr  \n";
} else {
     echo "Socket created $connection \n";
}

stream_socket_sendto($socket, $input);

The error i get is the following: $errorno = 0 and $errstr = Cannot assign requested address

I tried multiple addresses to send the data to, but every adres i try get's the same error.

What i tried is 172.16.42.42, 10.211.55.2 (the ip of network interface 1 of my virtual machine), 10.37.129.2 (interface 2).

I have the application running inside the virtual machine (Ubuntu) my Pineapple get's it's internet from the virtual machine.

Many thanks!

Edited by TheB
Link to comment
Share on other sites

I am assuming that the server it running on your host machine and that the client is running on your pineapple correct? I also assume that the above code is running on your pineapple?

If my assumptions are correct, your issue is that you need a stream_socket_client not stream_socket_server

http://php.net/manual/en/function.stream-socket-client.php

You can use netcat as your server and you want even have to write any code.

If my assumptions above are incorrect then i point you to the stream_socket_server documentation: http://php.net/manual/en/function.stream-socket-server.php

Link to comment
Share on other sites

In a client-server model the server is the one at accepts connections and the client is the one that initially creates them. After the connection is created they can both send and receive data to and from each other.

Happy I could help!

Link to comment
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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...