Closed psyray closed 2 days ago
This PR improves the scan initialization process by replacing HTTPx with Nmap for initial endpoint detection and adds several robustness improvements. The main changes focus on better error handling, improved URL validation, and more structured service detection using Nmap. The code has been refactored to be more maintainable and reliable.
sequenceDiagram
actor User
participant System
participant Nmap
participant HTTPx
User->>System: Initiate scan
System->>Nmap: Run Nmap to find web services
alt Web services found
Nmap-->>System: Return open ports and services
System->>HTTPx: Launch HTTPx with discovered ports
HTTPx-->>System: Return HTTP endpoints
else No web services found
Nmap-->>System: No open ports
System-->>User: Scan failed
end
classDiagram
class ScanHistory {
+int id
+DateTime last_scan_date
+String scan_status
+String error_message
+void save()
}
class Domain {
+int id
+String name
+DateTime last_scan_date
+void save()
}
class Subdomain {
+int id
+String name
+void save()
}
class EndPoint {
+int id
+String http_url
+bool is_default
+DateTime discovered_date
+void save()
}
class Nmap {
+dict get_nmap_http_datas(String host, dict ctx)
}
ScanHistory --> Domain : belongs to
Domain --> Subdomain : has
Subdomain --> EndPoint : has
EndPoint --> Nmap : uses
note for Nmap "Nmap is used to detect open ports and services"
Change | Details | Files |
---|---|---|
Replace HTTPx with Nmap for initial endpoint detection |
|
web/reNgine/tasks.py |
Improve URL validation and endpoint handling |
|
web/reNgine/common_func.py web/reNgine/tasks.py |
Enhance error handling and logging |
|
web/reNgine/tasks.py web/reNgine/celery_custom_task.py |
Refactor Nmap parsing functionality |
|
web/reNgine/tasks.py web/reNgine/common_func.py |
Update configuration handling |
|
web/reNgine/common_func.py web/reNgine/settings.py |
@AnonymousWP
Ready to merge for me. This one fix an old business logic error that I wanted to fix from a long time ago Replace inital HTTPx scan, that scans only the http port, by nmap which is more accurate in this case. It quickly probes the web service ports, and according to the result it will use the good http scheme by prioritizing https port if it exists. This will be improved in the future, but for the moment, the main goal was to fix screenshot issues (and others by collateral damage) and it prepares the ground to make a more precise initial scan, which is the starting point of all the remaining scan.
So if this one is badly recognized, reconnaissance will fail, and pentester could pass away a critical target
All my tests are OK
Fixes #237
Summary by Sourcery
Bug Fixes:
Enhancements:
This PR prepared the ground to effectively resolve #208 & #8
Todo