Linux for Hackers Tutorial (And Free Courses)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
OccupyTheWeb you've said this multiple times  and it's the reason I think that you wrote   this book Linux is one of those skills that you  have to have right? Yeah Linux is one of those   fundamental skills that every hacker has to have  I also open up the book with the the first line   of the book is hacking is the most important skill  set of the 21st century. Hacking is playing a key   role in geopolitical events, it's playing roles in  espionage, it's playing roles in Criminal activity   all of these things are part of hacking. Now this  is the kind of stuff I love to see, I mean what a   beautiful view but not only that I love it when  companies help people change their lives through   free education and lowcost certification programs  and I really want to thank Juniper for doing this   they are providing a whole bunch of training  for free security training, networking training,   DevOps training. You can use my link below  https://juniper.net/davidbombal sign up and   get access to their training for free but not  only that if you go through their assessments you   can get your exam for a discounted price at the  Associate level as an example you can get an exam   for $50 big shout out to Juniper for supporting  the community by providing free training and   lowcost certifications that help people change  their lives so go and sign up for their free   training get certified and change your life. Hey  everyone it's David Bombal back with OccupyTheWeb,   OccupyTheWeb welcome. Thanks David it's always  an honor to be back on the best IT cyber security   Channel on YouTube. I appreciate it and just  for everyone who's watching we've done a whole   bunch of videos we were just talking offline  about the Mr Robot series that OccupyTheWeb has   done with me. OccupyTheWeb that's one of your  favorite series right? Oh it's definitely one   of my favorite TV shows and if you talk about  Hollywood's depiction of hackers it's probably   the most accurate Hollywood does not have a good  record in terms of being able to to depict hackers   as they really are and in that show what most of  us love about that show is that it's real hacking   it's you Mr Robot Elliott in the show you know  he's he's a real hacker he's doing real hacking   with real tools from Kali and other places so  that's why we love it. So I'll link that below   for anyone who wants to watch those but before we  get started with today's video I want to mention   your books once again and I'm really excited  about today's video because we're going to   be talking about Linux basics for hackers um  but OccupyTheWeb also has Network Basics for   Hackers as well as Getting Started Becoming a  Master Hacker and I always say this and again I   I'll mention it a million times I really like the  way that you write your books you write it from a   hacker's perspective with a hacker's mindset and  with my background in networking it's really nice   to see your take on networking but OccupyTheWeb  you've said this multiple times and it's the   reason I think that you wrote this book Linux is  one of those skills that you have to have right?   Yeah Linux is one of those fundamental skills  that every hacker has to have the book grew out   of my experience of training hackers for the US  Military and the intelligence community and when   I used to do that and this is quite a few years  now it's at least 10 years ago now I used to get a   room full of very talented people who wanted to be  trained in hacking and a good number of them have   never used Linux before and so I couldn't really  train them without taking some time to be able   to train them on Linux first and so I developed a  little handbook for them and we'd spend the first   day or so going through Linux Basics so that  they could go on to the more advanced stuff   and then that grew into a book and when I when I  first developed the handbook for the military it   was very small and so one of our goals with Linux  Basics for Hackers was to keep it small you know   matter of fact I told the publisher I wanted it  to be less than 250 pages and we did that it's   pretty small it's succinct it's concise it covers  the what you need to know to get started you know   we don't put a lot of depth and a lot of detail  because you know there's a lot of books out there   you know that are are great books that cover Linux  in great depth and detail but nobody reads those   books exactly exactly so I wanted a book that was  accessible that people would actually read from   cover to cover and that's what has happened it's  become the bestselling Linux book in the last 5   years and so it continues to sell extraordinarily  well 5 years later and so that's why the book   was was written, was to get people started to  get them into Linux because so often we'd be   training people who had only spent their life in  a macOS or a Windows environment and just weren't   familiar with the command line in Linux so this  is what the book is designed for of course I also   open up the book with the the first line of the  book is Hacking is the most important skill set   of the 21st century and I will reemphasize that  hacking is the most important skill set of the   21st century if you look at you know what's going  on in the world today it's once again played out   that hacking is playing a key role in geopolitical  events, it's playing roles in espionage,   it's playing roles in criminal activity all of  these things are part of hacking I'm not saying   all of it's necessarily good what I'm saying  it's the most important skill set of the 21st   century. So if you want to play a role in the most  important skill set you know this is the place to   start is Linux Basics for Hackers, get your Linux  skills down first and then you can move on to the   more interesting and more advanced material but  you got to have those Linux skills first. I think   I see it a lot and I'm, you deal with a lot of  beginners I'm I'm assuming you see it all the   time they want to run before they can even crawl  right?Exactly and once again I've seen this for   for many many years and that's that was the whole  purpose of the book is to get you to get you up   and running so that you can go and do whatever  you're going to do with hacking but if you   don't have the Linux skills you're really you know  you're putting the you know the old saying the the   cart before the horse you got to have the Linux  skills, you got to have the networking skills,   those are two fundamentals you have to have to be  able to function in this world. Why why use Linux   um I I mean then there's there's you've given us  a good reason to write the book but why why is   Linux so important?Well Linux is is different  than the other Operating Systems in that it's   basically it's all open, it's open source, it's  open you can see all the source code and that is   why people have developed their tools for Linux  I mean there are tools that are developed for   Windows and there's some for mac and there's  some for Unix but most probably 90 to 95% of   the hacking tools are developed for Linux why  Linux because it's open source the people who   are developing the tools can see the source code  and use it. Linux is open source it's transparent   it allows you to have granular control over the  system things that you're not going to see in a   macOS or a Windows system and and probably the  best reason for a beginner outside of these kind   of esoteric reasons is that most of the tools are  written for Linux right I mean they're they're   almost almost all written for Linux almost all  so if you don't know Linux you're going to miss   out you you're just simply not going to have the  capability that you're going to you know get here   if you're trying to do it in a Windows environment  and one of my criticisms of say for instance the   certified ethical hacker certification is that  they don't emphasize Linux they they're trying   to teach hacking from a Windows perspective and  they don't require that you know Linux and that   is a disservice to anybody who's trying to achieve  that certification because if you don't know Linux   you're not a hacker. Let's let's be really clear  okay if you don't if you don't know Linux you're   not a hacker you might call yourself a hacker, you  might call yourself a certified ethical hacker,   you might call yourself anything a pentester  but if you don't know Linux you're not really   a hacker. I love that I think you've just  summarized it right there. The first intro,   the introduction of Linux basics for hackers  we talk about how to go ahead and download and   install Kali Linux but David's done some great  videos on how to do that so we're not going to   replicate that and David you can give them links  to how to to your videos and you've got some great   videos to do that so we're not going to waste  your time folks on doing that you can go to   David's excellent videos on how to go ahead  and download install it either as a physical   on a physical machine or a virtual machine. I use  Virtual machines. Why do I use Virtual machines?   Well there's there's a lot of advantages of  using virtual machines but one of the things   that those people are in my classes know is that  I use multiple virtual machines so I I'll have   different virtual machines for different Operating  Systems so I can switch between them. I can also   use my virtual machines as as target an attacker  without having to go outside of my own system,   so there's a lot of good reasons to use Virtual  machines you can see the upper tab here I've got a   Ubuntu over here I've got a bunch of other systems  on here I got multiple versions of Kali because   you know there's some Kali different versions of  Kali do things better than others so I'm running   virtual machines all the time there are some areas  where virtual machines don't work work as well   as a physical machine and one of those areas is  Radio hacking you know the SDR for hackers there's   there's really some difficulty with being able to  maintain that SDR Hardware to a virtual machine it   works but not real well and so there's one of the  there's one of the drawbacks outside of that in a   few other places virtual machines are terrific for  a learning environment and teaching environment.   So OccupyTheWeb 2 questions would would you  recommend for beginners start with virtual   machines and do I need to have the latest version  of Kali Linux or is like an older version okay?   Well one I recommend virtual machines, virtual  machines are great so you need to have a little   bit of knowledge of virtual machines to be able to  function well for as as a a beginner, a learner,   you can maintain a closed environment where you're  both the attacker and the target and you don't   have to worry about any legal issues of going out  there and attacking targets that you you shouldn't   be on or illegal for you to to target so that's  one of the reasons. Two is I can maintain many   Operating Systems on my single system. If you're  going to maintain multiple Operating Systems the   more RAM that you have in your system the better  it's going to run for you and then you know   there's a lot of beginners who want to use the  latest and greatest and I just got done teaching a   class and one of the things that happened in this  class last week is that I'm running a year old   version of Kali and the things that we were doing  actually worked better in this older version than   work in everybody in the class who had the newer  version so they had to actually downgrade their   systems to be able to do what we were doing in  class, so don't be fooled by you know the latest   Kali or the latest for that matter Windows or  whatever you is that sometimes the older things   if they work there's no reason necessarily  to upgrade them other than maybe for security   purposes right but I I maintain versions of Kali  going all the way back to the backtrack days. So   way back when you many viewers may not know this  but it used to be called BackTrack and so I've got   versions of BackTrack going back to BackTrack  1 and I've got BackTrack 2 back BackTrack 3,   BackTrack 4 and then I think I think at BackTrack  4 it switched over to Kali and that was somewhere   around 2012 I think or 2013 somewhere in that  area and so some of these older systems actually   do what I want better than the newer systems do  so as a result I have images of all of these old   Operating Systems around and sometimes I have to  go back to them but when I have a Kali that does   what I want why would I go and get the newest one  I have to have I have to have a reason not just   because it's newer I have to have a reason to go  and and go to the latest and greatest so as you'll   see in this particular video here I'm using 20223  why well because it does what I want and some of   the changes that have taken place since then I  don't necessarily aren't necessarily good for what   I do. But from a Linux point of you it doesn't  matter right because like the commands have   been around forever? Yeah the the the core, the  kernel of Linux has been around since what 1993,   92 it's when Linus Torvalds first released it and  and most of the commands are the same so the the   fundamentals of Linux whether you're talking  about Kali, Arch, Ubuntu, Parrot, Red Hat you   know you go through all the distributions the  primary commands are all going to be the same   in all of these Operating Systems so it doesn't  really matter what version using you could really   do what you want to do in terms of hacking from  an Ubuntu, okay from Red Hat, these these are  fine to use the only real strength of Kali is that  one it's Debian okay so and Debian handles many of   the tools better Debian is a distribution of Linux  so Kali is built on Debian and so is Ubuntu but   they kind of they Fork from Debian in different  some different ways but you could use Ubuntu,   you could use Lubuntu, you could use Red Hat, you  could use any of them so when people often ask me   you know which is the best Linux distribution the  answer is they're all good and so the strength of   Kali is that it's built on Debian which works  oftentimes a little bit better on some of the   tools and it has all the tools built into it  and Parrot, Parrot has the tools built into   it as well Black Arch has the tools in general  you can move the tools from any of the Linux   distributions. You can run them on basically any  of the Linux distributions so that's not really   that big of an issue it's more of a convenience  issue rather than a functionality right. So one   of the things that people who aren't from the  Linux environment or Unix environment there's a   few terms and few ideas that are kind of important  to introduce here. One is the term that people in   Linux always talk about binaries right these are  basically what people in other environments like   Windows would call an executable these are files  that can be run and these include simple things   like you know the PS command, the cat command,  the ls command, the CD command those are all   binaries as well as some of the tools that we use  for hacking those are binaries so when you hear   that term don't don't get upset you know that's  it just means that it's like an executable it's   a file that can be run. The second concept that's  really important in getting accustomed to Linux   is that Linux is case sensitive that means that  a uppercase c and a lowercase C are two different   things right so that if for instance there's if  you type desktop with lower case letters that's   different than uppercase letters. So for instance  let's say take a look at our our Kali here,   we can go to there is a directory called desktop  and if I go ahead and go cd desktop right like   this it's going to come back and say there's no  such directory file or directory, why because I   didn't start it with an uppercase D so if I go  and do it like this right which is the way it's   actually supposed to be you can see it goes to  desktop so if you get this message right here no   such file or directory one of the first things  that you want to do is check to make sure that   your case is correct this case I would you know  if I was a beginner I might look at that and go   my God I know that there's a desktop right there's  got to be a desktop on this system what's wrong   with my Linux and and really all it was is that  you didn't start it with a didn't start it with   a uppercase D so that applies to almost everything  in Linux that it's case sensitive. Windows is not   case sensitive so this is going to take a little  bit of getting accustom to. A directory is the   same thing as what some other Operating Systems  might call a folder so it's a directory it means   this is where I'm storing all of my files at right  you know one of the things that's also kind of   important okay to think about in Linux is that it  has a file system that's a little different. Let's   take a look at that I'm going to put up a diagram  here of the Linux file system for those people who   uh are coming from a Windows environment or  others this might be new information. So in   a Windows environment at a very top you might  have a c or a d or an e or an f there might   be these are physical drives Linux works on a  logical file system and at the very top there's   a slash and that slash flash is often referred  to as the root file system that's the top of the   file system underneath the root you have a number  of subdirectories and probably the most important   ones is there's one here called root and that's  the root users. Okay root user is like the system   admin in Linux. We have the boot the etc, etc  is generally where your configuration files are   stored now we say configuration files those people  are coming from a Windows environment when you   configure an application you usually have to go  through a series of clicks and click click click   click click click click click so so configure it  in Linux configuration is all done through text   files so there's a text file you go in, you  open up the text file, you make the changes,   you save it and then you restart the service  and then you've reconfigured it. Those files are   generally in the etc directory generally. There's  a home and that's where you as a user are at all   right so for instance I go back here, to go back  a level in Linux I go cd .. that takes me back   one level I can go pwd present working directory  this tells me where I am in the file system this   is a really useful command so if you're not used  to using the file system the the command line in   the Linux file system you can always just enter  pwd and it'll tell you where you are and so you   can see where I am I'm under home and then my  username and my username here happens to be kali   it could be other things but that's where all  of my stuff is stored is in my home directory.   Let's go back to our our diagram again then you  see there's the mnt directory okay this is where   your outside so for instance if you're putting a  physical drive on your system so a new hard drive   new SSD it's going to be mounted at this directory  that's where it's going to be attached to the file   system and this actually is kind of a a term that  has it's a throwback to like the 70s and 80s when   people used to physically mount they would take  a tape you know back then data was stored on tape   and they would physically take a tape and they  would mount it unto a computer big a big tape   and so that's where this term comes from because  remember that Linux is basically a clone of Unix,   Unix dates back to the 70s and so some of the  terminology comes back from comes through that   era. Process is proc is where we have a lot of  uh our processes we have files there that manage   those I'm going to skip this one, we'll talk  about dev this is devices this means like things   like keyboards and mice and all of the devices on  your system are maintained in a file here and then   we have bin and sbin these are binaries that's  what term I was just talking about is binaries   this is where you'll see stored the files that are  executable and sbin is system bi, system binaries   and then you'll see here lib which is libraries  these are the what in the windows world is often   referred to as a a DLL a Dynamic Link Library  this is just basically code that can be reused   so if I'm writing a tool, writing an application,  I can go in there and pull and use call a piece of   code in front of the libraries that I need to make  my application work so it's rather than everybody   rewriting the the same code over and over again  like how do I, how do I make a window right you   know in my application? I can just call the code  and this plays a big role in hacking because you   often times need to have the proper libraries to  actually use the tool and so one of the things   that you'll see as you develop as a hacker is  that certain tools you need to download specific   Library files that the application is dependent  on and then finally we have usr and this is where   we're going to see other users on the system are  going to be underneath this directory here. We can   see these directories if we go back to go cd and  then go right to the very top of the file system   right CD / that takes us you can see here it shows  me a slash that means that I'm at the very top of   the file system now I can view what's in there by  simply using the LS which is short for list right   list I can just go list and it'll show me those  are all of those directories and a few others   that we didn't have on our diagram and one of  them that's important here is media so in that   diagram I talked about mounting a hard drive to  the system but in modern Linux systems we now have   what's called media where your flash drive and  other devices will attach or am mount to the bio   system and we'll talk more about that in future  videos but they now get mounted at media and not   at mnt and you see a few other things that are  there as well so this is one of the key commands   is ls I like to use ls- l let's go and do ls- l and it gives me a little different view of the   same information so what it does now is it gives  me some information on the permissions all right   these are the permissions we'll talk more about  permissions in a future video and then it tells me   how many links it has that's what this is is links  and we'll talk more about links in the future   one of the things that I didn't put in the uh my  Linux Basics for Hackers is much of a discussion   of links and so that's probably something we we'll  talk about in the later class. This is the owner   of the file or directory notice here this let's uh  let's talk about this very first letter here that   tells us it's a link so this means that it's a  file that's linked to another file it's connected   so that when I use when I click on or use that  particular command it takes me to another command   that's what a link is it shows me right here that  the binary is also linked to user binary so when   I use the binary file or directory it's going to  take me to the user binary. Binaries as I said   are simply executable files. This first letter  here the D says that this is a directory when it   starts with a dash like this one here that means  it's simply a file all right so you see oh most   of these here are are all directories we might we  probably see some yeah right here we've got a file   a swap file right there if it starts with a d it's  a directory, if it starts with a dash it's a file,   if it starts with an l it's a link, and I'm going  to leave this right here which looks like gobbley,   looks like gobbley goop to most people who  are new to Linux but basically what this is,   is it defines who has permission to read write and  execute the directory or the file right. This is   important in Linux security, so this is what our  top of our file system looks like right, we've   introduced a few commands there a couple other  terms that I want to introduce here is the idea   of a script and people you know hackers are always  talking about scripts right and usually usually   hackers are using Python scripts. Right Python is  kind of the language of hacking tools now that's   do it mean that all hacking tools are written in  Python right it means that a good number of them   are and Python is native it's installed already on  your Linux all right so you don't have to install   any interpreter for it but there's a lot of other  languages that are out there that are used for   scripting of course there is what is referred  to as Bash scripting which is scripting within   this shell environment we have this is this is  actually a shell or a terminal right that's what   this is referring to here sometimes referred to as  a terminal emulator because back in the old days   Linux was and Unix was run from a terminal where  all you you didn't actually have a computer all   you had had was a a terminal that gave you access  to the computer so this is sometimes referred to   as a terminal emulator or a shell and most of the  linuxes for that matter use a born again shell or   bash shell the newer Linuxes the newer Kali's have  switched over to a different shell called Z shell   and we can talk about that in a future video we  start talking about Bash scripting but there's   other shells which is basically this environment  that we're working in here those are kind of some   new maybe some new terms especially if you've  never worked from a command line obviously this   is very similar to say a command shell or a uh a  PowerShell in Windows although I would say that   it's superior to both. It's it's superior  to both of those right I mean PowerShell is   Windows uh attempt Microsoft's attempt to give the  functionality of Linux into Windows that's the way   I see it they brought in the PowerShell in recent  years because people were unhappy with the shell   capabilities of Windows so give them some credit  but it's not as elegant I think it's actually   kind of clunky relative to the the elegant shell  within the Linux environment but you know I'm I'm   obviously have some bias here. I was talking to  someone has got many many years of experience in   the cyber security industry and he works for Cisco  now he's like a big shot at Cisco and he said uh   Powershell is the root of all evil because that's  how most attacks that's how a lot of attacks are   made I shouldn't say all attacks but a lot of  attacks are done that way so you know just to hide   on PowerShell even more sorry go on. Yeah I mean  that's a that's that's very true a lot of attacks   use PowerShell especially post exploitation or  in once somebody's gotten inside the system they   can use PowerShell to maintain and do all kinds  of nefarious things on the system to PowerShell   but and also it should point out that a lot of the  commands that we we use in Linux have been aliased   into PowerShell so if you're trying to use some  of these commands that we're talking about here   you can use them in PowerShell all right they're  not native in PowerShell but they're alias which   means that they're linked into uh PowerShell  so you can use your Linux commands within   PowerShell. Let's a, that's here's a command  that's kind of important and that's called clear, so so so what we're going to do is we're  going to clear our screen gives me a and I'm still   notice I'm still at my root directory, let's  go ahead and uh let's go ahead and navigate   okay cd is change directory to starting at  the top route then going to home, then going   to my user which is kali. Okay so that's so now  that I'm there of course I can I showed you that   we can use the pwd to always know where I am,  right this tells me this tells me where I am,   I'm at home Kali another really useful and simple  command that's always important to know is who am   I? Now this isn't going to give you it's not  going to reveal your identity right? yeah we   want to know we want you to run that come on. What  this is, it's going to tell you who are you logged   in as? Why is this important well because in Linux  especially when you're talking about using Linux   as a hacker there are certain things that can  only be done when you are root or root is the same   as system admin it's the all powerful user now  people often will tell you that you probably don't   want to run your system as root all the time why  because if you get hacked then the user the person   who hacks you is going to have all the privileges  of root, which means they have all the privileges   they can do anything they want just like the root  can. So Kali has taken that under advisement okay   the people at offensive security and primarily  you're working as a regular user with limited   privileges when you're in Kali today that wasn't  the case in the past and so for people like me   it's taken me a little bit to get used to this but  in any case so I hit who am I you can see that I   am kali that is my regular user who doesn't have  all the privileges if I want to run many tools   okay within Kali I often have to precede that  command with sudo, sudo is and this is something   that's not in Linux Basics for Hackers because  back then it wasn't required so this is something   that's come about since the book has been written  I wrote the book in 2017 it got published in 2018   so right around soon after that uh the new Kali  started to require that you had to actually use   sudo and sudo allows you to move into the root  user for a single command all right for a single   command if your user has those permissions and  we'll get into that in a later video but there's   a group of users who are on the sudoers list and  if you're on that list you can use sudo the way   that Kali is set up if you come in as once you  if you create a user when you install it you're   on that list so you can use sudo to switch to  the root user and run that and that'll give you   all the power of the Operating System you you're  not going to be limited to anything at all that's   a command that's really important in the newer  versions of Kali I showed you cd that's changed   directory all right so that's an important one  so if I wanted to change a directory say to the   etc directory remember this is where all of the  configuration files are at all right now I'm at   etc and then I can go ls -l and I'll see all of  the various directories here's that sudoers that   I was talking about okay the sudo config and  sudoers and we'll we'll talk more about that   it's kind of more advanced stuff you can see also  here's snort some of the people who've read my   book I I think it's in Chapter 2 or 3, we uh I use  snort as an example of a application that we can   we can use I'm showing you how to use it to using  Linux in it and it doesn't come anymore with Kali   so in a later video I'll show you how to install  it in Kali it's not that hard to do but I get a   lot of questions about that because it's no longer  it's not installed by default and it's not in the   repository anymore but as I'll show you in a later  class is that you can actually pull applications,   binaries from any repos any Linux repository  so you don't you're not limited to the Kali   repository if you know how to do that and I'll  show you how to do that. You can see I have it   installed on my system if you don't know snort  snort is a IDS an Intrusion Detection System, it   allows you to be a ble to detect malicious attacks  to your system you it's one of those things that   you if you want to protect your network and  protect your system snort is designed to do that   it's now owned by Cisco as of 2014 so it's almost  10 years now it started off as a small open-   source project some 20 some years ago, it got  purchased by a company called Sourcefire and then   Sourcefire got purchased by Cisco so it's part of  Cisco's product line because it started it as an   open- source project it's still an open- source  project but they do have a version a commercial   version as well you'll see this in a lot of open-  source projects that get purchased by commercial   companies they still have an open source Community  version and then they have a a commercial version   snort is one of those good examples of that.The  open source version still works great you know   we can maybe that's something we'll do in a future  video as well but at least I'll I'll show you how   to install it on your system and the future video  when we start talking about how to install new   software into Linux and of course that's a real  key kind of of skill set in Linux is you know   you you've got all these tools already built in  the Kali but you're invariably going to run into   a situation where you need to install new tools  and I'll show you how to do that and I think it's   adding new software chapter 4 so we'll do that on  chapter 4 how to add new software. So just just   just I'm going to try and ask the the beginner  questions, so why did you use forward slash why   not just cd etc? Okay so that's an important  question um so what happens is that when I when   I change directories okay there's this concept  of absolute path and relative path within well   for that matter in any Operating System it's  not just in in Linux it applies to Windows,   it applies to Mac, applies to Unix, so what I'm  telling the system here is I'm coming in with   an absolute path I'm saying change directories  starting at the top of the file system the slash   that's the root and then move from there into etc  so it's let's go back to our diagram. All right,   let's go this is our what I'm doing here is I'm  saying get right, go right here slash and slash   is the top of the file system okay it actually  is it it denotes the top of the file system and   then go to etc okay so if I were to have let's go  back let's go back one level it goes back to pwd,   let's do that this is a real important concept  and let's go say cd to my home directory which   is kali okay like that notice that I typed it out  with an absolute path starting with the Slash and   then home and then kali. Now if I said cd etc this  is what's called a relative path all right, this   is change directory to etc, this says go ahead and  look for the etc directory after the root the home   the Kali so what we're looking for essentially is  root home Kali etc and when I do that right I get   an error because there is no there is no directory  there, this is called relative path to a directory   now if I go cd etc I say go ahead and start at the  very top and then move down to etc that is going   to be the absolute path and that takes me there.  So the concept is you can write the absolute path   starting with the very top of the file system  and then going through each directory structure   absolute path relative path says start from where  I am right now and then look for a subdirectory   that had that has this name so often times when  people start this is they get this kind of error   message right here no file such file or directory  because they're not fully comprehending the the   concept between absolute path and relative path  right so those are two important concepts and it's   probably something that I I don't think I fully  developed in Linux Basics for Hackers so it's a   good question and I I get a lot of questions like  that also when we're we're talking about doing an   ls command and I told you using the ls -l this is  what I use and it gives me a lot more information   than simply the ls command right. ls command just  shows me the files and directories doesn't give   me all the information about you know who owns  it and who what permissions there are on it but   there's another variation on ls that's important  and that's ls -la now the difference here is that   the a will give me the hidden directories and  files often times you'll see files that are   hidden and they won't show up with an ls but they  will show up with the ls -a I'm going to clear my   screen again clear so I can get the get a big  picture here. Now let's talk about ways that I   can get help in Linux you know as you're starting  off in Linux you're not going to know everything   about everything not none of us do you can be  using Linux from day one 30 years ago and that's   how old Linux is is now 30 years old and you're  not going to know everything and there's always   new tools that are coming up and you're not going  to know how to use it and so one of the best ways   of of finding information about whatever tool  you're trying to use is to simply use the help.   One of the best tools for hacking probably the  original tool and best tools for hacking Wi-Fi is aircrack. aircrack is the the granddaddy of  hacking tools okay of Wi-fi hacking tools and   there you see aircrack -ng, the ng stands for new  generation that means that distinguishes it from   the old generation aircrack and we just do help  and notice that I get a very helpful screen that   gives me all of the key information that I need  about this particular tool. Now one of the things   that I want to point out is that first of all like  any other command line interface you can just up   arrow if I push the up arrow look what happens  I go, it gives me the last command sometimes you   want to you know you don't want to go ahead and  retype the same command over and over again just   go up arrow and it'll go ahead and pull up some go  through it and you see all my old commands that's   kind of an important thing. Also let's go back and  do up arrow okay let's go to our, well let's go to   our aircrack once again this is our a aircrack is  the granddaddy got to spell it right and I'm going   to I'm going to do something I'm going to use my  Tab Key you can use the Tab Key to autocomplete   all right so if youve put in enough characters to  make it unique you can just go ahead and tab an   auto complete all right apparently there's some  people who watch these videos who complain that   I don't use the autocomplete. I'm glad you did  that because yeah that's quite it's hilarious   when people say that. So autocomplete you use  that you can use the tab to auto complete so   here we go here's aircrack notice that I used a  double dash, Okay this is kind of a it's kind of   an important concept so that switches or options  in Linux there's usually two types, right there   are switches that have a options or switches is  what they're called notice here that if there a   single letter okay there's one dash if it's a  word it's double dash. Now this is something   that is kind of a convention in Linux but and not  everybody abides by it but it's generally a rule   that most people abide by, see here all these are  single options so it's a single dash whenever we   use a word as an option we use double dashes  that's it's a general rule it's adhered to by   maybe 80% of applications not by all of them and  you can see here that here's our help right here   sometimes you can get to help by just using a -h  in this case it doesn't it tells me that help is   actually at dash dash help different applications  will use different uh options for getting help   sometimes you can get help with not even putting  in the help you can just put in the command right   and I'm going to go ahead and do an auto complete  with a Tab Key and then you can see that I just   typed in aircrack and I got the help screen. This  is often times with with tools you can just get   the help screen by just simply entering the name  of the the tool the binary okay the application   and it'll pull up all of the help screen for you  aircrack is an excellent tool it's been around for   it's been around for a long time. Let's see the  very top here we can see it's been around since   2006 so aircrack is one of those tools that you  should be familiar with and if you're not familiar   with it you know you can learn more about it by  simply going ahead and looking at the help screen   I'm going to go and do a a clear to open up my  screen real estate um another one of those tools   that we uh we probably should be familiar with  as a hacker when you're starting out as nmap,   so nmap that uses a to get help like I said is  that in aircrack we can get help by simply going   ahead and entering the command and and then dash  dash help -h doesn't work with an nmap h does work   for help and so we get the whole nmap. nmap is a  port scanner it allows us to scan a target system   to see what ports are open what services are  running on it this this is a way to get a picture   of what the target looks like one of the things  that I emphasize to all my students is that you   can't possibly be successful in hacking a system  if you don't know what the system is. You have   to do proper reconnaissance on your target to be  able to be successful, you will not be successful   if you don't do proper reconnaissance. One of  the first steps of doing proper reconnaissance   is knowing what ports are open, what Operating  Systems are running, what services are running   on that system. If you don't have the information  you're not going to be successful NMAP is one of   those tools and maybe we can do something in the  future or you've got other videos on NMAP but what   I wanted to simply show here is that one there's  different ways of getting the help screen and some   cases it's going to be dash dash help, in some  cases it's going to be just h and then there's   something called the Man pages that that's short  for manual that has nothing to do with any gender   right it has to do with manual and you go man and  then you say nmap and it'll come up with a screen   that's going to give you a help screen it's going  to give you a lot more information than the help.   It's going to give you a lot of, you can just  simply hit the enter and go through this long   description of this is NMAP and so if you've never  used NMAP and you want to learn about it here's   a way to do it all right and it's going to tell  you all about how NMAP works and this is going to   apply to most tools okay most of your binaries  so we then notice it says at the bottom here   press h for help or q to quit. So let q to quit. I  going to say that it' be great if you can do NMAP   as well it's always nice to get your perspective  so you know we can do it I see it's in your book   right so we can always add it as as part of the  series. Yeah we can do NMAP, NMAP is a is a great   tool and NMAP has gotten a lot more powerful in  recent years as has added more scripts that you   can use so it's actually become it started off as  a simple tool that basically open ports and now   it's become it's kind of a hacking framework now  it's probably overstating it but it's become much   more powerful than it used to be. Then let's clear  my screen all right so anything I'm trying to find   you information on I can just use the man command  to get to a manual sometimes when there's new   scripts that come out most of the tools that come  out are are scripts they are written as oftentimes   a Python script and generally the developers will  create a man page a manual page but not always but   generally they will one of the next skills that  we want to to talk about is how do I find stuff   there's so much stuff inside of my Linux how do  I go ahead and find things? And there's there's a   number of tools that I can use to be able to find  stuff. The first place to start I think is using   the keyword locate okay so locate locate will  basically go through the entire file system and   look for this keyword that's going to I'm going  to enter next. So if I go aircrack like that it's   going to find every reference and there's a lot so  it's going to find every place where aircrack is   at. Now this is a lot of information and it might  be useful right especially if there's only one or   two references but if there's a lot of them it  can be more information than you want and so   oftentimes what we're looking for is a binary,  binary being the application right and so this   is these are a lot of files in here that really I  don't really care about and so what what I really   want is where's that command at that I want to run  right and I can just do whereis right that those   two should be pretty easy to remember locate  whereis and then I go air and then I hit the tab and I autocomplete and then it tells me  where aircrack is. The the binaries and this is   the first one okay usr bin okay that's the users  binary aircrack. Okay user include aircrack and   user share and this is the man page you can see  that we just looked at that this is the man page   for aircrack and so that's really useful in being  able to find where the binary is. Now there's one   other way that a couple ways I want to show and  that is that sometimes there's a thing in in   there's a thing there's a there's a feature in in  Linux there's a feature in Linux it also applies   to the Windows machines and the Mac machines and  it's called the path okay and and most people in   using Windows system or Mac system don't ever  pay attention to the path but we often have to   pay attention to the path in Linux because it  determines where the system is going to look   for your command okay where is it going going  to look for your command and that's determined   by the path variable. So if I go echo okay and  echo's another one of those those commands that   basically says go ahead and show me display for  me the contents of a variable it's in my system   we'll talk about environmental variables in a  later class. This is the this is the path is an   environmental variable that stores where the  system is going to look look for my commands   automatically it's not going to look in every  directory because that wouldn't be that wouldn't   be efficient what it's going to look for it's  going to look for say the command aircrack in   one of those directories that has binaries why  would it look in the etc directory or the dev   directory because there's no binaries there right  so this is where the system determines where it's   going to look for those and this is our path.  So the path variable says is okay when I type   something like aircrack right just type it as a  a command it's going to look in user local bin,   user local in this case sbin user local  bin user local sbin, user local bin,   these are all the places it's going to look  and if it doesn't find it there it's going to   come back with a message that says there's no  such file or directory that doesn't mean that   it's not there it simply means that it's not in  one of these places and this come this can be   really confusing for a beginner okay. I install  a new tool right and I try to use it I just type   the command but that tools binary is not in one  of these directories. So if I'm looking for for   instance where the binary is in a path directory  I know this gets a little confusing I can use the   which command and I'm going to and I'm going to  do a tab and autocomplete and so what I did is I   used the command which now this is different than  whereis, whereis tells me where aircrack binary   is located okay it shows me all the places which  shows me where aircrack binary is located among   the directories in the path variable slightly  different slightly different either one of these   are can be really useful in being able to find a  binary if I've installed a new tool the binary may   not be in the path so this is where I would look  I'd use whereis, if it's in the path and you've   used it in the past it's going to show you here  where it is well I'm just going to use an example   here I installed a tool on this system yesterday  and it's called kite kite runner and so I'm going   to go it's called locate I'm going use it for  each and I'm going to go kr is the the name of   the file and comes back with lots of examples some  of them which have nothing to do with Kite Runner   that's too much information doesn't really help me  anything I can go whereis and whereis will show me   where Kite Runner is where the binary is at and  there it is it's under user local bin and then   if I go which KR it comes back with nothing why  because this is not in my path directory so I got   different results for each one of those commands.  So the one that's probably the most useful for me   okay is this command right here whereis it shows  me where the binary resides so to run this command   I need to be in this directory right here it will  not work so if I just do command not found right   that's something that beginners often run up  against right command I just installed that,   I just installed I know it's there why does it  why does it come back with command not found   right? Why does it come I I know I have it there  it's there right yeah and yes it is there but it's   not going to find it because when you type it like  this it's looking in the directories that are in   the path command but this particular directory  is not in the path variable I said path command   I meant path variable and I showed you that path  variable just a moment ago. So let's go back and let's just way... I always get asked about and  you you might get asked as well is people want   to know where the passwords are stored in Kali  because they've heard about RockYou or they want   to do like a Brute Force attack against sorry  a dictionary attack against a Wi-Fi password or   some something um and they want to know where the  passwords are stored? Okay well one of the things   that you can do in Kali to find all of the word  lists is go locate word lists all right and most   of the word list the password lists are under  they're labeled wordless and you can see well   there's actually RockYou right there and there's  going to be hundreds of word lists in Kali,   so one of the you know there's there's an art  and there's a science to password cracking the   the science is the scripts and the tools that we  use the art is going to be selecting or creating   the proper password list to use to try to crack  a password and that's something that comes with   some experience and not necessarily it's not  something that you know that you can just throw   a password cracking tool add a particular password  or hash of a password and be successful selecting   the proper password list is part of the art of  doing it properly RockYou is um you know it's   an old list has been around for a while what I  prefer other than RockYou is I've got a couple   of lists on hackers arise one of them is the top  10,000 most common passwords and the top 1 million   most common passwords I prefer to use those first  they're more successful the top 10,000 passwords   will cover about 10% of all the possibilities in  other words what we've done is we've collected    those passwords that most commonly appear in  the data dumps on the dark web and there's   about 10,000 passwords that get used over and  over and over again you can imagine what those   are right 1 2 3 4 5 6 7 8 you know I I love you um  you know and some some vulgar ones as well right   and so these passwords people think oh you know it  doesn't really matter what password I use as long   as it's a number of characters what have you but  people you know human beings are similar and they   think similarly and they use similar passwords and  so you can go into the dark web and we've already   done this for you and we've collected those  passwords that are most common so you can simply   use our 10,000 password list and that's going to  get you about 10 thou 10% of all of the passwords   used by people around the world we also have  another list of a top 1 million and that's going   to get you about 30% of all the passwords now of  course 30 % it's not 100% but I always recommend   when you're doing password cracking that you start  with a simple okay start small okay start simple   and this probably applies to life in general start  simple and then work from simple to more complex   you don't want to be running RockYou password  list when the password is one 123456 right you   know start with a simple small password list see  if it's there if it's not keep on getting into   larger and more complex passwords and one of the  things that I always run up against is that people   will use RockYou and some of these other password  lists and they'll say I couldn't find it I I ran   it for hours days what have you and I couldn't  find the password and I said well what country   are you in oh I am I'm I'm in I'm in France right  well you're running an English password list in   France right the the the the password is probably  not going to be in English it might be but it's   probably not so what you need is a French password  list and so and you can do some searches do some   Google searches and find some French, Spanish,  Arabic whatever language password lists that are   out there on the web and use those because these  lists you know these are made by English speakers   and they're probably not going to apply in all  countries especially if nobody speaks English   in your country right? Now one of the things  interesting we found in in in our attacks against   Russia is that Russia we found a lot of systems  that had English passwords on them because it   is interesting because we didn't expect that not  at all and what we presume is that because a lot   of the software is coming from English speaking  countries okay that there's the default passwords   are in English and then for whatever reason the  administrators changed them and used English   passwords it was a surprise for us so and yeah  we found lots of systems with English passwords   for whatever reason not entirely sure why but  we presume it's because almost every case the   software that was being used was produced in the  US or the UK and you know it it had everything's   in English right the whole all the software is  in English so the administrators put in English   passwords in Russia. Let's talk a little bit  about another more powerful tool for finding   what you're looking for in Linux and that's the  find command so let's uh there's find and then   we can use the dash h and let's take a it says  unknown predicate h, so the h doesn't work for   find let's try just using and there when there's  a and find command if we do it it actually does it   actually does its work which means find everything  and then we can let's try using dash dash help and   there we get their help screen so it took three  times through but took us a moment this is a a   really powerful tool for finding information  in your system. So find is is going to find   you know previously we were looking for binary  but sometimes we're looking for other things   you know like a configuration file, what have you  and find has a really powerful uh capabilities of   finding files that by size, by name, by when it  was created all of these things find can do for   us but in this very let me clear my screen,  we'll use it for a pretty simple task here,   let's say we want to find and the next thing  that we put in in terms of find is where do we   want find to look find is going to look through  the entire file system if we don't tell it but   we can say start at the top of the file system  right and then we can say what type of file okay   what do we want either a directory or do we want  a file we can say type and say file and then we   can say how do we want to search for it and say  we want to search by and let's say we want to   go find apache2, apache2 is the most widely used  web server in the world and let's see if we have   any of those on this system and look at what it  does comes back and says permission denied once   again this is something that you'll often find  using a lot of tools a lot of tools in Kali,   you'll come back and permission that when you see  that you right away know that you need to be root   to be able to do what you want to do so if you  get this message right permission denied what you   do is you just simply use the sudo command let's  go up arrow okay let up arrow and then use sudo   before it and then it asks me for my password all  right to prove that I'm actually who I am and now   it goes ahead and finds apache2 every place that  apache2 is on the system and I still going to come   back and tell me that some of them are permission  denied we can get pretty sophisticated with what   we can do with the find command but I recommend  that you get familiar with it you can do the man   and then find and it'll show you them and there's  a lot that we can use in the find to be very   specific about what you're looking for right.  Here's a very long man page on find but what I   want to show is another really important concept  okay in getting started in Linux and that's   called filtering with grep. So let's talk about  that let's go um ps okay ps is the processes,   so ps aux will show me all of the processes on the  system and so there's a lot there these are all   of the processes but generally when I use the ps  aux I'm not necessarily looking for all of these   processes I'm looking for one in particular so  I can filter out all of this and just look for   one particular file all right one particular  process that's running on this system and so   I can go ps aux and let's say then I'll go grep  and it says so this right here is the pipe and   what the pipe does is it says take this command  right here and take all of its output and then   send its output to another command in this case  the grep command and the grep filters for me and   only will show me what I'm looking for so maybe  let's say let's look for say the Burp Suite okay   I look for the keyword burp and it's got it it's  done some filtering but there's still a lot there   you can see it's a burp burp browser here and the  Burp Suite I was using the Burp Suite yesterday   obviously and so there's still a lot there um  maybe a better example and this is I'm going to   go ahead let's uh back up a little bit I clear my  screen one of the things that that I'll show you   in a later class is that there are you can start  and stop processes within Kali or any Linux by   what's now known as the system control command so  I'm going to go sudo system control now it used   to be that we used to use the service command  it's now service still works but system control   is kind of the more modern command and I can go  start and then go apache say let's go apache2   this will start the apache2 web server it did  it okay it started my apache2, so now if I want   to see if it's actually running I can go ps aux  and then grep apache2 and now this will tell me   it'll show me whether that process so this is will  show me all of the processes and this filters for   just this key word apache2 and there we are we've  got instead of all of that stuff that fills up my   screen I filtered out for just the keyword apache2 and I see there's multiple processes that are   comprising the apache2 um service and so this  would be. So I was just going to say sorry just   for people who might be confused what you did  there is you made your terminal window wider you   want to make it like much wider and then run the  command again just so people see it's all on one   line perhaps. There we go that's much better  yeah so I've gone ahead and uh and asked the   system to show me all of the processes and then  filter for just the keyword apache2 and these are   all processes that are linked to the apache2  service the web server and you can it'll show   me who the user is this case is the root user and  then these are www -data are the standard user on   the Apache server and then this last line here is  basically the command looking for notice it says   grep so you're going to when you do this you're  going to get the the search itself is a process   and so here it is the Kali user me right now is  looking for apache2 so that's the final line here   is that command looking for Apache these are all  part of the service that has been started so this   is really useful when you're trying to filter out  out a lot of information and so the grep is one   of those key terms that you know we're working  from a command line and we've gotten too much   information we want something very specific we can  pipe the output okay that's what this is here pipe   the output to a filter command grep is a filter  command and then this is the keyword that we're   looking for and you see I've gone from this a ps  aux so much information to too much information   right to also notice that the last the last  process is the search and then I can go and   then I go from that to grep and then apache2  oh that's what I want I didn't want all that   other information I've got exactly what I want  on the screen right now and that's uh that's the   key. Just for people who missed it if you just  scroll up it show people might be confused and   not realize there's a lot of processes right yeah  like crazy right there's crazy. These are all the   processes that are running on your system and  many of them are simply started by default when   you start your system they're not ones that I  necessarily started but as you're running your   system the longer you run it here we yesterday  we were doing API hacking and this is a this   is the crappy is a uh is a simulation of a API  tool that we can use for attacking the uh apis   so you got lots of things running on here but I  only wanted to see this that's all I wanted to   see I want to see the services for Apache I even  though there's a little bit more in this chapter   I think we've done a lot and I don't want the  the video to get too long you know we've we've   covered a lot of material. OccupyTheWeb I really  want to thank you for sharing your knowledge and   you know creating this sort of video companion  guide to your book really appreciate you you   know taking all your experience and I've said  this many times but like bringing it down down   to like mere mortals level or beginners level  level so I really appreciate you doing that and   I really look forward to the to the next video  just for everyone who's watching OccupyTheWeb   and I going to hopefully continue with the series  going through his book put your comments below   let us know what you want us to cover we've got a  whole bunch of ideas uh time is the biggest issue   but hopefully we'll be able to cover a lot of  the the Linux videos on my channel OccupyTheWeb   any last words? uh no no last words other than I  love doing these with you David and hopefully we   can keep this going anybody who you know wants  to learn more about Linux take a look at my   Linux Basics for Hackers you know it's intended to  get you started on the path to becoming a master   hacker but the first thing you got to do is you  got to learn Linux so we'll continue to do this   and we'll go through the entire book over the next  several months. Great thank you. Thanks David!
Info
Channel: David Bombal
Views: 615,544
Rating: undefined out of 5
Keywords: linux, kali linux, ubuntu, kali, parrot os, ethical hacking, linux for hackers, ethical hacker, information security, linux for hacking, how to hack, linux tutorial, intro to linux, linux introduction, kali linux tutorial, mr. robot, hacking tools, hack the box, htb, linux foundations, linux course, linux beginner, linux hacking course, hacker (interest), hacking linux, kali linux nethunter, install kali linux on android, kali linux android, kali linux install
Id: YJUVNlmIO6E
Channel Id: undefined
Length: 71min 50sec (4310 seconds)
Published: Sun Sep 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.