0

I'm trying to run massdns.exe which is in the same folder as my python file

subprocess.run("dir", shell=True)

output

Volume in drive C has no label.
 Volume Serial Number is A6AB-C832

 Directory of C:\Users\Owner\Desktop\folder1\folder2\massdns

02/02/2020  07:59 PM           251,991 massdns.exe

as you can see, it's in the same folder.

when I try doing subprocess.run(".\massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt", shell=True) it does nothing. While, in the command line window or while in the powershell window, it runs the program as expected.

Things I have tried subprocess.check_output("massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt", shell=True)

subprocess.run(".\massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt", shell=True)

When I do this

subprocess.check_output("massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt", shell=True)

I get this error

subprocess.CalledProcessError: Command 'massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt' returned non-zero exit status 3221225781.
4
  • Have you tried escaping the backslash character? Commented Feb 3, 2020 at 19:19
  • Like this? subprocess.check_output("massdns.exe -r lists\\resolvers.txt -t AAAA -w results.txt generated_domains.txt", shell=True) Just tried it and doesn't seem to work. Commented Feb 3, 2020 at 19:24
  • The backslash, not forward slash. '.\\massdns.exe -r lists/resolvers.txt -t AAAA -w results.txt generated_domains.txt' Commented Feb 3, 2020 at 19:27
  • Ah I see, just tried, still doesn't work I also just tried import os os.system("C:\\Users\\Owner\\Desktop\\folder1\\folder2\\massdns\\massdns.exe") and nothing printed, when I think it should have printed the flags that are required when you use the massdns.exe program.. Commented Feb 3, 2020 at 19:37

1 Answer 1

1

I figured out my problem, which would have been really hard to answer if you weren't in the same room as me. I'm using pycharm and I moved the massdns.exe file into another folder (the same folder I was trying to execute it in python though) and I didn't close my pycharm's command line, which I guess somehow messes with it, I closed pycharm alltogether and ta-da it worked.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.