{ "info": { "author": "Tim Savannah", "author_email": "kata198@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "ProcessMappingScanner\n=====================\n\nPython module for scanning running processes for various pieces of information ( mappings, open files, owner, commandline, etc )\n\nThis module works on UNIX-derived systems only (Linux, BSD, cygwin, etc)\n\n\n**What is a mapping?**\n\n\nA mapping can include the running executable (like python), a shared library (like libc) or something else (like a locale-archive file or other mapping).\n\nYou 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.\n\n\nCommandline Tool\n----------------\n\nProcessMappingScanner's functionality is exposed through a commandline tool, `findProcessesUsing `_.\n\n\n\nFunctions\n---------\n\n\n**Mappings**\n\n\nHere are functions to scan running processes for mappings.\n\n\nThe following function, scanProcessForMapping, scans a single process for mappings. Use an empty string for searchPortion to get all mappings.\n\n def scanProcessForMapping(pid, searchPortion, isExactMatch=False, ignoreCase=False):\n\n '''\n\n scanProcessForMapping - Searches a given pid's mappings for a certain pattern.\n\n\n @param pid - A running process ID on this system\n\n @param searchPortion - A mapping for which to search, example: libc or python or libz.so.1. Give empty string to return all mappings.\n\n @param isExactMatch Default False - If match should be exact, otherwise a partial match is performed.\n\n @param ignoreCase Default False - If True, search will be performed case-insensitively\n\n\n @return - If result is found, the following dict is returned. If no match found on the given pid, or pid is not found running, None is returned.\n\n {\n\n 'searchPortion' : The passed search pattern\n\n 'pid' : The passed pid (as an integer)\n\n 'owner' : String of process owner, or uid if no mapping can be found, or \"unknown\" if neither could be determined.\n\n 'cmdline' : Commandline string\n\n 'matchedMappings' : All mappings likes that matched the given search pattern\n\n }\n\n\n '''\n\n\nThe following function, scanAllProcessesForMapping, scans all running processes for mappings.\n\n def scanAllProcessesForMapping(searchPortion, isExactMatch=False, ignoreCase=False):\n\n '''\n\n scanAllProcessesForMapping - Scans all processes on the system for a given search pattern.\n\n\n @param searchPortion - A mapping for which to search, example: libc or python or libz.so.1. Give empty string to return all mappings.\n\n @param isExactMatch Default False - If match should be exact, otherwise a partial match is performed.\n\n @param ignoreCase Default False - If True, search will be performed case-insensitively\n\n\n @return - - A dictionary of pid -> mappingResults for each pid that matched the search pattern. For format of \"mappingResults\", @see scanProcessForMapping\n\n '''\n\n\n**Owner**\n\n\nHere are the functions to determine whom is running a process\n\n\nThe following function returns information on the owner of a given process (uid, username):\n\n def getProcessOwner(pid):\n\n '''\n\n getProcessOwner - Get the process owner of a pid\n\n\n @param pid - process id\n\n\n @return - None if process not found or can't be determined. Otherwise, a dict:\n\n {\n\n uid - Owner UID\n\n name - Owner name, or None if one cannot be determined\n\n }\n\n '''\n\n\nThe following functions returns a string of the owner of a given process:\n\n def getProcessOwnerStr(pid):\n\n '''\n\n getProcessOwner - Get Process owner of a pid as a string instead of components (#getProcessOwner)\n\n\n @return - Returns username if it can be determined, otherwise uid, otherwise \"unknown\"\n\n '''\n\n\n**Commandline**\n\n\nThe following functions get the commandline (executable and arguments) for a running process.\n\n\nThe following function returns a string of the commandline of a running process:\n\n def getProcessCommandLineStr(pid):\n\n '''\n\n getProcessCommandLineStr - Gets a the commandline (program + arguments) of a given pid\n\n\n @param pid - Process ID\n\n\n @return - None if process not found or can't be determined. Otherwise a string of commandline.\n\n\n @note Caution, args may have spaces in them, and you cannot surmise from this method. If you care (like trying to replay a command), use getProcessCommandLineList instead\n\n '''\n\n\nThe following function returns a list representing the \"argv\" of a process.\n\n def getProcessCommandLineList(pid):\n\n '''\n\n getProcessCommandLineList - Gets the commandline (program + argumentS) of a given pid as a list.\n\n\n @param pid - Process ID\n\n\n @return - None if process not found or can't be determined. Otherwise a list representing argv. First argument is process name, remainder are arguments.\n\n\n @note - Use this if you care about whether a process had a space in the commands\n\n '''\n\n**Files**\n\n\nThe following functions deal with open file descriptors (fds) of running processes.\n\n\nThe following function returns information on a process\n\n\n def scanProcessForOpenFile(pid, searchPortion, isExactMatch=True, ignoreCase=False):\n\n '''\n\n scanProcessForOpenFile - Scans open FDs for a given pid to see if any are the provided searchPortion\n\n\n @param searchPortion - Filename to check\n\n @param isExactMatch Default True - If match should be exact, otherwise a partial match is performed.\n\n @param ignoreCase Default False - If True, search will be performed case-insensitively\n\n\n @return - If result is found, the following dict is returned. If no match found on the given pid, or the pid is not found running, None is returned.\n\n {\n\n 'searchPortion' : The search portion provided\n\n 'pid' : The passed pid (as an integer)\n\n 'owner' : String of process owner, or \"unknown\" if one could not be determined\n\n 'cmdline' : Commandline string\n\n 'fds' : List of file descriptors assigned to this file (could be mapped several times)\n\n 'filenames' : List of the filenames matched\n\n }\n\n '''\n\n\nThe following function scans all processes on a system for an open file:\n\n def scanAllProcessesForOpenFile(searchPortion, isExactMatch=True, ignoreCase=False):\n\n '''\n\n scanAllProcessessForOpenFile - Scans all processes on the system for a given filename\n\n\n @param searchPortion - Filename to check\n\n @param isExactMatch Default True - If match should be exact, otherwise a partial match is performed.\n\n @param ignoreCase Default False - If True, search will be performed case-insensitively\n\n\n @return - - A dictionary of pid -> mappingResults for each pid that matched the search pattern. For format of \"mappingResults\", @see scanProcessForOpenFile\n\n '''\n\nCurrent Working Directory\n-------------------------\n\nThe current working directory (CWD) of a process can be found via:\n\n def getProcessCwd(pid)\n\n '''\n\n getProcessCwd - Gets the cwd (current working directory) of a given pid\n\n\n @param pid - Process ID\n\n\n @return - None if process not found or can't be determined. Otherwise, a string of the CWD\n\n '''\n\n\nAlso contains scan functions, like those described above, *scanProcessForCwd* and *scanAllProcessessForCwd*.\n\n\n\n**General**\n\n\nThe following are general functions\n\nThe following function returns a list of all pids running on a system\n\n def getAllRunningPids()\n\n\n\n**Design**\n\n\nAll of the \"scan\" series of functions return some extra information about the process (owner/cmdline). This is because processes can begin and end quickly, so it's better to get a complete snapshot than to not be able to obtain one later.\n\n\nPydoc\n=====\n\nPydoc can be found at: http://pythonhosted.org/ProcessMappingScanner/", "description_content_type": null, "docs_url": "https://pythonhosted.org/ProcessMappingScanner/", "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kata198/ProcessMappingScanner", "keywords": "process,mapping,scanner,unix,proc,mappings,lib,detect,executable,shared,object,fd,filename,search,socket,descriptor,owner,pids,cwd", "license": "LGPLv3", "maintainer": null, "maintainer_email": null, "name": "ProcessMappingScanner", "package_url": "https://pypi.org/project/ProcessMappingScanner/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ProcessMappingScanner/", "project_urls": { "Homepage": "https://github.com/kata198/ProcessMappingScanner" }, "release_url": "https://pypi.org/project/ProcessMappingScanner/2.3.2/", "requires_dist": null, "requires_python": null, "summary": "Python module for scanning information on running processes, including mappings, open file-descriptors, process owner, and other information", "version": "2.3.2" }, "last_serial": 2941654, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "dca47e99c773ca5a52788f26c666eaf6", "sha256": "a09c935b3915c65ecd4fcac7eed38d47f5cf1b07053bfe2156ab0347740bc57b" }, "downloads": -1, "filename": "ProcessMappingScanner-1.0.tar.gz", "has_sig": false, "md5_digest": "dca47e99c773ca5a52788f26c666eaf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3080, "upload_time": "2015-08-30T23:53:58", "url": "https://files.pythonhosted.org/packages/81/89/7cb3864802107462858d5ad0a0494d843ead7fbc6964a2172124ed53f211/ProcessMappingScanner-1.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "8b111ea2850794c86977f700f8f556c3", "sha256": "5148ee4ee83e49fabfbb099852731c6e10cddfc9deebfe0d149a264771ad8f3c" }, "downloads": -1, "filename": "ProcessMappingScanner-2.0.1.tar.gz", "has_sig": false, "md5_digest": "8b111ea2850794c86977f700f8f556c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8610, "upload_time": "2015-09-08T16:54:05", "url": "https://files.pythonhosted.org/packages/3d/fa/cedff6787facd316b4366ca06e72de56704c25396f314e7bae2e41b2daa0/ProcessMappingScanner-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "7049f96af7c678802c7cf5ea764b6c31", "sha256": "8fe79ba00aafc3e6408f7e3b2628daa4abf7f925416d09dac42fe64eda45c0c9" }, "downloads": -1, "filename": "ProcessMappingScanner-2.0.2.tar.gz", "has_sig": false, "md5_digest": "7049f96af7c678802c7cf5ea764b6c31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13705, "upload_time": "2015-10-19T16:32:34", "url": "https://files.pythonhosted.org/packages/8f/b7/934bab9b4c9d1c8664ae7f31b457459b298396dd34cbecd1f7596c7d9f8e/ProcessMappingScanner-2.0.2.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "356860840829eaf3fc037f19ce1ccfbb", "sha256": "ab09175be9846d78c9b24c54a3ed5b43577f8c3c3097ad5defb1de970ab2e83e" }, "downloads": -1, "filename": "ProcessMappingScanner-2.1.0.tar.gz", "has_sig": false, "md5_digest": "356860840829eaf3fc037f19ce1ccfbb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16860, "upload_time": "2016-11-26T04:45:55", "url": "https://files.pythonhosted.org/packages/ec/c7/276d80cacc9e08e077d0ff7400bd2f48e2cb6c791835f6a45a1d0fe886f8/ProcessMappingScanner-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "984ccda53a85006bfae5feef9ad16ee6", "sha256": "5c96ad0fce3fed1e14607a4848d8eb46bdd75e5bf145ca728bfe47c7a3d537ba" }, "downloads": -1, "filename": "ProcessMappingScanner-2.1.1.tar.gz", "has_sig": false, "md5_digest": "984ccda53a85006bfae5feef9ad16ee6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17852, "upload_time": "2016-11-26T04:58:13", "url": "https://files.pythonhosted.org/packages/42/e4/7b16cba0db60dbc297aa5a5412047527e21b72f4d2e9202b53aef38dd2d4/ProcessMappingScanner-2.1.1.tar.gz" } ], "2.1.2": [ { "comment_text": "", "digests": { "md5": "a776103d3d46ff1a5efec5e0f785c3f0", "sha256": "dd4b7ee8f4cedd2d681483687cd92da6e6c1e0bdefb99ced56ac967531be9d97" }, "downloads": -1, "filename": "ProcessMappingScanner-2.1.2.tar.gz", "has_sig": false, "md5_digest": "a776103d3d46ff1a5efec5e0f785c3f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17927, "upload_time": "2016-11-26T05:06:48", "url": "https://files.pythonhosted.org/packages/3b/a9/362245f6815715494ef603c875f54feeba9a728c60da816b9ece5f48e3ca/ProcessMappingScanner-2.1.2.tar.gz" } ], "2.2.1": [ { "comment_text": "", "digests": { "md5": "03d6403dc23416ab129e3e2bb50efc08", "sha256": "20559972d6c880dfa9b3d7da0645cd4f97a2ad4e968c72d594623aaecba195c8" }, "downloads": -1, "filename": "ProcessMappingScanner-2.2.1.tar.gz", "has_sig": false, "md5_digest": "03d6403dc23416ab129e3e2bb50efc08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12972, "upload_time": "2017-06-11T04:58:48", "url": "https://files.pythonhosted.org/packages/52/87/78b4d0ffb27a78758055059e36e0833a4bc400d04a1e0b3d4faecddb920e/ProcessMappingScanner-2.2.1.tar.gz" } ], "2.2.2": [ { "comment_text": "", "digests": { "md5": "d6e085c12355c24a6bcebc058fa48ee1", "sha256": "d11d317bf244ce3692ad9f59303601c1ec0a1736456bd1f7561dbc41b13b890e" }, "downloads": -1, "filename": "ProcessMappingScanner-2.2.2.tar.gz", "has_sig": false, "md5_digest": "d6e085c12355c24a6bcebc058fa48ee1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13383, "upload_time": "2017-06-11T05:21:52", "url": "https://files.pythonhosted.org/packages/3c/b5/bad4c6f8385486beb62d1af1a6bcdc9c345d5eac2639138b527884bb9548/ProcessMappingScanner-2.2.2.tar.gz" } ], "2.3.2": [ { "comment_text": "", "digests": { "md5": "23b80eea4747f53a537462b0c3d6daa0", "sha256": "adab9033e2eec465cb69265de32830b886b4345bb5d2ed224db32ef011a89796" }, "downloads": -1, "filename": "ProcessMappingScanner-2.3.2.tar.gz", "has_sig": false, "md5_digest": "23b80eea4747f53a537462b0c3d6daa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13384, "upload_time": "2017-06-11T06:01:54", "url": "https://files.pythonhosted.org/packages/0b/7f/79e2a29a48c8889bd222d0989796b18dd706a18c9362ea0fffea83b9debc/ProcessMappingScanner-2.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "23b80eea4747f53a537462b0c3d6daa0", "sha256": "adab9033e2eec465cb69265de32830b886b4345bb5d2ed224db32ef011a89796" }, "downloads": -1, "filename": "ProcessMappingScanner-2.3.2.tar.gz", "has_sig": false, "md5_digest": "23b80eea4747f53a537462b0c3d6daa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13384, "upload_time": "2017-06-11T06:01:54", "url": "https://files.pythonhosted.org/packages/0b/7f/79e2a29a48c8889bd222d0989796b18dd706a18c9362ea0fffea83b9debc/ProcessMappingScanner-2.3.2.tar.gz" } ] }