# reg.exe query to pandas DataFrame
## pip install getregdf
### Tested against Windows 10 / Python 3.10 / Anaconda
This code provides a way to execute multiple registry queries using reg.exe and obtain the results in a structured DataFrame format. It abstracts the process of querying the registry and provides additional functionalities through the custom modules and functions used.
It's interesting for people who need to programmatically retrieve registry information from Windows systems because it allows them to automate the retrieval of registry data and process it in a structured manner using the powerful data manipulation capabilities of Pandas. They can analyze the retrieved registry information, perform further computations or transformations, and integrate it into their workflows or applications.
### Calling the function in Python:
```python
reg_query2df(
regquerys,
bufsize=2048,
timeout=30000000,
max_threads=5,
timeout_check_sleep=1.0,
convert_to_string=True,
):
r"""
Executes registry queries and returns the results as a DataFrame.
Args:
regquerys (str or list): A single registry query string or a list of query strings.
bufsize (int, optional): Buffer size for subprocess communication. Defaults to 2048.
timeout (int, optional): Timeout value for the subprocess execution. Defaults to 30000000.
max_threads (int, optional): Maximum number of threads to use for subprocess execution. Defaults to 5.
timeout_check_sleep (int, float, optional): Sleep duration between timeout checks. Defaults to 1.0.
convert_to_string (int, bool, optional): Convert data from bytes (stdout) to string. Defaults to True
Returns:
pandas.DataFrame: A DataFrame containing the results of the registry queries.
Raises:
None
Example usage:
reg_query2df(
regquerys=[
"HKEY_USERS",
r"HKEY_USERS\S-1-5-18",
r"HKEY_USERS\S-1-5-21-2954889181-1639616918-2495923365-1001\EUDC",
],
bufsize=2048,
timeout=30000000,
max_threads=5,
timeout_check_sleep=1,
)
# print(df[:10].to_string())
# aa_regkey aa_key aa_type aa_value aa_id
# 0 HKEY_USERS\.DEFAULT 0
# 1 HKEY_USERS\.DEFAULT\AppEvents 0
# 2 HKEY_USERS\.DEFAULT\AppEvents\EventLabels 0
# 3 HKEY_USERS\.DEFAULT\AppEvents\EventLabels\MirrorFinished (Default) REG_SZ Mirror Finished 0
# 4 HKEY_USERS\.DEFAULT\AppEvents\Schemes 0
# 5 HKEY_USERS\.DEFAULT\AppEvents\Schemes\Apps 0
# 6 HKEY_USERS\.DEFAULT\AppEvents\Schemes\Apps\WinHTTrack (Default) REG_SZ WinHTTrack Website Copier 0
# 7 HKEY_USERS\.DEFAULT\AppEvents\Schemes\Apps\WinHTTrack\MirrorFinished 0
# 8 HKEY_USERS\.DEFAULT\AppEvents\Schemes\Apps\WinHTTrack\MirrorFinished\.Current (Default) REG_SZ C:\Program Files\WinHTTrack\html\server\sfx\silent.wav 0
# 9 HKEY_USERS\.DEFAULT\AppEvents\Schemes\Apps\WinHTTrack\MirrorFinished\.Default (Default) REG_SZ C:\Program Files\WinHTTrack\html\server\sfx\finished.wav 0
# Slower than the first one: https://github.com/hansalemaos/a_pandas_ex_reg2df
# But key, type, and value are in separated columns
# HKEY_CLASSES_ROOT (HKCR): This key contains file association and COM object registration information.
# HKEY_CURRENT_USER (HKCU): This key stores configuration information for the currently logged-in user.
# HKEY_LOCAL_MACHINE (HKLM): This key contains system-wide configuration settings and information for all users.
# HKEY_USERS (HKU): This key contains user-specific configuration settings for each user profile on the computer.
# HKEY_CURRENT_CONFIG (HKCC): This key provides access to the current hardware profile being used by the computer.
from getregdf import reg_query2df
df = reg_query2df(
regquerys=[
"HKEY_USERS",
r"HKEY_CLASSES_ROOT",
r"HKEY_LOCAL_MACHINE",
r"HKEY_USERS",
r"HKEY_CURRENT_CONFIG",
],
bufsize=2048 * 100,
timeout=30000000,
max_threads=5,
timeout_check_sleep=1,
)
df.to_pickle("c:\\myregexported.pkl")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/getregdf",
"name": "getregdf",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "reg.exe,regedit,pandas",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2e/cc/f5504097decdb9e9efce7d535dd0a60592fbbcfb2c97117d0aa7f4f144f5/getregdf-0.10.tar.gz",
"platform": null,
"description": "# reg.exe query to pandas DataFrame \r\n\r\n## pip install getregdf\r\n\r\n### Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\nThis code provides a way to execute multiple registry queries using reg.exe and obtain the results in a structured DataFrame format. It abstracts the process of querying the registry and provides additional functionalities through the custom modules and functions used.\r\n\r\nIt's interesting for people who need to programmatically retrieve registry information from Windows systems because it allows them to automate the retrieval of registry data and process it in a structured manner using the powerful data manipulation capabilities of Pandas. They can analyze the retrieved registry information, perform further computations or transformations, and integrate it into their workflows or applications.\r\n\r\n### Calling the function in Python:\r\n\r\n\r\n```python\r\nreg_query2df(\r\n regquerys,\r\n bufsize=2048,\r\n timeout=30000000,\r\n max_threads=5,\r\n timeout_check_sleep=1.0,\r\n convert_to_string=True,\r\n):\r\n r\"\"\"\r\n Executes registry queries and returns the results as a DataFrame.\r\n\r\n Args:\r\n regquerys (str or list): A single registry query string or a list of query strings.\r\n bufsize (int, optional): Buffer size for subprocess communication. Defaults to 2048.\r\n timeout (int, optional): Timeout value for the subprocess execution. Defaults to 30000000.\r\n max_threads (int, optional): Maximum number of threads to use for subprocess execution. Defaults to 5.\r\n timeout_check_sleep (int, float, optional): Sleep duration between timeout checks. Defaults to 1.0.\r\n convert_to_string (int, bool, optional): Convert data from bytes (stdout) to string. Defaults to True\r\n\r\n Returns:\r\n pandas.DataFrame: A DataFrame containing the results of the registry queries.\r\n\r\n Raises:\r\n None\r\n\r\n Example usage:\r\n reg_query2df(\r\n regquerys=[\r\n \"HKEY_USERS\",\r\n r\"HKEY_USERS\\S-1-5-18\",\r\n r\"HKEY_USERS\\S-1-5-21-2954889181-1639616918-2495923365-1001\\EUDC\",\r\n ],\r\n bufsize=2048,\r\n timeout=30000000,\r\n max_threads=5,\r\n timeout_check_sleep=1,\r\n )\r\n\r\n # print(df[:10].to_string())\r\n # aa_regkey aa_key aa_type aa_value aa_id\r\n # 0 HKEY_USERS\\.DEFAULT 0\r\n # 1 HKEY_USERS\\.DEFAULT\\AppEvents 0\r\n # 2 HKEY_USERS\\.DEFAULT\\AppEvents\\EventLabels 0\r\n # 3 HKEY_USERS\\.DEFAULT\\AppEvents\\EventLabels\\MirrorFinished (Default) REG_SZ Mirror Finished 0\r\n # 4 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes 0\r\n # 5 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes\\Apps 0\r\n # 6 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes\\Apps\\WinHTTrack (Default) REG_SZ WinHTTrack Website Copier 0\r\n # 7 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes\\Apps\\WinHTTrack\\MirrorFinished 0\r\n # 8 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes\\Apps\\WinHTTrack\\MirrorFinished\\.Current (Default) REG_SZ C:\\Program Files\\WinHTTrack\\html\\server\\sfx\\silent.wav 0\r\n # 9 HKEY_USERS\\.DEFAULT\\AppEvents\\Schemes\\Apps\\WinHTTrack\\MirrorFinished\\.Default (Default) REG_SZ C:\\Program Files\\WinHTTrack\\html\\server\\sfx\\finished.wav 0\r\n\r\n # Slower than the first one: https://github.com/hansalemaos/a_pandas_ex_reg2df\r\n # But key, type, and value are in separated columns\r\n\t\r\n# HKEY_CLASSES_ROOT (HKCR): This key contains file association and COM object registration information.\r\n# HKEY_CURRENT_USER (HKCU): This key stores configuration information for the currently logged-in user.\r\n# HKEY_LOCAL_MACHINE (HKLM): This key contains system-wide configuration settings and information for all users.\r\n# HKEY_USERS (HKU): This key contains user-specific configuration settings for each user profile on the computer.\r\n# HKEY_CURRENT_CONFIG (HKCC): This key provides access to the current hardware profile being used by the computer.\r\n\r\n\r\nfrom getregdf import reg_query2df\r\n\r\ndf = reg_query2df(\r\n regquerys=[\r\n \"HKEY_USERS\",\r\n r\"HKEY_CLASSES_ROOT\",\r\n r\"HKEY_LOCAL_MACHINE\",\r\n r\"HKEY_USERS\",\r\n r\"HKEY_CURRENT_CONFIG\",\r\n ],\r\n bufsize=2048 * 100,\r\n timeout=30000000,\r\n max_threads=5,\r\n timeout_check_sleep=1,\r\n)\r\ndf.to_pickle(\"c:\\\\myregexported.pkl\")\t\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "reg.exe query to pandas DataFrame",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/getregdf"
},
"split_keywords": [
"reg.exe",
"regedit",
"pandas"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eaa14cf3bf95fdc27ddc3bdc1c06bbaab9e3dfb8582d942610ca61b248f8a541",
"md5": "b960a8337e7cc8879cbe92dab64eb090",
"sha256": "7f02c55290f748f307e9e11876bf0e0cf42e761ccd268140994db70e438a07bc"
},
"downloads": -1,
"filename": "getregdf-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b960a8337e7cc8879cbe92dab64eb090",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9175,
"upload_time": "2023-05-17T22:22:39",
"upload_time_iso_8601": "2023-05-17T22:22:39.504349Z",
"url": "https://files.pythonhosted.org/packages/ea/a1/4cf3bf95fdc27ddc3bdc1c06bbaab9e3dfb8582d942610ca61b248f8a541/getregdf-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2eccf5504097decdb9e9efce7d535dd0a60592fbbcfb2c97117d0aa7f4f144f5",
"md5": "9c31e7855d9c35c6551738c4da477d4e",
"sha256": "bb951af0c72853cbfa03131c9ce7f1abc34fe2f30ddc2f2c32b7cf770efcef69"
},
"downloads": -1,
"filename": "getregdf-0.10.tar.gz",
"has_sig": false,
"md5_digest": "9c31e7855d9c35c6551738c4da477d4e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6707,
"upload_time": "2023-05-17T22:22:41",
"upload_time_iso_8601": "2023-05-17T22:22:41.747535Z",
"url": "https://files.pythonhosted.org/packages/2e/cc/f5504097decdb9e9efce7d535dd0a60592fbbcfb2c97117d0aa7f4f144f5/getregdf-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-17 22:22:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "getregdf",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "a_pandas_ex_df_to_string",
"specs": []
},
{
"name": "a_pandas_ex_fastloc",
"specs": []
},
{
"name": "flatten_everything",
"specs": []
},
{
"name": "multisubprocess",
"specs": []
},
{
"name": "pandas",
"specs": []
}
],
"lcname": "getregdf"
}