Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Fixes crash when URL points to a domain without PTR record - #3

Open
ph5i wants to merge 1 commit into
5O4R3S:mainfrom
ph5i:main
Open

Fixes crash when URL points to a domain without PTR record#3
ph5i wants to merge 1 commit into
5O4R3S:mainfrom
ph5i:main

Conversation

@ph5i

@ph5i ph5i commented Mar 25, 2025

Copy link
Copy Markdown

Hi, I noticed that if the URL provided points to a domain without a PTR record, the gethostbyaddr() function will fail because a reverse DNS lookup can't be performed, ultimately causing the script to crash since exceptions are not handled gracefully.

phsi@wsl:~/tools/OutSystems-Scan/os-scan (*)
> py osscan.py -u https://example.com
[...]
Traceback (most recent call last):
  File "/home/phsi/tools/OutSystems-Scan/os-scan/osscan.py", line 124, in <module>
    exploit_modules(data,environment,app_module_name)
  File "/home/phsi/tools/OutSystems-Scan/os-scan/osscan.py", line 80, in exploit_modules
    get_AppDefinitions.get_app_definitions(environment,app_module_name,header)
  File "/home/phsi/tools/OutSystems-Scan/os-scan/get_AppDefinitions.py", line 40, in get_app_definitions
    print(f"| {Fore.WHITE}Real DNS (enterprise only): {Style.DIM}{get_RealAddress.get_address(environment)}/{app_module_name}{Style.RESET_ALL}")
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/phsi/tools/OutSystems-Scan/os-scan/get_RealAddress.py", line 7, in get_address
    ip_address = socket.gethostbyaddr(host)[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.herror: [Errno 1] Unknown host

I added basic error handling in get_RealAddress.py to return "Not found!" if no PTR record exists and updated get_AppDefinitions.py slightly for cleaner output.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant