Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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