Skip to main content

Checksec tool implemented in Python

Project description


checksec.py

Checksec tool in Python, Rich output, based on LIEF

Demo

CI badge PyPI package badge Python version badge

Table of Contents

Overview

A simple tool to verify the security properties of your binaries.

These properties can be enabled by your compiler to enforce the security of your executables, and mitigate exploits. However it can be challenging to apply them on a whole system.

Check the level of security your Linux distro / Windows release is providing you !

Supported formats:

  • ELF
  • PE
  • Mach-O

Based on:

  • Rich: Beautiful terminal output formatting
  • LIEF: Cross-platform library to parse, modify and abstract ELF, PE and Mach-O formats

Requirements

Setup

Windows

You find the checksec.exe on the latest Github releases:

Linux

python3 -m venv venv
source venv/bin/activate
(venv) pip install checksec.py

Usage

(venv) checksec <file_or_directory>...

Check --help for more options (JSON output, recursive walk, workers count)

FAQ

1️⃣ What's the difference between checksec.py and checksec.sh ?

checksec.py checksec.sh
Cross-Platform support
Distributed workload
Scan file
Scan directory
Scan directory recursively
Specify libc path
Scan process
Scan process libs
Scan kernel config
Output Cli
Output JSON
Output CSV
Output XML
ELF: Relro
ELF: Canary
ELF: NX
ELF: PIE
ELF: RPATH
ELF: RUNPATH
ELF: Symbols
ELF: Fortify
ELF: Fortified
ELF: Fortifable
ELF: Fortify Score

2️⃣ What's the difference between checksec.py and winchecksec ?

checksec.py winchecksec
Cross-Platform support
Distributed workload
Scan file
Scan directory
Scan directory recursively
Output CLI
Output JSON
PE: ASLR - DYNAMIC_BASE
PE: ASLR - HIGHENTROPYVA
PE: INTEGRITYCHECK
PE: Authenticode signed
PE: DEP
PE: Manifest Isolation
PE: SEH
PE: SafeSEH
PE: Control Flow Guard
PE: Return Flow Guard
PE: Stack Cookie

3️⃣ checksec is slow on some huge binaries ! What's happening ?!

checksec.py relies on the LIEF library to parse PE/ELF/MachO formats.

➡️The library doesn't offer at this point on-demand parsing, so it will parse and fetch unnecessary data.

➡️Retrieving symbols can be slow (ex: pandoc, 118M, +300 000 symbols, +2m 20sec). See this issue

4️⃣ I sent a CTRL-C to cancel checksec.py processing, the app doesn't want to quit

checksec.py is working with multiple process workers to parallelize its execution and binary processing. When a CRTL-C is received, checksec.py will wait for them to stop.

Sometimes, this is not working, and I don't know why at this point. You can kill the remaining Python workers afterwards.

References

License

License: GPL v3

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

checksec_py-0.7.5.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

checksec_py-0.7.5-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file checksec_py-0.7.5.tar.gz.

File metadata

  • Download URL: checksec_py-0.7.5.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1018-azure

File hashes

Hashes for checksec_py-0.7.5.tar.gz
Algorithm Hash digest
SHA256 892854f95d17a76d8f45a5c0cc597b9f1bebced3fffb9c7205d0baaf5eace886
MD5 aab5e7185a2bc2b6e663647abd80e9af
BLAKE2b-256 2e1fe95f52ca9b254e81f5b5fb9324a529747c99f780ff739f0caec212738196

See more details on using hashes here.

File details

Details for the file checksec_py-0.7.5-py3-none-any.whl.

File metadata

  • Download URL: checksec_py-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1018-azure

File hashes

Hashes for checksec_py-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fe2ba7293d537f1c09f7c5bbdcc002dcea1d8bfc2121adaba6b2f464dad9e26b
MD5 382e1d575eeb237679e751ade12eb576
BLAKE2b-256 1b8a0f1e5e7dbadcec39907851f25d9fafb87bf24a32f2b5592f63339e5ca3d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page