Skip to content

Commit

Permalink
Merge pull request #134 from yaroslav-o/master
Browse files Browse the repository at this point in the history
Allow python 3.12 and update lief to 0.14.1
  • Loading branch information
Wenzel authored May 31, 2024
2 parents cad6cbf + 09d278a commit 6a23f7d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 54 deletions.
4 changes: 3 additions & 1 deletion checksec/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
from pathlib import Path
from typing import List, Union

from lief.PE import MACHINE_TYPES
from lief.PE import Header
from rich.console import Console
from rich.progress import BarColumn, Progress, TextColumn
from rich.table import Table

from checksec.elf import ELFChecksecData, PIEType, RelroType
from checksec.pe import PEChecksecData

MACHINE_TYPES = Header.MACHINE_TYPES


class AbstractChecksecOutput(ABC):
def __init__(self, libc_detected: bool = False):
Expand Down
10 changes: 8 additions & 2 deletions checksec/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
from pathlib import Path

import lief
from lief.PE import DLL_CHARACTERISTICS, HEADER_CHARACTERISTICS, MACHINE_TYPES, Signature
from lief.PE import Header, OptionalHeader, Signature

from .binary import BinarySecurity

DLL_CHARACTERISTICS = OptionalHeader.DLL_CHARACTERISTICS
HEADER_CHARACTERISTICS = Header.CHARACTERISTICS
MACHINE_TYPES = Header.MACHINE_TYPES

PEChecksecData = namedtuple(
"PEChecksecData",
[
Expand Down Expand Up @@ -113,8 +117,10 @@ def has_isolation(self) -> bool:

@property
def checksec_state(self) -> PEChecksecData:
machine: MACHINE_TYPES = self.bin.header.machine
machine_int = machine.value
return PEChecksecData(
machine=self.bin.header.machine,
machine=machine_int,
nx=self.has_nx,
canary=self.has_canary,
aslr=self.is_aslr,
Expand Down
100 changes: 53 additions & 47 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ checksec = 'checksec.__main__:entrypoint'

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
lief = "0.13.0"
lief = "0.14.1"
docopt = "0.6.2"
rich = "13.3.5"
pylddwrap = "1.0.1"
rich = "^13.4"
pylddwrap = "^1.0"

[tool.poetry.dev-dependencies]
flake8 = "5.0.4"
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import subprocess
import shutil
import subprocess
from pathlib import Path
from typing import Dict

Expand Down

0 comments on commit 6a23f7d

Please sign in to comment.