ip.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ws-backend-community 作者: lavalamp- 项目源码 文件源码
def inspect_network_services_from_ip_address(
        self,
        org_uuid=None,
        ip_address_uuid=None,
        ip_address_scan_uuid=None,
        order_uuid=None,
):
    """
    Kick off all of the necessary tasks to inspect the live network services associated with the given IP
    address.
    :param org_uuid: The UUID of the organization to perform data retrieval on behalf of.
    :param ip_address_uuid: The UUID of the IP address to retrieve data about.
    :param ip_address_scan_uuid: The UUID of the IP address scan to associate retrieved data with.
    :return: None
    """
    logger.info(
        "Now kicking off all tasks to inspect network services on IP address %s."
        % (ip_address_uuid,)
    )
    self.wait_for_es()
    open_ports = get_open_ports_from_ip_address_scan(ip_address_scan_uuid=ip_address_scan_uuid, org_uuid=org_uuid)
    task_sigs = []
    for port_number, port_protocol in open_ports:
        network_service = get_or_create_network_service_from_org_ip(
            ip_uuid=ip_address_uuid,
            port=port_number,
            protocol=port_protocol,
            db_session=self.db_session,
            discovered_by="ip address scan",
        )
        task_sigs.append(scan_network_service.si(
            org_uuid=org_uuid,
            network_service_uuid=network_service.uuid,
            check_liveness=False,
            liveness_cause="ip address scan",
            order_uuid=order_uuid,
        ))
    if len(task_sigs) == 0:
        logger.info(
            "No network services were found to be open for IP address %s."
            % (ip_address_uuid,)
        )
        return
    group(task_sigs).apply_async()


#USED
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号