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

Added Namecheap Nameserver integration #55

Merged
merged 5 commits into from
Nov 25, 2024

Conversation

madhav6ram
Copy link
Contributor

Closes Issue #46

Tested using Namecheap sandbox API.

@0xbharath 0xbharath self-requested a review October 13, 2024 16:50
@0xbharath
Copy link
Collaborator

0xbharath commented Oct 16, 2024

@madhav6ram

This looks good but I got an error when testing this integration.

What is the error

I ran mantis with your Namecheap extension but I got the following error.

[2024-10-16 11:02:10,072] --> INFO: MANTIS Workflow - STARTED
[2024-10-16 11:02:10,072] --> INFO: Executing workname workflowName='test' schedule='daily between 00:00 and 04:00' cmd=[] scanNewOnly=False workflowConfig=[Module(moduleNam
e='dns', tools=['Namecheap'], order=1)]

DNS:   0%|                                                                                                                                             | 0/1 [00:00<?, ?it/s]
[2024-10-16 11:02:10,102] --> INFO: Reading zone files from Namecheap nameservers
[2024-10-16 11:02:10,299] --> INFO: Enumerating domain: test.com
[2024-10-16 11:02:10,673] --> INFO: Enumerating domain: test1.com
[2024-10-16 11:02:10,789] --> INFO: Failed
DNS: 100%|█████████| 1/1 [00:00<00:00,  1.45it/s]
        {
          "tool_name": "Namecheap",
          "success": 0,
          "failure": 1,
          "code": null,
          "command": null,
          "errors": null,
          "exception": "Error in response from Namecheap: b'<?xml version=\"1.0\" encoding=\"utf-8\"?>\\r\\n<ApiResponse Status=\"ERROR\" xmlns=\"http://api.namecheap.com/xml.response\">\\r\\n  <Errors>\\r\\n    <Error Number=\"2030288\">Cannot complete this command as this domain is not using proper DNS servers</Error>\\r\\n  </Errors>\\r\\n  <Warnings />\\r\\n  <RequestedCommand>namecheap.domains.dns.gethosts</RequestedCommand>\\r\\n  <CommandResponse Type=\"namecheap.domains.dns.getHosts\">\\r\\n    <DomainDNSGetHostsResult IsUsingOurDNS=\"false\" />\\r\\n  </CommandResponse>\\r\\n  <Server>PHX01APIEXT01</Server>\\r\\n  <GMTTimeDifference>--4:00</GMTTimeDifference>\\r\\n  <ExecutionTime>0.012</ExecutionTime>\\r\\n</ApiResponse>'",
          "tool_time_taken": "0:00:01",
          "output": null

Possible causes

This doesn't seem to be an issue with your code. I have two domains in my Namecheap account and this error happens when the the records are enumerated for a domain that uses external Nameserver.

Possible resolution

  1. Namecheap doesn't allow granular control over API key permissions. Can you add a check in your integration so that only the enumeration happens for the onboarded TLDs only and not all the domains on the nameserver. You can refer to this PR where the person added checks for TLDs in-scope. You can use the same CLI argument and add logic to your integration.
  2. Can you add exception handling for such cases? (Optional)

@0xbharath 0xbharath added enhancement New feature or request hacktoberfest hacktoberfest issues labels Oct 16, 2024
@madhav6ram
Copy link
Contributor Author

@0xbharath I will test both these suggestions and update my PR.

@0xbharath
Copy link
Collaborator

You can refer to this PR #53

@madhav6ram
Copy link
Contributor Author

@0xbharath This issue must be fixed when running mantis scan with -is or --in_scope flag. I completed adding this flag functionality into into the arg parser (arg_parse.py).

Note: I only catch this error '2030288 - domain is not using proper DNS servers'. If I need to handle any others let me know.

@0xbharath
Copy link
Collaborator

This should be good. I'll review this and let you know.

@0xbharath
Copy link
Collaborator

This has been delayed on my end. Will review this today.

@0xbharath
Copy link
Collaborator

This is good from a functionality PoV.

@Prateek-Thakare Can you go through the code and merge this?

Explicit installation is not needed for pip packages in the Dockerfile
Copy link
Collaborator

@Prateek-Thakare Prateek-Thakare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the code, Bharath has tested the code. Made changes to the files not needed.

@Prateek-Thakare Prateek-Thakare merged commit 43c2b1d into PhonePe:main Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest hacktoberfest issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants