Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Post using nc(netcat)

Tags
shell script, shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 07-27-2011
Post using nc(netcat)

Hi;
I have a url like
Code:
http://localhost:8080/examples/jsp/dates/nextPageToPost.jsp?name=ajay&password=pas&sex=Male&check=on&nationality=USA&description=aa&submit=submit

in which i want to use nc for http post for parameters like "name","password"....etc
can neone please help me how to do that using nc.i have read few articles regarding that..but only thing i came to kno that i can be done using nc command.

Please help me..

Last edited by radoulov; 07-27-2011 at 05:55 AM.. Reason: Code tags.
# 2  
Old 07-27-2011
You'll have to send a HTTP POST command through netcat, eg
Code:
(echo 'POST /examples/jsp/dates/nextPageToPost.jsp HTTP/1.1'
echo 'Host: localhost'
echo 'Content-Type: application/x-www-form-urlencoded'
echo
echo 'your data url encoded' ) | nc localhost 80

# 3  
Old 07-27-2011
Hi;
after encoding my data in url format..




Code:
(echo 'POST /examples/jsp/dates/nextPageToPost.jsp HTTP/1.1'
echo 'Host: localhost'
echo 'Content-Type: application/x-www-form-urlencoded'
echo
echo 'name=ajay&password=pas&sex=Male&check=on&nationality=USA&description=aa&submit=submit' ) | nc localhost 8080



I m not recieving ne response form server..or do we have to do nething special to get the response back for nc post.

Thnks

Last edited by pludi; 07-27-2011 at 07:39 AM..
# 4  
Old 07-27-2011
Please start using [CODE] tags when posting command lines and the like.
Tying 'ne' instead of 'any' saves you exactly 1 character, while making your text much harder to read. Please use correct English if possible.
An lastly, what I posted was a quick, non-tested example to show you how this could be done, and by no means a ready, full functional script. If you want a finished script because you don't want to bother yourself, just tell us so, but then don't expect us to go head over heels for that.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Netcat ( nc -l ) as webserver chakrapani Emergency UNIX and Linux Support 3 12-15-2016 11:59 AM
Telnet vs netcat behavior ckmehta UNIX for Advanced & Expert Users 4 07-25-2014 01:52 PM
Help with Netcat MrCrumbs IP Networking 0 09-12-2012 09:30 AM
Help with sed to add delimiter to send HEX with netcat patx Shell Programming and Scripting 3 12-30-2011 10:16 AM
Thank you radoulov for your help on netcat command (nc -lp) vectrum Linux 0 07-02-2011 07:00 AM
Please help me to install netcat on solaris praset Solaris 2 01-08-2011 03:05 PM
How does netcat manage the data it transfers ? qiulang UNIX for Advanced & Expert Users 2 08-31-2009 10:25 PM
netcat MartyIX Shell Programming and Scripting 6 08-22-2008 07:29 AM
Netcat with Authentication? pileofrogs UNIX for Advanced & Expert Users 1 12-04-2006 09:48 AM
netcat like file transfer linuxdba Programming 2 04-28-2005 06:10 AM


All times are GMT -4. The time now is 07:47 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password