Example #1
0
    def get_users_scan_count(**kwargs):
        """
        获取所有用户及其扫描次数
        To use:
        >>> users = UserService.get_users_scan_count(fields=(User.full_name), where=(User.mobile_phone == "122222"))
        >>> print(users)
        :param kwargs: 
        :return: 
        """
        from model.user_task import UserTask
        """
        open_id = TextField(null=True)
        user_name = TextField(null=True)
        pass_word = TextField(null=True)
        full_name = TextField(null=True)
        email = TextField(null=True)
        dept_name = TextField(null=True)
        role = IntegerField(default=Role.USER)
        recent_operation_time = DateTimeField(null=True)
        user_info = TextField(null=True)
        mobile_phone = TextField(null=True)
        """

        kwargs["fields"] = (
        User.id, User.open_id, User.user_name, User.full_name, User.email, User.dept_name, User.role,
        User.recent_operation_time, User.user_info, User.mobile_phone,
        UserTask.select(fn.COUNT(UserTask.id)).alias('scan_count').where(UserTask.user_id == User.id))

        return HunterModelService.get_fields_by_where(User, **kwargs)
Example #2
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> ldap_config = LdapConfigService.get_fields_by_where(fields=(LdapConfig.ldap_host), where=(LdapConfig.id == 1))
     >>> print(ldap_config)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(LdapConfig, **kwargs)
Example #3
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> tasks = TaskService.get_fields_by_where(fields=(Task.task_status), where=(Task.id == 1))
     >>> print(tasks)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(Task, **kwargs)
Example #4
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> vulns = VulnerabilityService.get_fields_by_where(fields=(User.full_name), where=(User.mobile_phone == "122222"))
     >>> print(vulns)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(Vulnerability, **kwargs)
Example #5
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> urls = UrlService.get_fields_by_where(fields=(Url.origin_data), where=(Url.task_id == 1))
     >>> print(urls)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(Url, **kwargs)
Example #6
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> plugin_infos = PluginInfoService.get_fields_by_where(fields=(PluginInfo.plugin_name), where=(PluginInfo.level == VulnLevel.LOW))
     >>> print(plugin_infos)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(PluginInfo, **kwargs)
Example #7
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> system_config = SystemConfigService.get_fields_by_where(fields=(SystemConfig.socket_port), where=(SystemConfig.id == 1))
     >>> print(system_config)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(SystemConfig, **kwargs)
Example #8
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> users = UserService.get_fields_by_where(fields=(User.full_name), where=(User.mobile_phone == "122222"))
     >>> print(users)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(User, **kwargs)
Example #9
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> user_tasks = UserTaskService.get_fields_by_where(fields=(UserTask.task_id), where=(UserTask.id == 1))
     >>> print(user_tasks)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(UserTask, **kwargs)
Example #10
0
 def get_fields_by_where(**kwargs):
     """
     To use:
     >>> proxy_config = NetWorkProxyConfigService.get_fields_by_where(fields=(NetWorkProxyConfig.ca_country_name), where=(NetWorkProxyConfig.id == 1))
     >>> print(ca_config)
     :param kwargs: 
     :return: 
     """
     return HunterModelService.get_fields_by_where(NetWorkProxyConfig,
                                                   **kwargs)