Skip to content

Commit

Permalink
v2.0.10
Browse files Browse the repository at this point in the history
---------
    - update jupyter notebook
    - set secrets for pypi upload
  • Loading branch information
bitranox committed Jul 21, 2023
1 parent 5b6fd2b commit c06f3d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib_registry.ipynb
@@ -1 +1 @@
{"cells":[{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# update pip and setuptools\nimport sys\n!{sys.executable} -m pip install --upgrade pip\n!{sys.executable} -m pip install --upgrade setuptools\n\n# install lib_registry from pypi\n!{sys.executable} -m pip install --upgrade lib_registry\n\n# install lib_registry from github\n!{sys.executable} -m pip install --upgrade git+https://github.com/bitranox/lib_registry.git","execution_count":1,"outputs":[{"output_type":"stream","text":"Requirement already satisfied: pip in /srv/conda/envs/notebook/lib/python3.10/site-packages (23.1.2)\nCollecting pip\n Downloading pip-23.2-py3-none-any.whl (2.1 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m15.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[?25hInstalling collected packages: pip\n Attempting uninstall: pip\n Found existing installation: pip 23.1.2\n Uninstalling pip-23.1.2:\n Successfully uninstalled pip-23.1.2\nSuccessfully installed pip-23.2\nRequirement already satisfied: setuptools in /srv/conda/envs/notebook/lib/python3.10/site-packages (67.7.2)\nCollecting setuptools\n Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl.metadata\n Downloading setuptools-68.0.0-py3-none-any.whl.metadata (6.4 kB)\nDownloading setuptools-68.0.0-py3-none-any.whl (804 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m804.0/804.0 kB\u001b[0m \u001b[31m14.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n\u001b[?25hInstalling collected packages: setuptools\n Attempting uninstall: setuptools\n Found existing installation: setuptools 67.7.2\n Uninstalling setuptools-67.7.2:\n Successfully uninstalled setuptools-67.7.2\nSuccessfully installed setuptools-68.0.0\nCollecting lib_registry\n Downloading lib_registry-2.0.7-py3-none-any.whl (18 kB)\nRequirement already satisfied: click in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib_registry) (8.1.6)\nRequirement already satisfied: cli-exit-tools in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib_registry) (1.2.6)\nRequirement already satisfied: fake-winreg in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib_registry) (1.6.3)\nRequirement already satisfied: lib-detect-testenv in /srv/conda/envs/notebook/lib/python3.10/site-packages (from cli-exit-tools->lib_registry) (2.0.8)\nRequirement already satisfied: wrapt in /srv/conda/envs/notebook/lib/python3.10/site-packages (from fake-winreg->lib_registry) (1.15.0)\nInstalling collected packages: lib_registry\nSuccessfully installed lib_registry-2.0.7\nCollecting git+https://github.com/bitranox/lib_registry.git\n Cloning https://github.com/bitranox/lib_registry.git to /tmp/pip-req-build-84m5oidu\n Running command git clone --filter=blob:none --quiet https://github.com/bitranox/lib_registry.git /tmp/pip-req-build-84m5oidu\n Resolved https://github.com/bitranox/lib_registry.git to commit 21f3ad47b50f7411b799fb99f0bf665bb61f60f6\n Installing build dependencies ... \u001b[?25ldone\n\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n\u001b[?25h Installing backend dependencies ... \u001b[?25ldone\n\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n\u001b[?25hRequirement already satisfied: click in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib-registry==2.0.9) (8.1.6)\nRequirement already satisfied: cli-exit-tools in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib-registry==2.0.9) (1.2.6)\nRequirement already satisfied: fake-winreg in /srv/conda/envs/notebook/lib/python3.10/site-packages (from lib-registry==2.0.9) (1.6.3)\nRequirement already satisfied: lib-detect-testenv in /srv/conda/envs/notebook/lib/python3.10/site-packages (from cli-exit-tools->lib-registry==2.0.9) (2.0.8)\nRequirement already satisfied: wrapt in /srv/conda/envs/notebook/lib/python3.10/site-packages (from fake-winreg->lib-registry==2.0.9) (1.15.0)\nBuilding wheels for collected packages: lib-registry\n Building wheel for lib-registry (pyproject.toml) ... \u001b[?25ldone\n\u001b[?25h Created wheel for lib-registry: filename=lib_registry-2.0.9-py3-none-any.whl size=19191 sha256=6161fb712f11f20bddc3eef4120fa9c4ce3d657213da4c41ba40dc3fe30b569a\n Stored in directory: /tmp/pip-ephem-wheel-cache-ua8g3d31/wheels/59/7f/63/95d6713b0d44c68a8af5f994ee8b116ad2209c4c53a4d93b22\nSuccessfully built lib-registry\nInstalling collected packages: lib-registry\n Attempting uninstall: lib-registry\n Found existing installation: lib-registry 2.0.7\n Uninstalling lib-registry-2.0.7:\n Successfully uninstalled lib-registry-2.0.7\nSuccessfully installed lib-registry-2.0.9\n","name":"stdout"}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# please be noted that the lib_registry interface will change (a lot) in the future, to offer pathlib-like\n# behaviour, as well as context managers, etc.\n\n# this version is fully functional however and allows to read / write / query the windows registry\n# here a few examples !\n\n# lib_registry is using fake_winreg to simulate a windows registry on linux, so this is possible here on jupyter.\nfrom lib_registry import *\nregistry=Registry()","execution_count":2,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# query values - there are only a few values set in the fake registry You can query here.\n# on Your windows machine of course You can query all values You have permission for.\nregistry.get_value(key='HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', value_name='CurrentBuild')","execution_count":3,"outputs":[{"output_type":"execute_result","execution_count":3,"data":{"text/plain":"'18363'"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# all subkeys, values, etc use generator objects\nregistry.subkeys(winreg.HKEY_USERS)","execution_count":4,"outputs":[{"output_type":"execute_result","execution_count":4,"data":{"text/plain":"<generator object Registry.subkeys at 0x7f81a6a3ab20>"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# so lets make a list of all subkeys of HKEY_USERS\nlist(registry.subkeys(winreg.HKEY_USERS))","execution_count":5,"outputs":[{"output_type":"execute_result","execution_count":5,"data":{"text/plain":"['.DEFAULT',\n 'S-1-5-18',\n 'S-1-5-19',\n 'S-1-5-20',\n 'S-1-5-21-206651429-2786145735-121611483-1001',\n 'S-1-5-21-206651429-2786145735-121611483-1001_Classes']"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# create a key - pathlib like options (in preparation to pathlib-like behaviour)\ntestkey=r'HKCU\\\\Software\\\\lib_registry_test'\nreg_handle = registry.create_key(testkey, exist_ok=True, parents=True)","execution_count":6,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# set a value, REG_TYPE can be given or is automatically set\nbinary_test_value=(chr(128512) * 10).encode('utf-8')\nregistry.set_value(testkey, value_name='test_string', value='HAM')\nregistry.set_value(testkey, value_name='test_multi_string', value=['HAM', 'SPAM'])\nregistry.set_value(testkey, value_name='test_int', value=42)\nregistry.set_value(testkey, value_name='test_binary', value=binary_test_value)\nregistry.set_value(testkey, value_name='test_none', value=None)","execution_count":7,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a string value from the Registry\nregistry.get_value(testkey, value_name='test_string')","execution_count":8,"outputs":[{"output_type":"execute_result","execution_count":8,"data":{"text/plain":"'HAM'"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a multi-string value from the Registry\nregistry.get_value(testkey, value_name='test_multi_string')","execution_count":9,"outputs":[{"output_type":"execute_result","execution_count":9,"data":{"text/plain":"['HAM', 'SPAM']"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a int value from the Registry\nregistry.get_value(testkey, value_name='test_int')","execution_count":10,"outputs":[{"output_type":"execute_result","execution_count":10,"data":{"text/plain":"42"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a binary value from the Registry\nregistry.get_value(testkey, value_name='test_binary')","execution_count":11,"outputs":[{"output_type":"execute_result","execution_count":11,"data":{"text/plain":"b'\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80\\xf0\\x9f\\x98\\x80'"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# get a None value from the Registry\nstr(registry.get_value(testkey, value_name='test_none'))","execution_count":12,"outputs":[{"output_type":"execute_result","execution_count":12,"data":{"text/plain":"'None'"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# delete a value from the registry\nregistry.delete_value(testkey, value_name='test_string')","execution_count":13,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# delete a key from the registry\nregistry.delete_key(testkey)","execution_count":14,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# function to get SID's (Secure ID)\nlist(registry.sids())\n","execution_count":15,"outputs":[{"output_type":"execute_result","execution_count":15,"data":{"text/plain":"['S-1-5-18',\n 'S-1-5-19',\n 'S-1-5-20',\n 'S-1-5-21-206651429-2786145735-121611483-1001']"},"metadata":{}}]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# function to get the username from a SID\nfor sid in registry.sids():\n print(registry.username_from_sid(sid))","execution_count":16,"outputs":[{"output_type":"stream","text":"systemprofile\nLocalService\nNetworkService\nbitranox\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"language_info":{"name":"python","version":"3.10.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"}},"nbformat":4,"nbformat_minor":4}
{"cells":[{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true,"scrolled":false},"cell_type":"code","source":"# update pip and setuptools\nimport sys\n!{sys.executable} -m pip install --upgrade pip\n!{sys.executable} -m pip install --upgrade setuptools\n\n# install lib_registry from pypi\n!{sys.executable} -m pip install --upgrade lib_registry\n\n# install lib_registry from github\n!{sys.executable} -m pip install --upgrade git+https://github.com/bitranox/lib_registry.git","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# please be noted that the lib_registry interface will change (a lot) in the future, to offer pathlib-like\n# behaviour, as well as context managers, etc.\n\n# this version is fully functional however and allows to read / write / query the windows registry\n# here a few examples !\n\n# lib_registry is using fake_winreg to simulate a windows registry on linux, so this is possible here on jupyter.\nfrom lib_registry import *\nregistry=Registry()","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# query values - there are only a few values set in the fake registry You can query here.\n# on Your windows machine of course You can query all values You have permission for.\nregistry.get_value(key='HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', value_name='CurrentBuild')","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# all subkeys, values, etc use generator objects\nregistry.subkeys(winreg.HKEY_USERS)","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# so lets make a list of all subkeys of HKEY_USERS\nlist(registry.subkeys(winreg.HKEY_USERS))","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# create a key - pathlib like options (in preparation to pathlib-like behaviour)\ntestkey='HKCU\\\\Software\\\\lib_registry_test'\nreg_handle = registry.create_key(testkey, exist_ok=True, parents=True)","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# set a value, REG_TYPE can be given or is automatically set\nbinary_test_value=(chr(128512) * 10).encode('utf-8')\nregistry.set_value(testkey, value_name='test_string', value='HAM')\nregistry.set_value(testkey, value_name='test_multi_string', value=['HAM', 'SPAM'])\nregistry.set_value(testkey, value_name='test_int', value=42)\nregistry.set_value(testkey, value_name='test_binary', value=binary_test_value)\nregistry.set_value(testkey, value_name='test_none', value=None)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a string value from the Registry\nregistry.get_value(testkey, value_name='test_string')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a multi-string value from the Registry\nregistry.get_value(testkey, value_name='test_multi_string')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a int value from the Registry\nregistry.get_value(testkey, value_name='test_int')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get a binary value from the Registry\nregistry.get_value(testkey, value_name='test_binary')","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# get a None value from the Registry\nstr(registry.get_value(testkey, value_name='test_none'))","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# delete a value from the registry\nregistry.delete_value(testkey, value_name='test_string')","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# delete a key from the registry\nregistry.delete_key(testkey)","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# function to get SID's (Secure ID)\nlist(registry.sids())\n","execution_count":null,"outputs":[]},{"metadata":{"pycharm":{"name":"#%%\n"},"trusted":true},"cell_type":"code","source":"# function to get the username from a SID\nfor sid in registry.sids():\n print(registry.username_from_sid(sid))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"language_info":{"name":"python","version":"3.10.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"}},"nbformat":4,"nbformat_minor":4}

0 comments on commit c06f3d2

Please sign in to comment.