Skip to main content

A Modern Python wrapper for the Windows registry

Project description

“Use the Windows Registry like a king”
A Modern Python wrapper for the Windows Registry (wrapping winreg)
Python Windows Registry Module
Access Registry like a dict

Install

pip install winregal

Usage

Use winregal.RegKey along with the ‘with’ statement to access any key of your choice. winregal handles key opening and closing for you and makes iteration really simple.

Get a Key hierarchy with all values as a dictionary

Example : Print Putty sessions

In[2]: from winregal import RegKey
In[3]: with RegKey("HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions") as key:
...     print(key.to_dict())
...
{'Server1: {'UserName': u'user', 'HostName': u'192.168.48.131', ... },
 'Server2': {'UserName': u'user', 'HostName': u'192.168.48.132', ... }}

Iterate over Key hierarchy handling only values

Example : Print most recently run commands(RunMru)

In[1]: with RegKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU") as key:
...     for item in key:
...         if isinstance(item, RegValue):
...             print(item.name, item.data)
...
('a', u'cmd\\1')
('b', u'winword\\1')
('c', u'notepad\\1')
('d', u'control\\1')
('e', u'regedit\\1')
('f', u'calc\\1')
('j', u'notepad++\\1')

Directly access a value / key

In[10]: with RegKey(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerRunMRU”) as key: … print(key[‘a’].data) … cmd1

Next in module Development

  • Support ConnectRegistry (via RegKey.__init__)

  • Wrap Edit/Save/Delete operations: e.g. CreateKey, DeleteKey, DeleteValue, SetValue, SaveKey

Contact me (py@bitweis.com) if you need these anytime soon.

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

winregal-1.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

winregal-1.0.1-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file winregal-1.0.1.tar.gz.

File metadata

  • Download URL: winregal-1.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for winregal-1.0.1.tar.gz
Algorithm Hash digest
SHA256 15f6c953fca69b9df186ae736c0acb8b6b56b99cd84571f8a60c2b784d74968d
MD5 ead0cb681882f82cbdcdd3a63e42d3cd
BLAKE2b-256 bfc49e869bcdcceea231001cbaefc71a0d6e2d4c00c858ad99bba73121021eff

See more details on using hashes here.

File details

Details for the file winregal-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for winregal-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6f29127fbdb4184a8fa8ba7711b661a7d965bb0ec4691d1cebaa82dec42ef2eb
MD5 54e1bf7cc0f062269f2cf395e619a91d
BLAKE2b-256 4cd7dec3a6aaf8678b30a56563f9449b9e0e3cfa5830ce0ca40c30cfe9bce66a

See more details on using hashes here.

Supported by

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