Skip to content

Instantly share code, notes, and snippets.

@vic4key
Forked from silverwolfceh/fbshield.py
Created September 4, 2018 15:03
Show Gist options
  • Save vic4key/1d308f326208605753ccc1d874e9e551 to your computer and use it in GitHub Desktop.
Save vic4key/1d308f326208605753ccc1d874e9e551 to your computer and use it in GitHub Desktop.
Turn on or off facebook shield (profile picture guard)
import requests
import json
USER_TOKEN = "" #Fill your fb user token (open https://facebook.com/me, ctrl +u and copy access token
SHIELD_ENABLE = "true" #Change to false if turn off shield
def get_userid(token):
url = "https://graph.facebook.com/me?access_token=%s" % token
res = requests.get(url)
info = json.loads(res.text)
return info["id"]
def turn_shield(token, enable = True):
uid = get_userid(token)
data = 'variables={"0":{"is_shielded": %s,"session_id":"9b78191c-84fd-4ab6-b0aa-19b39f04a6bc","actor_id":"%s","client_mutation_id":"b0316dd6-3fd6-4beb-aed4-bb29c5dc64b0"}}&method=post&doc_id=1477043292367183&query_name=IsShieldedSetMutation&strip_defaults=true&strip_nulls=true&locale=en_US&client_country_code=US&fb_api_req_friendly_name=IsShieldedSetMutation&fb_api_caller_class=IsShieldedSetMutation' % (enable, str(uid))
headers = {"Content-Type" : "application/x-www-form-urlencoded", "Authorization" : "OAuth %s" % token}
url = "https://graph.facebook.com/graphql"
res = requests.post(url, data = data, headers = headers)
print(res.text)
turn_shield(USER_TOKEN, SHIELD_ENABLE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment