py-win-ban-hyperv 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_win_ban_hyperv-0.1.0/LICENSE +21 -0
- py_win_ban_hyperv-0.1.0/PKG-INFO +46 -0
- py_win_ban_hyperv-0.1.0/README.md +27 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/__init__.py +5 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/__main__.py +15 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/ban_hyperv.ps1 +56 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/core.py +10 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/DG_Readiness_Tool_v3.6.ps1 +1539 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/DefaultWindows_Audit.xml +265 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/DefaultWindows_Audit_sipolicy.p7b +0 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/DefaultWindows_Enforced.xml +262 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/DefaultWindows_Enforced_sipolicy.p7b +0 -0
- py_win_ban_hyperv-0.1.0/py_win_ban_hyperv/dgreadiness_v3.6/ReadMe.txt +99 -0
- py_win_ban_hyperv-0.1.0/pyproject.toml +18 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GGN_2015
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-win-ban-hyperv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Used to disable Hyper-V virtualization on Windows systems
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: GGN_2015
|
|
8
|
+
Author-email: neko@jlulug.org
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Dist: py-admin-launch (>=0.1.3)
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# py-win-ban-hyperv
|
|
20
|
+
|
|
21
|
+
Used to disable Hyper-V virtualization on Windows systems.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
pip install py-win-ban-hyperv
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
CLI:
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
# you need to reboot after running this script
|
|
35
|
+
python -m py_win_ban_hyperv
|
|
36
|
+
|
|
37
|
+
# schedule a reboot for you after done (in 30s)
|
|
38
|
+
python -m py_win_ban_hyperv --reboot
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Python Code:
|
|
42
|
+
```python
|
|
43
|
+
from py_win_ban_hyperv import ban_hyper_v
|
|
44
|
+
ban_hyper_v(reboot=False) # or, reboot=True
|
|
45
|
+
```
|
|
46
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# py-win-ban-hyperv
|
|
2
|
+
|
|
3
|
+
Used to disable Hyper-V virtualization on Windows systems.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
pip install py-win-ban-hyperv
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
CLI:
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
# you need to reboot after running this script
|
|
17
|
+
python -m py_win_ban_hyperv
|
|
18
|
+
|
|
19
|
+
# schedule a reboot for you after done (in 30s)
|
|
20
|
+
python -m py_win_ban_hyperv --reboot
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Python Code:
|
|
24
|
+
```python
|
|
25
|
+
from py_win_ban_hyperv import ban_hyper_v
|
|
26
|
+
ban_hyper_v(reboot=False) # or, reboot=True
|
|
27
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from . import ban_hyper_v
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
yn_inp = ""
|
|
6
|
+
while yn_inp == "" or yn_inp[0] not in ["y", "n"]:
|
|
7
|
+
yn_inp = input("Are you sure to ban hyperV (y/N):").lower().strip()
|
|
8
|
+
|
|
9
|
+
if yn_inp[0] == "y":
|
|
10
|
+
reboot = "--reboot" in sys.argv
|
|
11
|
+
ban_hyper_v(reboot)
|
|
12
|
+
else:
|
|
13
|
+
print("Operation Abort.")
|
|
14
|
+
|
|
15
|
+
main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
echo "+================================================+"
|
|
2
|
+
echo "+ py-win-ban-hyperv: v0.1.0 +"
|
|
3
|
+
echo "+================================================+"
|
|
4
|
+
echo ""
|
|
5
|
+
|
|
6
|
+
Set-Location -LiteralPath $PSScriptRoot
|
|
7
|
+
|
|
8
|
+
echo "Disabling the Windows hypervisor launch at boot for the current boot entry."
|
|
9
|
+
bcdedit /set "{current}" hypervisorlaunchtype off
|
|
10
|
+
echo ""
|
|
11
|
+
|
|
12
|
+
echo "Disabling Virtualization-Based Security in Device Guard settings."
|
|
13
|
+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v EnableVirtualizationBasedSecurity /t REG_DWORD /d 0 /f
|
|
14
|
+
echo ""
|
|
15
|
+
|
|
16
|
+
echo "Disabling required platform security features for Device Guard."
|
|
17
|
+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v RequirePlatformSecurityFeatures /t REG_DWORD /d 0 /f
|
|
18
|
+
echo ""
|
|
19
|
+
|
|
20
|
+
echo "Disabling Hypervisor-Enforced Code Integrity."
|
|
21
|
+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v Enabled /t REG_DWORD /d 0 /f
|
|
22
|
+
echo ""
|
|
23
|
+
|
|
24
|
+
echo "Disabling Credential Guard through the LSA configuration flag."
|
|
25
|
+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags /t REG_DWORD /d 0 /f
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
echo "Disabling all Microsoft Hyper-V optional features."
|
|
29
|
+
dism /online /disable-feature /featurename:Microsoft-Hyper-V-All /norestart
|
|
30
|
+
echo ""
|
|
31
|
+
|
|
32
|
+
echo "Disabling the Virtual Machine Platform optional feature."
|
|
33
|
+
dism /online /disable-feature /featurename:VirtualMachinePlatform /norestart
|
|
34
|
+
echo ""
|
|
35
|
+
|
|
36
|
+
echo "Disabling the Windows Hypervisor Platform optional feature."
|
|
37
|
+
dism /online /disable-feature /featurename:HypervisorPlatform /norestart
|
|
38
|
+
echo ""
|
|
39
|
+
|
|
40
|
+
echo "Disabling the Windows Sandbox optional feature."
|
|
41
|
+
dism /online /disable-feature /featurename:Containers-DisposableClientVM /norestart
|
|
42
|
+
echo ""
|
|
43
|
+
|
|
44
|
+
echo "Allowing scripts to run in this PowerShell process only."
|
|
45
|
+
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
46
|
+
echo ""
|
|
47
|
+
|
|
48
|
+
echo "Running the Device Guard and Credential Guard readiness tool to disable DG/CG."
|
|
49
|
+
& .\dgreadiness_v3.6\DG_Readiness_Tool_v3.6.ps1 -Disable
|
|
50
|
+
echo ""
|
|
51
|
+
|
|
52
|
+
echo "Done. Please reboot to validate the settings."
|
|
53
|
+
if ($args[0] -eq "True") {
|
|
54
|
+
shutdown -r -t 30
|
|
55
|
+
}
|
|
56
|
+
pause
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import py_admin_launch
|
|
2
|
+
import os
|
|
3
|
+
DIRNOW = os.path.dirname(os.path.abspath(__file__))
|
|
4
|
+
BAN_HYPERV_PS1 = os.path.join(DIRNOW, "ban_hyperv.ps1")
|
|
5
|
+
|
|
6
|
+
def ban_hyper_v(reboot:bool):
|
|
7
|
+
py_admin_launch.launch(["powershell", BAN_HYPERV_PS1, str(reboot)], cwd=DIRNOW)
|
|
8
|
+
|
|
9
|
+
if __name__ == "__main__":
|
|
10
|
+
ban_hyper_v(True)
|