Projects STRLCPY Osintgram Commits d7277d44
🤬
  • ■ ■ ■ ■ ■ ■
    src/commands/whotagged/config.yaml
     1 +---
     2 +name: "whotagged"
     3 +description: "Get a list of user who tagged target"
     4 +commands:
     5 + - run
     6 +options:
     7 + output_limit: 0
     8 + delay: 0
     9 +
  • ■ ■ ■ ■ ■ ■
    src/commands/whotagged/run.py
     1 +import yaml
     2 +import readline
     3 +import signal
     4 +from prettytable import PrettyTable
     5 +from src import printcolors as pc
     6 +from src import utils as utils
     7 +import json
     8 +import sys
     9 +import time
     10 + 
     11 +from src.CommandFather import CommandFather
     12 + 
     13 + 
     14 +class Command(CommandFather):
     15 + 
     16 + def __init__(self, status, api):
     17 + super().__init__(status)
     18 + self.status = status
     19 + self.osintgram = api
     20 + 
     21 + def run(self):
     22 + if self.osintgram.check_private_profile():
     23 + return
     24 + 
     25 + pc.printout("Searching for users who tagged target...\n")
     26 + 
     27 + posts = []
     28 + rank_token = self.osintgram.generate_uuid()
     29 + data = self.osintgram.get_api().usertag_feed(str(self.osintgram.target_id), rank_token=rank_token)
     30 + posts.extend(data.get('items', []))
     31 + 
     32 + next_max_id = data.get('next_max_id')
     33 + while next_max_id:
     34 + if(int(super().get_option('output_limit')) > 0 and len(posts) > int(super().get_option('output_limit'))):
     35 + break
     36 + 
     37 + if(int(super().get_option('delay')) > 0):
     38 + time.sleep(int(super().get_option('delay')))
     39 + 
     40 + sys.stdout.write("\rCatched %i posts" % len(posts))
     41 + sys.stdout.flush()
     42 + results = self.osintgram.get_api().usertag_feed(str(self.osintgram.target_id), max_id=next_max_id, rank_token=rank_token)
     43 + posts.extend(results.get('items', []))
     44 + next_max_id = results.get('next_max_id')
     45 + sys.stdout.write("\rCatched %i posts\n" % len(posts))
     46 + sys.stdout.flush()
     47 + 
     48 + if len(posts) > 0:
     49 + users = []
     50 + 
     51 + for post in posts:
     52 + if(int(super().get_option('output_limit')) > 0 and len(users) > int(super().get_option('output_limit'))):
     53 + break
     54 + 
     55 + if not any(u['id'] == post['user']['pk'] for u in users):
     56 + user = {
     57 + 'id': post['user']['pk'],
     58 + 'username': post['user']['username'],
     59 + 'full_name': post['user']['full_name'],
     60 + 'counter': 1
     61 + }
     62 + users.append(user)
     63 + else:
     64 + for user in users:
     65 + if user['id'] == post['user']['pk']:
     66 + user['counter'] += 1
     67 + break
     68 + 
     69 + ssort = sorted(users, key=lambda value: value['counter'], reverse=True)
     70 + self.status.print_output(ssort, ['Photos', 'ID', 'Username', 'Full Name'], ['counter', 'id', 'username', 'full_name'])
     71 + else:
     72 + pc.printout("Sorry! No results found :-(\n", pc.RED)
  • ■ ■ ■ ■ ■
    src/setup.yaml
    skipped 18 lines
    19 19   - totalcomments
    20 20   - totalikes
    21 21   - whocommented
     22 + - whotagged
Please wait...
Page is in error, reload to recover