Shell Programming and Scripting

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)


👤 Login to reply

    #1  
Old 07-27-2011
ajaypadvi ajaypadvi is offline
Registered User
 
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.
Sponsored Links
    #2  
Old 07-27-2011
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
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

Sponsored Links
    #3  
Old 07-27-2011
ajaypadvi ajaypadvi is offline
Registered User
 
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
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
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.
Sponsored Links
👤 Login to reply

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
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
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 01:46 PM.

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





Not a Forum Member?
Forgot Password?