Show Password


Netcat ( nc -l ) as webserver

Emergency UNIX and Linux Support

Kindly Note - This is a Single User Post by Forum Member chakrapani Regarding:
Netcat ( nc -l ) as webserver.
Please Follow The Primary Link Above to View the Full Discussion.

Old 12-14-2016
chakrapani's Unix or Linux Image
chakrapani chakrapani is offline
Registered User
Join Date: Sep 2009
Last Activity: 10 January 2017, 8:11 AM EST
Location: America
Posts: 207
Thanks: 0
Thanked 8 Times in 7 Posts
Lightbulb Netcat ( nc -l ) as webserver

Dear Linux guru's

I am trying to create a webserver using nc (netcat only) on RHEL 7.2 running on bash shell.

now the easy thing is to get nc listing to a port and respond back

$ while true; do { echo -e 'HTTP/1.0 200 OK\r\n'; set; } | nc -l 7877; done

This when called from a browser: http://My-server:7877 I get my env variables. Works perfect !! Love it

Now when I try http://My-server:7877?asd=1&something=2&other=hello

I was hopping to get QUERY_STRING env variable with all the values sent via browser GET method ! . However the env variable is not set. There is not variable set with these values.


GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)

Ncat: Version 6.40 ( Ncat - Netcat for the 21st Century )

Red Hat Enterprise Linux Server release 7.2

Dont want to use anything other than nc. Cannot install any tool or webserver or binaries. Please dont suggest that

And thanks all for reading my question .

Last edited by rbatte1; 12-15-2016 at 06:09 AM.. Reason: Changed ICODE tags to CODE tags