Skip to content

Instantly share code, notes, and snippets.

@silverwolfceh
Last active November 7, 2020 01:21
Show Gist options
  • Save silverwolfceh/ad96c0a66b2819635424bb985d0da8fe to your computer and use it in GitHub Desktop.
Save silverwolfceh/ad96c0a66b2819635424bb985d0da8fe 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)
@Tommy2003-dev
Copy link

EAAAAUaZA8jlABAFvexV1zm6RRY6piF04QKD5NVC4NQz5b7v3RZAJGIs1BDSfKaZBYRoy5zAhNeqq1lC5s0qZBkvAwO4BMrMc8D0W6Ge8Dx3R21gTWSzqs4sbuu5coiOKyztZBVNuLfZC2M8UXvKqwNo2hG0Qp8xCJfirusRQtguues2symjPfl

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