Skip to content

Conversation

@kokatesaurabh
Copy link

Description

This PR enhances error handling and logging in MalwareDomainCheck.py to improve reliability and debugging:

  • Added specific exception handling for FileNotFoundError, PermissionError, and IOError.
  • Implemented pre-flight checks for database file existence and permissions.
  • Added input validation for URLs and domains.
  • Improved logging with detailed messages and progress tracking.
  • Ensured graceful degradation on errors.

Changes

  • Updated malware_check, maltrail_check, scan, verify_domain, get_netloc, and get_domains.
  • Added file existence and permission checks.
  • Enhanced logging for better traceability.

Testing

  • Tested normal operation with valid domains and database files.
  • Tested edge cases: missing database files, permission errors, empty databases, invalid URLs.
  • Verified log output in mobsf.log for all scenarios.
  • Confirmed no regressions in existing functionality.

Impact

  • Prevents crashes due to missing or inaccessible database files.
  • Improves debugging with clear, specific error messages.
  • Maintains backward compatibility.

Related Issues

  • Addresses common issues with missing or inaccessible database files.

Checklist

  • Code follows MobSF coding standards.
  • Tested locally with multiple scenarios.
  • No breaking changes introduced.

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

Successfully merging this pull request may close these issues.

2 participants