GithubHelp home page GithubHelp logo

Comments (13)

b31ngd3v avatar b31ngd3v commented on May 26, 2024

Still working for me, can you give me more details about the error (like the line number) ?

image

from myigbot.

asarra avatar asarra commented on May 26, 2024

Sure.
Traceback (most recent call last):
File "c:\Users\name\Desktop\Youtube script\instagram3.py", line 11, in
bot = ig("name", "pw", proxy=proxies)
File "c:\languages\lib\site-packages\myigbot_init_.py", line 61, in init
self.csrf_token = cookie_jar['csrftoken']
KeyError: 'csrftoken'

from myigbot.

asarra avatar asarra commented on May 26, 2024

Btw. I shortened MyIGBot to ig.
"from myigbot import MyIGBot as ig"

from myigbot.

asarra avatar asarra commented on May 26, 2024

I put a print(json_data) in the init() of MyIGBot and I am getting this:

{'message': '', 'two_factor_required': True, 'two_factor_info': {'username': 'Something', 'sms_two_factor_on': False, 'totp_two_factor_on': True, 'obfuscated_phone_number': '', 'two_factor_identifier': 'Something', 'show_messenger_code_option': False, 'show_new_login_screen': True, 'show_trusted_device_option': True, 'should_opt_in_trusted_device_option': True, 'pending_trusted_notification': False, 'sms_not_allowed_reason': None, 'phone_verification_settings': {'max_sms_count': 2, 'resend_sms_delay_sec': 60, 'robocall_count_down_time_sec': 30, 'robocall_after_max_sms': True}}, 'phone_verification_settings': {'max_sms_count': 2, 'resend_sms_delay_sec': 60, 'robocall_count_down_time_sec': 30, 'robocall_after_max_sms': True}, 'status': 'fail', 'error_type': 'two_factor_required'}

Seems like it wants me to use two factor auth., but in the init() it does that process later when it is already too late.

from myigbot.

b31ngd3v avatar b31ngd3v commented on May 26, 2024

Sure.
Traceback (most recent call last):
File "c:\Users\name\Desktop\Youtube script\instagram3.py", line 11, in
bot = ig("name", "pw", proxy=proxies)
File "c:\languages\lib\site-packages\myigbot__init__.py", line 61, in init
self.csrf_token = cookie_jar['csrftoken']
KeyError: 'csrftoken'

I just updated the repo (not the package) can you clone this again and try?

from myigbot.

asarra avatar asarra commented on May 26, 2024

Sure.
Here's the traceback:
File "c:\languages\lib\site-packages\myigbot_init_.py", line 181, in init
self.sessionid = login_response.headers['Set-Cookie'].split('sessionid=')[1].split(';')[0]
IndexError: list index out of range

from myigbot.

asarra avatar asarra commented on May 26, 2024

I printed login_response.headers['Set-Cookie'] and this was the ouput:

csrftoken=""; Domain=instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=i.instagram.com; expires=Thu, 01-Jan-1970
00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/

There is no sessionid anywhere. Thus it cannot be splitted.

from myigbot.

asarra avatar asarra commented on May 26, 2024

Ok, I have found more information now.
It goes the two factor required way, BUT it stops and skips when it tries to assign the cookie_jar elements to the class attributes.
Which means that the cookie_jar is still empty and we're back where we started :D

        try:
            if json_data["two_factor_required"]:

                self.ig_nrcb = cookie_jar['ig_nrcb']
                self.ig_did = cookie_jar['ig_did']
                self.mid = cookie_jar['mid']

from myigbot.

asarra avatar asarra commented on May 26, 2024

This one is a bit off-topic, but might be related.

Inside MyIGBot we have:
payload = {
'username': self.username,
'enc_password': f'#PWD_INSTAGRAM_BROWSER:0:{time_now}:{self.password}',
'queryParams': {},
'optIntoOneTap': 'false'
}

self.password is the password itself without going through an encryption process.
I was analyzing the Instagram traffic with Fiddler and found that enc_password was encrypted with aes 256.

Here they're going more in-depth about it:
https://stackoverflow.com/questions/62076725/instagram-enc-password-generation

from myigbot.

asarra avatar asarra commented on May 26, 2024

Turns out, it was not off-topic, but important for it to work lol.

I modified your code and took the encrypted password and put into payload's enc_param as self.password.

Now I am getting:
[✗] Login Failed! {"user": true, "authenticated": false, "status": "ok"}

At least some progress

from myigbot.

asarra avatar asarra commented on May 26, 2024

I have some positive news again. I have been trying to shrink the request from the analyzing tool. The following code gives me a new csrftoken, id_did and mid!

import requests
link = 'https://www.instagram.com/'

headers = {
"User-Agent": "",
"Cookie": 'ig_cb=2',
}

response = requests.get(link, headers=headers)
print(response.cookies)

from myigbot.

m2083902 avatar m2083902 commented on May 26, 2024

from myigbot.

asarra avatar asarra commented on May 26, 2024

Ok, I have solved it and optimised the code on the way.
I will make a pull request once I am done integrating it to my main bot and look at the differences between mine and your version.
Btw. "self.ig_nrcb = cookie_jar['ig_nrcb']" is not needed. Not sure why it is in there.

from myigbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.