예제 #1
0
 def get_data(self):
     """
     get user level and IP historical data
     """
     normal_user = ['user', 'developer']
     api_key, access_token = file.get_auth_key()
     zm = ZoomEye(api_key=api_key, access_token=access_token)
     role = zm.resources_info()
     # permission restrictions
     if role["plan"] in normal_user:
         show.printf(
             "this function is only open to advanced users and VIP users.",
             color='red')
         exit(0)
     # the user chooses to force data from the API
     if self.force:
         history_data = zm.history_ip(self.ip)
     else:
         # from local cache get data
         history_data_str = self.get_data_from_cache()
         # local cache not exists from API get data
         if history_data_str is None:
             history_data = zm.history_ip(self.ip)
         else:
             history_data = json.loads(history_data_str)
     # cache data
     self.cache_data(history_data)
     return history_data
예제 #2
0
파일: data.py 프로젝트: r4b3rt/ZoomEye
 def request_data(self):
     """
     get api data
     """
     api_key, access_token = file.get_auth_key()
     zm = ZoomEye(api_key=api_key, access_token=access_token)
     data = zm.dork_search(self.dork)
     return data
예제 #3
0
파일: data.py 프로젝트: yenhao123/ccu_proj
    def __init__(self, dork, num, facet=None):
        self.dork = dork
        self.num = num
        self.facet = facet

        self.dork_data = []
        self.facet_data = None
        self.total = 0

        self.api_key, self.access_token = file.get_auth_key()
        self.zoomeye = ZoomEye(api_key=self.api_key, access_token=self.access_token)
예제 #4
0
파일: core.py 프로젝트: r4b3rt/ZoomEye
def info(args):
    """
    used to print the current identity of the user and the remaining data quota for the month
    :param args:
    :return:
    """
    api_key, access_token = file.get_auth_key()
    zm = ZoomEye(api_key=api_key, access_token=access_token)
    # get user information
    user_data = zm.resources_info()
    if user_data:
        # show in the terminal
        show.printf("Role: {}".format(user_data["plan"]))
        show.printf("Quota: {}".format(user_data["resources"].get("search")))
예제 #5
0
파일: data.py 프로젝트: r4b3rt/ZoomEye
    def __init__(self, dork, num, resource, facet=None, force=False):
        self.dork = dork
        self.num = num
        self.resource = resource
        self.facet = facet
        self.force = force

        self.dork_data = list()
        self.facet_data = None
        self.total = 0

        self.api_key, self.access_token = file.get_auth_key()
        self.zoomeye = ZoomEye(api_key=self.api_key,
                               access_token=self.access_token)