What we just walked through was the default implementation of Python,
or sometimes referred to as CPython, not to be confused with Cython,
which we will get into later.
Your situation and the use case may call for other implementations, though.
Let's talk about a few of these.
Jython allows you to write Python code that compiles
your files into Java bytecode.
This allows your code to run on the JVM. Multi‑platform for the win here.
Jython has a few quirks that tie it closer to Java versus
Python, such as implementing garbage collection.
IronPython, similar to Jython, allows you to code in Python, but compiles
your code and prepares it to run on the Microsoft CLR, which includes C#
and .NET. The last two on my list here are slightly different variations
of that. PyPy, another variation of CPython, but utilizes a concept called
just‑in‑time compilation, which compiles the code when executing.
This, in turn, speeds up the processing at runtime. Finally,
Cython. Similar to Jython, but allows you to compile programs in C
rather than Java, giving you the ability to take advantage of both
the C and Python languages, but having the comfort of writing
everything in the Python language.
Each implementation provides a unique benefit and should be considered when
kicking off a project where Python will be utilized. If you recall in Visual
Studio Code, when I hit Shift+Ctrl+P to bring up the command palette and
search for Python, select interpreter, depending on which interpreter above or
many others out there you have installed will allow you to select how you want
to compile the code you are running. Before moving on in this course, there
are a few more Python related tools I thought would be worth mentioning here.
The first is Pipenv.
Pipenv brings the virtual world of virtualenv and pip together in one
tool. This allows you to manage your projects in a controlled
environment, and as you install or uninstall packages,
it automatically updates the pip file,
which is basically a running list of the dependencies and libraries
used in your project so that anyone who comes along can quickly pick
it up and continue to build off it.
Python Poetry is another third‑party tool for managing projects,
packaging, and dependencies.
You can easily set up the project with a virtual environment using the
executable you want to build the Python project in.
Finally,
pyenv helps you to quickly contribute to different projects built on
various versions of Python. In addition, it allows you to switch between
Python versions on a single project so you can quickly test your code
out across multiple projects, or even better, upgrade your script faster
to the latest version.
Okay, so there's a little background and setup for this course.
Why is Python important to the information security field?
Well,
it is powerful, yet easy to learn. It has modules for a single desktop,
network or even online, everything a security professional has vested
interest in. And because you don't work in just Linux,
Macs or on Windows systems, Python works across multiple platforms.
You would think it would take months to secure a budget for
such a powerful tool, but the best part is it is free and
open source. And not only that,
it comes with a wealth of third‑party add‑ons to boost
your productivity. No matter your role,
there is a benefit to learning Python. In this course,
we'll talk through some of the more important libraries you need to know about.
Now let's dive into some of these standard
functions that will benefit your work.