Skip to content

Instantly share code, notes, and snippets.

@will3942
Last active July 20, 2022 00:53
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save will3942/8113903 to your computer and use it in GitHub Desktop.
Save will3942/8113903 to your computer and use it in GitHub Desktop.
Reverse-Engineering Instagram
require 'openssl'
require 'base64'
require 'json'
require 'httpclient'
http = HTTPClient.new(:agent_name => useragent)
key = "" #The Private key
login_info = {:guid => "00000000-0000-0000-0000-000000000000",
:password => "PASSWORD",
:username => "USERNAME",
:device_id => "android-0000000000000000",
:_csrftoken => "missing"
}.to_json
signed_body = "#{Digest::HMAC.hexdigest(login_info, key, Digest::SHA256)}.#{login_info}"
post_data = {:signed_body => signed_body, :ig_sig_key_version => 4}
result = http.post("https://instagram.com/api/v1/accounts/login/", post_data, "Content-Type" => "application/json")
p result.body
const-string v5, "LOGGING"
invoke-static {v5, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
@eliasbagley
Copy link

Key for Instagram 9.6.0:
19054fe6bacb4e68bb243d12a6879941be86aeb672b0a7f79f1db8573957035d

and this worked for me to get the correct hash for following users, in bash:
JSON={"_csrftoken":"xxx","user_id":"xxx","_uid":"xxx","_uuid":"xxx"}
Put in whatever values are yours, from sniffing the API

alias urlencode='python -c "import sys, urllib as ul; \
    print ul.quote_plus(sys.argv[1])"'

SIGNED_BODY=$(echo -n $JSON | openssl dgst -sha256 -hmac $KEY).$(urlencode $JSON)"&ig_sig_key_version=4"

@drawrowfly
Copy link

Was anyone able to extract key from 10.0.1 ?

@drawrowfly
Copy link

Never mind just did it my self

@Mariusio
Copy link

Mariusio commented Dec 9, 2016

@glazkoman can you post it? Also, do you have a working example to post images?

@Trewqa
Copy link

Trewqa commented Dec 25, 2016

@Maarius Did you get it?

@Coldz0
Copy link

Coldz0 commented Feb 9, 2017

Anyone got the key for instagram 10.x ? Thanks in advance

@TonyDaniels
Copy link

Anyone have the key?

@wondersoftwares671
Copy link

Anyone found key for 10.9 or later? If anyone has, Please give me i need it.

@alitoufighi
Copy link

This is what Instagram-API by mgp25 used (it works):
0443b39a54b05f064a4917a3d1da4d6524a3fb0878eacabf1424515051674daa

@remon
Copy link

remon commented Nov 29, 2017

not working anymore , does anyone still working with him this method ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment