Skip to content

Instantly share code, notes, and snippets.

@cmlh
Forked from glennzw/getFBProfilePhoto.py
Created April 19, 2018 06:09
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 cmlh/f2f316dcc48e36ae5c2d6dc0ad01cd0d to your computer and use it in GitHub Desktop.
Save cmlh/f2f316dcc48e36ae5c2d6dc0ad01cd0d to your computer and use it in GitHub Desktop.
Hack to allow us to load icon images in Maltego by following the redirect and serving up the actual image.
#!/usr/env/python
# -*- coding: utf-8 -*-
# Hack to allow us to load icon images in Maltego by following
# the redirect and serving up the actual image.
from flask import Flask, send_file
import requests
app = Flask(__name__)
@app.route('/fb/pic/<id>')
def getPicURL(id):
"Pass Facebook ID, get profile photo"
r = requests.get("https://graph.facebook.com/%s/picture" % id)
url = r.url
response = requests.get(url, stream=True)
return send_file(response.raw, mimetype='image/gif')
return response.raw
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment