pwncat
pwncat copied to clipboard
Methodically check existence and permissions before adding authkeys
Description of Changes
Addresses https://github.com/calebstewart/pwncat/issues/260. The Linux implant module for authorized keys now checks for the existence of the .ssh directory and the key file. Any file or directory created in the process as well as permission changes will be reverted on calling remove on the implant.
The implant now keeps track of all the tampers it has committed and the remove function rolls back all the changes.
Please note any noqa:
comments needed to appease flake8.
Major Changes Implemented:
- Added tamper classes
ModifiedPermissions
,ModifiedOwnership
- Authkeys implant module keeps track of its tampers internally
- A call to
remove
on the implant rolls back any changes made
Pre-Merge Tasks
- [x] Formatted all modified files w/
python-black
- [x] Sorted imports for modified files w/
isort
- [x] Ran
flake8
on repo, and fixed any new problems w/ modified files - [x] Ran
pytest
test cases - [x] Added brief summary of updates to CHANGELOG (under
[Unreleased]
)
pytest
results
4 failed, 26 passed
tests/test_platform.py::test_platform_su[ubuntu] FAILED
tests/test_platform.py::test_platform_su[centos] FAILED
tests/test_platform.py::test_platform_sudo[ubuntu] FAILED
tests/test_platform.py::test_platform_sudo[centos] FAILED
Note: Running these tests on the pwncat master branch returned the same results for me.
For issues with pre-merge tasks, see CONTRIBUTING.md