0

How do I locate the local IP of my machine then store it in a variable ready to call it and used when I run the cmd.exe using the os.system

So I basically want to open the shell and run a network mapping software ( which I have done). I want it to include the IP address that is now stored in the variable so that the shell command will say ("nmap" >the IP goes here)

python 3.9

  • 1
    Does this answer your question? [Finding local IP addresses using Python's stdlib](https://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib) – StardustGogeta Jul 13 '21 at 17:15
  • Which local IP? An IP address identifies a network interface, and a machine can have multiple interfaces. – chepner Jul 13 '21 at 17:16
  • Just the current IP the IPv4 of the current machine that identifies it on the network. Don't no why they say this has been answered as that's not true. I no how to get the IP, but want it to be stored in a variable so can call it when using nmap. So it will open a Windows shell(CMD) and type NMAP (The IP would go here). Everything else. Works fine but can't get it stored and called because it just prints out the line of text because it's all in the same line of code once it calls a shell. – CyberCypher0x0 Jul 15 '21 at 13:42

0 Answers0