I am trying to make a simple ping (ping target.com) in a terminal.
The problem is the terminal counts the quotation marks in the string "ping"
. The result of my code now will be:
""ping target.com""
and this will run a error --> ""ping target.com"" is not recognized as an internal or external command
I know that problem is the double mark but I don´t know how to remove the quotation mark from the ping.
Here the code:
target = input('[+] Please put the IP target: ')
ping = subprocess.Popen(["ping " + target], shell=True, stdout=subprocess.PIPE)
out = ping.communicate()[0] #access stdoutdata
print(out)