Skip to content

Instantly share code, notes, and snippets.

@vsec7
Created January 7, 2020 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsec7/5f88654f0d74a49a3fb5649699cab7ce to your computer and use it in GitHub Desktop.
Save vsec7/5f88654f0d74a49a3fb5649699cab7ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# by : sec7or
base="https://www.instagram.com"
ua="Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36"
# login $user $pass
login(){
csrf=$(curl -Is "$base/accounts/login/" | grep -oP 'csrftoken=\K[^;]+')
curl -s -c "cookie.txt" "$base/accounts/login/ajax/" \
-H "user-agent: $ua" \
-H "x-csrftoken: $csrf" \
-H 'content-type: application/x-www-form-urlencoded' \
--data "username=$1&password=$2&queryParams=%7B%7D&optIntoOneTap=false" \
--compressed
}
login "username" "password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment