Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: is_smb_vulnerable.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- # Additional Script Download: https://pastebin.com/dl/GYB65Yvy
- import subprocess
- import urllib.request
- import os
- """
- This script provides options to:
- 1. Verify the status of SMB1 protocol.
- 2. Download and save 'smb_protocol_manager_eternalblue_vulnerability_checker.py' script in the cwd.
- 0. Exit the script.
- WARNING: Enabling SMB1 is highly insecure and may expose your system to potential attacks.
- Only enable SMB1 for testing purposes and if you understand the risks involved.
- Known exploits that use EternalBlue attack methods:
- 1. WannaCry
- 2. EternalRocks
- 3. Petya
- 4. NotPetya
- 5. Bad Rabbit
- 6. TrickBot
- 7. Emotet
- 8. Ryuk
- 9. GandCrab
- 10. SamSam
- 11. Smominru
- 12. RobbinHood
- 13. Dharma
- The user is prompted to confirm their choice when enabling SMB1.
- Numeric options are provided for the user to choose (e.g., 1 for Yes, 2 for No).
- Note: Changes made to SMB protocols may require system restart to take effect.
- """
- def verify_smb1_status():
- """
- Verify the status of SMB1 protocol.
- This function checks whether SMB1 protocol is enabled or disabled on the system.
- """
- try:
- # Check the value of the SMB1 registry key
- result = subprocess.run(
- [
- "reg",
- "query",
- "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters",
- "/v",
- "SMB1",
- ],
- capture_output=True,
- text=True,
- )
- if "SMB1 REG_DWORD 0x1" in result.stdout:
- print("\nSMB1 is enabled. \n\t\t:: ⚠️ Warning ⚠ ::\n\n\t- Enabling SMB1 exposes your system to potential vulnerabilities such as EternalBlue.\n\n\t- Disable SMB1 with Option 6 or Remove the registry key with Option 7.")
- print("\nYour machine is at risk from vulnerabilities from exploits such as EternalBlue, Petya, NotPetya & many more malicious attacks.")
- print("Select Option 2: Download & Save [SMB Protocol Manager]\n")
- elif "SMB1 REG_DWORD 0x0" in result.stdout:
- print("\nSMB1 is disabled.\n")
- print("\nAll Clear!\nYour machine is not at risk from vulnerabilities from exploits such as EternalBlue, Petya, NotPetya & many more malicious attacks.")
- else:
- print("\nSMB1 status could not be determined or registry key not found on the system.\n")
- except subprocess.CalledProcessError as e:
- print("\nAn error occurred while checking SMB1 status:", e.stderr)
- def download_script(url, filename):
- """
- Download script from the provided URL and save it with the given filename.
- """
- try:
- urllib.request.urlretrieve(url, filename)
- print(f"\nScript downloaded successfully and saved as '{filename}' in the current working directory.\n")
- except Exception as e:
- print(f"\nFailed to download script from '{url}': {e}\n")
- def main():
- while True:
- print(":: [VERIFY SMB VULNERABILITY STATUS] ::\n")
- print("1: Verify SMB1 status")
- print("2: Download & Save [SMB Protocol Manager]")
- print("0: Exit")
- choice = input("\nEnter your choice: ")
- if choice == "1":
- verify_smb1_status()
- elif choice == "2":
- download_script("https://pastebin.com/raw/GYB65Yvy", "smb_protocol_manager_eternalblue_vulnerability_checker.py")
- elif choice == "0":
- print("\nExiting Program...\nGoodbye!\n")
- break
- else:
- print("\nInvalid choice. Please enter a valid option.\n")
- input("\nPress Enter to continue...\n")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement