Fix payload visibility, add filename headers, OS detection, and improve error handling #3
+425
−97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses multiple critical issues in the XSS-PDF generator to improve functionality, reliability, and user experience.
Issues Fixed
1. Complete Payload Visibility in PDF Files
Previously, PDF files only showed truncated payloads (limited to 45 characters per line, max 8 lines), making it difficult to reference the complete exploit code. Now all payloads are fully visible in the PDF with proper formatting:
Before:
After:
2. Filename Integration as PDF Headers
PDF files now display their filename as a prominent heading, making it easy to identify which specific payload file you're viewing.
3. OS-Aware File System Targeting
Added automatic OS detection to use appropriate file paths instead of hardcoded ones:
C:\Windows\System32\,C:\Users\, etc./etc/passwd,/home/,/usr/bin/, etc./Applications/,/Users/,/System/, etc./system/,/data/, Android-specific pathsThis prevents inappropriate file paths (e.g., Windows paths on Linux machines).
4. Fixed "Parent Not Defined" JavaScript Errors
All DOM manipulation payloads now include proper existence checks to prevent runtime errors:
Before:
After:
5. Payload Integration from Another-Script.py
Merged unique payloads from
Another-Script.pyintoscript.pyin appropriate categories, including:6. Clean Project Organization
Moved all XSS-PDF related files into a dedicated
PDF/folder for better organization:Testing Results
All improvements have been thoroughly tested:
✅ Complete payload visibility - Full JavaScript code now visible in PDFs
✅ Filename headers - PDF filenames properly displayed in content
✅ OS detection - Linux paths (
/etc/passwd) correctly used on Linux system✅ Error prevention - No more "parent not defined" JavaScript errors
✅ Enhanced payloads - Additional techniques from Another-Script.py integrated
✅ Folder structure - All scripts function correctly in new organization
Backward Compatibility
All changes maintain full backward compatibility while significantly enhancing functionality. Both scripts continue to work with existing command-line arguments and produce the same output formats with improved content.
Documentation
Updated README.md with new folder structure and added comprehensive IMPROVEMENTS.md documenting all changes with examples and usage instructions.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.