-1

Been working on a code that pulls information on the network, BSSID and system info. I would am going to be turning this into an .exe for work but I am having trouble adding user input to choose the path?

import subprocess

netinfo = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in netinfo if "All User Profile" in i]
for i in profiles:
    results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8').split('\n')
    results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
    try:
        print ("{:<30}|  {:<}".format(i, results[0]),file=open(/Desktop/wlanpass.txt", "a"))
    except IndexError:
        print ("{:<30}|  {:<}".format(i, ""))
input("")

I was thinking about adding an input option but not sure how this would work with user input? Do I need to add a Tkinter pop up or would it be the same as VBA where the file path opens up?

Thank you

Ooo
  • 39
  • 9
  • This question was already asked: https://stackoverflow.com/questions/9319317/quick-and-easy-file-dialog-in-python – MaKaNu Jul 14 '20 at 12:15

1 Answers1

2

Tkinter is a good option if you are thinking of converting this into an executable.

You can use a code similar to this:

from tkinter import Tk
from tkinter.filedialog import askopenfilenames, askdirectory
Tk().withdraw()
assets_folder_name = askdirectory()

This opens a dialog for your users to choose a directory. You can also ask for filenames using the "askopenfilenames" command. Using the "os" module you can essentially do a lot of things with users files.

analytical_prat
  • 842
  • 12
  • 14