Renaissance Quanta FreeBSD InfoSec Programming Cats Miscellaneous
Python Perl Bourne

Python

What is Python

What does Python look like

My Scripts

What is Python?

Python is a high-level, interpreted scripting language, much like Perl. I had the opportunity to learn and use this language after I finished graduate school, which was a good four years after I had started programming. This is somewhat unforunate, as Python is an excellent beginner's langauge. The white-space It is a very straight-forward langauge, and is easy to learn. There are several key advantages, including:

Back to the top

What does Python look like?

Here is the obligitory "Hello World" script:

aristotle10:26pm[1]> python - Eric
Python 2.1.1 (#1, Nov 22 2001, 19:20:19)
[GCC 2.95.3 [FreeBSD] 20010315 (release)] on freebsd4
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> username = sys.argv[1]
>>> print "Hello World, ", username, "!"
Hello World, Eric !

Several things are being exemplified here. The first is the command-line intepreter. The above is an exact copy of a session I just threw together in a terminal window. I simply opened aterm, typed python - Eric to launch the Python interpreter. The "-" flag told Python to stay in command-line mode, taking "Eric" as an argument, rather than trying to execute some script named "Eric".

After entering the interpreter I imported the sys module, which has a pre-defined list called argv. This list contains the program name in element 0, and then all of the arguments passed to the script in the remaining elements.

In that same line, I created a variable called username and made it a reference to the value held by sys.argv[1].

In the last line of the script, I told Python to print to STDOUT the string "Hello World, ", username, "!". It then grabbed the value referenced by username.

At this point, if you have any more questions about Python, or are interested in learning how to actually write Python scripts, you should probably go here. The Python website has lots of great documentation and an outstanding tutorial. If you're interested in the scripts I've written, just proceed to the next section.

Back to the top

My Scripts

Below you will find all of the scripts I've writen on my own time which are worth publishing to the world. For the record, they are all released under the GNU Public License. Please feel free to download my stuff, use it, take it apart and figure out how it works, add to it, change it, or just ignore it. Whatever you do, please don't hesitate to give me your feed back, but please be sure to abide by the GPL.

There will be more to come, soon (I hope!)

NmapViewer
NmapViewer is a little Python/GTK application to make it easier to grok the results from a larger Nmap scan. Lots of room for improvement here, and I may get to such later, as I find time.
Makeregex
makeregex is a very small python script I wrote which takes any string passed to it as an argument and creates a [Rr][Ee][Gg][Uu][Ll][Aa][Rr] [Ee][Xx][Pp][Rr][Ee][Ss][Ss][Ii][Oo][Nn] that matches any case combination of the letters in the strings passed. It prints the result to STDOUT. Just a note, it collapses spaces.
Ticker
PyTicker is a little Python script which uses PyGTK to produce a small, scrolling ticker. Use your windowmanager to remove the border elements. Eventually, I'll figure out how to make this a Gnome panel applet. It may have to be ported to C for that, tho.

Back to the top