Multikill
pip install killallappsinfolder
Tested against Windows 10 / Python 3.11 / Anaconda
ProcKiller
ProcKiller is a Python utility designed to identify and terminate processes running on a Windows machine based on specific executable files found within given directories. It utilizes the Windows API through the ctypes library to manage processes.
Features
- Executable Filtering: Search for executable files within specified directories.
- Process Mapping: Map running processes to executables.
- Process Termination: Terminate processes based on matching executable files.
- Customizable Termination Criteria: Include options for sending different signals and handling child processes.
Usage
To use ProcKiller, run the script from the command line with directories as arguments, followed by the interval (in seconds) for repeated execution. Here’s how to invoke it:
python prockiller.py "C:\path\to\first\directory" "C:\path\to\second\directory" 60
This will search for executables in the specified directories and terminate any matching running processes every 60 seconds.
Components
Main Functions
- get_command_line(pid): Retrieves the command line used to start a process.
- get_all_executables(folder, exeendings, filter_function): Searches for executable files in a specified folder.
- get_procs_to_kill(allexefiles_onlyexe, allfullpath): Identifies running processes that should be terminated.
- kill_running_procs(allprocsdic, ...): Terminates the processes identified for termination.
Class Definition
- ProcKiller: A class to encapsulate the functionality of finding and killing processes.
Command-Line Interface
- The script can be executed directly from the command line with specified parameters for directories and execution interval.
Code Example
pki = (
ProcKiller(
folders=(
r"C:\ProgramData\BlueStacks_nxt",
r"C:\Program Files\Oracle",
r"C:\Program Files\BlueStacks",
r"C:\Program Files\BlueStacks_nxt",
),
kill_timeout=2,
protect_myself=True, # important, protect_myselfis False, you might kill the whole python process you are in.
winkill_sigint_dll=True, # dll first
winkill_sigbreak_dll=True,
winkill_sigint=True, # exe from outside
winkill_sigbreak=True,
powershell_sigint=True,
powershell_sigbreak=True,
powershell_close=True,
multi_children_kill=False, # try to kill each child one by one
multi_children_always_ignore_pids=(0, 4), # ignore system processes
print_output=True,
taskkill_as_last_option=True, # this always works, but it is not gracefully anymore):
exeendings=(".com", ".exe"),
filter_function=lambda files: True,
)
.get_active_procs()
.kill_running_procs()
)
# Use it again to keep on killing
pki()
Contributions
Contributions are welcome! If you find a bug or have suggestions for improvements, please open an issue or submit a pull request.
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for killallappsinfolder 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| killallappsinfolder-0.10.tar.gz | 9.4 kB | Without provenance | Details for killallappsinfolder-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| killallappsinfolder-0.10-py3-none-any.whl | Python 3 | none | any | Details for killallappsinfolder-0.10-py3-none-any.whl |
Total release size: 19.7 kB
Release files / killallappsinfolder-0.10.tar.gz
| Download URL | killallappsinfolder-0.10.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dd699c5d12b0e4a64f54b3ebb1aa45c9a55279eeaf21dd0fcab6dad721107d1
|
|
BLAKE2b-256 checksum How to use checksums |
14e5364fffe1c93b888cf85efbef8d4f3ca1d748fc9da96b7b03eaffba069b05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / killallappsinfolder-0.10-py3-none-any.whl
| Download URL | killallappsinfolder-0.10-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82e00bcd245608855531f40516d67701db73a9fa0459d82c03008be9380581c8
|
|
BLAKE2b-256 checksum How to use checksums |
503e55371f0be0cef11aee9761de7bb085737004f5c5ce1b2b3ddf8a9206f528
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for killallappsinfolder 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.