Skip to content

Python script to decode QR codes found in various filetypes. The goal for analysis of malicious URLs stored in a QR code. Identified URLs will be defanged.

License

Notifications You must be signed in to change notification settings

legit4n6/qrcode-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Decoder

This project is a Python script designed to extract and decode QR codes from various file types, including PDFs, HTML files, and image files. This can be particularly useful in cybersecurity scenarios, such as analyzing phishing emails that contain malicious QR codes.

Requirements

  • PyMuPDF
  • pyzbar
  • Pillow
  • beautifulsoup4

You can install the required libraries using the following command:

pip install -r requirements.txt

Usage

To use the script, run the following command:

python qrcode-decoder.py <file_path>

Replace <file_path> with the path to the PDF, HTML, or image file you want to process.

Example

python qrcode-decoder.py example.pdf

How It Works

  1. Extract Images from PDF: The script uses PyMuPDF to extract all images from the provided PDF file.

  2. Extract Images from HTML: The script uses BeautifulSoup to parse the HTML file and extract image URLs. It downloads the images and processes them.

  3. Decode QR Code: The script converts the extracted images to a NumPy array and decodes any QR codes using the pyzbar library.

  4. The output will be a defanged URL such as: [https[:]//bad[.]example[.]com]

Supported File Types

  • PDF
  • HTML
  • Common image formats (JPG, JPEG, PNG, BMP, GIF)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Python script to decode QR codes found in various filetypes. The goal for analysis of malicious URLs stored in a QR code. Identified URLs will be defanged.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages