Login using curl command-line simulation WordPress

WordPress default login page: http://192.168.0.120/wordpress/wp-login.php

1, Chrome browser F12 , enter a wrong password, click Login:

image.png

Remove " log = the root & pwd = the root @ 123 & WP-Submit =% E7% 99% BB% E5% the BD% 95 & the redirect_to = HTTP%. 3A%. 2F% 2F192.168.0.120% 2Fwordpress% 2Fwp-ADMIN%. 2F & TestCookie =. 1 ", and replaced with the correct password

2, get the cookie :

# curl -b cookies -c cookies "http://192.168.0.120/wordpress/wp-login.php" > index.html

image.png

Note: use the saved cookies file blog login

3, analog login Home:

# curl -L -b cookies -c cookies -d "log=root&pwd=root@123&wp-submit=%E7%99%BB%E5%BD%95&redirect_to=http%3A%2F%2F192.168.0.120%2Fwordpress%2Fwp-admin%2F&testcookie=1" "http://192.168.0.120/wordpress/wp-login.php" > wordpress.html

image.png

# Cp wordpress.html / var / www / html

Browser access http://192.168.0.120/wordpress.html , already logged a

image.png

Then click on the left "article":

image.png

Get "writing" link: http://192.168.0.120/wordpress/wp-admin/edit.php

4, analog Login "write articles" page:

As the "writing" function does not need to submit any arguments, so the direct use the following command:

# curl -L -b cookies -c cookies "http://192.168.0.120/wordpress/wp-admin/edit.php" > article.html

image.png

# Cp article.html / var / www / html

Browser access http://192.168.0.120/article.html , had been "writing" on page

image.png

4, Description:

(1) the cookie and the session of the differences:

Ø   the cookie and session are technical sessions, the cookie is running on the client browser, session is running on the server-side

Ø   cookie is limited in size, and the browser to store cookie number is also limited, the session is no size limits, and memory size of the server-related

Ø   cookie security risks, by intercepting or find a local cookie security risks files

Ø   session is saved on the server side, there will be some time after the disappearance, if the session too will increase the pressure on the server

(2) c url command line options used:

Ø   -b : string read from the specified file or cookie

Ø   -c : the cookie written to the specified file

Ø   -L : follow the jump

Ø   the -I : show only document information

Ø   -A : to be sent to the user agent server

image.png

image.png

Guess you like

Origin blog.51cto.com/qiuyue/2449325
Recommended