 Hey YouTube, this is John Hammond still talking about the introduction to Linux course that I taught and the training wheel shell with the software that I wrote to provide an interactive textbook to pretty much learn Bash and the Linux command line. So this portion of the video series that I want to talk about is the lesson book package that essentially reads from your file system or the files internal and resources for training wheels to load JSON configuration files that act as the script or the text in the textbook. So it actually reads them all from a path like from a directory literally just a folder called lessons and then it tries to glob or find all the files that have the name ending in a JSON file or as long as they are a JSON extension it will load them and it will process them. So this code does that and okay I talk about a little bit in the PDF again if you want to read more about it. It also showcases the type out effect and how that works. It is just essentially writing each character out one at a time determining whether or not it's in punctuation so to kind of make it more realistic and speaking wise and sleeping for a little bit to determine how long you just want to have a delay between each character. So it is essentially like typing out onto the screen and it just looks a little nicer and I guess user friendly whatever it's for learning a nice little visual effect as someone is typing on the keyboard. So it determines whether or not it is in a current directory that's kind of a handy dandy thing just to make sure the user is kind of on the right track. I added this functionality kind of late into the development of the tool and I feel bad because some of the previous lessons don't have this functionality but it tries to make sure if you're trying to run specific commands like if it's important that you're in a certain directory with a certain set of files you'll make sure that the user is actually in that directory. That's a good note to keep in mind if you do end up writing some of these lessons. Because writing a lesson is what's important in extending the software and that you don't actually need to learn or know a whole lot of Python if you want to use the software you can certainly if you want to develop or fix bugs or really change up the program but if you wanted to add more content all you have to do is really like how to write English and talk etc etc. So it loads a lesson sorry I'll kind of I guess go off in that tangent as we get closer to loading the files and the files themselves but the load lesson just determines okay can I read a file out of this and determine each portion of it by the lesson number and name. Moving to the next lesson is in its own function here because it will say okay you're all you're all good with this lesson you're all done and it will try and move on if you can if it can get detect that you there aren't any more lessons or you're finished then sweet you can go off on your own and the program will exit you're done essentially with the lessons that training wheels has for you. If not it will reset the pointer like keep track of what lesson that you're actually on and move in the array or in the kind of setup of lessons that it's been able to load for you. Again you can read more about the text if you particularly want to but I just have variables that are keeping tracking all of all of those things. There are functions to select a lesson and a lesson is kind of the greater I don't want to say architecture that's not the right word but the the bigger entity than a concept and the concept is each question or input line by line as you're going through as you're working through the interactive textbook or as you're working through training wheels but the lesson is a broader set of questions or set of activity things to do so selecting a lesson will display out just like the menu that we saw in the demonstration when I ran this code and I think two videos back now and determining whether or not you actually want to load a lesson whether or not you have one loaded before it's just kind of a menu to do so and displaying tab characters the number etc it just displays them out a little bit of content displayed on screen with colors I'm using these shorthand capital letter functions because they're defined in that colors package that tries to create quick and easy return the string wrapped in the color detailer from colorama selecting a concept again very very similar thing from a lesson but again starting kind of the line by line each question that you go through each thing that you actually do and interact with while you're moving through the training wheel shell and you can probably see a little bit more of this if you actually play with the program or do things with it but again this is the back end how it works it displays whatever lessons it can lets you choose whichever one you are on or not on and then jump into it that lesson pointer and all those things that are kept inside this object are necessary for the lesson book go function that will walk through and and and do things like actually proceed through the lesson and text as you're working through training wheels this is a big function so I didn't include it all in the actual kind of bible pdf documentation thing right here so I explain what it does and that I check out the current position in the running lesson and constantly save an update so you have the the data or the progress that you've already done will be kept track in that file that you can load from the save and load engine it'll retrieve all the properties from the current concept or what you're reading display it out wait for user input through with that process function in the shell object it'll parse the input and then check if the user is in the current directory as you saw a functionality earlier process it and then increment the pointer to move through the lesson and actually progress through that text so the cool thing that I wanted to talk about in this tangent that I wanted to go on now is that you don't need to know python if you want to extend this or add content or add material to teach a class all you need to particularly know is json which again isn't that hard it's just kind of semantics and markup and stuff um and that's just english if you want to write lessons for it but I do an interesting thing here in the code and that I don't write them all in straight json I write things in hjson and hjson is human readable json and that it adds a little bit of niceties like trailing commas not necessary not needed in data fields or different kinds of commenting that's whatever sure and strings without quotes particularly if you wanted to but the big thing is support for multi-line strings because if we're writing essentially a textbook we're going to go on more than one line if we're trying to explain a concept or something so that became necessary and I wrote all the lesson files in hjson but python doesn't know how to import them or process them I don't think there's a quick and easy library or module to do that and I didn't really want to write one in this case um so if we use json if we use hjson we have to convert it all back into json that's fine at least for development purposes it's easier for us to build and rapidly deploy and develop things in hjson and then just convert it back so I wrote a thing to process a lot of them and a lot of the files in a fellow script here that I'll display but it's using the command line hjson utility that you can install if you need it and again I wrote a little install script to do that and that it needs node js the node package manager and this is just a simple bash script with colors and all to quickly run through that stuff so stupid and cheesy but handy you can install those if you want to and just those two lines again but for good packaging I use that color and output and all those fancy things so the compile lesson script is the code that I had written to just okay convert hjson into regular json and it does this in the directory that you give it or in the directory that you are currently in you don't actually supply it so that's bad that's not good code whatever my fault I expected dirty usage because you're kind of in the weeds as a developer right now so you'd have to run it from within the lessons lessons directory lessons folder you can see because it's doing that with the asterisk dot json remove all new lines character turns blah blah blah so this is necessary to do this if you want those lessons included in training wheels and it'll automatically load them because of the way that the lesson book just checks the files in the in the directory so handy but just remember to run the compile lesson script the hjson lesson file syntax you can see a lot of them as examples if you wanted to just kind of rework them or do something on your own but I offer some sample syntax for one of the lessons in here and that I explain okay there's a name for the lesson the concepts are an array of objects and each one has a tag which is essentially the listing that you'll see if you were to select a concept the message that's displayed and typed out on the screen as you're working with that and then the command that you are waiting for or that they expect you to run or do and move on with that's what you as the user would run or type as you're progressing through the training wheel shell and just a message or some notification to explain or kind of offer a hint as to what to do if they don't know the command or if something is wrong or they they aren't entering what you would expect them to enter so again I talk about this in the code but I do showcase that I try and drive the point home in this documentation that these are the lessons that I wrote as I taught this class welcome to training wheels here's how to use it the man pages to discuss them what your home directory is absolute relative paths how they are what what they are and how you work with them paths and files special places and catting files working with files filters and pipes users root and sudo adding and removing users etc and that is the amount of concepts the amount of material that I covered in the class with some with some activities and with some other engaging stuff that I'll showcase in later videos but keep in mind that is not the end all be all of the Linux class or of my software I know that this is not the most elegant program with not the most elegant lessons and certainly not elegant documentation or even just me trying to talk about it but I give this to you or I give it to whoever uses it with the disclaimer that your mileage may you can tweak it and customize it to your liking that is the point of open-source software but the creation that I wrote it to begin with and the original content is mine there it is push that to the world give it to the internet with the flagstay claim that this is mine that I wrote it to begin with so this was a joke that kind of came up from this in that training wheel shell didn't have a nice cool quick name just like bash has and that bash comes from the born-again shell so thinking about this I discovered I wanted the name based off of training wheel shell to be trash and hopefully that's a good one so cool in the next couple videos I'll talk about the Linux scavenger hunt and that actually gets you some interactive material that I would like to cover and showcase so I'll actually move around this game and do it and kind of this is actually the the start of my air this is the original ctf platform and framework that I wrote so hopefully that'll be interesting to watch and a couple cool fun interesting challenges to poke around a Linux file system or learn how to do things this was an activity that I gave the students and an exercise to do alongside training wheels because training wheels is just essentially the skeleton or the jumping off point for a lot of activities and stuff within the class but I wanted to spice it up with with other kinds of content and material so quick shout out to the people that support me on patreon thank you guys so much I cannot say it 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 really access to everything that I release on youtube before it goes live because I don't really like to record and bulk in the youtube release them gradually on like a day-to-day basis or whatever but if you want the content right away right when it's hot when it's ready that's the best way to do it just five dollars on patreon thanks if you did like this video please do like comment and subscribe if you want to get in the scene come hang out with cool people like me and other CTF players programmers and hackers please do join our discord server link in the description it's an awesome community and we would love to have you I would personally welcome you as soon as you enter they they all laugh at me because I do that but it's nice I would love to see you guys on patreon and I would love to see you guys in the next video thanks for watching