If you want to get started hacking you will LOVE The Complete Ethical Hacking Course: Beginner to Advanced! This complete course as seen on Udemy http://bit.ly/2klAkkc, and will take you from beginner to expert hacker. We will begin with the very basics showing you how to setup your environment, and move on to password cracking, WiFi hacking, Dos attacks, SQL injections, and much more!
Together we’re going to take a journey through Linux and give you the knowledge you need to be a power user, but first we must ask the question, what is Linux? Well, confusingly it depends on who you ask. In order to get an idea of what Linux is we’ve gotta go back in time. In the early 1980’s Richard Stallman, then working in the AI lab at MIT, started the GNU project with the goal of creating an entirely free and open Unix-like operating system. This all started when the lab got a new printer, but the license restricted his ability to modify the code. He had hacked earlier printers to electronically send messages to users who printed items when the printing was complete, as well as notifying other users when the printer was free to use. By the early 1990’s there was almost enough GNU software to create an entire operating system, however their kernel, the GNU Hurd, was not yet complete. Meanwhile, in the early 1990’s Linus Torvalds set out on a hobby project to develop Unix-like colonel known as Linux, and used GNU software such as GNU’s “C” compiler to do it. While a kernel on its own was useless, he ended up including GNU software with the kernel tree to release an operating system. Later, Richard Stallman’s free software foundation sponsored the group Debian to release a GNU/Linux distribution that was completely open for people to use and contribute to. Debian over the years grew from a small group of Free Software Foundation hackers, to the enormous community that is today. Due to its popularity, Debian has become the base of countless Linux distributions. Because of how open the software is, anybody to read the source code, modify it, and then redistribute it. Because of this, this is what we have now, it’s kind of a mess. There are so many Linux distributions that a common problem for beginners is what Linux distribution should I use. While there are a few distros out there that actually include its own software, one of the biggest problems in Linux is how many distros there are and the fact that a lot of them are the same distribution with new wallpapers, and icons, and everything else is the same. Ubuntu was started in the early 2000’s and is owned and distributed by Canonical. The base of Ubuntu is Debian, and Ubuntu has become so popular that it has in turn been forked countless times. Forking is a process which the operating system is used as the base of a new distribution. Ubuntu includes it’s own desktop environment called Unity, and has recently started distributing phones running a version of Ubuntu. Canonical also contributes bug fixes and other contributions upstream, meaning that they send these changes back to Debian to include in future releases. While Debian releases new versions sporadically, Ubuntu’s aim was to capture the stability of Debian, but released new versions more frequently. As such, Canonical releases two distributions a year, one in April and one in October. The naming convention of Ubuntu is year & month. So, the version we’ll be working with was released in October of 2015 and it’s called Ubuntu 15.10. Every two years in April, a long-term support version is released called LTS, which is officially supported for five years. While releases in between LTS versions are supported for only 9 months, the next LTS release will be in April of 2016. So, to download Ubuntu we’re going to go to Ubuntu.com, and when the page loads we’re going to see in the top navigation that there’s an option that says desktop. Just click on that, this is the version of Ubuntu we’re gonna be working with, and then when you get on the overview page, just click download Ubuntu, the big orange button in the main area. And on this page it’s gonna give us a few versions, so it’s gonna prompt us to download the last LTS release which was released 2014, in April. If you’re gonna be running Ubuntu on a server it makes sense to you long-term support versions because you only need to install a new version like every five years. You can install more frequently because there’s new LTS version every two years, but with a non LTS version there’s only official support and bug fixes for nine months. So, we’re gonna go with one of the nine months cycles here and download the latest stable release which is Ubuntu 15.10, this was released maybe 10-15 days ago. We’re gonna download 64 bit because that’s the processor type we’re running. You can either click the download button to download it directly in the browser, or you can click alternative downloads & torrents to view what other type of other files you can download. Now, if you’re running on a really super fast internet connection it doesn’t really make a difference. The in browser download is probably going to download just as quickly as a torrent, however if you don’t have an incredible internet connection, a torrent download is going to make a lot of sense. It’s going to download a lot quicker than it would in the browser. Now, I’ve already got my version downloaded, it took about 10-15 minutes, because I have really bad at the moment. Next thing we’re gonna do, we’re not going to install to directly onto our hard drives yet. That’s an awful big commitment to make when you you’re not really familiar with the system. So, we’re gonna do is go to VirtualBox.org, and this is a piece of software that allows us to create virtualized machines, virtual machines are a virtual computer if you want to call it that. This allows us to create different virtual machines, set them up differently, as well as star different operating systems on one. So, when you get to VirtualBox.org there’s a gigantic button here that you cannot miss. Click on that and it’s gonna take you to the download page for VirtualBox. Now, it offers different packages dependent on different operating systems. This is going to be for the host machine, and to put that it clearer terms, the computer that I’m in right now that we can see is running Windows 10, that is the host. So, I need to download VirtualBox 5 for Windows hosts, this link right here, click that it’s gonna start the download. Now, I’ve already got mine downloaded. We’re going to need these in the next few videos, so thanks for watching!
Alright guys so let’s talk about keyword arguments. In the last video we found out how we can pass only one parameter into a function if we have the other one set up with the default value. So, this will allow us to pass the first argument only there’s going to be no way to omit this and pass the age, so let’s do this. Let’s run it and it’s going to say my name is 27 and my age unknown. Now there is another keyword in Python called “none” just like this, this would be a Boolean I guess or just a keyword in general, basically this is the equivalent to null in other languages. So we’re going to save this and run this again, and it’s going to say my name is none and my age 27. There’s literally no way to only pass in an argument that is not the first argument unless you use keyword arguments, and that is defining what variable this is supposed to be. So if we do this and hit run we’re going to see that my name is someone, because we didn’t define a name, and my age is 27. Now we can also use this capacity and parameters in different orders. So I can say name “name=Nick” there let’s save that and run it and you’ll see that the order we’re passing it in it should if we weren’t using keyword arguments would say my name is 27, and my age is Nick. So, by using keyword arguments we can specify which value is supposed to go into which variable, when it goes into the function. So that was actually pretty quick. That’s keyword arguments and how to use them. I kind of like the sister concept of default arguments. So in the next video we’re going to be talking about an infinite number of arguments.
Alright guys, in this video we’re going to be talking about arguments a little further, we were going to move onto keyword arguments but before we do that it’s going to make more sense to cover default arguments first. So, let’s go ahead I’ve cleared out my script here I suggest you guys do the same just for repetition. I mean you could remodel your current function to work with this, however repetition is the key to mastering something. So let’s go ahead drop down two lines, define a new function, we’re going to name it “print_something” and it’s going to take two parameters, one is going to be “(name, age)” let’s open that with a “:” and print out one string which we’re going to concatenate with name and age. So “My name is name ” + name + ” and my age is ” + age” Now we’re going to go down here and call this function “print_something(“Nick” , 27)” I’m sure you guys already see a problem with this, so I’ll give you props for that because this is not going to work, that’s exactly why I’m showing you. We’re going to run it amd it’s going to say that it “Can’t convert ‘int’ object to a str implicity” Now there’s a few different resolutions to this, one I’ve already shown you, you can just wrap this in a string. Now you can run it and it will work. Now, this is why I mentioned this earlier because you can definitely do this, however what we’re going to do is instead of concatenating the string we’re going to remove all these extra characters, we’re going to separate things by a comma, going to remove the extra spaces around the text as well because we don’t need them and you’ll see why. Now this will work without converting this integer to a string, and the reason is because when we use commas it just says print out these four things one after another. We don’t need to concatenate different pieces of data, it’s actually printing out a different number of things. So, it’s going to print this out as a string, it’s going to print this out as a string because we’re passing it in as a string. This is going to be printed out as a string and this is going to be printed out as an integer, however when I save it here and run it you won’t know the difference. See it says my name is Nick and my age 27. You don’t notice that this is an int so this is a perfectly acceptable way to do that. Now, what if I only wanted to pass it one argument? What we can do there is we can create default arguments. Actually, let’s pass in “Nick” So, let’s go ahead and change these to accommodate only passing in some of the values. So, what we’re going to do is set a default value and how you do that is inside the parameter list of the function you’re going to assign values to these variables. These are just variables that you’re creating right here, so you can create a variable and assign a default name, and then same with age. You’re going to assign a default age which we’re going to say is “Unknown” Now we’re going to save it. Now when I run this what we have here is my name is Nick and my age is unknown because I’m only passing in this. So what happens is you think well, shouldn’t name equal someone? It would if I didn’t pass anything in so we can do that as well. We’re going to save this and run it and it’s going to say my name is someone and my age is unknown because we’re not passing in anything. However, we’re going to pass in the first argument here and this is going to take priority over this value here. This
basically means this variable is going to be equal to someone, if no value is passed in. Age is going to be equal to unknown, if no value is passed in for it. So, that’s how to use default arguments in functions. In the next video we’re going to be talking about passing in specific parameters by using keyword arguments.
Alright guys, welcome back. In this video we’re going to expand on this function here and we’re actually going to implement arguments into the function. So what this means that this is very static right now, nothing would change this even if we wanted to change it. I could call this function let’s say 10 times and each time it’s going to print out very static strings. So how we can change this to make it more dynamic is by using arguments and the arguments again go in the brackets here at the end of the function name, and what you’re doing is creating a variable so we don’t even need to know the value that’s being passed in we just let’s decide to use two arguments here in this function, and each one is going to be used in its own print statement. So we’re going to name it “str1, and str2” there and this basically we’ve abbreviated string 1 and string 2. It also tells us right now it’s not being used. You’re going to find PyCharm pretty smart. So what we’re going to do is change this line of code to print out string 1, we’re going to use this print statement to print out string 2. Let’s go ahead and save it and run it. We’re going to get an error and the reason is because we’re calling this function without passing anything into it, and it actually tells us right here parameter string 1 unfilled. So it knows that this function is looking for two values here separated by a comma, one of them is string one and one of them is string two, we haven’t passed anything into it so it’s calling this function and immediately the function is freaking out saying I can’t find this information. So what we need to do is pass in two strings here and how we do that is similar to how it looks in here except each one is going to be the value and not the variable name. So, the first one is going to be called “This is argument 1”, “This is the second argument which is also a string.”) Now if we save, go-ahead run, you’re going to see that this is now printing out string 1 as defined right here, and string 2 as defined right here. So, why would we need to do this? Well, let’s say we’re always going to want to print out two things. Let’s go ahead and call the function again, but this time we’re going to pass in different strings. Let’s fall back to the good ole hello world. Now we’re going to save this and what’s gonna happen is it’s going to print out four lines. It’s going to print out “This is argument 1”, “This is the second argument which is also a string.” being called from the first call of that function, and then “Stringy” , “Hello World” from the second call that function and so that’s how to use arguments. Now in the next video we’re going to be discussing keyword arguments and what those are.
Alright guys, we are going to talk about some built-in functions before we move on, and then we’re going to get onto defining our own functions, and the different parts of a function. So, let’s go ahead and open up a terminal here. I want you guys to loosely follow what I’m doing here so that you guys can get used to using these functions which I think we’re going to be using some of them quite a bit and you’re going to be using some of them quite a bit once you, once you’re done this course. So these are some basic, very basic, functions that we need to learn about, we’re not going to go through any modules like the math module or anything like that, we’re just going to go through a few basic functions. So let’s jump into a Python console here and we’ve already learned about a few so they’re just going to get a quick mention here. You can print out on the screen in the terminal, whatever you you want to basically use the print command, you can convert things to a string using the str function, and you can do this for both integers and floating points, and actually Booleans, and then for each of these types you can also convert them to their own types if they are a string. So I can use int here, and it’s going to convert that to an integer. I could use int that…oh sorry “flo(“5.6″)” I can use float to convert 5.6 to an actual number, and then you can perform mathematical operations on if you want. Now, let’s say we have a string like true, and we want to convert that to a Boolean to actually be able to test things with it. What we would do is type “bool(“True”)” and there we go that’s going to convert that to a Boolean operator. Now let’s also talk about a command called “len” Basically, what this is is it’s going to determine the length of something so it can work with arrays and strings. So let’s go ahead and try and figure out how long “len(“Hello”)” Hello is which means how many characters are in this, and there are 5. Now this command can also be used on an array. So “len([1, 2, 6, 3, 4])” just a few random numbers in there and it’s 5 digits long. Now also if you were put strings in here each with different a number of characters, you would see that this is still going to be equal to the number of items and not the number of characters within each item. So that’s how to calculate the length of an array. Now another thing you can do with an array that’s pretty neat is sort the array. So let’s go ahead and create an array which is let’s say we’re going to put some random numbers in here in you know no specific order there “[16, 3, 8, 6, 9, 133, 435, 21, 823, 45]” Now as you can see this is incredibly random but let’s say that we wanted to sort the array into lowest to highest, or you know first to last. What we would do is actually wrap it in a function called “sorted” and this will shift around the array until all numbers are in ascending order. Now let’s do the same with an array with strings instead. So let’s create some letters here, “sorted([“B”, “R”, “a”, “N”])” couple issues with that line of code there. So it sorts it but as you’ll notice the “a” is at the end. Well, why did that happen? If we were to capitalize it the “A” would that be at the beginning. So, again if we turn some of these letters into lower case which obviously come before other letters here, and one more, you can kind of see how it’s working. The capital letters are parsed first because that’s just the way it works, and then lower case letters, what if we threw a number in there? You’ll see that it can’t do that, so what you would have to do is wrapping quotes and let’s throw another number right here, and a floating-point wrapped in quotations, and you’re going to see that the way this sorted is it put numbers first regardless of if it’s a floating-point or integer type. They have to be wrapped in quotations in order to be sorted with other strings in an array, and then it parses the capital alphabet and the lowercase alphabet, so that’s kind of a priority order there. Just so you guys are aware of that. So what we’re going to do next is actually explore functions, this was just a few basic building commands in Python that we are going to use through the rest of the course, and we’re probably going to, well we definitely are going to, find other built-in functions as we move along, as we need them. So let’s get into functions.
Welcome back everyone, let’s talk about variables now. Now you can probably guess by the name a variable is something that has variable meaning that the name the value of it is not always going to be constant. So by explicitly stating strings they’re not reusable as well. If I wanted to you know say let’s jump into a Python console, alright. If I wanted to create a string not using variables, “This is a string” I could create that. However, there’s no way now for me to reuse it to do something else so I’d have to do “This is a string” + “Hello” and then there’s no way for me to reuse that one and see you can see the problem. Now that’s a one reason why we use variables is so we can reuse the variables, now another reason is because when you pass values into functions it’s going to take on the form of variable through the parameter list of the function, we will get more functions later. Now the difference between Python and some other programming languages is some programming languages are typed, and you might say well hey aren’t all programming languages typed? Yes, you type them with your fingers on the keyboard, however a typed language basically means that you need to define the type of variable. So as we learned in the previous videos the different types are integers, strings, Booleans and stuff like that. So if you’re setting a string variable you would have to explicitly tell the program that it’s a string but with Python you don’t need to do that. All you need to do is give your variable a name and a value. So, let’s go ahead and let’s create a variable called greeting and it’s going to equal a string that’s going to say “greeting = “hello world”” Now you’ll notice when I hit enter it didn’t print anything on the screen and it didn’t do anything noticeable and it’s because setting a variable doesn’t have any type of response, so it just creates variable and it’s there. Now we can use it by using greeting. So I could type “print(greeting)” and it’s going to print “hello world” Now also now that I’ve got it in a variable we can manipulate that variable in a number of ways. So I’m going to type “greeting = greeting.split(” “)” So basically what we’re doing here, and I can’t use double quotation or double equal sign there, we’re setting greeting to a new value which is going to be greeting which we’re gonna split at the space, so we’re going to split it right here, and we’re going to get the first item in there. So it’s going to turn greeting into just Hello. So let’s hit enter here. We’ve assigned it a new value so if we now go ahead and “print(greeting)” you’re going to see that it says Hello. So now what we can do is now concatenate this with something else. So, we can do that in a number of ways we can reuse the previous example where we just let’s just print it out first, we can “print(greeting + “Nick”” and it’s going to say Hello Nick. Now if we wanted to store that in a variable we could do the same thing that we did before, or you can continue using this variable for different people. So I could say “print(greeting + “someone else”” and so that’s how that works. Now if i did want to make the greeting equal to concatenate a string all you have to do is redefine it as “greeting = greeting + “Nick” Now when we print out greeting you’ll see that it says Hello Nick. So that’s a variable and the useful things that you can do with it, now you can also assign values of other types. So we can say number is going to equal 1 and then second number is going to equal 2. So now we’ve got number and second number stored in variables. Let’s do something with that. So, what we’re just going to do is add these two numbers together in a print statement. So, “print(number * secondnumber + secondnumber * number)” and this is going to print out 4. So essentially what the print statement is doing is before it prints it out it’s calculating this because we’ve stored these as integers, and so it’s going 1*2+2*1 So it’s essentially saying 1*2 + 1*2 and it’s coming up with this, so. And as well you can set “check = True” So, that’s how to set variables, it’s pretty simple and we’re going to be doing a lot of this so this is a concept that you’re going to have to be very familiar with, and get used to using it. In the next video, we’re going to be talking about some built-in functions, and we’ve already actually talked about some of them.