Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Errno 1] Unknown host #13

Open
restena-pyg opened this issue Jun 7, 2024 · 2 comments
Open

[Errno 1] Unknown host #13

restena-pyg opened this issue Jun 7, 2024 · 2 comments

Comments

@restena-pyg
Copy link
Contributor

Hi

If an IP address cannot resolved by socket.gethostbyaddr(ip) call, it throws an uncaught exception and the XML report is ignored:
WARNING - Unable to parse attachment; name="<redacted>.xml"; reason="[Errno 1] Unknown host"

Such a change could fix the problem

def lookupHostFromIp(ip):
    host = ip
    try:
        hosts = socket.gethostbyaddr(ip)
        if len(hosts) > 0:
            host = hosts[0]
            segments = host.split('.')
            if len(segments) > 2:
                host = segments[-2] + "." + segments[-1]
    except socket.herror:
        pass
    except Exception as e:
        print(f"An error occurred: {e}")

    return host
@jertel
Copy link
Owner

jertel commented Jun 7, 2024

Thanks. Would you like to submit a PR?

@jertel
Copy link
Owner

jertel commented Jun 10, 2024

Resolved by #14.

@restena-pyg Please try the latest tag of this docker image and see if it's working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants