Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--resolve not working? #37

Closed
peterthehan opened this issue Apr 11, 2017 · 14 comments
Closed

--resolve not working? #37

peterthehan opened this issue Apr 11, 2017 · 14 comments

Comments

@peterthehan
Copy link

peterthehan commented Apr 11, 2017

--resolve seems to get stuck after entering your email. The password prompt ("Facebook password:") does not display at all and I'm forced to end the process.

What I'm trying to do is "fbcap ./messages.htm -f json --resolve > messages.json" and I'm on version 0.9.post3.

@ownaginatious
Copy link
Owner

I'm not able to reproduce your issue. What operating system and Python version are you using?

@peterthehan
Copy link
Author

Windows 10 and Python 3.5.2.

@ownaginatious
Copy link
Owner

I'll try to investigate, but it'll take a while given that I don't really have any Windows machines/VMs on hand.

@ownaginatious
Copy link
Owner

I believe I've fixed the issue under Windows. Please try version 0.9.post4. Thanks!

@peterthehan
Copy link
Author

peterthehan commented Apr 11, 2017

Thanks for the quick patch, appreciate the effort.

The password prompt now appears but the next issue is that it freezes after entering my credentials. I thought maybe it had to do with my 2FA or Code Generator being enabled but no cigar even after disabling those security features.

I'll check if maybe it has to do with my privacy settings and report back.

@ownaginatious
Copy link
Owner

Does this happen even when not redirecting to a file?

@peterthehan
Copy link
Author

peterthehan commented Apr 11, 2017

Yeah, it still freezes after entering credentials with or without redirecting to file.

I added some print statements in main.py:

    sys.stderr.write("Facebook password: ")
    print('a')
    sys.stderr.flush()
    print('b')
    password = getpass.getpass("")
    print('c')
    name_resolver = FacebookNameResolver(email, password)
    print('d')

and getpass.getpass("") never seems to return (c and d are not printed). I'm unsure what getpass is all about but I hope that info might help you. My terminal output looks like:

$ fbcap ./messages.htm -f json --resolve
Facebook username/email: email@email.com
Facebook password: a
b
mypassword

@ownaginatious
Copy link
Owner

Hmm, getpass.getpass("") should basically just capture input from the keyboard, but not display it in the terminal while you type it. The argument "" is the prompt text to the user. Windows apparently has a dumb issue where it won't print this prompt to stderr and instead to stdout, which ends up going into your file instead. That was the issue you were experiencing when you opened this ticket.

I fixed that issue by manually writing the prompt to stderr and making the getpass prompt empty.

When you get to that line, you're supposed to copy-paste/type your password and hit enter in the terminal. Is it still freezing even after doing that?

@peterthehan
Copy link
Author

peterthehan commented Apr 11, 2017

Yeah, my cursor just blinks on the next line after entering password. And actually, my password is echoed back in terminal which doesn't seem right.

Peter@Peter MINGW64 ~/Dropbox/asdf
$ fbcap ./messages.htm -f json --resolve
Facebook username/email: email@email.com
Facebook password: mypassword

What displays after I end process:

Peter@Peter MINGW64 ~/Dropbox/asdf
$ mypassword
bash: mypassword: command not found

Peter@Peter MINGW64 ~/Dropbox/asdf
$

@peterthehan
Copy link
Author

peterthehan commented Apr 11, 2017

Kind of hacky but for the time being, I switched to using input() for password and it worked as expected.

  import platform
  
  if platform.system() == "Windows":
    password = six.moves.input()
  else:
    password = getpass.getpass("")

Also had to disable my 2FA to avoid throwing an exception and just dying (the desktop notification warning that popped up when 2FA was enabled and I tried to sign in):
chrome_2017-04-11_15-27-30

@ownaginatious
Copy link
Owner

ownaginatious commented Apr 11, 2017

Ah, thanks for trying that out 👍 I'll look further into it later to see if I can get getpass(...) to work properly.

Yeah, unfortunately there isn't an easy way around that. I listed the --resolve thing as a beta feature since it essentially just grabs a chunk of JSON floating around your Facebook friends page to map the IDs to names.

The "proper" way of doing this would be to create a Facebook app and authorize it to access your friends list. That's a lot more work and much more annoying for the end user. I was hoping the hacky --resolve feature would be a good enough holdover until Facebook finally fixes the issue on their end... if ever :(

@peterthehan
Copy link
Author

No problem and all in all thanks for the quick responses. I'll be sure to give this program another go if/when you find the workaround. Great tool!

@ownaginatious
Copy link
Owner

Super old now, but I think I was able to resolve this issue recently by doing the password prompting via a third-party library instead.

Not sure if the --resolve option is even necessary anymore, given that Facebook has randomly started supplying full names with each message again (at least for me). Anyway, if you want, you could try it out again with the latest on PyPI: 1.0

@peterthehan
Copy link
Author

Yep, I just downloaded an updated version of my Facebook data and the full names were there for me as well.

I didn't try using the --resolve option (so I wasn't able to try your updated password prompting) but it seems to be a non-issue now that Facebook's data isn't janky in the first place. Feel free to close this issue at your leisure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants