Forum Thread: How Can I Run Python Scripts?

So my question is,

lets say I one day somehow made a script to do something (i.e. script that searches for key words and updates a online page I keep data on),

How do I run the script?

(I know Python doesn't have a compiler, so how would I run the script? Is there a program in Kali that lets me run scripts?)

--------

Another thing,

Whats the difference between Internal and External IPs? (aside from one being within a network, and one being someplace else)

Do they serve different purposes? If External IPs are used for a lot of stuff on the internet, wouldn't Internal be pointless?

Thanks

4 Responses

To run a python script, there are two ways. You can save the file with the .py extension then execute it by navigating to it and entering 'python file.py'.

Or, at the top of the file you can set the interpreter path using the shebang, this would look like '#! /usr/bin/python'. Then you'd have to give it execute permissions using the chmod command. It would then be executed by navigating to it and entering './filename'. With this method, the .py file extension is not necessary.

-Defalt

Good answer, The Defalt, our resident Python expert. Check out his excellent series, "Training your Python".

As for the IP question, there are external or public IP's and internal or private IP's. External are routeable around the Internet, internal are not. We have internal IP's because IPv4 has only 4.3 billion IP addresses. That is not enough to for all the IP addresses for all the devices, so to conserve IP's, we use internal IP addresses and only use external IP's when we need to route through the Internet. IPv6 will resolve this issue and there will be no more internal IP's.

Thanks for the answers Defalt and OTW

another question, hope my questions aren't getting annoying

Are all python programs script? or only the ones that run and work with online stuff?

thanks again

Yes, python programs are scripts. This is because python is an interpreted language.

-Defalt

Share Your Thoughts

  • Hot
  • Active