Datalux / Osintgram

Osintgram is a OSINT tool on Instagram. It offers an interactive shell to perform analysis on Instagram account of any users by its nickname
GNU General Public License v3.0
9.15k stars 1.98k forks source link

Instagram Blocking Requests [SOLVED] #657

Open adyrol opened 1 year ago

adyrol commented 1 year ago

Osintgram.txt I came across an issue where my sessions were being closed out when I try to get a large amount of target followers/emails/phone numbers. I'm sure a lot of people experienced this too so I took a look at the source code

in src/Osintgram.py line 331 for get_followers:

    while next_max_id:

        sys.stdout.write("\rCatched %i followers" % len(_followers))
        sys.stdout.flush()
        results = self.api.user_followers(str(self.target_id), rank_token=rank_token, max_id=next_max_id)
        _followers.extend(results.get('users', []))
        next_max_id = results.get('next_max_id')

So I imported the time and random libraries to create pauses between scrapes (if you're familiar with nmap it's the same idea as scan delay).

    counter = 0

    while next_max_id:

       # Sleeps between Scrapes
       counter += 1
       if counter == 3: 
           min_sleep = 5 * 60
           max_sleep = 15 * 60
           time.sleep(random.randrange(min_sleep,max_sleep))
           counter = 0

        # And I Added a limiter for some bigger accounts I came across
        if len(_followers) > 20000:
            break

        sys.stdout.write("\rCatched %i followers" % len(_followers))
        sys.stdout.flush()
        results = self.api.user_followers(str(self.target_id), rank_token=rank_token, max_id=next_max_id)
        _followers.extend(results.get('users', []))
        next_max_id = results.get('next_max_id')

Around lines 1577 in get_fwersnumber it's the same concept just changing a few variables around

        counter = 0

        for follow in followings:

            #counter and sleep
            counter += 1
            if counter == 4:
                time.sleep(70)
                counter = 0
            if len(results) > 1500:
                break

            sys.stdout.write("\rCatched %i followers phone numbers" % len(results))
            sys.stdout.flush()
            user = self.api.user_info(str(follow['id']))
            if 'contact_phone_number' in user['user'] and user['user']['contact_phone_number']:
                follow['contact_phone_number'] = user['user']['contact_phone_number']
                if len(results) > value:
                    break
                results.append(follow)
djukavrabac commented 1 year ago

@adyrol Ur code seems not to work to me, displaying "counter = 0 indentationerror: unexpected indent"

djukavrabac commented 1 year ago

Or can u myb paste here whole file so i can copy & paste it into my src

adyrol commented 1 year ago

@djukavrabac okay I have it up - just rename the filetype from .txt to .py

djukavrabac commented 1 year ago

Ty mate. But not happening anything cuz i have problem with the request i posted on my issue.

shanow7 commented 1 year ago

I have the same problem when I try to get a small number of targeted followers/emails/phone calls and an instagram account lockout occurs

Run a command: fwersemail Searching for emails of target followers... this can take a few minutes Catched 200 followers email

Do you want to get all emails? y/n: n How many emails do you want to get? 30 Traceback (most recent call last): File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/client.py", line 523, in _call_api response = self.opener.open(req, timeout=self.timeout) File "/usr/lib/python3.10/urllib/request.py", line 525, in open response = meth(req, response) File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response response = self.parent.error( File "/usr/lib/python3.10/urllib/request.py", line 563, in error return self._call_chain(args) File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(args) File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 401: Unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/csi/Desktop/Osint/Osintgram/main.py", line 186, in _cmd() File "/home/csi/Desktop/Osint/Osintgram/src/Osintgram.py", line 1238, in get_fwersemail user = self.api.user_info(str(follow['id'])) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/endpoints/users.py", line 17, in user_info res = self._call_api('users/{user_id!s}/info/'.format(**{'user_id': user_id})) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/client.py", line 527, in _call_api ErrorHandler.process(e, error_response) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/errors.py", line 135, in process raise ClientError(error_msg, http_error.code, error_response) instagram_private_api.errors.ClientError: Unauthorized: Please wait a few minutes before you try again.

djukavrabac commented 1 year ago

Well same happened to me. So this isn't sloved. @Datalux need to fix this. I can't even catch user with only 200+ or 300+ their numbers, emails. That's sad.

1qaz0okm commented 1 year ago

I'm getting the same instagram_private_api error and none of my scrapes work at all. Osintgram has been totally useless can't scrape anything

Kadaber commented 1 year ago

Same error here. Osintgram can't scrape anything.