marcelja / facebook-delete

Fast facebook activity deletion
MIT License
1.28k stars 48 forks source link

Add support for 2FA #8

Open julianxhokaxhiu opened 4 years ago

julianxhokaxhiu commented 4 years ago

Hi,

thank you very much for this project. It seems your script is missing 2FA support. Would you be able to add that?

Thank you in advance, Julian

marcelja commented 4 years ago

Hi, I don't have this enabled. It would be great if you could check how the 2FA login works on https://mbasic.facebook.com/. It would be interesting whether the 2FA code is sent via a POST request.

julianxhokaxhiu commented 4 years ago

Hi, I don't have this enabled. It would be great if you could check how the 2FA login works on https://mbasic.facebook.com/. It would be interesting whether the 2FA code is sent via a POST request.

I currently found a way to accomplish the same thing on the new Facebook Layout using Javascript, but as soon as I'm done cleaning up I'll definitely try and let you know :) Cheers!

r1bnc commented 3 years ago

Perhaps add a way to use existing browser cookie to be used as login?

marcelja commented 3 years ago

Perhaps add a way to use existing browser cookie to be used as login?

I don't think that there's an easy way to get the cookie out of a browser.

julianxhokaxhiu commented 3 years ago

I forgot to reply with my approach, but for anyone curious to know, this is where you can find it: https://gist.github.com/julianxhokaxhiu/f8a2dae96cd0d29277aa5912d0a07f5f

I've used it by the time the Gist was created and it worked successfully, although it might be Facebook did change their HTML so minor adaptations might be required.

r1bnc commented 3 years ago

Perhaps add a way to use existing browser cookie to be used as login?

I don't think that there's an easy way to get the cookie out of a browser.

Theres addons/extensions that can dump the cookies off the browser.

marcelja commented 3 years ago

Perhaps add a way to use existing browser cookie to be used as login?

I don't think that there's an easy way to get the cookie out of a browser.

Theres addons/extensions that can dump the cookies off the browser.

Nice, I didn't know about that. I just tested it with this extension https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg I went to https://mbasic.facebook.com, used the extension to export the cookie in json format and changed the format to work with the persistent cookiejar.

Here's a small python script which generates the .go-cookies file.

json_to_go_cookie.py

json_string = """
PASTE_JSON_COOKIE_HERE
"""

import json

json_object = json.loads(json_string)
out_json = []
for elem in json_object:
    out_elem = {}
    for key, value in elem.items():
        out_elem[key[0].upper() + key[1:]] = value
    out_elem["Persistent"] = True
    out_elem["CanonicalHost"] = "mbasic.facebook.com"
    out_elem["Domain"] = "facebook.com"
    out_elem["Expires"] = "2099-01-30T00:00:00.000000+00:00"
    out_json.append(out_elem)
print(json.dumps(out_json).replace(' ', ''))

Paste json in the file and run this:

$ python3 json_to_go_cookie.py > ~/.go-cookies