How To: Web stuff

Manage a website using git

  • Create a local repo on your workstation:
$ git init
$ git add index.html
$ git commit
  • SSH into the server and create the remote repo:
$ mkdir website.git
$ cd website.git
$ git init --bare
  • Create a post-receive hook (hooks/post-receive) that automatically updates the server’s DocumentRoot:
$ vim hooks/post-receive

#!/bin/sh
GIT_WORK_TREE=/var/www/www.mywebsite.com git checkout -f

$ chmod +x hooks/post-receive
  • On your workstation, add the remote repo as a “remote”:
$ git remote add website ssh://www.mywebsite.com/home/.../website.git
$ git push website +master:refs/heads/master
  • Afterwards, any further changes can be pushed with the usual git push

Miscellaneous

  • Send a POST request using curl:
curl -d "var1=value&var2=value2" -X POST "https://..."
  • Use POST parameters from a file:
curl "https://..." -X POST -d @myfile.txt
  • Use sqlmap for basic pentesting:
python .\sqlmap.py -u "https://.../?var1=value1&var2=value2" -p "var1,var2"
python .\sqlmap.py -u "https://.../" --data "var1=value1" -p "var1" --method POST