...with Python Tutorials for All!

A shameless plug for a set of tutorials I made a few years ago that can be see here.

I wrote these back at a time where I was learning lots of different parts of the Python Programming language and thought it would be a good idea to give this information back to the community along with the shortcuts I have found for myself along the way, they might not work for everyone but they have helped me gain a deeper understanding of the language as it has grown over the past decade.

A lot of these challenges have been created over the years for various meet up groups aimed at helping others up skill with programming as a whole!

One of the fun talking points is that the .ipy notebooks themselves were generated automatically from a small quick writer I created that would create the repository above and even upload these into Google for the class to copy and use. Neat, huh?

So let's get stuck in shall we!

The PythonTutorials Repository

I had initially designed this repository to focus on the varying skill levels that would be attending the different meet ups, trying to rank the challenges and build a foundation of knowledge with each student before moving on to the next, harder topic. There is a point as the harder subjects sub-divide that I did wish I had raised them in series, e.g. Security Tasks vs Plain Coding tasks and a whole section just dedicated to the different ways of making games (which seems to be a subject with an ever increasing interest from new coders to the scene).

Beginners

The section for the beginners started out very simplistically, it aims to get the user up and running with the installation of the Python compiler. Having been to many clients where they were adopting the language for the first time, there will be some people who are not able to do things right from the get go, by writing these guides and expanding upon them as problems arose, it became a self developing Bug Fix manual for the classroom.


InstallingPython
This would focus on the generics of what is happening during the installation of Python, no matter what Operating System you are going to install Python on, there will always be the common factors of what will be installed and what the installer will typically do.

InstallingPythonOnLinux
Does what is says on the tin, the very simplistic instructions for installing Python on *nix systems, as most ipy notebooks are Linux based this can even be demonstrated. It made for some fun reverse engineering of the environment for me while creating!

InstallingPythonOnMac
Despite Mac's being very similar to Linux, having used one for a long time I am always reminded of the following XKCD. I thought it might be wise to get a unified way of installing on Macs for the class to follow to avoid this scenario.

InstallingPythonOnWindows
Always the biggest problem from an installation point of view, for some reason there are more issues when it comes to installing on Windows, this guide hopefully helps get people around the discovered pitfalls and saves you time jumping in!

ExploringPythonObjects
My hidden toolkit of Python built-ins that have taught me how to code over the years, when probing an unknown variable this tool kit has proved invaluable. Another blog goes in to getting this data back out of a highly complex system.

IntroductionToPythonEnvironments
A primer to help a user gain an understanding in to what has been accomplished by installing and a little taste of what is now possible.

ExtendingPythonEnvironments
A look into growing the python environments capability with modules and virtualisation!


LogAllTheThings
To go with the above tutorial on Exploring Python objects, the logging tutorial will help get a user set up to prepare to log across different channels so that no matter where a developer needs to dig information on a random variable from, or test execution flow. They are able to extract this data without having to break the more in depth debugging tools that can be daunting to new users.


Intermediate

The Intermediate level assumes an environment already set up by the student and a keen interest to get stuck in, it was at this point I feel I really fell over with my organisation as there was just so much information to record, so many directions to take the various students in and no idea what each individual might want to learn... So the following mess happened!

Cloud

As the Cloud was where I began properly with Python (I mean actually using the language as a programmer and not just writing simple single use scripts), I thought it might be a good way to show the student what I saw, AWS's API seemed to simple and most programatic so a lot more time was dedicated here.

AWS

Although, the original intention was to expand to exercises across all Clouds, time only allowed me to get these AWS tutorials out the door and into the repository, it would have been good to build a foundation understanding and broaden the students mind with the others and show the differences between their APIs and how to research them, I only got as far as the Boto3 setup before having to resort to suggesting challenges to the students, this was another great use for my Random Value Generator project though.

Boto3Setup

A guide to helping the student set up the required to use boto3 Python module, helping them to ramp up into the cloud and start playing with the AWS APIs as well as a brief tour of all the ways a user can provide their AWS credentials.

Games

Games are always a popular subject, I think it's the reason half of us got in to computers in the first place and no surprise these were the most popular tutorials. The crazy thing was that there are now so many ways to write your game, so many different frameworks that will specialise in the different ways that our product could be consumed at the end of it all. Maybe in time I will be able to expand on these, Kivvy is a fun library I was playing with recently but have not managed to include in this repository.

PyGameIntroduction

Only a small introduction in to the massive world of PyGame alone, this will look at helping a student get setup with the module and any additional installations that are needed and ways to test it has worked.

PyGame

A quick look into PyGame to build on the above and guide a student through a quick build to make something silly and spark ideas of what is possible with the language and the PyGame Framework provided by the Module.

Security

It would be with this security section and the intended split with Red and Blue team operations that I feel my sorting came undone, it would have been better to split these out into different repositories, but that can be for another day, the data is still recorded.

Red Team

Originally, I had planned to put the past 2 parts of the buffer overflow exercise here. However, when they were put to the class a lot of them had troubles and I felt they still needed more education in this subject, pushing them up a difficulty level. Sadly, I didn't get around to replacing these just yet but always on my TODO list!

Blue Team

BlueGate-PythonPoC
At the time of authoring the BlueGate exploit had just become mainstream, there was a lot of panic to get this bug patched and I created an exercise to take the attack to pieces and create a testing tool for users to take back to their organisations and ensure they were covered, or alert their Security Teams.

IncidenceResponse-MargaritaShotgun

Another tool I had been playing with for a Proof of Concept for a client, was the idea of automatically snapshotting remote instances memory in a Cloud Environment, this seemed like the best tool for the job and was a lot of fun to play with, so I created a little tutorial that I hoped to expand with the Cloud Exercises above.

Hard

The Harder section of these tutorials were designed to provide more complex applications, consuming the snippets of code we created in the above tutorials we would dive deeper into the language and even computers as some exercises teach you to use python to control other tools such as debuggers to decompile binaries for exploitation!

Security

Of course the first set of hard challenges I would write would revolve around security, especially more the Offensive side. Although, I recall writing a few other challenges in this vein, I don't think they made the final cut as the code was still plagued with bugs!

Red Team

BufferOverflow-Part1-4
A Small guide helping students to learn the principles of the simple buffer overflow attack, the guides help to set up the binaries as well as provide instruction of how to use python to break into the binary and make it run our code as opposed to it's intended use.

Blue Team

Sadly, I didn't get around to writing any fun challenges for Blue Teams to handle, at least at the moment. I hope to be able to dust this repository off and give it some more love in the future, time is always a limited resource.

Give them a try and see what you think!

All the code can be found here or can be pulled from GitHub with the following:

$ git clone https://github.com/s1l0uk/PythonTutorialsForAll
This will get you the tutorials and you can then upload these to a Jupyter Notebook (even hosted on Google) to get you up and running with the language. If you are using it, give it a star to let me know and I will look to add more in this direction! Happy Hacking!