 All right, hello internet. This is John Hammond again with a little bit more content regarding my intro Linux course that I taught at the US Coast Guard Academy while I was still there as a cadet and student. So I actually got confirmation just today that they are in fact using this code to teach some of their courses within the cyber systems major and the new courses that they're bringing to the core curriculum. So that's kind of neat, but I still want to plant my flag and say that this is mine that I wrote this. So I'm so showcasing more of the content here online. This is the startup script to run training wheels that interactive textbook for learning bash in the Linux command line. This is initially what you run when you dot slash training wheels. It goes ahead and import a lot and imports a lot of modules that are necessary for the program to operate the way that it does specifically read line helps keep track of your history, simulating what the bash shell normally does or what you're doing when you're on a regular terminal. It uses the time module for actually trying to type out text that you saw in the previous demonstration, the OS module for actually changing directories etc, sub process to start things, text wrap to get things displayed properly, threading in JSON for actually usage and configuration. So it will make sure that it can import colorama. It actually uses colors. Thankfully the Raspberry Pi that was this was originally run on actually had that module installed by default. I don't know why it explains how to get it if you don't already have it and otherwise will exit it ensures that you have colorama because it's part of the learning experience colors and then imports a lot of things from the other packages that I've defined in that the shell along with the colors definitions etc that I can showcase but the shell is what's important here and then it goes ahead and starts the object to start the training wheels program. So I talk about this a little bit in the final guide Bible book PDF file that explains all this and I'll showcase this but hopefully I'll be able to talk through really what the script is doing what the code is doing as I look through it here. The shell object then is the real brain of the program. It will essentially immediately start for one thing right. It will get the current save or the most recent save data if in case the user had ran this program before it will load up the lesson book which is a archive of like JSON configuration files that are essentially defining what to say when as you progress through essentially the textbook storyline and script here sets up some variables to actually use time again to just type out and print information as as you move through the shell and it creates some functions necessary for special case commands like the quit command or the cd command or trying to change the password or nano or other things that will I said normally break a classic input and output program here. So the special case shell functions are kind of protecting the shell from things that could go wrong like nano or vi and other cases will actually go ahead and break the terminal because it the line buffering and the end curses display is not the regular input and output that turning wheels would expect change directory is special because cd is a built-in command so I had to essentially recreate the functionality kind of just through python here which isn't hard I can use the os module same thing if it doesn't have any arguments or they're using the tilde again for replacing etc and then alongside this I test for any errors if they don't have the directory available. I also showcase a help function in case that's necessary to be able to change lessons and concepts etc and the meat of the code comes from the process function which does exactly as you would expect it will take in the user's input and then handle it appropriately it'll determine whether or not it's actually in that special cases dictionary we defined those exceptions the rule otherwise it will go ahead and create a process for the command that they tried to run if it errors out it will go ahead and display okay that command's not found and in between some some commands if I had a support for it in the lesson book or in that specific specific instance it will display out a notification that you can define that is the exactly what we saw when we saw the control c output that was recurring over and over and over again repeating and occurring over and over again and the run function and the error function are again just handling these errors and run specifically is the the main loop of the program if it has information that it can load or save data that it can find it will go ahead and load that again if not it will allow the user to select a lesson or concept like they would start the program for the first time if they do successfully load some information from a previous rendition or runtime of the program it'll start to just go and move through the lesson book and the interactive textbook as necessary and then it will actually handle the control c out and just display it on the screen because you have to be able to quit the program just by entering quit control c otherwise should just stop like program from running etc the save engine is another package or python package that i wrote and developed for this thing and that it just has a kind of defined location to save information or the practice of where you've been been actually running the program if it doesn't have that file name it will go ahead and create it and once the object is completed or done or the program is closed or whatever it will go ahead and close that handle it loads data with that load function just by opening up the file if it hasn't had it already opened and going ahead and reading information out of it with json json again is what i'm using to just kind of encapsulate all that information and i pretty much just use base 64 to essentially obfuscate it like anyone that can recognize that's base 64 they could totally take a look at it but for a person who's never seen linux before they probably don't know what base 64 is so if they have used the tool before it will continue like it'll start off just where they left off and return successfully that way i know in that previous run function whether or not we should start where we were before or just give them a new session where they can choose the lesson and concept they're working with to save user data i pretty much do the reverse of what i had done for loading and that i can write to the log file and use base 64 with the dumps command etc that is that and all that i wanted to showcase in this video in the next one i'll talk a little bit more about the lesson book and how it's actually reading other files or external english words to be able to piece together essentially the script or the storyline that you work through while you're working in training wheels quick shout out to the people that support me on patreon thank you guys so much i cannot say this enough one dollar a month or more on patreon will give you a special shout out just like this at the end of every video five dollars or more on patreon will give you a early access to everything that released on youtube before it goes live because i normally record in bulk and then let youtube gradually upload them on a daily schedule or whatever the case may be um but if you want the content right away right when it's hot right when it's ready that's the way to do it just five dollars a month on patreon please do join our discord server link in the description it's a cool community of ctf players programmers and hackers if you want to hang out with me and other cool people that's the best way to do that and if you did like this video please do like comment and subscribe i would love to see you guys on patreon and i'd love to see you in the next video thanks