Skip to content

Commit

Permalink
elf: add PIEType.REL
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenzel committed Sep 8, 2021
1 parent 387428e commit b1eb586
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions checksec/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class PIEType(Enum):
No = 1
DSO = 2
PIE = 3
REL = 4


class Libc:
Expand Down Expand Up @@ -155,6 +156,8 @@ def pie(self) -> PIEType:
return PIEType.PIE
else:
return PIEType.DSO
elif self.bin.header.file_type == E_TYPE.RELOCATABLE:
return PIEType.REL
return PIEType.No

@property
Expand Down
2 changes: 2 additions & 0 deletions checksec/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def add_checksec_result(self, filepath: Path, checksec: Union[ELFChecksecData, P
pie_res = f"[red]{pie.name}"
elif pie == PIEType.DSO:
pie_res = f"[yellow]{pie.name}"
elif pie == PIEType.REL:
pie_res = f"[yellow]{pie.name}"
else:
pie_res = "[green]Yes"
row_res.append(pie_res)
Expand Down
2 changes: 1 addition & 1 deletion tests/binaries
Submodule binaries updated 1 files
+ elf/pie_rel

0 comments on commit b1eb586

Please sign in to comment.