Unix/Linux Go Back    


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)

Shell Programming and Scripting


Tags
shell script

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-27-2011   -   Original Discussion by ajaypadvi
ajaypadvi ajaypadvi is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 27 July 2011, 6:41 AM EDT
Posts: 22
Thanks: 6
Thanked 0 Times in 0 Posts
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..Linux

Last edited by radoulov; 07-27-2011 at 06:55 AM.. Reason: Code tags.
Sponsored Links
    #2  
Old Unix and Linux 07-27-2011   -   Original Discussion by ajaypadvi
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
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 Unix and Linux 07-27-2011   -   Original Discussion by ajaypadvi
ajaypadvi ajaypadvi is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 27 July 2011, 6:41 AM EDT
Posts: 22
Thanks: 6
Thanked 0 Times in 0 Posts
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 08:39 AM..
    #4  
Old Unix and Linux 07-27-2011   -   Original Discussion by ajaypadvi
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
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
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 08:00 AM
Please help me to install netcat on solaris praset Solaris 2 01-08-2011 04:05 PM
netcat MartyIX Shell Programming and Scripting 6 08-22-2008 08:29 AM
Netcat with Authentication? pileofrogs UNIX for Advanced & Expert Users 1 12-04-2006 10:48 AM
netcat like file transfer linuxdba Programming 2 04-28-2005 07:10 AM



All times are GMT -4. The time now is 05:05 AM.