-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix(scan): resolve detection of the first endpoint in the initiate scan task #238
Conversation
…an task - Replace HTTPx first scan by nmap, then launch HTTPx with discovered port - Create a reusable function to launch nmap on the fly - Add parsing to get ports and services from Nmap output - Add more logs to debug scans while running - Remove the HTTP CRAWL global var, Nmap is the default to retrieve the first endpoint (the starting point for all the others tasks) - Adjust the is_alive parameter for tasks that need alive endpoints - Fix S3 scanner source file not found - Add more checks to prevent errors and scan crash - Refactor Endpoint saving for a better logic and less errors - Improve URLs validation
Reviewer's Guide by SourceryThis 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. Sequence diagram for scan initiation with NmapsequenceDiagram
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
Updated class diagram for scan initiationclassDiagram
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"
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @psyray - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…thod - Extract first endpoint creation logic from initiate_scan to simplify it - Improve logging for debug - Add/remove logs for production
- Dedicated class/methods created for this purpose - Sanitize domain name to prevent dangerous chars - Full path normalization - Verify that final path is within the base folder - Explicit permissions defined - Manage errors with explicit message
Ready to merge for me. 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