Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import tkinter as tk
- from tkinter import ttk
- from tkinter import scrolledtext
- from tkinter import messagebox
- from tkinter import filedialog
- import os
- # Create a Tkinter window
- window = tk.Tk()
- window.geometry("1000x680")
- window.configure(bg="#336699")
- window.title("Windows Information PC Management Tool")
- # Function to execute shell commands
- def run_command(command):
- try:
- if command.startswith(('dir ', 'WHERE ', 'ping ', 'wmic ', 'assoc ', 'break ', 'call ', 'cd ', 'chdir ', 'cls ', 'color ', 'copy ', 'date ', 'del ', 'erase ', 'dir ', 'echo ', 'exit ', 'mkdir ', 'mklink ', 'move ', 'rd ', 'rmdir ', 'ren ', 'rename ', 'rmdir ', 'set ', 'setlocal ', 'shift ', 'start ', 'time ', 'title ', 'ver ', 'vol ', 'netsh ')):
- # Use os.system for commands like dir, WHERE, ping, wmic, and cmd commands
- result = os.popen(command).read()
- elif command.startswith('help'):
- # For 'help' command, execute 'cmd /c help' to get help info
- result = subprocess.run(['cmd', '/c', 'help'], capture_output=True, text=True, check=True).stdout.strip()
- else:
- # Use subprocess.run for other commands
- result = subprocess.run(command, capture_output=True, text=True, shell=True, check=True).stdout.strip()
- return result
- except subprocess.CalledProcessError as e:
- messagebox.showerror("Error", f"Command failed: {e.stderr}")
- except FileNotFoundError:
- messagebox.showerror("Error", "Executable file not found. Please check your command.")
- return None
- # Function to display selected command result
- def execute_selected_command():
- selected_command = command_options.get()
- if selected_command:
- output_text.delete(1.0, tk.END) # Clear previous output
- result = run_command(selected_command)
- if result:
- output_text.insert(tk.END, result)
- else:
- output_text.insert(tk.END, "No data available.")
- # Function to execute custom command
- def execute_custom_command():
- custom_command = custom_command_entry.get()
- if custom_command:
- output_text.delete(1.0, tk.END) # Clear previous output
- result = run_command(custom_command)
- if result:
- output_text.insert(tk.END, result)
- else:
- output_text.insert(tk.END, "No data available.")
- else:
- messagebox.showwarning("Warning", "Please enter a command.")
- # Function to clear the output text field
- def clear_output():
- output_text.delete(1.0, tk.END)
- # Function to save displayed result to a text file
- def save_result():
- result = output_text.get(1.0, tk.END)
- if result.strip():
- file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text files", "*.txt")])
- if file_path:
- with open(file_path, "w") as file:
- file.write(result)
- messagebox.showinfo("Success", "Result saved successfully.")
- else:
- messagebox.showwarning("Warning", "No data to save.")
- # Function to show help.txt
- def show_help():
- # Save help information to Help.txt file
- #run_command('Help >> Help.txt')
- # Read help information from file
- with open("Help.txt", "r") as file:
- help_text = file.read()
- if help_text:
- output_text.delete(1.0, tk.END)
- output_text.insert(tk.END, help_text)
- else:
- output_text.delete(1.0, tk.END)
- output_text.insert(tk.END, "No help available.")
- # Function to delete help.txt
- def delete_help_file():
- try:
- os.remove("Help.txt")
- messagebox.showinfo("Success", "Help.txt deleted successfully.")
- except FileNotFoundError:
- messagebox.showwarning("Warning", "Help.txt not found.")
- # Dropdown list of commands
- commands = [
- # NAJEEB PC TOOLS
- "--[NAJEEB PC TOOLS]--",
- "Everything.exe -?",
- "Everything.exe -search Najeeb",
- "ES.exe -a jpg",
- "START C:\CMDER\TOOLS\LIST.pyw",
- "START C:\CMDER\TOOLS\RENAME-EXT.pyw",
- "START C:\CMDER\TOOLS\ALL-RADIOS.pyw",
- "START C:\CMDER\TOOLS\TOOL.ahk",
- "START C:\CMDER\SOFT\SOFT.ahk",
- "START C:\CMDER\APP\APPS.ahk",
- "START C:\CMDER\TOOLS\TOOLS.txt",
- "START C:\CMDER\SOFT\SOFT.txt",
- "START C:\CMDER\APP\APP.txt",
- "START C:\CMDER\HOME.ahk",
- "START C:\CMDER\TOOLS.ahk",
- "START C:\CMDER\COMMANDER.ahk",
- "START C:\CMDER\CMDR.ahk",
- "START C:\CMDER\CMD.ahk",
- "START C:\CMDER\FFMPEG.ahk",
- "START C:\CMDER\AHK.ahk",
- # NAJEEB PC INFORMATION
- "--[NAJEEB PC INFORMATION]--",
- "systeminfo",
- "msinfo32",
- "DOSKEY /?",
- "START C:/CMDER/BOOK.py",
- "compmgmt.msc",
- "diskmgmt.msc",
- "devmgmt.msc",
- "Control Panel",
- "START shell:AppData",
- "START shell:Startup",
- "START shell:ProgramFiles",
- "START C:/Users/Najeeb/AppData/Local/Temp",
- "START C:\Windows\Prefetch",
- "START C:\Windows\Temp",
- "TZUTIL /L",
- "TZUTIL /G",
- 'TZUTIL /S "Pakistan Standard Time"',
- "getmac",
- "ipconfig /all",
- "net share",
- "netstat -ao",
- "net view",
- "arp -a",
- "ipconfig /displaydns",
- "tracert www.google.com",
- "tasklist",
- "whoami",
- "whoami /priv",
- "net user",
- "cmdkey /list",
- 'dir "C:\\Program Files" >> Help.txt',
- 'dir /S /B /A "C:\\" >> Help.txt',
- 'dir /S /B /A "D:\\" >> Help.txt',
- 'dir /S /B /A "E:\\" >> Help.txt',
- 'dir /S /B /A "F:\\" >> Help.txt',
- 'dir /S /B /A "G:\\" >> Help.txt',
- # COMMANDS ALL BOOKS
- "--[COMMANDS ALL BOOKS]--",
- "START C:\CMDER\BOOKS.pyw",
- "START C:\CMDER\BOOKS\BATCH.txt",
- "START C:\CMDER\BOOKS\CHANNELS.txt",
- "START C:\CMDER\BOOKS\CMD.txt",
- "START C:\CMDER\BOOKS\CMD2.txt",
- "START C:\CMDER\BOOKS\CMDER.txt",
- "START C:\CMDER\BOOKS\COM.txt",
- "START C:\CMDER\BOOKS\DOSKEY.txt",
- "START C:\CMDER\BOOKS\DOSKEY-HELP.txt",
- "START C:\CMDER\BOOKS\ENVIRONMENTAL-VARIABLES.txt",
- "START C:\CMDER\BOOKS\EVERYTHING.txt",
- "START C:\CMDER\BOOKS\FFMPEG.txt",
- "START C:\CMDER\BOOKS\FOLDER.txt",
- "START C:\CMDER\BOOKS\INFO.txt",
- "START C:\CMDER\BOOKS\MAGICK.txt",
- "START C:\CMDER\BOOKS\MOVIES.txt",
- "START C:\CMDER\BOOKS/NIRCMD.txt",
- "START C:\CMDER\BOOKS\PYTHON.txt",
- "START C:\CMDER\BOOKS\RAR.txt",
- "START C:\CMDER\BOOKS\SEARCH.txt",
- "START C:\CMDER\BOOKS\TOOLS.txt",
- "START C:\CMDER\BOOKS\WEB.txt",
- "START C:\CMDER\BOOKS\WGET.txt",
- "START C:\CMDER\BOOKS\WHERE.txt",
- "START C:\CMDER\BOOKS\WMIC.txt",
- "START C:\CMDER\BOOKS\YOUTUBE.txt",
- # NIRCMD Commands
- "--[NIRCMD Commands]--",
- "nircmd.exe emptybin & Exit",
- "nircmd.exe mutesysvolume 1",
- "nircmd.exe mutesysvolume 0",
- 'nircmd.exe loop 10 60000 savescreenshot "~$folder.desktop$\P~$loopcount$.png" & Exit',
- # WGET ALL COMMANDS
- "--[WGET ALL COMMANDS]--",
- "wget --help",
- "wget http://nwhiker.com/wallpaper/wp06.jpg",
- "wget -O Download\1.jpg http://nwhiker.com/wallpaper/wp07.jpg",
- "wget -b http://nwhiker.com/wallpaper/wp08.jpg",
- "wget --limit-rate=100 http://nwhiker.com/wallpaper/wp09.jpg",
- "wget -c http://nwhiker.com/wallpaper/wp01.jpg",
- "wget -i download_list.txt",
- # WHERE ALL COMMANDS
- "--[WHERE ALL COMMANDS]--",
- "WHERE /?",
- 'WHERE /R "c:\\windows" *.exe *.dll *.bat',
- 'WHERE /R C:\\ /F *.exe',
- 'WHERE notepad.exe > Help.txt',
- "WHERE.exe cmd",
- "WHERE.exe *.exe",
- "WHERE.exe /R C:\Windows *.exe",
- "WHERE.exe some_command && echo Command exists || echo Command does not exist",
- "WHERE.exe python.exe",
- "WHERE.exe *.bat",
- "WHERE.exe *.dll",
- "WHERE.exe /R . *.exe",
- "WHERE.exe ipconfig.exe",
- 'WHERE.exe /R "C:\\Program Files" *.exe'
- "WHERE.exe *VIDEOS*",
- # NETSH ALL COMMANDS
- "--[NETSH ALL COMMANDS]--",
- "netsh /?",
- "netsh interface ipv4 show config",
- "netsh wlan export profile folder=. key=clear",
- "netsh interface ipv6 show interfaces",
- "netsh advfirewall show allprofiles",
- "netsh advfirewall firewall show rule name=all",
- "netsh interface show interface",
- "netsh wlan show networks",
- "netsh wlan show drivers",
- "netsh winhttp show proxy",
- "netsh interface tcp show global",
- "netsh interface udp show global",
- "netsh show alias",
- "ping -n 30 google.com",
- "--[WMIC ALL COMMANDS]--",
- # WMIC ALL COMMANDS
- "wmic /?",
- "wmic computersystem list full",
- "wmic startup list full",
- "wmic context",
- "wmic qfe list",
- "wmic product get name",
- 'wmic qfe list | find /c /v ""',
- "wmic cpu get numberofcores",
- 'wmic process where ExecutablePath="C:\\windows\\system32\\notepad.exe" get ProcessId',
- "wmic bios get version",
- "wmic csproduct get name",
- "wmic process list",
- "wmic process get ProcessID,ExecutablePath",
- "wmic CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors",
- "wmic systemslot get slotdesignation,currentusage,description,status",
- "wmic temperature get deviceid,name,status",
- "wmic port get name",
- "wmic bios get serialnumber",
- "wmic cpu get name",
- "wmic os get caption",
- "wmic logicaldisk get caption,description",
- "wmic nic get name,MACAddress",
- "wmic nicconfig get IPAddress,DefaultIPGateway",
- "WMIC os list brief",
- "WMIC product list brief",
- "WMIC diskdrive get model,name,size",
- "WMIC OS GET localdatetime",
- "wmic os get version",
- # CMD Commands
- "--[CMD Commands]--",
- "Help >> Help.txt",
- "assoc /? >> Help.txt",
- "attrib /? >> Help.txt",
- "break /? >> Help.txt",
- "call /? >> Help.txt",
- "cd /? >> Help.txt",
- "chdir /? >> Help.txt",
- "cls /? >> Help.txt",
- "color /? >> Help.txt",
- "copy /? >> Help.txt",
- "DISKPART",
- "date /? >> Help.txt",
- "del /? >> Help.txt",
- "erase /? >> Help.txt",
- "dir /? >> Help.txt",
- "echo /? >> Help.txt",
- "exit /? >> Help.txt",
- "md /? >> Help.txt",
- "mkdir /? >> Help.txt",
- "mklink /? >> Help.txt",
- "move /? >> Help.txt",
- "rd /? >> Help.txt",
- "rmdir /? >> Help.txt",
- "ren /? >> Help.txt",
- "rename /? >> Help.txt",
- "rmdir /? >> Help.txt",
- "set /? >> Help.txt",
- "setlocal /? >> Help.txt",
- "shift /? >> Help.txt",
- "start /? >> Help.txt",
- "time /? >> Help.txt",
- "title /? >> Help.txt",
- "ver/? >> Help.txt",
- "vol /? >> Help.txt"
- # OTHER Commands
- "--[OTHER Commands]--",
- "FFMPEG -h",
- "youtube-dl -h",
- "magick -help",
- "wget --help",
- ]
- # Create dropdown list
- command_options = ttk.Combobox(window, values=commands, state="readonly", width=74, font=("Arial", 12))
- command_options.grid(row=1, column=0, padx=10, pady=(10, 5))
- # Entry field for custom command
- custom_command_entry = tk.Entry(window, width=74, font=("Arial", 12))
- custom_command_entry.grid(row=2, column=0, padx=10, pady=5)
- # Button to execute selected command
- execute_button = tk.Button(window, text="Execute Seleted Command", command=execute_selected_command, fg="White", bg="Blue")
- execute_button.grid(row=1, column=1, padx=10, pady=(10, 5), sticky="w")
- # Button to execute custom command
- execute_custom_button = tk.Button(window, text="Execute Custom Command", command=execute_custom_command, fg="White", bg="Blue")
- execute_custom_button.grid(row=2, column=1, padx=10, pady=5, sticky="w")
- # Button to clear output
- clear_button = tk.Button(window, text="Clear", command=clear_output, fg="white", bg="Red")
- clear_button.grid(row=1, column=2, padx=10, pady=(10, 5), sticky="w")
- # Button to save result
- save_button = tk.Button(window, text="Save Result", command=save_result, fg="white", bg="Green")
- save_button.grid(row=1, column=3, padx=10, pady=(10, 5), sticky="w")
- # Button to show help.txt
- help_button = tk.Button(window, text="Show Help", command=show_help, fg="black", bg="yellow")
- help_button.grid(row=1, column=4, padx=10, pady=(10, 5), sticky="w")
- # Button to delete help.txt
- delete_help_button = tk.Button(window, text="Delete Help", command=delete_help_file, fg="black", bg="orange")
- delete_help_button.grid(row=2, column=4, padx=10, pady=5, sticky="w")
- # Text field to display output
- output_text = scrolledtext.ScrolledText(window, width=107, height=28, wrap=tk.WORD, font=("Arial", 12))
- output_text.grid(row=3, column=0, columnspan=5, padx=10, pady=10, sticky="nsew")
- # Label for the heading
- heading_label = tk.Label(window, text="NAJEEB ALL PC INFORMATION", font=("Arial", 24, "bold"), bg="#336699", fg="white")
- heading_label.grid(row=0, column=0, columnspan=5, pady=(5, 10))
- # Configure grid weights to make the text field expandable
- window.grid_columnconfigure(0, weight=1)
- window.grid_rowconfigure(3, weight=1)
- # Run the Tkinter event loop
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement