Skip to main content

Python module for scanning running process mappings (for detecting libraries, executables, etc). UNIX-only.

Project description

Python module for scanning running process mappings (for detecting libraries, executables, etc)

This module works on UNIX-derived systems only (Linux, BSD, etc)

What is a mapping?

A mapping can include the running executable (like python), a shared library (like libc) or something else (like a locale-archive file or other mapping).

You can use this module to, for example, scan for running processes to see what is using libpython2.7, or scan a paticular process for a mapping.

Functions

The following function, scanProcessForMapping, scans a single process for mappings. Use an empty string for searchPortion to get all mappings.

def scanProcessForMapping(pid, searchPortion):

‘’’

scanProcessForMapping - Searches a given pid’s mappings for a certain pattern.

@param pid <int> - A running process ID on this system

@param searchPortion <str> - A mapping for which to search, example: libc or python or libz.so.1. Give empty string to return all mappings.

@return <dict> - If result is found, the following dict is return. If no match found on the given pid, or pid is not found running, None is returned.

{

‘searchPortion’ : The passed search pattern

‘pid’ : The passed pid (as an integer)

‘owner’ : String of owner, or “unknown” if one could not be determined

‘cmdline’ : Commandline string

‘matchedMappings’ : All mappings likes that matched the given search pattern

}

The following function, scanAllProcessessForMapping, scans all running processes for mappings.

def scanAllProcessessForMapping(searchPortion):

‘’’

scanAllProcessessForMapping - Scans all processes on the system for a given search pattern.

@return - <dict> - A dictionary of pid -> mappingResults for each pid that matched the search pattern. For format of “mappingResults”, @see scanProcessForMapping

‘’’

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

ProcessMappingScanner-1.0.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file ProcessMappingScanner-1.0.tar.gz.

File metadata

File hashes

Hashes for ProcessMappingScanner-1.0.tar.gz
Algorithm Hash digest
SHA256 a09c935b3915c65ecd4fcac7eed38d47f5cf1b07053bfe2156ab0347740bc57b
MD5 dca47e99c773ca5a52788f26c666eaf6
BLAKE2b-256 81897cb3864802107462858d5ad0a0494d843ead7fbc6964a2172124ed53f211

See more details on using hashes here.

Supported by

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