diff --git a/flowsint-api/Dockerfile b/flowsint-api/Dockerfile index cdf8fd2..c23f8b9 100644 --- a/flowsint-api/Dockerfile +++ b/flowsint-api/Dockerfile @@ -46,11 +46,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* -# Install httpX for 'to_ssl' enricher -RUN apt-get update && apt-get install -y golang-go -RUN rm -f /app/.venv/bin/httpx || true -RUN go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest - WORKDIR /app # Copy virtual environment from builder @@ -94,11 +89,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean -# Install httpX for 'to_ssl' enricher -RUN apt-get update && apt-get install -y golang-go -RUN rm -f /app/.venv/bin/httpx || true -RUN go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest - # Create non-root user RUN groupadd -g 1001 flowsint && \ useradd -u 1001 -g flowsint -s /bin/bash -m flowsint diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py index 3dfd471..d52d7e5 100644 --- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py +++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py @@ -1,7 +1,6 @@ import json import os import requests -import subprocess from typing import Any, Dict, List, Optional from flowsint_core.core.enricher_base import Enricher @@ -11,6 +10,9 @@ from flowsint_types.website import Website from flowsint_core.core.logger import Logger from flowsint_types.address import Location +from tools.network.httpx import HttpxTool + + @flowsint_enricher class DomainToTLS(Enricher): """[httpX] Get TLS information from a domain.""" @@ -38,31 +40,24 @@ class DomainToTLS(Enricher): async def scan(self, data: List[InputType]) -> List[OutputType]: results: List[OutputType] = [] + Logger.info(self.sketch_id, f"(DomainToTLS) Received {len(data)} inputs") for domain in data: - Logger.info(self.sketch_id, f"(DomainToTLS) Received {len(data)} inputs") try: - httpx_process = subprocess.Popen( - ["/root/go/bin/httpx", "-tls-grab", "-json", "-silent"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - text=True + tool = HttpxTool() + httpx_results = tool.launch( + target=domain.domain, + args=["-tls-probe"] ) - stdout, stderr = httpx_process.communicate(f'{domain.domain}\n') - - if not stdout.strip(): + if not httpx_results : Logger.error(None, {"message": f"(DomainToTLS) No results for the domain '{domain.domain}'"}) continue else: - for line in stdout.splitlines(): - if line.strip(): - tlsdata = json.loads(line) - - web_url = tlsdata.get("url") - web_title = tlsdata.get("title") - web_content_type = tlsdata.get("content_type") - web_statuscode = tlsdata.get("status_code") # status_code is int + for r_line in httpx_results : + web_url = r_line.get("url") + web_title = r_line.get("title") + web_content_type = r_line.get("content_type") + web_statuscode = r_line.get("status_code") # status_code is int results.append( Website(