neo-instabot icon indicating copy to clipboard operation
neo-instabot copied to clipboard

json decoder error

Open guestofhonor3000 opened this issue 4 years ago • 6 comments

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • [x] I have searched for other issues with the same problem or similar feature requests.

Select one:

  • [x ] Bug
  • [ ] Feature Request
  • [ ] Technical Help (Please don't create an issue, join the facebook group or telegram channel)
  • [ ] Other

Environment

  • [x] Are you hosting the bot on a VPS or other Cloud hosting?
  • [ ] Are you running the code on your phone
  • [x] If so, have you tried running the code on your local machine?
Include more details about the environment

Operating System? (include version)

  • [ ] macOS
  • [x] Windows
  • [ ] Rasbian Linux Raspberry PI (include flavour)
  • [x] Linux (include flavour)
  • [ ] Android (include terminal)
include the output of 'uname -a'

Linux instanceig 5.3.0-1029-gcp #31~18.04.1-Ubuntu SMP Mon Jun 22 15:24:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Python Version Requirement

  • [x] I am using Python 3.6 or above

Exact Python Version?

Include here the response of 'python --version' or 'python3 --version'

Python 3.6.9

Pip Version?

Include here the response of 'pip --version' or 'pip3 --version'

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Instabot Version?

Include here the response of 'instabot-py --version'

Installed version 0.6.0

How you use the instabot

  • [ ] instabot-py -c my-configfile.yml (my-configfile.yml is an example you may have a different file )
  • [x] instabot-py --login LOGIN --password PASSWORD
  • [ ] instabot-py
  • [ ] example.py (Deprecated, please install newer version)

Description of your issue

Include the contents of the error.log here (if applicable). < REPLACE THIS TEXT

Config

Ensure that you specify the configuration file in the command line.
Ensure that the default file instabot.config.yml contains only common settings if you use multiple accounts.
Include the contents of your config here (instabot-py -c config.yml --dump) (REMOVE YOUR USERNAME AND PASSWORD!) (if applicable). < REPLACE THIS TEXT

Traceback (most recent call last): File "/home/puscasu_and/.local/bin/neo-instabot", line 11, in sys.exit(main()) File "/home/puscasu_and/.local/lib/python3.6/site-packages/instabot/main.py", line 330, in main bot = InstaBot(config=config) File "/home/puscasu_and/.local/lib/python3.6/site-packages/instabot/bot.py", line 198, in init self.login() File "/home/puscasu_and/.local/lib/python3.6/site-packages/instabot/bot.py", line 301, in login loginResponse = login.json() File "/home/puscasu_and/.local/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.6/json/init.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

guestofhonor3000 avatar Jul 02 '20 19:07 guestofhonor3000

It seems that Instagram changed their login request method..

In the past it was a json containing user and password..

Now it's a form_data and the password goes in a variable "enc_password". It looks like it had some kind of a encryption on it: enc_password: #PWD_INSTAGRAM_BROWSER:10:1595532093:ASxQAHEUCEkXhA/kAjPsp3blL5vYRG+HaY+9MSPe4ISIvHlrbUDLo7s5I50eDVf1+ioOVp1aPuBSY7QWlowgYP+Wr0PcWmkNlpO58qHj/PonaYV5xiX6lOW01x5ZXqAyVS00WWOPT/tRjpS4ACY=

:(

marcelofox avatar Jul 23 '20 13:07 marcelofox

There appears to be a change in the sent authentication request. Instagram is now using the password string in the "enc_password" key. The encryption is evp_aes_256_gcm. Someone has to write a method to generate the enc_password string

v0lumehi avatar Jul 23 '20 22:07 v0lumehi

I'm trying to implements the encryptation algorithm. I'm struggling with the AES GMC python implementation .. cause if you see how instagram implemented their encryption , it's something like this:

A.subtle.encrypt(p, t, h.buffer);

Where:

p = { "additionalData":"1596161418", "name":AES-GMC", "tagLen":16 }

t= Instance of CriptoKey

h= byte array of your password.

In Python the package Crypto.Cipher has and implementation of AES-GMC.. but there's no way to pass the additionalData do the encrypt_and_digest method.

Checking the javascript documentation : https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams

additionalData Optional A BufferSource. This contains additional data that will not be encrypted but will be authenticated along with the encrypted data. If additionalData is given here then the same data must be given in the corresponding call to decrypt(): if the data given to the decrypt() call does not match the original data, the decryption will throw an exception. This gives you a way to authenticate associated data without having to encrypt it.

Even though it's not used in the encryption, it's used with the autentication of the data .. so I'm trying to find a implementation in Python that provides additionalData as part of the encryption.

marcelofox avatar Jul 31 '20 02:07 marcelofox

Having the same login error... Tried different bots with different accounts. It's always the same:

loginResponse = login.json() File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

sohartma avatar Aug 12 '20 13:08 sohartma

just got the same error. is it fixable ?

kevinours avatar Oct 01 '20 17:10 kevinours

same error here, any solution?

stefanoregis avatar Oct 19 '20 07:10 stefanoregis