Summary of Kali curl command

Time:2020-11-26

brief introduction

curlIs a command-line tool, the role is to issue network requests, and then get and extract data, displayed in the “stdout” above.

It supports multiple protocols

View the source code of the webpage

Add the URL directly after the curl command, you can see the source of the web page.

$ curl www.sina.com

Display header information

-iParameter can display the header information of HTTP response together with the web page code

$ curl -i www.sina.com

-IThe parameter displays only the header information of HTTP response

Display communication process

-vParameters can display the whole process of an HTTP communication, including port connection and HTTP request header information.

$ curl -v www.sina.com

See more detailed communication process: $curl — trace output.txt www.sina.com Or $curl — trace ASCII output.txt www.sina.com

After running, open output.txt File view

Send form information

There are two ways to send form information: get and post. The get method is relatively simple, as long as the data is attached to the web address

$ curl example.com/form.cgi?data=xxx

The post method must separate the data from the web address, and curl uses the — data parameter

$ curl -d “param1=value1&m2=value2” “http://www.baidu.com

Or useWGet command

wget –post-data “user=foo&password=bar” http://www.baidu.com

Add header information

Sometimes you need to add a header in HTTP request.--headerParameters can do this.

$ curl –header “Content-Type:application/json” http://example.com

$ curl –local-port 51 http://web.jarvisoj.com:32770/Use port 51 to access this website locally