Created
November 13, 2019 06:13
-
-
Save armandomiani/ac8c8a17b29961ef6178d9ee27e9eaa7 to your computer and use it in GitHub Desktop.
Revisions
-
armandomiani created this gist
Nov 13, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ apt-get install -y jq https://gist.github.com/subfuzion/08c5d85437d5d4f00e58 # Test 301 and redirection curl -L -I -s http://localhost | grep -E "^HTTP/1.1 301|^Location: .*/Main_Page.*$" # api test LOGIN_TOKEN=$(curl "http://localhost/api.php?action=query&meta=tokens&format=json&type=login" | jq -r '.query.tokens.logintoken') CSRF_TOKEN=$(curl "http://localhost/api.php?action=query&meta=tokens&format=json | jq -r '' ACCESS_TOKEN=$(curl -X POST "http://localhost/api.php?action=login&lgname=Admin&format=json" -d "lgpassword=mediawiki1234&lgtoken=${LOGIN_TOKEN}" | jq -r '.login.token') curl "http://localhost/api.php?action=query&list=allpages&format=json" | jq -r '.query.allpages[0].title' curl -X POST "http://localhost/api.php?action=edit&format=json&title=Main_Page&appendtext=Hello" -d "token=${ACCESS_TOKEN}"