Nmap Development mailing list archives

Re: Using ncat to read TCP stream --> send HTTP GET request


From: Brian Elias <brianelias433 () comcast net>
Date: Wed, 18 May 2011 09:35:05 -0400

Marek, et al.,

Thanks for the quick response on this.  I tried your suggestion, however the
client still sees the "socket closed" message from the server.  Socat does
not reopen the connection itself, instead requiring the client to do this
(which unfortunately it is not able to).

I'm thinking that I need an intermediary server that would operate as:

                TCP String (HTTP GET)                                   TCP
String (HTTP GET)
Client    ------------------------------------------>    Server #1
--------------------------------------->       Server #2
                 Socket Always Open
Socket Closed at EOF


Note:  Bi-directional communication is NOT required; the HTTP GET only
functions to set a flag on Server #2.

The actual use of this is to transmit motion alarms from a video-analytics
server to a security system.  The potential exists for up to 1 transmission
per second (although this may occur for only one or two "bursts" per day).



Any help would be greatly appreciated.


Thanks,


- Brian




On Mon, May 16, 2011 at 8:38 AM, Marek Lukaszuk <m.lukaszuk () gmail com>wrote:

On Mon, May 16, 2011 at 14:12, Elias Home <brianelias433 () comcast net>
wrote:

Hello,

I'm attempting to get two devices to communicate with each other on my
network.  The first device (sender) is able to send plain text via TCP to an
IPAddress:Port when an event occurs.  The second device (receiver) is
triggered by receiving an HTTP GET request; it then closes the socket as it
should.  The problem is that the transmitter does not expect the socket to
be closed after the string is sent - it is designed to send to a simple
"open TCP port" that just monitors for TCP plain text traffic and doesn't
respond (and certainly doesn't close the socket).

I am able to send the following from the transmitter via TCP:  GET
/rest/programs/0071/runThe n HTTP/1.1[CRLF]Authorizatio n: Basic
xxxxxxxxxx[CRLF][CRLF]

This works perfectly, however the HTTP server (receiver) replies with a
200 and then closes the socket.  The transmitter doesn't know how to hand
this, and nothing works until I reset the socket connection.


Try socat, binaries for windows should be in cygwin:
http://www.dest-unreach.org/socat/

the command line should look like this:
socat TCP-LISTEN:80,reuseaddr=1,fork=1
TCP-CONNECT:address_of_the_HTTP_server:80

Documentation:
http://www.dest-unreach.org/socat/doc/socat.html

Hope this helps,
Marek

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: