0:02 hello and welcome to this 15 hour
0:04 edition of the Practical ethical hacking
0:06 course my name is Heath Adams and I'm
0:08 going to be your instructor for the
0:10 entirety of this course okay quick edit
0:12 so you might be looking at the YouTube
0:13 video and seeing that it's only seven
0:16 plus hours that is because YouTube
0:19 recently implemented a rule that we can
0:21 no longer have videos over 12 hours so I
0:23 had to split this into two parts I had
0:25 to add this edit in and go back and
0:27 re-render everything so this is
0:30 officially part one and we'll go through
0:31 part one and then I'll have a link in
0:33 the description below for part two so
0:35 without further Ado let's Jump Right In
0:39 A really quick who am I again my name is
0:42 Heath Adams and I am the CEO of TCM
0:44 security we are a cyber security
0:46 consulting firm and an educational
0:49 institution on a day-to-day basis we
0:51 primarily focus on what's called ethical
0:54 hacking that is where companies hire us
0:56 to try to hack into them to find
0:58 vulnerabilities and let them know of any
1:00 security issues they may have before the
1:02 bad people find those on their own that
1:04 could be breaking into a network a web
1:07 application wireless network mobile
1:11 applications thick client applications
1:13 Etc I can even be breaking into a
1:14 building which is called physical pen
1:16 testing there's a lot of different types
1:18 of hacking out there we're going to
1:20 cover quite a bit of that in this course
1:23 now hacking is such an interesting field
1:24 because you don't have to necessarily
1:27 come from an I.T background I'm actually
1:29 a former accountant and I just fell in
1:32 love with hacking and I know people from
1:33 all different walks of life we have
1:35 somebody that works for us that used to
1:37 be a mayor I've seen doctors I've seen
1:39 pharmacists I've seen all different
1:42 kinds of weird backgrounds come into
1:43 ethical hacking so if you're watching
1:45 this and you really don't have an I.T
1:48 background a formal one that's okay as
1:50 long as you have some basic computer
1:51 knowledge some basic networking
1:53 knowledge that's all you really need to
1:54 succeed in this course we're going to
1:56 hold your hand the entire way through
1:58 and make sure that you get and
2:00 understand everything that's presented
2:02 in front of you in terms of the
2:03 qualifications I've listed my hacker
2:05 certifications that's not all the
2:06 certifications but those are the ones
2:08 that are relevant maybe make me an
2:11 expert whatever I've also listed my
2:13 social media if you want to follow me on
2:15 LinkedIn or follow the company on
2:17 Twitter follow me on YouTube I would
2:19 love if you just hit subscribe right now
2:21 before we even get started or you want
2:23 to wait till the end that's perfectly
2:25 fine as well we're making our way to a
2:27 million subscribers and you could be a
2:28 part of that and I would absolutely love
2:30 it if you did
2:32 we also have some sites we have our
2:34 Consulting site which is just
2:37 tcm-tech.com we've got the academy which
2:38 I'll show you here in a second we also
2:41 have certifications site now before we
2:42 dive into things you might say to
2:45 yourself this course seems familiar and
2:48 that's because it might be last year we
2:50 released a ethical hacking course in 12
2:54 hours this year it's up to 15 hours last
2:57 year that total of you has got 3 million
2:59 views in 11 months which is great it
3:01 hasn't even been a full year yet and we
3:03 taught quite a bit of lessons in here
3:05 you can see all the different lessons we
3:07 taught in here so you might say hey
3:08 what's the difference between this
3:11 12-hour course and the 15-hour course
3:13 while there's quite a few differences
3:17 three hours to be exact but even with
3:18 the three hours of time difference we
3:20 went through a lot of this in for
3:22 example in the Kali Linux section that's
3:25 been completely redone the python
3:27 section has been completely redone so a
3:29 lot of these videos and tools and ideas
3:32 have been brought in into 2023
3:35 methodologies so not only are there
3:36 three hours more but a lot of the videos
3:40 and content have been recreated for 2023
3:42 specifically to make sure that this is
3:45 up to date and fresh so you're getting a
3:47 brand new courses this is the latest and greatest
3:48 greatest
3:51 now this course is actually an extension
3:54 of a 25 hour it's pretty close to 27
3:57 hours now of materials that is on our
4:00 TCM Security Academy website and this is
4:02 the only time I'm going to try to sell
4:04 you on anything throughout the entirety
4:06 of this 15 hours so I just ask for one
4:07 minute of your time
4:11 this course takes the first half the 15
4:13 hours takes the first half of what's in
4:15 here if we scroll down to the curriculum
4:17 we actually have all the first half here
4:19 you'll see this if you actually came to
4:21 the website it's the exact same thing
4:23 you're getting in this course this goes
4:25 all the way through the Capstone and the
4:28 buffer overflows here and that is a
4:29 great stopping point we'll go to the
4:31 Capstone we'll go through it it's a
4:33 great Midway point to test your skills
4:36 if you get through the Midway point and
4:38 you say hey I really like this I want to
4:40 get the rest of the course we have even
4:42 more stuff in here we have active
4:43 directory which is one of my favorite
4:46 things to pen test against and I would
4:48 say it's the best part of the entire
4:50 course we teach that we cover quite a
4:52 bit of this all this is on active
4:54 directory right here we cover more post
4:56 exploitation we cover web app pen
4:59 testing application pen testing we get
5:00 into a little bit of Wireless testing
5:02 and legal documents and all that fun
5:07 stuff so the 15 hours that's here it's a
5:09 great great resource it gets you started
5:11 if you love it you love our instruction
5:15 you want more this course is 29.99 all
5:17 of our courses in fact on the academy if
5:20 we go over here they're all 29.99 so if
5:21 you're interested we have an all access
5:23 pass that gives you access to everything
5:26 we've got courses on Linux python we've
5:29 got courses on privilege escalation osin
5:32 external pen testing all different kinds
5:33 of stuff in here if you're interested in
5:35 that I just encourage you to check out
5:37 the website you don't have to buy
5:39 anything this is completely 100 free if
5:41 you just want to stick with the 15 hours
5:45 last but not least this course does lead
5:47 to what is a certification we have a
5:49 certification called the pmpt it's the
5:51 Practical Network penetration testing
5:53 certification I'll link it down in the
5:55 description below it's a one-of-a-kind
5:58 certification you go through you try to
6:00 hack an organization you write a report
6:02 you present a debrief and the good thing
6:05 about this is it gets you job ready for
6:07 the field so if you can get through this
6:09 certification you actually go look for
6:11 the pmpt on LinkedIn or indeed you're
6:14 going to find this on job postings so
6:16 this course 15 hours of this is part of
6:19 a 50 hour curriculum that we have and so
6:21 if you feel that hey I really am
6:22 interested in this field and maybe I
6:24 want a certification consider looking at
6:27 the pmpt as well and that's really it
6:30 we're gonna end here salesmanships over
6:33 please enjoy this 15 hours if you do
6:36 please like comment subscribe all that
6:37 fun YouTube stuff let's go ahead and
6:39 jump right into this course I'm so
6:41 excited to teach you in this 2023 day Edition
6:48 all right I hate PowerPoints but I love
6:51 this template I don't know what's so
6:52 cool about it it's all the colors I
6:55 think so welcome to a day in the life of
6:57 an ethical hacker 2022 edition let's
6:59 talk about a pen tester's day to day and
7:02 I'm going to highlight this at a very
7:05 high level so what we do is we roll out
7:06 of bed hopefully we wake up in the
7:10 morning and we kick off our day and now
7:12 our day can be performing an assessment
7:13 and we're going to talk about the
7:15 different assessment types that are out
7:17 there it could be writing a report it
7:19 could be giving a debrief or a
7:21 collection of the three when we perform
7:23 an assessment we're talking about
7:25 different types of pen testing or
7:27 ethical hacking and we're going to cover
7:29 the most common types we'll talk about
7:31 some other types as well once we perform
7:34 our assessment we need to write a report
7:36 we deliver a report to our client that
7:39 report then gets digested and eventually
7:41 we give them a debrief if they want one
7:44 and we talk about our findings and so
7:46 we'll cover this whole process from
7:49 start to finish let's talk about the
7:50 different types of Assessments that we
7:52 could perform as an ethical hacker now
7:54 the first type of assessment I want to
7:56 talk about is what is called an external
7:58 network pen test and one of the
8:00 questions that we ask people when we're
8:01 doing phone screens and baselines on
8:03 interviews is we say hey can you tell me
8:06 what an external pen test is versus an
8:09 internal pen test and honestly I would
8:10 say at least half the people get the
8:12 answer wrong so make sure you're paying
8:14 attention and you take notes because
8:17 this may come up on an interview now an
8:19 external pen test is probably the most
8:20 common type of pen test that we perform
8:22 if you just got hired as a penetration
8:24 tester and you're brand new to the
8:26 industry it's likely they're going to
8:28 start you out doing external network pen
8:30 tests these pen tests are the most
8:33 straightforward and something that a
8:35 junior could take on and work through
8:37 and build up some experience and or
8:39 confidence as they go through their
8:42 process so an external pen test is
8:44 looking at an organization's security
8:47 from the outside this could to be us
8:50 trying to hack in from our mom's
8:52 basement or from another country or
8:54 whatever it might be whatever scenario
8:56 plays out in your head that's what it
8:58 could be you're trying to hack in from
9:00 the outside the methodology for external
9:02 pen tests focuses heavily on what's
9:03 called open source intelligence
9:06 gathering or oh send we're trying to
9:08 gather as much Intel and data about an
9:11 organization who are their employees
9:13 what is their email format have they
9:15 ever been involved in a breach can we
9:17 find out what passwords were in those
9:19 breaches can we collect data and then
9:22 use it against that organization to
9:25 reach a login panel or breach the VPN or
9:27 get into an area where we otherwise
9:29 would not be allowed into now why do we
9:31 focus so much on open source
9:34 intelligence well because this is an
9:36 external assessment you have to think
9:38 about the internet as a whole there are
9:42 Bots scanning the internet 24 7. if you
9:44 don't believe me try putting up an SSH
9:47 server or something similar and leave it
9:49 up for 24 hours and see how many login
9:51 attempts you get on that server it's a
9:53 lot Bots are scanning all the time so
9:56 what does that mean for us well that
9:57 means that if we do vulnerability
10:00 scanning and we find something that is
10:03 incredibly dangerous
10:05 well somebody's probably already found
10:07 that as well so the chances of us
10:09 finding something like remote code
10:12 execution where we can land on a machine
10:14 externally without doing a lot of work
10:17 it's pretty low usually organizations
10:19 have their external networks buttoned up
10:22 from a patching perspective so what
10:23 we're really looking at is the Intel
10:25 that we can gather where are the login
10:27 panels who are the users and how can we
10:29 use that against the organization now
10:31 this is the most common type of pen test
10:34 that organizations do in my opinion for
10:37 two reasons the main reason is that a
10:39 lot of compliance organizations dictate
10:41 that an external network pen test must
10:44 be performed annually that is not true
10:46 for the rest of the pen test though some
10:48 compliance organizations might dictate
10:51 other pen tests the external is by far
10:53 the most common the other side of this
10:56 is external pen tests tend to be a
10:58 little bit cheaper than the rest of the
11:00 assessments depending on the size and
11:01 scope of the engagement and a lot of
11:04 organizations like to dip their toes in
11:06 the water before going and doing more
11:09 assessments with a security firm so they
11:11 might test you out and say hey let's do
11:12 an external pen test we'll see how it
11:14 goes we like you we'll hire you for more
11:17 stuff so between those two reasons we
11:19 see a lot of external network pen tests
11:21 more so than anything else in my opinion
11:23 now these pen tests tend to last around
11:26 32 to 40 hours on average though if you
11:28 have a very large engagement that can go
11:30 a lot longer or if you have a very small
11:33 company and you're looking at one IP
11:35 address or five IP addresses and 10
11:37 employees it's probably not going to
11:38 take you 32 hours to do that pen test
11:40 maybe somewhere in the 8 to 16 hour
11:43 range we then tend to add another 8 to
11:45 16 hours for report writing and we'll
11:47 touch base on report writing towards the
11:49 end of this video so moving on is what
11:51 is called an internal Network pen test
11:53 this is assessing an organization's
11:55 security from the inside of the network
11:58 this means that we somehow breached the
12:00 perimeter perhaps we sent a phishing
12:02 email and somebody opened our email
12:04 clicked on our link and now we're inside
12:06 the network or maybe we broke into the
12:08 building and left a dropbox behind
12:10 whatever scenario in your head you want
12:12 to play as well you can do that what we
12:14 do on our end is we typically send a
12:16 laptop out to the client the client
12:18 plugs that laptop in and we are able to
12:21 remote into that laptop and perform a
12:23 network assessment as if we were sitting
12:26 inside the office this is why a lot of
12:28 work nowadays is remote because we don't
12:30 have to be on site anymore to do
12:32 internal pen tests now the methodology
12:34 for an internal penetration test focuses
12:37 heavily on active directory now if you
12:38 don't know what active directory attacks
12:40 are you absolutely need to learn those
12:42 in order to be a successful internal
12:44 penetration tester and it's one of those
12:46 things that a majority of the
12:49 organizations that are out there use so
12:51 I believe the statement that I read once
12:54 was 95 or 99 don't quote me on this by
12:57 the way of the Fortune 500 companies use
12:59 active directory in their environments
13:01 and I honestly think that this number is
13:04 way closer to 99 than anything else
13:06 every single internal pen test I've ever
13:08 done with the exception of one client
13:11 one very small client has always been on
13:13 active directory so you need to
13:15 understand active directory methodology
13:17 in order to perform an internal Network
13:20 pen test these typically last 32 to 40
13:22 hours though they can run a lot longer
13:24 again depending on the size and the
13:26 scope they don't typically run shorter
13:28 though I have seen them run 16 to 24
13:30 hours if the network is very small but
13:32 there is a checklist that we have to run
13:34 through that is usually in the 32 to 40
13:36 hour range and just like external pen
13:39 tests we tack on another 8 to 16 hours
13:41 for report writing now the third type of
13:43 assessment I wanted to talk about is a
13:46 web application pen test this is
13:47 probably the second most common I wanted
13:49 to group the external and the internal
13:52 pen test together but you have to think
13:54 about networks nowadays versus web
13:56 applications there are websites
13:58 everywhere there are more websites than
13:59 there are networks if we're just
14:01 counting websites to business networks
14:03 there probably are more web sites to
14:05 home networks as well though I'm not
14:07 entirely sure of that I would argue that
14:09 the answer is probably way more websites
14:12 than home networks so with that there's
14:14 a lot of attack surface that's out there
14:17 so organizations will come to us and
14:19 they'll say hey we need a web
14:21 application pen test this can be
14:23 dictated Again by compliance perhaps
14:25 stakeholders want to see this or maybe
14:27 the client is very interested in the
14:29 security of the application and wants to
14:31 make sure that it is very secure before
14:33 they launch their application now the
14:36 methodology focuses heavily on web-based
14:39 attacks obviously and the owas testing
14:42 guidelines so oauth stands for the open
14:44 web application security project you've
14:46 never heard of it Google it it's a great
14:48 resource they have testing guidelines
14:50 for not just web application but mobile
14:53 as well they have how to test how to
14:55 defend how to prevent all kinds of great
14:57 things and we follow their testing
14:59 guidelines pretty exclusively if you're
15:01 ever going to be a pen tester and you
15:03 want a pen test against web apps you you
15:05 for sure need to know what the owas top
15:07 10 attacks are because you will be asked
15:09 those in an interview now these
15:11 engagements last typically 32 to 40
15:14 hours and that is pretty much the
15:16 minimum we have a very thorough
15:17 checklist that we have to go through
15:20 when we're doing a web app pen test and
15:21 I would say it pushes closer to 40 hours
15:24 than anything else unless it were a very
15:26 very small and specific web application
15:29 they're almost always in the 32 to 40
15:31 hour range with another 8 to 16 hours
15:33 for report writing another Common
15:35 Assessment that we are asked to perform
15:37 as pen testers is what's known as a
15:39 wireless pen test or a wireless network
15:41 pen test and we're assessing an
15:43 organization's wireless network security
15:45 so the methodology will vary depending
15:47 on what type of wireless network is
15:49 being used for example if they're using
15:51 a guest Network we might log on to the
15:54 guest Network and test segmentation can
15:57 a guest access internal resources or is
15:59 the network properly segmented if
16:01 they're using a pre-share key which is
16:04 what's common in most household and we
16:06 might test that pre-share key for
16:08 password strength and see how strong the
16:09 pre-shared key is and how strong the
16:11 password is if they're using
16:13 enterprise-based network then we open
16:15 ourselves up to a variety of new attacks
16:17 as well so our methodology really
16:20 changes depending on what is being used
16:22 now Wireless pen testing is fairly
16:24 straightforward you can look up the
16:26 methodology online find blog posts about
16:28 it you just need a wireless network
16:30 adapter that you can honestly pick up
16:34 for 30 to 50 dollars at most and I'll
16:35 leave a link in the description below to
16:38 my favorite wireless network adapter but
16:39 you can just pick one that is compatible
16:43 with your machine and that will work and
16:45 do packet injection it's honestly where
16:47 a lot of hackers start this is where I
16:49 got my start before I ever learned about
16:51 real pen testing or anything I went and
16:54 bought a cheap wireless adapter and I
16:55 started just hacking my own network and
16:57 some devices that I had laying around at
16:59 the house and I learned how to hack
17:01 wireless pretty quick so it's one of
17:02 those things that kind of gets you
17:04 excited it and gets you into the hacking
17:05 mindset and kind of teaches you some of
17:07 the wireless assessments that are out
17:09 there and I think it's pretty fun as
17:12 well now these typically last about four
17:15 to eight hours per SSID so if we're
17:17 testing two ssids we're probably looking
17:20 in the 8 to 16 hour range and then
17:21 typically another two to four hours for
17:23 report writing all right the last thing
17:25 I want to touch on in terms of
17:27 Assessments that we do quite a bit are
17:29 physical pen tests and social
17:31 engineering assessments so when we're
17:32 doing a physical pen test we're
17:34 assessing an organization's physical security
17:35 security
17:37 and our methodology is going to depend
17:40 on the tasks and goals that are at hand
17:42 that are given to us by the client so if
17:44 we're doing a physical pen test we are
17:46 going on site and we're trying to break
17:48 into the building that can be through
17:50 cloning badges that can be through
17:52 social engineering that can be through
17:54 picking locks there's a lot of different
17:57 scenarios that are at hand there now
17:59 that methodology again depends on what
18:01 we're up against and it also depends on
18:03 the client's goal the client might say
18:04 hey we want to see if you can just even
18:06 get in the building or they might say
18:08 hey I want you to get in the building
18:11 and find our server closet and take a
18:12 picture of yourself in our server closet
18:14 we want to see if you can make it there
18:16 so there's typically some goal behind
18:18 why you're breaking into a building but
18:20 it is legal breaking and entering and
18:21 it's pretty fun and pretty exciting if
18:23 that's your jam and there's a lot of
18:25 social engineering involved in that so
18:28 it's very very fun engagement to do the
18:30 other side of this is pure social
18:33 engineering and what I mean by that is
18:35 doing something like a phishing campaign
18:37 against an organization and we might
18:39 actually do a phishing campaign in
18:42 combination with an external pen test so
18:43 we might combine those together though
18:46 often they're left apart we might do
18:48 something like a fishing campaign where
18:51 we call people and we say hey I'm from
18:53 I.T can you give me your password or I
18:55 just sent you a code to your account can
18:57 you give me the code that I just sent
19:00 you we might do a smishing campaign
19:02 where we send text messages and see if
19:04 anybody responds back to us there's a
19:05 lot of different social engineering
19:06 that's out there and we have different
19:08 campaigns that we can run in different
19:10 engagements depending again on the
19:12 client's need now the great thing about
19:14 this is social engineering and physical
19:16 pen testing offer a lot of learning
19:18 opportunities and training opportunities
19:20 for example when we do physical pen
19:22 tests we wear cameras on our hip and we
19:25 record everything that we do not just
19:28 for our liability but also for teaching
19:29 end users at the end of the day we'll
19:32 cut that video have a Lessons Learned
19:33 here's the good things they did here's
19:35 the bad things they did and they can
19:38 walk away with a way to improve moving
19:40 forward the weakest element of any
19:41 organization is going to be the human
19:44 you can have a great environment great
19:47 policy security everything set up and
19:48 all it takes is one really nice person
19:51 to hold the door open for you and that
19:54 can lead to catastrophic events so
19:56 social engineering again is a very
19:59 important part of security and it's one
20:01 of my favorite things to assess when I'm
20:03 doing this type of work now again these
20:06 can last anywhere from 16 to 40 hours
20:07 maybe even more depending on the
20:09 engagement that you're on plus another
20:11 four to eight hours for report writing
20:13 again maybe more depending on the scope
20:14 of the engagement that you're working
20:16 now these aren't the only assessments
20:18 there are other assessments that we
20:20 might perform as a pen tester these tend
20:22 to get a little bit more specialized and
20:23 you might have to take additional
20:25 training in order to learn this type of
20:26 stuff but these are things that we
20:28 perform at work and you may end up
20:30 performing as well so we have mobile
20:33 penetration testing it's a lot like web
20:34 application penetration testing in the
20:36 sense that you're testing against an
20:38 application except it's on a mobile
20:41 device so iOS or Android and then
20:42 there's specific methodology and
20:44 techniques related to those operating
20:47 systems you may have iot or Internet of
20:49 Things penetration testing and somebody
20:51 might send you something like one time
20:54 we got sent over a pressure cooker that
20:55 was a wireless pressure cooker and they
20:57 wanted it pen tested so we had a lot of
20:59 fun doing that there's red team
21:02 engagements which are kind of sort of
21:04 like pen testing but not really what I
21:06 say pen testing I think of banging at
21:08 the front door where red teaming is
21:10 trying to sneak in in whatever creative
21:12 way you can so a red team engagement
21:15 might say hey we want you to hack our
21:17 company you've got a month or six months
21:19 or a year and we don't want to hear you
21:21 we don't want to see you we don't want
21:22 to know about it just let us know if you
21:24 can hack into us in these types of
21:26 engagements the methodology can be
21:28 anything depending on what is allowed in
21:30 scope usually it's pretty open in the
21:32 scope I've heard a red team sending
21:35 people to the client location and they
21:36 might even live there for a little bit
21:38 they might befriend some of the
21:40 employees try to become buddy buddy
21:42 learn some internal Secrets maybe get a
21:44 password slip them a thumb drive they
21:46 might do all kinds of social engineering
21:48 engagements it's very very custom and
21:51 unique to the client and Depends again
21:53 on the scope which is usually pretty
21:56 wide and what they can and can't do so
21:57 red team engagements are pretty awesome
21:59 but they're also incredibly stealthy
22:01 where pen testing is very time Limited
22:04 in the sense that we might only have a
22:05 weak engagement we're going to know the
22:07 IP addresses we're going to know our
22:09 scope and we're going to have a set
22:11 defined limitation in front of us where
22:14 red team doesn't have that as much now a
22:16 purple team engagement is something that
22:18 you might do tabletop exercises and
22:20 things like that where you as a red
22:23 teamer or being offensive and working
22:26 with a blue team or defensive you work
22:28 together and that makes purple and in
22:30 that sense you might tabletop and say
22:33 hey I just ran this attack do you see me
22:34 in your network I just ran this other
22:36 attack do you see me and you try to
22:39 establish a Baseline and you can see Hey
22:42 where's the detection at where is the
22:44 detection weak and how can we improve
22:45 detection mechanisms within the network
22:48 it's usually a bit of a more mature
22:50 process an organization that's never
22:52 gone through a pen test before likely
22:54 isn't just going to jump right into a
22:55 purple team engagement but it is
22:57 something that more mature organizations
23:00 do in order to improve their baselines
23:02 and improve their detection mechanisms
23:04 internally now I've covered just a
23:06 handful of the different types of pen
23:08 testing engagements that you can work on
23:10 there's car hacking there's airplane
23:13 hacking there's scada hacking there's
23:15 all kinds of really cool stuff out there
23:18 that you can do I discovered the most
23:19 common items but you can absolutely
23:21 specialize if that's something that
23:23 you're interested in now with all the
23:25 fun of getting to do assessment work
23:27 there comes the downside of report
23:30 writing and debriefing I actually enjoy
23:33 doing both and in order to be a
23:35 successful consultant you really need to
23:39 be a three-headed person in a sense you
23:41 have to be really good at technical
23:43 abilities you have to be really good at
23:45 report writing and communicating
23:47 effectively not just to a technical
23:49 audience but to a non-technical audience
23:51 and you also have to be good with
23:53 presentation skills in the sense that
23:56 you need to present your findings to a
23:58 technical and non-technical audience so
24:00 with report writing we typically deliver
24:02 a report within a week after the
24:05 engagement now that report should be
24:07 high level and Technical so we have
24:09 what's called an executive summary for
24:11 non-technical people think about a CEO
24:14 who might not be a technical person if
24:16 they're going to read the report it
24:18 should still be Crystal Clear what the
24:20 issues were and how they should be fixed
24:22 and that's what the executive summary is
24:24 now we have a technical findings section
24:26 and that's for the people doing the work
24:28 maybe the security engineer the network
24:30 engineer or the web app developer
24:32 depending on who you're working with it
24:35 can digest the findings they can say hey
24:37 here's what they found here's what tools
24:40 they use here's how they were able to do
24:42 it and here are the recommendations for
24:44 remediation now recommendations should
24:47 be incredibly clear you should have high
24:49 level recommendations like hey patch
24:51 this and you should have technical
24:54 recommendations as well that says hey go
24:55 to this website here's how you would
24:58 install this patch etc etc so depending
24:59 on your audience you want to make sure
25:01 that you're communicating effectively to
25:03 both of them and for a lot of new pen
25:05 testers this can be an incredible
25:07 struggle it's one of those things that
25:09 you write a report you get beat up on it
25:12 in the QA process and you just get
25:14 better over time and it's just something
25:16 that is kind of passed down and you
25:18 learn as you go so don't be worried if
25:20 you're not great at report writing just
25:22 make sure that you understand that if
25:23 you're going to do this job you will
25:24 have to write reports and you will have
25:27 to get better at it as you go last but
25:30 not least is the debrief process now a
25:33 debrief walks your clients through your
25:36 report findings and again this should be
25:39 non-technical and Technical as well you
25:42 may be sitting in a room with a CEO and
25:44 a network engineer you might be sitting
25:45 in front of all technical people you
25:47 might be sitting in front of all c-level
25:49 non-technical people so you need to make
25:51 sure that when you are presenting your
25:53 findings that you can explain it at a
25:55 high level and a technical level as well
25:58 I've seen many people struggle with this
26:00 all right I've had I've been in one
26:02 situation I remember that I was in a
26:04 debrief with a co-worker of mine this
26:07 was years ago and he was very much
26:09 struggling to communicate he was giving
26:12 very technical in-depth details about
26:15 what he was Finding and the CEO kept
26:16 stopping him and saying I don't
26:18 understand what you're saying so we had
26:19 to do a little bit of translation
26:21 because he really wasn't great at the
26:23 debrief process yet he was still fairly
26:25 new and it's one of those things that if
26:26 you're going to be an effective
26:28 consultant you need to be able to do both
26:29 both
26:31 now the debrief is important because it
26:33 also gives the opportunity for your
26:35 client to ask any questions about the
26:37 findings that you have and address any
26:39 concerns as well so maybe there's a
26:41 finding that they want to challenge or
26:44 they want more information on it gives
26:46 them the opportunity to do that because
26:48 when we give them the initial report the
26:50 report is a draft after the debrief or
26:53 if they choose to not have a debrief we
26:55 finalize that report so the debrief is
26:57 the last opportunity the client has to
26:58 understand what you're presenting to
27:01 them and to ask any questions or address
27:03 any concerns so it's a very very
27:06 important process alright hopefully that
27:08 was informative for you if you're
27:10 looking to become a pen tester you
27:12 should know at a high level what these
27:13 different types of assessments are and
27:14 you should know what you're getting
27:16 yourself into because a lot of people
27:18 think oh it's fun and games I just get
27:20 to go hack things and yes that's a lot
27:22 of the job but a lot of the job is also
27:25 doing report writing and doing debriefs
27:26 in front of our clients so if you're not
27:28 strong with report writing or if you're
27:29 not strong with your presentation skill
27:32 cells you may have some time on The
27:34 Struggle Bus before you get decent at it
27:36 alright so make sure that you know
27:37 coming into that that those are things
27:39 that you're going to have to be doing
27:41 and that you're comfortable doing those
27:48 so before we begin in this course and we
27:50 really start to dive in it's important
27:53 to cover one of the topics that I'm
27:55 going to harp on the most which is
27:58 effective no keeping if you're going to
28:00 be successful in your career and you're
28:01 going to be successful in this course
28:05 you really need to take good notes now
28:07 in this first video I'm going to show
28:09 you what my notebook kind of looks like
28:12 not only for my personal notebook but as
28:15 a notebook for an assessment and how I
28:17 might take notes for an assessment and
28:19 then I'll also show you some note
28:22 keeping applications that I prefer or
28:25 I've heard students prefer in the second
28:26 video we're going to cover how to
28:28 install one of the applications and
28:31 another cool application used for taking
28:33 screenshots so let's take a look at my
28:35 notebook first
28:37 so here is my notebook and actually
28:40 let's click over here so this is my
28:41 notebook and you can see it's really
28:43 long it's got all kinds of stuff in here
28:44 and it's just something that I build
28:47 upon this one in particular is actually
28:50 only geared towards active directory so
28:52 I have a few different notebooks this
28:54 one is active directory and it's
28:55 actually a few different courses that
28:57 I've taken in the past that I've kind of
28:59 put together and then just for
29:01 assessment work etc I just kind of have
29:03 a little cheat sheet here so I wanted to
29:05 show you this one in particular because
29:07 these were built off of courses and
29:09 you're going to be working through a
29:11 course so kind of just get an idea of
29:14 how maybe to structure it so here you
29:16 can see I structured it and I've got
29:18 different modules here where okay module
29:20 one might have had this email macro
29:23 fundamentals module two two here has all
29:25 these different uh components to them
29:28 right and we have we have our notes then
29:29 we have child notes and even sub
29:32 children to those child notes and I'll
29:33 show you how to create that here in a
29:35 second but let's say for example
29:37 enumeration which is one of the most
29:38 important things that you're going to
29:41 cover in hacking and we take a look at
29:43 enumeration you don't have to understand
29:46 what any of this means here but you
29:48 could see if I want to look at a domain
29:50 and I want to get the current domain
29:52 that I'm on here's the command I run and
29:55 here is a picture of what it looks like
29:57 and here's what comes back when you run
29:59 that command that's great that's what I
30:00 want to see and I have a whole list of
30:03 commands for all these in here right so
30:06 if I'm confused on a assessment and I
30:08 want to go and
30:10 find a command that I'm not sure of I
30:13 can go to my little cheat sheet here now
30:16 again this is really long so you have to
30:17 create your notes the way it really
30:19 helps you for a course I think it's good
30:22 to write it all out step by step like
30:24 this and then go back and make a cheat
30:26 sheet I don't need this pictures anymore
30:28 I've been doing this for a while so
30:31 maybe I just say hey get current domain
30:33 is get net domain and then I say hey
30:36 okay get object of another domain here's
30:37 an example of it I don't need the
30:38 pictures because it makes it really long
30:41 but as an example and over time you
30:43 learn with the pictures as well at least
30:48 so let's build from that
30:51 here is an example of an actual
30:53 assessment that I did for a client and
30:56 you can see how I did this now I did an
30:58 external internal and web application
31:00 assessment for this client and these
31:02 were the findings now I'm only going to
31:05 show you what is Master obfuscated
31:07 already or doesn't reveal client
31:10 information but as you can see here one
31:12 example is on the internal they had
31:14 something called SMB signing disabled
31:16 you don't need to worry about it but
31:18 here in my picture I've got a nice
31:20 picture the picture has highlighted it
31:22 says Hey message shining disable that
31:25 signifies SMB signings disabled and it
31:27 has the IP address so we identified the
31:29 machine and we give proof of concept
31:32 that this SMB signing is disabled here
31:34 another example
31:38 ms-17010 these are both internal
31:39 exploits that you're going to encounter
31:42 in this course here's one I check this
31:44 machine it says hey this Target's not
31:46 patched now this is one I didn't exploit
31:48 but it shows that it's actually
31:51 vulnerable to this attack so these are a
31:53 couple screenshots that I'll put now
31:54 your notes could be different than mine
31:57 how I organize is I take a screenshot I
31:59 put it in here and then I make sure that
32:02 I have at least the IP address and the
32:03 screenshot for reference because I'll
32:05 remember it but if you need to go in
32:06 here and take detailed notes that's
32:09 absolutely fine as well you always want
32:10 good notes for your assessments because
32:12 you never know if a client's going to
32:14 come back in six months or even a year
32:15 and say hey what was that one thing that
32:17 you did here and if you go back to your
32:20 notes you say oh you know I did this and
32:22 some people get down really into the
32:25 weeds they have dates times everything
32:27 for step by step what they do on an
32:29 assessment and that's completely up to
32:31 you and how well you take your notes
32:33 this is kind of how I lay it out and
32:34 then you see the green check marks next
32:36 to it I add those green check marks when
32:38 I'm doing my report so as I'm building
32:41 my report out and I cover something in
32:43 the report I'll just go ahead and right
32:44 click and I'll change the note icon to a
32:47 check mark meaning that I've written
32:49 that part of the report for that finding
32:52 and we just kind of go through over time
32:54 so with that being said I do want to
32:57 show you some decent applications the
32:58 one that I'm using here and that you see
33:01 is called keep note now I run on Windows
33:05 as a base so keep note.org that's how
33:07 you get keep note it is for Linux it is
33:10 for Mac OS X but this is totally a
33:12 preference thing me I prefer I've been
33:14 using it for a long time some people
33:16 don't like it okay so I'm going to offer
33:18 some Alternatives as well
33:20 cherry tree comes built into Kali Linux
33:22 as you're going to see here in just a
33:25 little bit worth looking at worth trying
33:28 seeing if you like it one note's another
33:30 example if you use Microsoft and if
33:32 you're a Mac User a lot of students have
33:35 told me that Joplin is really good now
33:37 I've never used this but I keep hearing
33:38 great things about it so what I'm going
33:40 to do is I'm going to put all of these
33:44 into the course resources and you'll be
33:46 able to look at them download them
33:48 decide on your own now you're not
33:50 limited to these four no keeping
33:53 applications by any means feel free to
33:55 use whatever you like to take notes if
33:58 you want pen and paper that's great as
34:00 well and so just make sure that you're
34:01 taking good notes and we're gonna we're
34:03 gonna harp on this throughout the entire
34:05 course over and over and over again so
34:07 make sure you're taking good notes so
34:09 from here what we're going to do is
34:11 we're going to install keep note in the
34:13 next video and we're going to install an
34:14 awesome tool called greenshot I'm going
34:16 to show you what greenshot does and why
34:19 it's so cool and I can cannot live on
34:21 any assessment without it so let's catch
34:23 you over in the next video when we work
34:32 alright so in that example in the last
34:35 video we talked about using keep note so
34:37 if you go to Google and you type in keep
34:39 note all you got to do is come here and
34:41 keep noteworks on Windows Linux and Mac
34:44 OS X so
34:47 great great tool the only issue with
34:49 this tool is it has not been updated in
34:52 a long time some people find issue with
34:54 that if you're one of those people I'm
34:56 actually not you can use other tools
34:58 OneNote is an option
35:01 cherry tree is also an option you can
35:03 also find other options out there for
35:05 you if you have a favorite note-taking
35:07 tool already that's absolutely fine as
35:09 well just make sure to take good notes
35:11 especially during this course and make
35:13 the most of it learn all the things that
35:15 you can and incorporate that so I will
35:17 show you quickly how to install keep
35:20 note here and another thing note too is
35:23 while we do this is cherry tree is
35:25 available on Cali Linux we're going to
35:28 install Kali Linux here very soon so
35:30 once we install Kali Linux and we get
35:31 into the introductory Linux and we
35:33 explore it I'll show you a little bit
35:34 more of cherry tree and what that looks
35:36 like and we'll talk pros and cons of
35:38 cherry tree when we get there so here we
35:40 go if you are on Windows you can follow
35:42 along or you download your appropriate
35:45 one here depending if you're on Linux or
35:47 if you need Mac as well so I'm going to
35:49 go ahead and install the exe and I'm
35:51 just going to actually run this
35:53 we're just going to say yes
35:58 and I'm going to say next next install
36:01 and that's it that I mean it's it's that
36:02 quick and then we just launch Keep note
36:05 and here you go we've got keep note so
36:07 the other tool the really cool tool that
36:10 I love this one is called Green shot now
36:13 this is a screenshot capturing tool so
36:15 let's go to downloads here on greenshot
36:17 if you are running on something other
36:19 than Windows you're going or Windows or
36:22 Mac so basically Linux you're going to
36:24 need a different tool the recommended
36:25 tool that I've heard out there is called
36:27 Flame shot
36:30 f-l-a-m-e though I have no experience
36:31 with it
36:33 I've heard it is identical to Green shot
36:35 so here I'm going to download the latest
36:39 stable I'm going to select run yes
36:41 yes okay
36:43 okay
36:45 accept the agreement give away our firstborn
36:47 firstborn
36:50 next next next place it however you want
36:51 I'm just going to next through
36:53 everything and I'm going to start green
36:54 shot with Windows start that is my
36:57 preference I love this tool again
37:00 so it's finished all right let's take a
37:02 look at it so it should be running let's
37:05 start greenshot now
37:06 okay now you see it running down here on
37:09 the bottom okay let's let's go let's
37:11 open up a web page let's say we want to
37:13 take a screenshot of something now you
37:15 just hit your print screen button
37:17 and this nice cursor gets brought up
37:19 here and let's say we wanted to take
37:21 this downloads part right here we're
37:23 just going to capture this
37:25 and now we have choices we can just save
37:27 the image that we just grabbed
37:30 or my favorite is that we can actually
37:32 just open an image editor right so let's
37:35 open this in their image editor look at
37:37 this okay so here's the picture we just
37:39 grabbed right on top of this really
37:41 great tools let me show you two that I
37:44 use always so I come into effects I put
37:46 a border on it let's say that you have
37:48 like a Kali Linux and Kali Linux if
37:49 you've never used it has a black
37:51 terminal it's really nasty so let's
37:53 imagine here that it's black it's nasty
37:55 when it comes to reporting so let's
37:57 imagine that we're in this situation and
37:59 we're writing a report and we've got
38:01 this black background similar to this
38:03 well you can see what I just did I just
38:05 inverted it and I do this for all of my
38:07 reports I invert the Cali background so
38:09 that way it's white and that way it
38:10 looks nice on a report and when we get
38:12 into the reporting you'll kind of see
38:14 what that looks like but I like a nice
38:17 clean background it saves on ink as well
38:19 if they were to print it and it's just
38:20 nice and neat when you give it to a
38:23 client so I always invert my images if I
38:25 need to you've got the black border here
38:27 another thing is let's say you want to
38:28 point something out you saw in my keep
38:31 note notebook that I had a highlight you
38:32 can just click that button up here and
38:34 just highlight something like right here
38:37 great another tool that's in here is
38:39 this officegate so let's say that
38:41 there's like a password or something
38:43 really sensitive in here that that you
38:45 don't want the client to see or you
38:46 don't want to be reveal on a final
38:49 report you can do that and then you can
38:51 just like up the pixel size on this and
38:53 make it really blurry you know
38:55 um so it's a really really great tool
38:57 and then when you're done you can copy
38:59 it to your clipboard you can save the
39:01 file I just usually like copy this and
39:03 if I want to go paste it like you know
39:06 make a new notebook or whatever I'll
39:07 just paste it in my keep note and just
39:10 kind of go from there so again fantastic
39:13 tool awesome to use if I had two
39:15 recommendations for your note keeping
39:18 it's keep note and green shot if I had
39:19 to make one recommendation of the two
39:21 it's absolutely green shot you can be
39:24 flexible on your note keeping tool so
39:26 again hopefully this helps you again
39:28 again please do take good notes of this
39:30 course you're going to find yourself
39:32 wanting to know hey what was that
39:34 command I ran again and because we're
39:35 going to go through so much stuff by the
39:37 time this is all said and done that
39:38 you're gonna want to remember it so
39:40 please take good notes so from here
39:44 let's go ahead and move on into our
39:48 networking refresher and we'll catch you
39:56 hello everyone and welcome to this
39:58 section on networking so this section is
40:01 titled networking refresher meaning that
40:03 some of you might have a networking
40:05 background and if you're looking at this
40:07 list that's on the screen and you go
40:09 down the list and you say yep I know all
40:11 those you can feel free to skip this
40:14 section if you've taken some of these in
40:15 the past and you just might want a
40:17 little bit of a refresher on them then
40:19 this section is for you we're going to
40:22 cover these topics not totally in depth
40:24 but we're going to use it as a way to
40:26 brush up and then we'll hit on
40:27 networking again when we get into
40:31 introductory Linux so if you are
40:34 unfamiliar with things like TCP UDP in
40:36 the three-way handshake or if you're
40:37 subnetting is a little shaky or you
40:40 don't know what the OSI model is chances
40:41 are you should probably stick around and
40:44 just click through this series watch it
40:46 and build that Foundation remember we
40:48 talked about one of the core foundations
40:52 of pen testing being a strong networking background
40:53 background
40:55 this is a good way to build it up
40:57 remember what you might have forgotten
41:01 and go from there so let's go ahead and
41:02 just jump right into the first video
41:12 what's up everybody so I'm gonna preface
41:13 this video really quick with that it is
41:16 raining pretty hard here so if the
41:18 soothing sounds of the rain put you to
41:20 sleep during this video and you can hear
41:23 it I'm very very sorry but the show must
41:25 go on so what we're going to be doing
41:27 today is we're going to be talking about
41:30 IP addresses now if you've ever used a
41:33 computer before and you're any anywhat
41:35 familiar with it you probably know what
41:38 an IP address is but I want to take this
41:42 a little bit deeper in in theory on why
41:44 we use IP addresses what types of IP
41:46 addresses are out there and talk more
41:49 about protocols and how IP addresses are
41:51 actually designed and made up
41:54 so I'm here in a Cali terminal and I'm
41:56 just going to type in a simple command
41:59 and that command is ifconfig now if
42:01 you've used Linux before this might be
42:04 familiar to you if you used windows it's
42:06 similar to ipconfig all I'm trying to do
42:10 is bring up my IP address so what we can
42:12 see here is that we have an IP address
42:15 which is our inet this is my IP address
42:18 here I also have another IP address this
42:22 inet 6. this is what's called an IPv6
42:24 address so we've got this inet which is
42:28 considered an ipv4 in this inet 6 which
42:31 is considered an IPv6 now you can notice
42:33 right away that there's two different
42:36 types of notations for these this inet
42:40 here is in a decimal notation and the
42:44 IPv6 is in a hexadecimal notation we'll
42:46 get to the importance of that in just a
42:49 second so when it comes to IP addresses
42:52 this looks probably pretty familiar to
42:55 us this is an IP address this is how we
42:57 communicate we communicate over layer
42:58 three and you're going to hear me
43:00 talking about layers repeatedly
43:02 throughout the course or at least
43:04 throughout this part of the course so
43:07 that we can get familiar with how we're
43:10 actually doing this so I want you to be
43:12 familiar with troubleshooting these
43:13 layers and these layers all refer to
43:16 something called The OSI model so when
43:18 we we talk about layers we think about
43:20 the OSI model and I'll introduce the OSI
43:23 model here in a few videos and it should
43:25 all click once I introduce the OSI model
43:27 so if I brought in the OSI model up
43:29 front it might be boring might not make
43:31 sense so I'm going to introduce the OSI
43:32 model near the end and you're going to
43:35 say hey yeah that all makes sense so
43:37 what we've got here is we've got this
43:39 ipv4 address and this is the most
43:42 commonly used format that we use today
43:44 right we use ipv4 for mostly everything
43:46 and again this is in that decimal
43:48 notation so when we see this decimal
43:52 notation it's just a realistically a
43:53 bunch of ones and zeros that are put
43:55 together so that we have this human
43:57 readable format
44:00 realistically all we're seeing here with
44:03 192 this first this first section here
44:06 this first octet is actually just a
44:08 bunch of ones and zeros it's eight bits
44:11 so we've got a range of eight ones and
44:13 zeros here we've got another eight here
44:16 eight here and eight here so when it's
44:19 all said and done this inet or this ipv4
44:23 is made up of 32 bits eight plus eight
44:25 plus eight plus eight here and which
44:28 equals four bytes so another way to
44:30 think about that is to think about it as
44:33 say something like this one two three
44:36 four five six seven eight period period
44:39 okay that is one section there so we've
44:42 got eight ones that can make up this and
44:44 then we'd have another eight
44:46 Etc not gonna be the dead horse here but
44:47 I do want to give you guys another
44:49 example so if we go into our
44:51 applications and we go to a text editor
44:52 really quick
44:56 so the way this looks is something like
45:00 this we start with a number like 128 I'm
45:01 gonna try to space this out as best as
45:04 possible and all I like to do is think
45:07 of 128 as my base and this will make a
45:08 lot more sense when we get into
45:10 subdending so please if you're confused
45:12 by this don't worry this is all Theory
45:15 right now when we get into subnetting
45:16 and we get Hands-On it'll make a lot
45:18 more sense I promise you
45:21 so let's say we have ones and zeros here
45:24 if we have a one for each of these sections
45:25 sections
45:27 and I'm going to space this out again as
45:29 best as possible it's not pretty but if
45:32 we have a one for all these this equals
45:35 255 why does this equal 255 will you
45:38 take this and all these numbers add up
45:40 one plus two plus four plus eight all
45:44 this adds up to 255. so let's say if we
45:46 didn't have all the ones and zeros we
45:48 had just
45:50 someone's enabled
45:53 like these last three here okay well
45:55 this would equal seven
45:57 because we have four plus two plus one
46:00 equals seven so our first number or
46:02 whatever number this applied to in the
46:06 octet would be seven so if we had
46:10 7.7.7.7 it would just be this numbers
46:12 repeating over and over these numbers
46:14 repeating over and over right so uh be
46:18 zero zero zero zero one one one dot zero
46:20 zero zero zero one one one
46:22 and so forth so this is kind of what it
46:24 looks like behind the scenes because
46:26 again a computer is just ones and zeros
46:28 we're all binary so what we're going to
46:29 do is we're going to close this out
46:31 we're going to talk a little bit of
46:33 other Theory when it comes to this and
46:37 why inet or IPv6 and why ipv4 so let's
46:41 close this and let's talk about ipv4
46:42 so I'm going to bring up a calculator
46:47 and with ipv4 we have these 32 bits so
46:49 what we can do is we could take two
46:52 to the 30 second power
46:55 and this is the possible amount of IAP
46:57 addresses that we could have so we have
46:59 somewhere in the four billion range of
47:04 IP addresses well spoiler alert we don't
47:06 have only four billion people on earth
47:08 right we're up to seven something
47:11 billion at this point and all these IEP
47:15 address spaces are gone so ipv4 has been
47:17 around since 1981. nobody thought we
47:19 were ever going to use all these
47:21 addresses uh computers weren't really a
47:22 thing who knew that we were going to
47:26 want all these addresses and you know uh
47:28 these companies started buying them up
47:30 and they started buying them up in large
47:32 chunks and then they sold those to isps
47:35 and then isps sell those to you and so
47:38 these IP addresses have been gone for a
47:41 very very long time and uh chances are
47:43 when you when you have an IP address and
47:45 you get this ipv4 you're only going to
47:47 get one if your corporation you might
47:50 buy it more but we've run out of IP
47:52 address space there's just not enough to
47:55 go around so the theory is okay let's
47:57 come up with something different let's
48:01 come up with IPv6 now this hexadecimal
48:06 mole is actually in 128 bits which makes
48:09 things just a little bit longer and adds
48:11 quite a bit so let's take this 2 to the
48:13 128 power
48:16 and we get a number that I cannot tell
48:19 you how to say not even going to try but
48:21 I can guarantee you that in our lifetime
48:24 we will never use this address space
48:27 so we've come up with a solution of IPv6
48:31 but nobody really uses it IPv6 is just a
48:33 thing that's that's there but when we we
48:37 get IPv6 addresses a sign but still to
48:40 this day everybody's using ipv4 well how
48:43 how is that possible if we're using ipv4
48:46 but we're out of address space well
48:49 think about this we're using something
48:51 called nat which is Network address
48:54 translation now let's think about your
48:57 network so you might have a cell phone
48:59 or computer or multiple devices my
49:01 network has at least 20 devices on it
49:03 I've got I've got cameras I've got
49:06 multiple cell phones Smart TVs
49:10 everything that connects to my internet
49:12 gets an IP address
49:15 and that's 20 IP addresses right there
49:16 right so let's say I have 20 devices
49:19 that's 20 IP addresses am I taking up 20
49:23 IP addresses out of that 4 billion no
49:24 we're actually using something called
49:27 Network address translation or it's
49:29 called nat for short and we'll talk
49:33 about this again when we we set up our
49:35 actual lab but
49:37 with Nat what we're doing is we're
49:40 assigned these private IP address spaces
49:47 192.168.57.139 now if you've ever seen a
49:49 IP address before and you've been on a
49:51 network good chances are it probably
49:54 started with 192 or maybe it started
49:56 with a 10 dot or something along those
49:57 lines and that's because those are
50:00 private IP addresses so anything that
50:04 starts with 192.168 is not an IP address
50:08 that is going to be out in the uh the
50:10 interwebs it is going to be an IP
50:12 address that is only known to you these
50:14 are called private IP addresses so
50:16 because we use these private IP
50:18 addresses we can pass them out through
50:21 what is called a public IP address now
50:23 to make better use of this let's go out
50:25 to Firefox and I've already got a tab open
50:26 open
50:28 so I went to Google and I just said
50:30 private IP addresses and I clicked the
50:32 second image here because I think it's a
50:34 great image so if we look at this there
50:37 are classes of IP addresses private IP
50:40 addresses now there is a Class D and E
50:42 we're not going to worry about those The
50:44 Big Three are class A B and C if you
50:48 know these you are good to go uh so if
50:50 we look at class C this is what the most
50:53 common household and small business use
50:57 so we see it starts with the
51:01 192.168.0.0 so the 192 168 are constant
51:04 if you see a 192.168 address you can
51:05 guarantee yourself that that is a
51:07 private IP address space and then we
51:09 have the range of changing this number
51:12 between 0 and 255 and this number
51:16 between 0 and 255. Y 0 to 255 well
51:18 that'll all make sense when we get into
51:20 subnetting but what that allows us to do
51:23 is have a large number of networks here
51:28 and a small amount of hosts but for a a
51:31 regular user like you or I uh or a small business
51:32 business
51:36 254 hosts is pretty good I mean I'm only
51:38 using like 20 in my household so the
51:40 most common household is probably using
51:41 this 192 address
51:44 but what about a big big business right
51:46 something huge
51:48 okay well they might use a 10 address
51:51 because a 10 address frees you up to
51:54 anything after this 10 is private so 10.1
51:55 10.1
51:57 10.1.1.1 whatever you want to put in
52:01 here up to 255 on each octet
52:05 makes for a small amount of networks but
52:08 a large amount of hosts okay and don't
52:09 worry about the host versus Network
52:12 thing again subnetting we'll talk about
52:14 that it'll all make sense
52:16 but just imagine the amount of amount of
52:18 host that you can put in here with this
52:21 wide range so because of this you'll see
52:23 larger corporations using 10 addresses
52:26 you'll also see a lot of Corporations
52:28 even small businesses using 10 addresses
52:31 the the matter of fact is as long as you
52:34 have this private IP address you're good
52:36 to communicate across your network so
52:39 any IP address outside of these and the
52:41 loopback here are free game for the
52:43 public address space they're probably
52:46 already owned and you purchase those or
52:49 rent those really from your ISP your
52:52 internet service provider so going back
52:54 to this thought we have a class C
52:58 address my Network's Class C 192 168 57
53:01 139 here so it falls into that class C
53:03 I've got all these devices on this
53:06 192.168 network all these devices are
53:09 talking out of one IP address that is my
53:12 public IP address that is what I rent
53:15 from my ISP and all this network traffic
53:19 goes out one IP so this is how we have
53:23 achieved or solved the issue of running
53:25 out of address space without having to
53:27 use IPv6 not that there's anything wrong
53:31 with IPv6 uh it's it's not pretty I mean
53:32 it's way easier to type this stuff in
53:33 than it would be to type something like
53:35 this in
53:37 um but at the same time this is how
53:39 we've solved it we've we're able to
53:42 still use ipv4 in mostly all networks
53:46 and we are able to communicate out with
53:49 this quote unquote IEP address shortage
53:52 so hopefully that makes sense we're
53:54 going to build upon these Concepts again
53:58 ipv4 IPv6 IP addresses are layer 3
54:02 protocols Layer Three is a router so
54:05 when we Route traffic we route via an IP
54:07 address so we're going to build upon
54:09 that as well as we go in hopefully this
54:12 is all just a refresher to you so that
54:14 is it for this video I'll go ahead and
54:21 all right so we're going to move down a
54:24 layer here and talk about Layer Two so
54:28 remember ipv4 IPv6 IP address is just a
54:30 whole that is layer three we're talking
54:33 about routing here in Layer Two we're
54:35 going to be talking about a Mac address
54:38 or a physical address now Mac stands for
54:40 media access control and that is
54:43 identified here in our ifconfig as this
54:46 ether here so we can think of this as
54:49 our physical address and a way that we
54:51 communicate when we are using switches
54:53 switches communicate over this physical
54:55 address this is kind of how they know
54:59 what device is what so what we say here
55:01 is if we have a device say you just
55:03 built a computer and you're installing
55:05 your network interface card or your Nick
55:08 you're going to plug that in and you're
55:11 going to have a MAC address for that
55:13 Nick your cell phone that's going to
55:15 have a MAC address anything that's using
55:18 a network interface is going to have a
55:21 MAC address so these Mac addresses are
55:23 important because they utilize layer 2
55:25 or switching and they are how we
55:27 communicate over switches now there's
55:29 something to be noted briefly about Mac
55:32 addresses now Mac addresses have
55:35 identifiers so as you can see here this
55:37 Mac address
55:41 has six different pairs of two right
55:43 and what we can do is we could take the
55:45 first three pairs
55:48 and we can just copy this
55:50 and we can go out and we can try to put
55:53 it into a MAC address lookup now for
55:55 this one this is just going to be VMware
55:57 I'm not sure if it's actually going to
55:58 come up but I'm going to go ahead and
56:01 paste it and see what happens
56:03 and you can see that the vendor actually
56:07 shows up as VMware so the first three
56:10 pairs here are identifiers and we can
56:12 identify what we're up against if you've
56:15 ever looked in your house and you've
56:18 looked at your network and you you're
56:20 trying to find a device and you see the
56:22 IP address but the IP address doesn't
56:24 really help you identify it you might
56:26 see something along the lines of a MAC
56:29 address because your your home device
56:31 say your your router might also be
56:33 what's called a layer two slash layer 3
56:36 device meaning it's doing switching and
56:39 routing for you and it'll also know the
56:42 MAC address of that device so you can
56:45 take the first three pairs here put
56:47 those into the Google machine and see if
56:49 you can identify what the device is so
56:52 if I was unsure this didn't have a host
56:54 name or device name and I could just
56:57 reach out and say okay well let me let
56:59 me look these up maybe it'll give me an
57:00 ink link it's not going to tell me the
57:02 exact device but if I know it's it's
57:03 running VMware then I could say oh you
57:05 know that's my host machine running or
57:07 if it's related to like Texas
57:09 Instruments or something maybe I know
57:11 that device in my house so this is just
57:14 a quick way to look up devices and know
57:16 about them the other option or other
57:18 thing that you need to know here is just
57:21 that again Mac addresses layer two
57:24 related to switching I'm just trying to
57:26 repeat this and get this into your head
57:28 so that's all we need to know from this
57:30 lesson and we're going to go ahead and
57:39 all right so now we're moving into layer
57:42 four which is the transport layer of the
57:43 OSI model
57:46 and we're going to talk about what is
57:50 TCP and what is UDP so we'll type that
57:55 in here TCP versus UDP so TCP is what is
57:57 known as the transmission control
58:00 protocol and you could think of that as
58:04 a connection oriented protocol and we
58:06 also have UDP which is the user datagram
58:10 protocol and this is a connection less
58:12 protocol so when we have these two
58:15 protocols one is best suited when it
58:19 comes to high reliability that's TCP TCP
58:21 is connection oriented we want to make a
58:23 connection we need High reliability so
58:24 you can think of something like a
58:29 website which is HTTP or https or you
58:32 can think of something like SSH or FTP
58:34 the file transfer protocol those all
58:38 utilize TCP when you think about UDP you
58:40 might think about something like a
58:41 streaming service that's connectionless
58:44 or DNS is connectionless or our voice
58:47 over IP is connectionless and when this
58:49 comes into the importance of scanning
58:52 scanning is super important we're going
58:55 to be scanning both TCP and UDP as a
58:57 penetration tester and don't worry about
58:58 scanning right now when we get into the
59:00 scanning section this will make a lot
59:01 more sense
59:03 but we need to know what TCP and udpr
59:06 and Define them broadly so the most commonly
59:07 commonly
59:09 we commonly use protocol that you're
59:12 going to be scanning is going to be TCP
59:14 now TCP works on what is called a
59:16 three-way handshake now if we look at
59:18 the three-way handshake it's going to
59:20 look something like this we're going to
59:22 first send out a sin packet
59:25 and then we're going to receive back a
59:27 sin act packet
59:29 and finally we're going to send an act
59:31 packet now how does this work now you
59:33 could think of this as an interaction so
59:35 let's say you have a friend or a
59:37 neighbor and you go to your neighbor and
59:41 you say hello that's a sin now sinach is
59:42 going to be the response it's going to
59:44 say hey sin I acknowledge you that's
59:47 your neighbor waving hello back and then
59:49 you know you are good to go start a
59:50 conversation so that's the
59:52 acknowledgment now when we think about
59:56 this in the terms of ports now Port is a
59:58 item that can be open on a machine it's
60:00 a way to communicate with certain protocols for example if you think about
60:03 protocols for example if you think about HTTP that's over Port 80. if you think
60:05 HTTP that's over Port 80. if you think about https that's over Port 443 there's
60:09 about https that's over Port 443 there's a lot of different protocols and there
60:11 a lot of different protocols and there are 65 000 plus ports that can utilize
60:14 are 65 000 plus ports that can utilize these protocols so everything related
60:16 these protocols so everything related here is has to do with these ports
60:19 here is has to do with these ports now let's say that you want to connect
60:20 now let's say that you want to connect to Port 443 on a website you're going to
60:24 to Port 443 on a website you're going to send out a sin packet to that website
60:25 send out a sin packet to that website you're going to say hey I want to
60:27 you're going to say hey I want to connect to you on Port 443 and if 443 is
60:32 connect to you on Port 443 and if 443 is open and available for connection
60:34 open and available for connection they're going to say hey you can go
60:35 they're going to say hey you can go ahead and connect to me and when you
60:38 ahead and connect to me and when you want to actually establish that
60:39 want to actually establish that connection you're going to send that
60:40 connection you're going to send that acknowledgment packet back now let's
60:43 acknowledgment packet back now let's make more sense of this let's go ahead
60:45 make more sense of this let's go ahead and open up a tool called Wireshark so
60:49 and open up a tool called Wireshark so this is built into Kali Linux I'm just
60:51 this is built into Kali Linux I'm just going to type in Wireshark and I'm going
60:53 going to type in Wireshark and I'm going to provide an ampersand here just so I
60:55 to provide an ampersand here just so I have shell access if I need it in the
60:57 have shell access if I need it in the background
60:58 background and all I'm going to do is capture
61:01 and all I'm going to do is capture packet data so this is going to be
61:03 packet data so this is going to be listening in on my Nic and it's going to
61:05 listening in on my Nic and it's going to say hey what's he doing let's capture
61:07 say hey what's he doing let's capture all that data so we're going to capture
61:09 all that data so we're going to capture that I'm going to start a capture here
61:11 that I'm going to start a capture here you're going to start to see a bunch of
61:12 you're going to start to see a bunch of traffic coming through you can see the
61:14 traffic coming through you can see the different protocols here you can see UDP
61:16 different protocols here you can see UDP is coming through right now but we're
61:18 is coming through right now but we're going to go establish a TCP connection
61:20 going to go establish a TCP connection so let's go out to the world wide web
61:23 so let's go out to the world wide web and I've got Google up I'm just going to
61:25 and I've got Google up I'm just going to refresh Google you're going to see a lot
61:27 refresh Google you're going to see a lot of traffic start coming through so I'm
61:29 of traffic start coming through so I'm going to go ahead and just stop this
61:30 going to go ahead and just stop this right here
61:32 right here look at all the data packets that get
61:34 look at all the data packets that get sent when you're using your computer
61:35 sent when you're using your computer this is what's going on in the
61:37 this is what's going on in the background you don't even think about it
61:38 background you don't even think about it so we could see some sin synacts there
61:41 so we could see some sin synacts there those are in the gray let's see if we
61:43 those are in the gray let's see if we could find a good one okay so here is
61:46 could find a good one okay so here is one right here
61:48 one right here um so what we're gonna do actually let's
61:50 um so what we're gonna do actually let's find a better one so we're going to come
61:52 find a better one so we're going to come down to
61:53 down to here and we're going to say okay
61:57 here and we're going to say okay so here we are we're our source IP this
62:00 so here we are we're our source IP this is 192.168 5739 we're going out to
62:03 is 192.168 5739 we're going out to destination of 74 125 21 155 we're
62:06 destination of 74 125 21 155 we're saying hey I've got this port here I
62:09 saying hey I've got this port here I want to connect to your Port so Port 443
62:11 want to connect to your Port so Port 443 this is a web page we're sending a sin
62:13 this is a web page we're sending a sin packet
62:15 packet if that port is open and available for
62:17 if that port is open and available for connection and communication what's
62:19 connection and communication what's going to happen back is that IP address
62:21 going to happen back is that IP address is going to say hey here I am I'll allow
62:24 is going to say hey here I am I'll allow you to connect on this port and if we
62:27 you to connect on this port and if we make that final connection we're going
62:29 make that final connection we're going to go ahead and send the ACT packet back
62:30 to go ahead and send the ACT packet back which is right here it's going to say
62:33 which is right here it's going to say ack so that is the three-way handshake
62:36 ack so that is the three-way handshake please do remember this is going to come
62:38 please do remember this is going to come back into play when we get into scanning
62:40 back into play when we get into scanning and we'll talk about Stealth scanning
62:41 and we'll talk about Stealth scanning and how we modify the three-way
62:43 and how we modify the three-way handshake to actually do some scanning
62:45 handshake to actually do some scanning so that is it for this lesson I will
62:47 so that is it for this lesson I will catch you over in the next one
62:56 all right so before we go into the OSI model I do want to talk about some
62:58 model I do want to talk about some common ports and protocols since this is
63:00 common ports and protocols since this is a refresher most of these should be
63:02 a refresher most of these should be pretty familiar to you I'm going to run
63:04 pretty familiar to you I'm going to run through them pretty quickly and just
63:06 through them pretty quickly and just talk about them briefly on each of these
63:09 talk about them briefly on each of these common ports and the reason I've listed
63:11 common ports and the reason I've listed these is because there are things that
63:13 these is because there are things that we'll see quite often as a penetration
63:15 we'll see quite often as a penetration tester and it's just something that as
63:17 tester and it's just something that as we're going through the course if one of
63:19 we're going through the course if one of these show up it's something that just
63:20 these show up it's something that just rings a bell and you see you see a scan
63:23 rings a bell and you see you see a scan it comes back and you see Port 21 you
63:25 it comes back and you see Port 21 you just think ah yes FTP or you see Port 80
63:28 just think ah yes FTP or you see Port 80 you think ah yes HTTP so you got to
63:30 you think ah yes HTTP so you got to start training your mind to memorize
63:32 start training your mind to memorize these ports so when we get into our
63:34 these ports so when we get into our scanning which again we haven't covered
63:36 scanning which again we haven't covered scanning but when we get there and we
63:37 scanning but when we get there and we see what ports are open on a machine
63:39 see what ports are open on a machine we're going to be able to have these
63:41 we're going to be able to have these common ports memorized so on the TCP
63:44 common ports memorized so on the TCP side we've got FTP FTP is the file
63:47 side we've got FTP FTP is the file transfer protocol you're going to see
63:49 transfer protocol you're going to see this in some assessments you're going to
63:51 this in some assessments you're going to see this a lot when we do something
63:52 see this a lot when we do something called Capture the Flag or we run
63:53 called Capture the Flag or we run through some test machines you'll see
63:55 through some test machines you'll see FTP open quite a bit so FTP file
63:58 FTP open quite a bit so FTP file transfer protocol all that means is we
64:01 transfer protocol all that means is we can log into this server we can put a
64:02 can log into this server we can put a file or we can get a file off the server
64:05 file or we can get a file off the server now SSH and telnet kind of play hand in
64:07 now SSH and telnet kind of play hand in hand telnet is the ability to log into a
64:12 hand telnet is the ability to log into a machine remotely now SSH does the same
64:15 machine remotely now SSH does the same thing the only difference is SSH is the
64:18 thing the only difference is SSH is the encrypted version of that so with telnet
64:21 encrypted version of that so with telnet you are in clear text and with SSH you
64:24 you are in clear text and with SSH you are encrypted now SMTP POP3 and IMAP all
64:28 are encrypted now SMTP POP3 and IMAP all relate to mail we're not going to worry
64:31 relate to mail we're not going to worry too much about mail in this course but
64:32 too much about mail in this course but you might see it come back up at some
64:34 you might see it come back up at some point so just remember your 25 110 and
64:38 point so just remember your 25 110 and 143
64:39 143 DNS so DNS is a way to resolve IP
64:45 DNS so DNS is a way to resolve IP addresses to names and we could take a
64:47 addresses to names and we could take a quick look at that if we go back to our
64:49 quick look at that if we go back to our Kali machine and say we're at Google
64:52 Kali machine and say we're at Google here we've got Google up but the
64:54 here we've got Google up but the computer doesn't really know what Google
64:56 computer doesn't really know what Google is the computer is just using nice text
65:00 is the computer is just using nice text like google.com for us to humans what's
65:03 like google.com for us to humans what's going on on the back end is Google
65:04 going on on the back end is Google actually resolves to an IP address
65:07 actually resolves to an IP address now the IP address is how the computer
65:09 now the IP address is how the computer knows to get back and forth
65:11 knows to get back and forth because we don't want to sit there and
65:13 because we don't want to sit there and type in IP addresses this DNS or domain
65:16 type in IP addresses this DNS or domain name system has been implemented for us
65:19 name system has been implemented for us so we type in google.com on the back end
65:22 so we type in google.com on the back end it knows hey I want to go out to
65:25 it knows hey I want to go out to 17179 10 22 34 whatever it is in in
65:29 17179 10 22 34 whatever it is in in reality but this is just a quick way for
65:31 reality but this is just a quick way for the computer to relate to a human and
65:34 the computer to relate to a human and the human to you know have easily
65:37 the human to you know have easily readable access to some of this stuff so
65:40 readable access to some of this stuff so going back to our PowerPoint
65:43 going back to our PowerPoint we have HTTP and https that is a website
65:47 we have HTTP and https that is a website just what you saw there mostly
65:49 just what you saw there mostly everything is on 443 now or https the
65:53 everything is on 443 now or https the HTTP on Port 80 you'll see sometimes
65:55 HTTP on Port 80 you'll see sometimes remember that is the non-secure version
65:58 remember that is the non-secure version of the protocol so https is encrypted
66:01 of the protocol so https is encrypted HTTP is not encrypted and not secure
66:06 HTTP is not encrypted and not secure so lastly SMB ports 139 and 445.
66:11 so lastly SMB ports 139 and 445. originally it was just 139 in the later
66:14 originally it was just 139 in the later versions of Windows they put on 445
66:17 versions of Windows they put on 445 you're going to see these ports a lot
66:19 you're going to see these ports a lot this is probably the most common Port
66:21 this is probably the most common Port you're going to see as a pen tester
66:22 you're going to see as a pen tester these relate to file shares you might
66:25 these relate to file shares you might also hear this called Samba so there are
66:28 also hear this called Samba so there are a few names for it but when you think of
66:30 a few names for it but when you think of SMB and you see 139 or 445 think of file
66:34 SMB and you see 139 or 445 think of file shares and as a pen tester perspective
66:36 shares and as a pen tester perspective you got to think about all the crazy
66:39 you got to think about all the crazy exploits we've had regarding SMB the
66:42 exploits we've had regarding SMB the most recent one as of this course was
66:46 most recent one as of this course was the wannacry virus right so you have the
66:49 the wannacry virus right so you have the wannacry virus it's also known as
66:51 wannacry virus it's also known as Eternal blue was what it was built off
66:53 Eternal blue was what it was built off of or
66:54 of or ms17010 was the official term of that
66:57 ms17010 was the official term of that exploit that exploit utilized an SMB
67:01 exploit that exploit utilized an SMB exploit to navigate through networks so
67:04 exploit to navigate through networks so it became very vicious very quick
67:05 it became very vicious very quick because SMB is open so frequently on
67:08 because SMB is open so frequently on networks now on the UDP side we also
67:12 networks now on the UDP side we also have DNS over here DNS is both atcp and
67:15 have DNS over here DNS is both atcp and UDP protocol we also have DHCP
67:18 UDP protocol we also have DHCP now when it comes to IP addresses DHCP
67:22 now when it comes to IP addresses DHCP Associates you with an IP address kind
67:24 Associates you with an IP address kind of at random now you could have the
67:26 of at random now you could have the opposite of that is what is a static IP
67:29 opposite of that is what is a static IP address so with DHCP you plug into your
67:32 address so with DHCP you plug into your network say your home network and the
67:35 network say your home network and the internet just fires up guess what
67:37 internet just fires up guess what probably DHCP on the back end it just
67:39 probably DHCP on the back end it just picks a number between a range says hey
67:42 picks a number between a range says hey here's your IP address I'm going to let
67:43 here's your IP address I'm going to let you lease that out for eight hours or a
67:46 you lease that out for eight hours or a day or a week or however long the timing
67:48 day or a week or however long the timing is set for and that IP address is yours
67:50 is set for and that IP address is yours now the opposite of that again is static
67:53 now the opposite of that again is static so you could say hey I want a static IP
67:56 so you could say hey I want a static IP address and anytime I plug in with this
67:58 address and anytime I plug in with this specific computer go ahead and give it
68:00 specific computer go ahead and give it this IP address so how are we going to
68:02 this IP address so how are we going to know that most likely the MAC address
68:03 know that most likely the MAC address right so from Layer Two it's going to
68:06 right so from Layer Two it's going to know layer 3 and how to assign it so
68:09 know layer 3 and how to assign it so again DHCP should be pretty familiar to
68:11 again DHCP should be pretty familiar to you we've also got tftp on Port 69 which
68:14 you we've also got tftp on Port 69 which is the trivial FTP and it utilizes UDP
68:18 is the trivial FTP and it utilizes UDP instead of TCP and we also have SNMP
68:22 instead of TCP and we also have SNMP which is the simple Network management
68:24 which is the simple Network management protocol so you will encounter SNMP
68:28 protocol so you will encounter SNMP occasionally on networks not always but
68:31 occasionally on networks not always but when we do encounter it there may be
68:33 when we do encounter it there may be some information to be gathered
68:35 some information to be gathered especially if there are strings being
68:37 especially if there are strings being used that are Community or public
68:39 used that are Community or public strings and we'll worry about that when
68:41 strings and we'll worry about that when we we encounter it but you'll probably
68:43 we we encounter it but you'll probably see it again in this course
68:45 see it again in this course so that is it in this video we're going
68:48 so that is it in this video we're going to go ahead and move on to the OSI model
68:50 to go ahead and move on to the OSI model and tie all this together then we'll get
68:52 and tie all this together then we'll get into a little bit of subnetting and
68:54 into a little bit of subnetting and we'll end this with a refresher on
68:57 we'll end this with a refresher on networking a final final video on
69:00 networking a final final video on networking so I'll see you over in the
69:02 networking so I'll see you over in the next video
69:09 all right so this whole time we've been talking we've been talking about
69:12 talking we've been talking about networking and I've been throwing terms
69:14 networking and I've been throwing terms at you and I every time I throw a term
69:16 at you and I every time I throw a term at you I try to use the respective layer
69:18 at you I try to use the respective layer for it so you've heard me say layer two
69:21 for it so you've heard me say layer two layer three layer four and those all
69:25 layer three layer four and those all correspond with what is called The OSI
69:28 correspond with what is called The OSI model now if you're ever in a network
69:31 model now if you're ever in a network interview or if you're ever talking to
69:32 interview or if you're ever talking to somebody who has experience in
69:34 somebody who has experience in networking or even if you're on the help
69:37 networking or even if you're on the help desk or taking tickets knowing the OSI
69:40 desk or taking tickets knowing the OSI model is incredibly helpful and people
69:43 model is incredibly helpful and people will just throw layers at you especially
69:45 will just throw layers at you especially the people who have been in the field
69:47 the people who have been in the field for quite some time might just say Layer
69:49 for quite some time might just say Layer Two instead of a switch or they might
69:51 Two instead of a switch or they might say layer three instead of a router so
69:54 say layer three instead of a router so I'm going to discuss the OSI model
69:56 I'm going to discuss the OSI model really quickly give you a mnemonic on
69:59 really quickly give you a mnemonic on how to remember it and just talk about
70:00 how to remember it and just talk about some of the concepts within it and how
70:03 some of the concepts within it and how to troubleshoot down it as well so
70:06 to troubleshoot down it as well so I picked this up from Keith Barker a
70:08 I picked this up from Keith Barker a long time ago great trainer by the way
70:10 long time ago great trainer by the way and this is the mnemonic so we're gonna
70:14 and this is the mnemonic so we're gonna go p d n t s
70:19 go p d n t s p a
70:20 p a and this stands in my head for please do
70:24 and this stands in my head for please do not throw sausage pizza away
70:27 not throw sausage pizza away again that is please do not throw
70:29 again that is please do not throw sausage pizza away so I'm gonna put
70:32 sausage pizza away so I'm gonna put numbers corresponding to the layers in
70:34 numbers corresponding to the layers in front of it here
70:36 front of it here and we're gonna go ahead and type these
70:38 and we're gonna go ahead and type these out one by one so on the first layer
70:42 out one by one so on the first layer here we've got what is called the
70:45 here we've got what is called the physical layer
70:47 physical layer and you could think of your physical
70:49 and you could think of your physical layer as like data cables
70:52 layer as like data cables or like your cat 6 cables
70:55 or like your cat 6 cables stuff like that something you might you
70:57 stuff like that something you might you might plug in right that is the physical
71:00 might plug in right that is the physical layer and we've already talked about
71:02 layer and we've already talked about Layer Two quite a bit Layer Two is the
71:05 Layer Two quite a bit Layer Two is the data layer and that is our switching
71:08 data layer and that is our switching right and also our Mac addresses
71:13 right and also our Mac addresses going down the list we've got the
71:15 going down the list we've got the network layer which is IP addresses
71:20 network layer which is IP addresses also routing
71:26 the fourth layer is the transport layer which is TCP UDP which we have talked
71:29 which is TCP UDP which we have talked about as well
71:30 about as well and the last few so the session layer
71:35 and the last few so the session layer we've got the session layer which is
71:36 we've got the session layer which is just session management you don't really
71:38 just session management you don't really have to worry too much about this one
71:40 have to worry too much about this one six is the presentation layer now this
71:44 six is the presentation layer now this should be familiar to you because think
71:46 should be familiar to you because think about WMV
71:48 about WMV jpeg movie files that's what your
71:51 jpeg movie files that's what your presentation layer is so media and then
71:54 presentation layer is so media and then lastly we've got the application layer
71:56 lastly we've got the application layer which is like HTTP SMTP your
72:01 which is like HTTP SMTP your applications that you utilize right
72:03 applications that you utilize right so we've got this laid out here and you
72:07 so we've got this laid out here and you might be asking why is this important
72:08 might be asking why is this important well again when we say something like my
72:12 well again when we say something like my home router is a layer 2 3. so that
72:15 home router is a layer 2 3. so that means it does it does switching and it
72:18 means it does it does switching and it does routing right you might think of
72:22 does routing right you might think of this in another way as well you might be
72:24 this in another way as well you might be asked to troubleshoot and something to
72:27 asked to troubleshoot and something to talk about too with the with the OSI
72:29 talk about too with the with the OSI model is when we receive data we receive
72:33 model is when we receive data we receive data down this physical layer all the
72:35 data down this physical layer all the way down to the application when we
72:37 way down to the application when we transmit data it goes out the
72:39 transmit data it goes out the application layer down to the physical
72:41 application layer down to the physical when we're troubleshooting this it is
72:44 when we're troubleshooting this it is always best to start with the physical
72:45 always best to start with the physical and go down to the application Level
72:48 and go down to the application Level okay so say you get a your working help
72:51 okay so say you get a your working help desk and you get a phone call and
72:54 desk and you get a phone call and somebody says you know my internet's not
72:56 somebody says you know my internet's not working help me
72:58 working help me well what's the first thing you're going
73:00 well what's the first thing you're going to do are you going to ask them
73:01 to do are you going to ask them application Level questions yeah
73:03 application Level questions yeah probably not you might say hey can you
73:06 probably not you might say hey can you look at the back of the computer do you
73:07 look at the back of the computer do you see a uh the cable plugged in
73:10 see a uh the cable plugged in oh the cable's plugged in okay well uh
73:13 oh the cable's plugged in okay well uh do you do you see the the where the
73:14 do you do you see the the where the cables plugged in is there a blinking
73:16 cables plugged in is there a blinking light is that blinking light green by
73:18 light is that blinking light green by chance okay we're checking the Nick
73:20 chance okay we're checking the Nick right and then we might ask them to you
73:23 right and then we might ask them to you know do they have an IP address what's
73:24 know do they have an IP address what's going on uh all the way down and then we
73:27 going on uh all the way down and then we troubleshoot all the way down to layer
73:29 troubleshoot all the way down to layer seven so we wouldn't start on layer
73:31 seven so we wouldn't start on layer seven right we would start from the
73:33 seven right we would start from the basics and move down so it's important
73:36 basics and move down so it's important to know this this isn't a help desk
73:38 to know this this isn't a help desk course by any means but it's super
73:40 course by any means but it's super important to know this especially if
73:41 important to know this especially if it's been a while since you've seen this
73:43 it's been a while since you've seen this network stuff or even if this is new to
73:45 network stuff or even if this is new to you that the osm model is commonly
73:47 you that the osm model is commonly referred to even as a pen tester I get
73:50 referred to even as a pen tester I get all kinds of layer two layer three talk
73:53 all kinds of layer two layer three talk and you will be sitting in meetings with
73:56 and you will be sitting in meetings with network Engineers with people who are
73:58 network Engineers with people who are very very smart about this stuff and
74:00 very very smart about this stuff and they're going to throw all this lingo at
74:02 they're going to throw all this lingo at you so if you know this lingo really
74:04 you so if you know this lingo really really benefits you or else you're just
74:06 really benefits you or else you're just gonna sit there and wonder what the heck
74:08 gonna sit there and wonder what the heck they're talking about so hopefully the
74:10 they're talking about so hopefully the this is a quick informative method for
74:13 this is a quick informative method for you and again remember
74:15 you and again remember please do not throw sausage pizza away
74:18 please do not throw sausage pizza away that's the easiest way that I remember
74:19 that's the easiest way that I remember it you can make up your own mnemonics if
74:21 it you can make up your own mnemonics if you want people have other things as
74:23 you want people have other things as well if you've got a if you got a
74:24 well if you've got a if you got a favorite mnemonic please feel free to
74:26 favorite mnemonic please feel free to comment down below and tell me your
74:28 comment down below and tell me your mnemonic as well so I'd love to hear
74:29 mnemonic as well so I'd love to hear some of these other ones so let's go
74:31 some of these other ones so let's go ahead and move on into subnetting and
74:34 ahead and move on into subnetting and then we'll uh we'll start moving into
74:35 then we'll uh we'll start moving into other fun parts of the course
74:45 let's talk about subnetting so subnetting is important in networking
74:48 subnetting is important in networking you hear about it all the time you hear
74:50 you hear about it all the time you hear even people perhaps freaking out I know
74:53 even people perhaps freaking out I know I freaked out when I heard that I had to
74:54 I freaked out when I heard that I had to do it for exams like Network Plus or
74:57 do it for exams like Network Plus or CCNA and I feel like there are a lot of
75:00 CCNA and I feel like there are a lot of complicated methods out there for
75:02 complicated methods out there for submitting but there was a method that
75:05 submitting but there was a method that was shown to me middle of my career and
75:08 was shown to me middle of my career and it just blew my mind it's really really
75:10 it just blew my mind it's really really fast subnetting method and I really want
75:13 fast subnetting method and I really want to break down for you what subnetting is
75:16 to break down for you what subnetting is why we do it and then show you the
75:18 why we do it and then show you the methodology behind it so if we want to
75:20 methodology behind it so if we want to talk about subnetting if we just come in
75:22 talk about subnetting if we just come in here and just do an ifconfig
75:24 here and just do an ifconfig and we look at our IP address right we
75:28 and we look at our IP address right we have our inet which is our ipv4 and you
75:31 have our inet which is our ipv4 and you can see here too we have this net mask
75:33 can see here too we have this net mask this is also known as a subnet mask or a
75:36 this is also known as a subnet mask or a subnet and it just says 255-255-255.0
75:44 really tell us a lot if we don't know much about it but this is what a subnet
75:46 much about it but this is what a subnet looks like and we can think of subnets
75:49 looks like and we can think of subnets in ones and zeros it's all bit right so
75:52 in ones and zeros it's all bit right so we've got eight bits here just like an
75:54 we've got eight bits here just like an IP address ipv4 same thing 8 Bits 8 Bits
75:58 IP address ipv4 same thing 8 Bits 8 Bits 8 Bits and another eight bits and we've
76:00 8 Bits and another eight bits and we've got ones and zeros if all the ones are
76:03 got ones and zeros if all the ones are switched on we've got 255 if none of the
76:06 switched on we've got 255 if none of the ones are switched on we've got zero and
76:09 ones are switched on we've got zero and depending on how those ones and zeros
76:10 depending on how those ones and zeros are switched on or off determines a lot
76:14 are switched on or off determines a lot of things for us and that's why this net
76:15 of things for us and that's why this net mask is important now attached to your
76:18 mask is important now attached to your resources for this course I've created
76:21 resources for this course I've created an Excel sheet that I think will be
76:22 an Excel sheet that I think will be useful so if we look at the Excel sheet
76:25 useful so if we look at the Excel sheet here is the Cyber mentors subnetting
76:27 here is the Cyber mentors subnetting sheet and let's talk through this it
76:30 sheet and let's talk through this it looks like a bunch of numbers and it
76:31 looks like a bunch of numbers and it might look crazy for you and we're going
76:33 might look crazy for you and we're going to talk about how this breaks down how
76:35 to talk about how this breaks down how the bits break down and then how I would
76:37 the bits break down and then how I would write this shorthanded for an exam or a
76:39 write this shorthanded for an exam or a test or just something that I do on a
76:41 test or just something that I do on a day-to-day basis
76:43 day-to-day basis so first let's talk about the bit so
76:45 so first let's talk about the bit so come to the bits tab here and we have
76:48 come to the bits tab here and we have our eight bits right we can count this
76:50 our eight bits right we can count this across and there's eight here on the
76:51 across and there's eight here on the count you can see that and it starts
76:54 count you can see that and it starts with 128 and descends down to one you
76:57 with 128 and descends down to one you just keep cutting it in half right so
77:00 just keep cutting it in half right so 128 64 32 16 8 whatever what's more
77:04 128 64 32 16 8 whatever what's more important is why we get to these numbers
77:06 important is why we get to these numbers so if we have a 1 switched on here it
77:11 so if we have a 1 switched on here it adds to the value when all the ones are
77:14 adds to the value when all the ones are switched on it equals to 255 you see all
77:17 switched on it equals to 255 you see all the ones switched on here if we were to
77:19 the ones switched on here if we were to highlight over all this come down to the
77:21 highlight over all this come down to the sum you see the sum is 255 that's all
77:23 sum you see the sum is 255 that's all this formula is doing here
77:25 this formula is doing here so if we were to come through and you
77:27 so if we were to come through and you see all the zeros here nothing's flipped
77:29 see all the zeros here nothing's flipped on to actually turn any value on here
77:32 on to actually turn any value on here how this actually works is the switch
77:36 how this actually works is the switch has to be on in order right so if we
77:39 has to be on in order right so if we were to switch on another bit we'd have
77:41 were to switch on another bit we'd have to switch it on here
77:43 to switch it on here and we'd have to switch another one on
77:45 and we'd have to switch another one on here we couldn't just come down here and
77:47 here we couldn't just come down here and switch it on here it wouldn't make sense
77:49 switch it on here it wouldn't make sense it doesn't work that way not with
77:51 it doesn't work that way not with subnetting so we're going to take these
77:53 subnetting so we're going to take these back off and just show zeros again but
77:55 back off and just show zeros again but you see how the values change if for
77:58 you see how the values change if for example we had this network and you saw
78:00 example we had this network and you saw the default and I'm showing you the
78:03 the default and I'm showing you the 255-255-2550 the standard here because
78:06 255-255-2550 the standard here because that is what's known as a slash 24
78:08 that is what's known as a slash 24 Network that's very very common
78:11 Network that's very very common and it's very common because it's used
78:13 and it's very common because it's used mostly in household and small businesses
78:15 mostly in household and small businesses and it's done this way because of the
78:18 and it's done this way because of the amount of hosts that it allows now if we
78:21 amount of hosts that it allows now if we talk about the host you can see that I
78:22 talk about the host you can see that I have here 2 to the eighth power
78:25 have here 2 to the eighth power why do I have that well we actually go
78:27 why do I have that well we actually go by how many bits are switched off or how
78:30 by how many bits are switched off or how many hosts are available to us so if a
78:33 many hosts are available to us so if a host here or a bit was switched on then
78:35 host here or a bit was switched on then we lose the amount of hosts we have
78:37 we lose the amount of hosts we have available to us and this subnet gets
78:39 available to us and this subnet gets smaller and smaller now don't worry too
78:42 smaller and smaller now don't worry too much about the ones and zeros it's going
78:44 much about the ones and zeros it's going to make a lot more sense when we stop
78:45 to make a lot more sense when we stop talking in these binary terms I just
78:48 talking in these binary terms I just kind of want to break down the math
78:49 kind of want to break down the math behind it first before we make it really
78:52 behind it first before we make it really really simplistic so again we've we're
78:55 really simplistic so again we've we're talking about what's called the slash 24
78:56 talking about what's called the slash 24 or whack 24 Network and it's so standard
79:00 or whack 24 Network and it's so standard because of the host again 256. think of
79:03 because of the host again 256. think of all the devices in your house you have
79:05 all the devices in your house you have cell phones you probably have computers
79:07 cell phones you probably have computers you might have like a Roku or Amazon
79:10 you might have like a Roku or Amazon Fire or something along those lines you
79:12 Fire or something along those lines you might have Smart TVs or smart watches or
79:15 might have Smart TVs or smart watches or something that connects to the internet
79:16 something that connects to the internet well again they're all connecting
79:19 well again they're all connecting through Nat right and going out but the
79:22 through Nat right and going out but the amount of hosts that you can have on
79:23 amount of hosts that you can have on your private Network really depends on
79:25 your private Network really depends on the subnet mask and how you set it so we
79:28 the subnet mask and how you set it so we have this class C that you saw before
79:31 have this class C that you saw before the
79:32 the 192.168.1 or dot zero or however you
79:35 192.168.1 or dot zero or however you want to have it right well it allows us
79:37 want to have it right well it allows us to have 256 when we have a subnet of
79:40 to have 256 when we have a subnet of Slash 24 so that's very common for a
79:43 Slash 24 so that's very common for a household it's also common for a small
79:45 household it's also common for a small business maybe there's a printer some
79:47 business maybe there's a printer some few devices in there but they're never
79:49 few devices in there but they're never going to get over this 256 hose okay so
79:53 going to get over this 256 hose okay so when we come to the subnet cheat sheet
79:55 when we come to the subnet cheat sheet let's break this down a little bit
79:57 let's break this down a little bit differently
79:58 differently so we have our host here let's start
80:01 so we have our host here let's start with the slash 24 we just were and you
80:04 with the slash 24 we just were and you saw that there is 256 available hosts as
80:08 saw that there is 256 available hosts as we start turning off bits
80:11 we start turning off bits okay we turn off a bit here we turn off
80:13 okay we turn off a bit here we turn off a bit keep going down the list the hosts
80:15 a bit keep going down the list the hosts start getting bigger and that just
80:16 start getting bigger and that just corresponds here we have a slash 24 and
80:19 corresponds here we have a slash 24 and the only reason I'm saying 24 is I'm
80:21 the only reason I'm saying 24 is I'm counting the ones across right so we've
80:23 counting the ones across right so we've got 24 bits switched on if we had 23
80:26 got 24 bits switched on if we had 23 okay it gets bigger and bigger and
80:29 okay it gets bigger and bigger and bigger
80:30 bigger now
80:31 now let's stay away from the ones and zeros
80:33 let's stay away from the ones and zeros I think it's a little bit complicated
80:35 I think it's a little bit complicated the better way to think about this is to
80:38 the better way to think about this is to look at the subnet Mass down here and
80:41 look at the subnet Mass down here and I'm going to replicate this and then
80:42 I'm going to replicate this and then we're going to come back to it so what I
80:45 we're going to come back to it so what I do here is we can have a possibility of
80:48 do here is we can have a possibility of 32 bits switched on right so I'm just
80:50 32 bits switched on right so I'm just making a new tab and I'm just going to
80:52 making a new tab and I'm just going to go over here and I'm going to hit
80:54 go over here and I'm going to hit control and drag this across until it
80:56 control and drag this across until it hits eight
80:57 hits eight okay and then I'm gonna do the same
80:59 okay and then I'm gonna do the same thing with nine I'm gonna drag it across
81:01 thing with nine I'm gonna drag it across all I'm doing is just making really
81:03 all I'm doing is just making really quickly 32 placeholders
81:08 quickly 32 placeholders and I'm just emulating here
81:10 and I'm just emulating here if we had the possibility of
81:13 if we had the possibility of 32 different switched on bits so imagine
81:15 32 different switched on bits so imagine one bit is switched on imagine all 32
81:18 one bit is switched on imagine all 32 bits are switched on that's the
81:20 bits are switched on that's the possibilities here right so always for
81:23 possibilities here right so always for sure we're going to have an amount of
81:24 sure we're going to have an amount of host and we're gonna have a subnet mask
81:27 host and we're gonna have a subnet mask okay so we'll just call it subnet there
81:32 okay so we'll just call it subnet there we always start here
81:34 we always start here with 128 just like the bits that you saw
81:37 with 128 just like the bits that you saw you saw the 128 start on the bits let's
81:39 you saw the 128 start on the bits let's just start also with 128. now as you saw
81:42 just start also with 128. now as you saw every bit that's switched on remember
81:45 every bit that's switched on remember when we switch a bit on over here
81:48 when we switch a bit on over here it starts decreasing so we're going to
81:50 it starts decreasing so we're going to decrease for the bits that are switched
81:52 decrease for the bits that are switched on 64 32 16 8
81:56 on 64 32 16 8 4 2 1. you come over here and what I
82:01 4 2 1. you come over here and what I like to actually do is I like to just
82:02 like to actually do is I like to just add these numbers together and you can
82:05 add these numbers together and you can see 128 and 64 is 192.
82:08 see 128 and 64 is 192. and then you can add these two together
82:10 and then you can add these two together so you get 192 32 you just add diagonals
82:14 so you get 192 32 you just add diagonals the way I I actually always do it so 224
82:17 the way I I actually always do it so 224 240 248
82:20 240 248 252 254 and 255. now what does that
82:25 252 254 and 255. now what does that correspond to it corresponds to the
82:27 correspond to it corresponds to the possibilities of the bits being flipped
82:29 possibilities of the bits being flipped on right so this looks just like what
82:32 on right so this looks just like what you see here
82:33 you see here same deal and if you had a one
82:35 same deal and if you had a one underneath of it okay then you got 128
82:38 underneath of it okay then you got 128 if you've got another one underneath of
82:41 if you've got another one underneath of it well guess what you've got 128 plus
82:43 it well guess what you've got 128 plus 64 which is 192. and this number keeps
82:47 64 which is 192. and this number keeps growing why is this important this is
82:49 growing why is this important this is still all ones and zeros right well
82:51 still all ones and zeros right well let's start thinking about it
82:53 let's start thinking about it if we have a slash 24 Network we've got
82:56 if we have a slash 24 Network we've got 24 bits turned on
82:58 24 bits turned on our subnet mask is
83:01 our subnet mask is 255.255.255.0
83:14 255.255.0.0 why where are these changes coming from let me show you this
83:16 coming from let me show you this okay for a slash eight I'm just tying
83:18 okay for a slash eight I'm just tying this into just this right here well this
83:21 this into just this right here well this is coming from the number of bits that
83:23 is coming from the number of bits that are turned on
83:24 are turned on eight bits turned on we've got two five
83:27 eight bits turned on we've got two five five and the rest are zeros you got
83:29 five and the rest are zeros you got another eight bits turned on two five
83:31 another eight bits turned on two five five two five five the rest are zeros
83:33 five two five five the rest are zeros come down to the slash 24 which is that
83:36 come down to the slash 24 which is that really common subnet that you see and
83:38 really common subnet that you see and you've got two five five two five five
83:40 you've got two five five two five five two five five zero now this is very
83:43 two five five zero now this is very common okay let's go back to the cheat
83:45 common okay let's go back to the cheat sheet now
83:46 sheet now and you can see that I've got X as a
83:48 and you can see that I've got X as a placeholder in the subnet so what I'm
83:51 placeholder in the subnet so what I'm saying here is you look at this list and
83:53 saying here is you look at this list and you say I've got a slash one well for
83:56 you say I've got a slash one well for this whole area here from one to eight
83:58 this whole area here from one to eight the placeholder is going to hold in
84:00 the placeholder is going to hold in place of this x so for a slash one if
84:03 place of this x so for a slash one if I've got 128 then guess what it's going
84:06 I've got 128 then guess what it's going to become
84:08 to become 128.0.0.0 because that's how it would be
84:10 128.0.0.0 because that's how it would be and if you were turned on just one bit
84:12 and if you were turned on just one bit here and made all of these zeros guess
84:14 here and made all of these zeros guess what just the 128 would be on the rest
84:16 what just the 128 would be on the rest would be zeros okay if we had a slash 14
84:20 would be zeros okay if we had a slash 14 okay so 255's automatically flipped on
84:23 okay so 255's automatically flipped on you have a slash eight already you've
84:25 you have a slash eight already you've passed through it okay so you're
84:27 passed through it okay so you're starting on the second iteration here
84:29 starting on the second iteration here slash 14 corresponds down here to 252 so
84:33 slash 14 corresponds down here to 252 so you'd have a 255.252.0.0
84:40 so all this is is placeholders let's go back to the sheet here
84:41 back to the sheet here so I make this quick and dirty list this
84:43 so I make this quick and dirty list this is what I write out when I'm just
84:45 is what I write out when I'm just writing out something quick for an exam
84:47 writing out something quick for an exam I'll write out one through thirty two
84:49 I'll write out one through thirty two I'll put the host here and I'll put the
84:52 I'll put the host here and I'll put the subnet here so again if we know that
84:55 subnet here so again if we know that once we cross through 8 16 24 32 that
84:58 once we cross through 8 16 24 32 that has a two five five in front of it
85:01 has a two five five in front of it all we've got to do then is we'll say
85:03 all we've got to do then is we'll say slash 27 well we've come through three
85:05 slash 27 well we've come through three columns then I know for sure that we've
85:07 columns then I know for sure that we've got
85:12 255.255.255.something right you see the slash 27 you come down here the subnet
85:15 slash 27 you come down here the subnet would be 224.
85:17 would be 224. say 28 okay two five five two five five
85:20 say 28 okay two five five two five five two five five look at the 28 you've got
85:23 two five five look at the 28 you've got a DOT 240.
85:26 a DOT 240. and this is gonna be confusing this is
85:28 and this is gonna be confusing this is subnetting is not necessarily easy once
85:30 subnetting is not necessarily easy once you get the chart down it makes a lot
85:32 you get the chart down it makes a lot more sense so let's start piecing some
85:35 more sense so let's start piecing some more things together when I say that
85:37 more things together when I say that I've got host now the host I'm showing
85:40 I've got host now the host I'm showing you only correspond to these first rows
85:42 you only correspond to these first rows but it's very common or very useful just
85:45 but it's very common or very useful just to know this number right off the bat
85:47 to know this number right off the bat now if you look at the cheat sheet what
85:49 now if you look at the cheat sheet what you can do here is you just know that
85:52 you can do here is you just know that you start with a one or you start with
85:53 you start with a one or you start with the 128 you go down but every time you
85:55 the 128 you go down but every time you go up you're doubling and why are we
85:58 go up you're doubling and why are we doubling do you remember from the bits
86:00 doubling do you remember from the bits part
86:00 part every time a bit is turned off so as we
86:04 every time a bit is turned off so as we go up a number
86:05 go up a number we take it to the next power so we've
86:08 we take it to the next power so we've got eight bits turned off we take two to
86:10 got eight bits turned off we take two to the eighth power it's 256. well
86:13 the eighth power it's 256. well here you go look
86:16 here you go look come through here 256 we go to the ninth
86:19 come through here 256 we go to the ninth power 512 to the 10th power 10 24 it
86:23 power 512 to the 10th power 10 24 it just keeps doubling okay that's all you
86:25 just keeps doubling okay that's all you got to think about in your mind is it
86:26 got to think about in your mind is it keeps doubling so on an exam for example
86:30 keeps doubling so on an exam for example you might have something like what how
86:33 you might have something like what how many hosts could be potentially in a
86:36 many hosts could be potentially in a slash 20 Network and you come to your
86:38 slash 20 Network and you come to your cheat sheet that you made or you have in
86:40 cheat sheet that you made or you have in your head and you say well 496 and then
86:43 your head and you say well 496 and then we'll get to this in a minute but we
86:44 we'll get to this in a minute but we have to subtract two so 494 potential
86:48 have to subtract two so 494 potential and why is this all important what do we
86:50 and why is this all important what do we even care about any of this why am I
86:52 even care about any of this why am I rambling on well you need to know based
86:54 rambling on well you need to know based on the network okay the slash 24 is
86:57 on the network okay the slash 24 is great for a small office home network
86:59 great for a small office home network however you want to have it but what if
87:01 however you want to have it but what if you're a large Enterprise
87:03 you're a large Enterprise maybe you have thousands of devices okay
87:06 maybe you have thousands of devices okay maybe you want a slash 16 Network that
87:09 maybe you want a slash 16 Network that might make more sense for you or you
87:11 might make more sense for you or you even see some with a slash 8 Network it
87:15 even see some with a slash 8 Network it just depends on how big the company is
87:16 just depends on how big the company is the larger the company the greater
87:19 the larger the company the greater chance that you're going to see that
87:20 chance that you're going to see that they're not using slash 24 or they could
87:22 they're not using slash 24 or they could even have subnetted segments of their
87:25 even have subnetted segments of their Network where say they have just
87:28 Network where say they have just telephones and they've got 500 employees
87:31 telephones and they've got 500 employees and 500 telephones they might just have
87:33 and 500 telephones they might just have one slash 23 Network for nothing but
87:35 one slash 23 Network for nothing but telephones because that's the amount of
87:37 telephones because that's the amount of hosts that fit in there
87:39 hosts that fit in there so what we're after with subnetting is
87:41 so what we're after with subnetting is how many hosts can we fit and what is
87:43 how many hosts can we fit and what is the mask that's behind it so those are
87:46 the mask that's behind it so those are questions you might be asked in the exam
87:47 questions you might be asked in the exam and these are questions that you're just
87:48 and these are questions that you're just going to see and when you're given
87:50 going to see and when you're given addresses say you're doing a pen test
87:52 addresses say you're doing a pen test for a client you might be given
87:53 for a client you might be given something like this you might be given
87:55 something like this you might be given IP address it's
87:56 IP address it's 192.168.1.0 24. okay and immediately in
88:00 192.168.1.0 24. okay and immediately in your head you're like oh slash 24 that's
88:02 your head you're like oh slash 24 that's standard there could be up to 256 hosts
88:05 standard there could be up to 256 hosts or 254 hosts or devices in this network
88:08 or 254 hosts or devices in this network but if they gave you something like 192
88:11 but if they gave you something like 192 168 1.0 20. then you might look at your
88:16 168 1.0 20. then you might look at your little chart and say
88:18 little chart and say 4094 hosts remember we're going to
88:20 4094 hosts remember we're going to subtract two four thousand ninety four
88:22 subtract two four thousand ninety four hosts in this network now I know if I'm
88:24 hosts in this network now I know if I'm scanning this I'm up against a lot more
88:26 scanning this I'm up against a lot more devices potentially than I am in this
88:29 devices potentially than I am in this okay so when a client gives you your
88:32 okay so when a client gives you your subnets they might just write it out
88:34 subnets they might just write it out like this and depending how big your
88:36 like this and depending how big your client is might depend on how big their
88:38 client is might depend on how big their subnets are for you for example I just
88:40 subnets are for you for example I just pen tested a client that was a slash 16
88:42 pen tested a client that was a slash 16 all the way across and it looks
88:44 all the way across and it looks something like
88:45 something like 10.1.0.0 16.
88:49 10.1.0.0 16. okay and your subnet mask for that would
88:51 okay and your subnet mask for that would be something like two five five two five
88:53 be something like two five five two five five zero dot zero and how does this
88:56 five zero dot zero and how does this come into play well every time you have
88:58 come into play well every time you have a two five five that number's locked in
89:01 a two five five that number's locked in place that's another way to think about
89:02 place that's another way to think about this so that 10 is always locked down
89:05 this so that 10 is always locked down this one is always locked down the rest
89:08 this one is always locked down the rest of the bits are fair game meaning we
89:10 of the bits are fair game meaning we could have
89:16 10.1.1.0.1.2.3 we could actually have a zero here
89:19 zero here 0.1.2.3.4 and that's how this number for
89:21 0.1.2.3.4 and that's how this number for like a slash 16 gets so big because you
89:24 like a slash 16 gets so big because you have 10.1.0.0
89:31 through 255 on the possibilities which equals 256 hosts okay for one range you
89:35 equals 256 hosts okay for one range you get 256. well imagine you have to do
89:39 get 256. well imagine you have to do that 255 other times right and that
89:43 that 255 other times right and that number gets substantially bigger here
89:46 number gets substantially bigger here and then if you were to have a slash
89:48 and then if you were to have a slash eight then of course it gets bigger and
89:50 eight then of course it gets bigger and bigger so what you need to realize are a
89:53 bigger so what you need to realize are a few things here
89:55 few things here we have these addresses and you see the
89:58 we have these addresses and you see the slash one slash a again we call them wax
90:00 slash one slash a again we call them wax whack 24 is going to be very common I
90:02 whack 24 is going to be very common I would say wax 16 is probably your next
90:04 would say wax 16 is probably your next common you might see some weird cemented
90:07 common you might see some weird cemented networks like this subnetted networks
90:09 networks like this subnetted networks like this but typically it's slash 24
90:11 like this but typically it's slash 24 16. now
90:14 16. now your network ID is typically what is
90:16 your network ID is typically what is known as your first address and your
90:18 known as your first address and your broadcast ID is known as your last
90:21 broadcast ID is known as your last address this is not always the case but
90:23 address this is not always the case but it is very common and let me log back
90:26 it is very common and let me log back into this Cali machine here and I'll
90:27 into this Cali machine here and I'll show you
90:29 show you so we have our IP address 192 168 57.139
90:35 so we have our IP address 192 168 57.139 and we've got a net mask of
90:38 and we've got a net mask of 255-255-2550 what does that tell you
90:41 255-255-2550 what does that tell you from what we just learned that tells you
90:43 from what we just learned that tells you we have a slash 24 Network okay this is
90:46 we have a slash 24 Network okay this is a common Network there are potentially
90:48 a common Network there are potentially 250 for hosts why have I keep saying
90:51 250 for hosts why have I keep saying that why do I keep subtracting true well
90:53 that why do I keep subtracting true well we've got a network ID and a broadcast
90:55 we've got a network ID and a broadcast ID or broadcast IP here well what we
90:58 ID or broadcast IP here well what we need to know
91:00 need to know is we are DOT 139 we could be anywhere
91:03 is we are DOT 139 we could be anywhere from dot 1.254 within this network
91:06 from dot 1.254 within this network that's our 254 possibilities this zero
91:09 that's our 254 possibilities this zero means we have the flexibility to be any
91:12 means we have the flexibility to be any IP address range from 1 to 254. usually
91:17 IP address range from 1 to 254. usually usually a DOT zero for this IP here and
91:20 usually a DOT zero for this IP here and a DOT 255 make up your network ID and
91:24 a DOT 255 make up your network ID and your broadcast IP okay usually so if we
91:28 your broadcast IP okay usually so if we were to say something along the lines of
91:30 were to say something along the lines of let's go back to this Excel document and
91:33 let's go back to this Excel document and we were to say something along the lines
91:35 we were to say something along the lines of this let's say that we have a slash
91:37 of this let's say that we have a slash 24 Network
91:39 24 Network and we want to know how many hosts
91:42 and we want to know how many hosts we want to know how what our network ID
91:45 we want to know how what our network ID is
91:46 is and what our broadcast ideas or IAP is
91:49 and what our broadcast ideas or IAP is okay
91:50 okay we would say okay and we'll we'll give
91:53 we would say okay and we'll we'll give it one more we'll say it's a slash 24
91:55 it one more we'll say it's a slash 24 and the IP starts with
92:00 and the IP starts with 192.168.1 DOT
92:03 192.168.1 DOT zero okay or we can even write it like
92:06 zero okay or we can even write it like this 192 168 1.0 24 delete this and
92:12 this 192 168 1.0 24 delete this and we'll say what's our subnet mask
92:15 we'll say what's our subnet mask what's our host what's our Network
92:17 what's our host what's our Network what's our broadcast so subnet you come
92:19 what's our broadcast so subnet you come to your cheat sheet you say Okay slash
92:21 to your cheat sheet you say Okay slash 24 I already know that I need to be
92:24 24 I already know that I need to be filling in this area here on the X so
92:26 filling in this area here on the X so I'm just going to come in 255 255 what's
92:29 I'm just going to come in 255 255 what's the X well we know to come down this row
92:32 the X well we know to come down this row 255 here
92:34 255 here dot zero
92:35 dot zero okay and then we've got hosts I'm just
92:37 okay and then we've got hosts I'm just going to expand this a little bit we've
92:39 going to expand this a little bit we've got the host okay hosts are right here
92:42 got the host okay hosts are right here 256 hosts potentially 254 though because
92:45 256 hosts potentially 254 though because we always subtract 2 from the host total
92:48 we always subtract 2 from the host total so our network ID is usually the first
92:51 so our network ID is usually the first address available to us which is
92:53 address available to us which is 192.1681.0 the broadcast is
92:58 192.1681.0 the broadcast is 192.168.1.255 meaning available to us is
93:01 192.168.1.255 meaning available to us is anything from dot 1 to Dot 254.
93:05 anything from dot 1 to Dot 254. let's take a look at something else
93:06 let's take a look at something else that's uh a basic example let's do like
93:09 that's uh a basic example let's do like a slash 28. let's say we got
93:17 192.168.1.0 28. now what
93:18 now what well you've got 16 hosts here
93:21 well you've got 16 hosts here okay so our subnet is then going to fill
93:23 okay so our subnet is then going to fill in two five five two five five two five
93:26 in two five five two five five two five five dot X right because we're in this
93:28 five dot X right because we're in this row
93:29 row slash 28 says it's going to be a 240
93:31 slash 28 says it's going to be a 240 when we drop down to the subnet mask
93:35 when we drop down to the subnet mask I'm going to make this a little bigger
93:37 I'm going to make this a little bigger how many hosts 16 minus two we have 14
93:41 how many hosts 16 minus two we have 14 hoes
93:42 hoes okay so the first non-host would be a
93:47 okay so the first non-host would be a 192.168.1.0 again still the same thing
93:49 192.168.1.0 again still the same thing first first address
93:51 first first address last address is going to be what
93:54 last address is going to be what 192.168.1.15.
94:01 does that make sense 0 to 15 is 16 addresses usable space is 14 because we
94:04 addresses usable space is 14 because we take out the network and the broadcast
94:07 take out the network and the broadcast now you could see something like this
94:10 now you could see something like this and then guess what you're segmented so
94:12 and then guess what you're segmented so because you're only using this little
94:14 because you're only using this little bit of space you can then in turn have
94:17 bit of space you can then in turn have something like this
94:20 something like this 192.168.1.16 28.
94:23 192.168.1.16 28. and then it starts the same way your
94:26 and then it starts the same way your subnet mask is actually the same because
94:27 subnet mask is actually the same because you're using a slash 28 you come through
94:30 you're using a slash 28 you come through you can just copy and paste that the
94:32 you can just copy and paste that the hosts are still the same what changes
94:34 hosts are still the same what changes here
94:35 here well your first address 102.168.1.16
94:42 and then your last address which is 192.168.1.31
94:50 so because this is smaller on the slash 28 side
94:51 28 side we can actually have multiple networks
94:53 we can actually have multiple networks within like say a DOT
95:00 1.0.1.16.1.32 you get a multiple little networks here with only a small amount
95:02 networks here with only a small amount of hosts so maybe you have just a few
95:04 of hosts so maybe you have just a few servers in this range and you have like
95:07 servers in this range and you have like servers
95:08 servers um a b and c they go in a slash 28 and
95:11 um a b and c they go in a slash 28 and then you have another one of servers DC
95:13 then you have another one of servers DC and e or d d e and f however you want to
95:16 and e or d d e and f however you want to say it and you have more in that range
95:18 say it and you have more in that range okay so you can subnet this out into
95:20 okay so you can subnet this out into different things and when we see subnets
95:23 different things and when we see subnets we see all kinds of stuff we can see
95:24 we see all kinds of stuff we can see phones servers user computers Wireless
95:27 phones servers user computers Wireless all different sort of things some
95:29 all different sort of things some companies get really specific with their
95:31 companies get really specific with their subnetting now let's try one more let's
95:33 subnetting now let's try one more let's say we have a slash 23. now I want to
95:37 say we have a slash 23. now I want to put in
95:39 put in 192.168.1.0 23 but that would be wrong
95:44 192.168.1.0 23 but that would be wrong why would this be wrong this is actually
95:46 why would this be wrong this is actually going to be a zero and I'll show you why
95:48 going to be a zero and I'll show you why in a second
95:49 in a second so we're no longer locking in the this
95:52 so we're no longer locking in the this this number anymore right when we get
95:55 this number anymore right when we get below the slash 24 of the 255 all the
95:59 below the slash 24 of the 255 all the way across for three of them guess what
96:01 way across for three of them guess what we're now have the ability to change
96:04 we're now have the ability to change this number other than what's locked in
96:06 this number other than what's locked in so let's do a DOT zero we'll talk about
96:09 so let's do a DOT zero we'll talk about why let's hit enter here so the subnet
96:12 why let's hit enter here so the subnet on a slash 23 well we're going to do a
96:15 on a slash 23 well we're going to do a 254 which is going to be the placeholder
96:16 254 which is going to be the placeholder of the X here we're going to come in and
96:18 of the X here we're going to come in and say 255-255-254.0
96:24 and now again we're not locked in so remember this 255 would lock in this dot
96:27 remember this 255 would lock in this dot one that doesn't happen anymore so we've
96:29 one that doesn't happen anymore so we've got 255 255 254.0 we're actually going
96:33 got 255 255 254.0 we're actually going to start at zero here and we're going to
96:35 to start at zero here and we're going to say the number of hosts that are
96:36 say the number of hosts that are possible
96:38 possible it's 510 okay 512 minus two we'll say
96:42 it's 510 okay 512 minus two we'll say our network ID is
96:45 our network ID is 192.168.0.0 and our broadcast would then
96:48 192.168.0.0 and our broadcast would then be 192.168.1.255.
96:57 why okay so we have the possibility now that we're spanning two ranges we've got
97:00 that we're spanning two ranges we've got 510 hosts in this network okay and we
97:03 510 hosts in this network okay and we have the ability to go between zero and
97:06 have the ability to go between zero and one we've got two options now zero and
97:09 one we've got two options now zero and one so if we were to say another network
97:12 one so if we were to say another network if we wanted to get to like a two we'd
97:15 if we wanted to get to like a two we'd actually have to say
97:17 actually have to say 192.168.2.0 23 it would be the same
97:21 192.168.2.0 23 it would be the same subnet mask
97:22 subnet mask same number of hosts but then this would
97:25 same number of hosts but then this would be 192.168.2.0
97:37 again there's 500 510 possible hosts in between this right because you got to
97:39 between this right because you got to think dot
97:41 think dot 0.1.0.2.0.3 all the way through 254 and
97:44 0.1.0.2.0.3 all the way through 254 and again 1.1 1.2 all the way through 254.
97:49 again 1.1 1.2 all the way through 254. so that equals 510. once you've hit that
97:52 so that equals 510. once you've hit that maximum that 1.255 then guess what you
97:56 maximum that 1.255 then guess what you start at 2 you have a whole new network
97:58 start at 2 you have a whole new network here just like these smaller segments
98:00 here just like these smaller segments you get whole new networks on the bigger
98:02 you get whole new networks on the bigger side as well so what you need to know is
98:05 side as well so what you need to know is that when I if I were to put something
98:07 that when I if I were to put something like a 192.168.1.0.23
98:14 that would have fallen into line with the one and the zero in our actual
98:16 the one and the zero in our actual network ID still would have been 0.0 and
98:19 network ID still would have been 0.0 and a 1.255 would have been the broadcast
98:21 a 1.255 would have been the broadcast here and you can double check this
98:23 here and you can double check this anytime you're confused you can double
98:25 anytime you're confused you can double check your cider notation so I'm going
98:28 check your cider notation so I'm going to bring over a website that I will show
98:30 to bring over a website that I will show you here and this is just an IP
98:33 you here and this is just an IP addressing guide It's called
98:35 addressing guide It's called ipaddressguide.com you bring this over
98:38 ipaddressguide.com you bring this over and you scroll down just a little bit
98:40 and you scroll down just a little bit and I just put in
98:42 and I just put in 192.168.1.0 23 and you can see that it
98:46 192.168.1.0 23 and you can see that it actually corrects me and says the first
98:48 actually corrects me and says the first bit is
98:49 bit is 192.168.0.0 the last one's
98:52 192.168.0.0 the last one's 192.1681.255 total host is 5 12 minus
98:56 192.1681.255 total host is 5 12 minus two shows you that again first IP last
98:59 two shows you that again first IP last IP you got your net mask very easy to
99:02 IP you got your net mask very easy to use a cider calculator here or an IP
99:04 use a cider calculator here or an IP range to convert to cider as well so
99:07 range to convert to cider as well so very useful calculators but if you're
99:09 very useful calculators but if you're not allowed to use these for like an
99:10 not allowed to use these for like an exam purpose or something along those
99:12 exam purpose or something along those lines then using the cheat sheet that
99:14 lines then using the cheat sheet that I've shown you is super useful now what
99:17 I've shown you is super useful now what I want to do is I want to try three more
99:20 I want to do is I want to try three more subnets okay I'm going to write these
99:22 subnets okay I'm going to write these out I'm going to say
99:33 192.168.1.0 26 and
99:41 192.168.1.0 27. I want you to solve these for me tell me the subnet mask the
99:42 these for me tell me the subnet mask the host Network and broadcast
99:45 host Network and broadcast and with that being said this again is a
99:48 and with that being said this again is a very complicated topic I did not pick
99:50 very complicated topic I did not pick this up the first time or the second
99:51 this up the first time or the second time that I got it if you're running
99:53 time that I got it if you're running confused right now perfectly normal you
99:56 confused right now perfectly normal you can go back and watch this video again
99:57 can go back and watch this video again try to pick up more topics try to
99:59 try to pick up more topics try to understand it maybe I'm not the right
100:02 understand it maybe I'm not the right instructor for this either I do
100:03 instructor for this either I do recommend looking at other resources to
100:06 recommend looking at other resources to completely fill in your knowledge Gap if
100:08 completely fill in your knowledge Gap if there is one that exists another
100:09 there is one that exists another resource that I'll link down is what is
100:12 resource that I'll link down is what is called seven second subnetting it is
100:14 called seven second subnetting it is very useful a lot of students have
100:15 very useful a lot of students have recommended it to me I'm going to push
100:17 recommended it to me I'm going to push it forward as well so go ahead and try
100:20 it forward as well so go ahead and try to solve this understand that what
100:22 to solve this understand that what you're after here is just understanding
100:23 you're after here is just understanding what a subnet is okay when you see
100:26 what a subnet is okay when you see something like this if a client sends
100:28 something like this if a client sends you
100:29 you 192.1681.024 you're gonna say hey okay I
100:33 192.1681.024 you're gonna say hey okay I know that there's probably 254 hosts in
100:35 know that there's probably 254 hosts in that Network and I know what I'm working
100:36 that Network and I know what I'm working with if you see this
100:39 with if you see this 255.255.255.0 again you know that you're
100:42 255.255.255.0 again you know that you're working with a slash 24 Network very
100:44 working with a slash 24 Network very standard stuff that's what we're after I
100:47 standard stuff that's what we're after I don't expect you to ever memorize this I
100:49 don't expect you to ever memorize this I don't have this memorized like I don't
100:50 don't have this memorized like I don't come in here and say you know a slash 18
100:52 come in here and say you know a slash 18 is a two five five two five five 192.0
100:55 is a two five five two five five 192.0 Network and it's got 16 384 hosts I
100:59 Network and it's got 16 384 hosts I don't do that okay I have a cheat sheet
101:01 don't do that okay I have a cheat sheet I'll use a website if I need to for the
101:04 I'll use a website if I need to for the most part what you need to understand is
101:06 most part what you need to understand is two 254 hosts for a slash 24 if that
101:10 two 254 hosts for a slash 24 if that number has gone up to like a slash 28
101:11 number has gone up to like a slash 28 you know you're dealing with less if
101:13 you know you're dealing with less if that number is lower like a slash 16 you
101:16 that number is lower like a slash 16 you know you're doing with a bigger Network
101:17 know you're doing with a bigger Network that's really what it comes down to
101:19 that's really what it comes down to unless you are working in networking and
101:21 unless you are working in networking and then these become more important but as
101:23 then these become more important but as a pen tester understanding how to read
101:25 a pen tester understanding how to read this understanding what the subnet is
101:27 this understanding what the subnet is and just identifying it with very basic
101:30 and just identifying it with very basic measures this is extremely useful so I
101:33 measures this is extremely useful so I will catch you over in the next video
101:34 will catch you over in the next video when we talk about solving these
101:36 when we talk about solving these challenges and hopefully we got them all
101:38 challenges and hopefully we got them all right so I'll see you over there in the
101:40 right so I'll see you over there in the next one
101:46 foreign so let's solve this challenge together
101:48 so let's solve this challenge together shall we
101:49 shall we 've got a
101:51 've got a 192.168.00 22 why did I write this out
101:54 192.168.00 22 why did I write this out this way well similar to the slash 23.
101:57 this way well similar to the slash 23. so if we come to a slash 22 we see that
102:00 so if we come to a slash 22 we see that there are
102:01 there are 1024 hosts which means we have a
102:04 1024 hosts which means we have a possibility of 1022 right and all we
102:08 possibility of 1022 right and all we need to do is fill in the blank on the X
102:10 need to do is fill in the blank on the X so
102:11 so 255.255 dot 252.0
102:20 we come across we know our first IP here or ID is
102:23 IP here or ID is 192.1680.0 first address possible now if
102:26 192.1680.0 first address possible now if we think about this we can kind of do
102:28 we think about this we can kind of do this mentally in our head we can think
102:30 this mentally in our head we can think okay there's probably 250 or so hosts in
102:34 okay there's probably 250 or so hosts in a network and we've got a thousand or so
102:37 a network and we've got a thousand or so hosts here well that's going to be about
102:39 hosts here well that's going to be about four right four ranges because we got a
102:42 four right four ranges because we got a thousand divided by 250 so I'm going to
102:44 thousand divided by 250 so I'm going to go ahead and go 0 1 2 3. that's four
102:48 go ahead and go 0 1 2 3. that's four total we'd say
102:54 192.168.3.255. and hopefully that math makes sense again zero
102:56 makes sense again zero dot 0.1 through 254
103:01 dot 0.1 through 254 .1.1 through
103:03 .1.1 through 254.2.1 through
103:05 254.2.1 through 254.3.1 through 254. that equals about
103:09 254.3.1 through 254. that equals about 1022 hosts okay actually I lied to you
103:15 1022 hosts okay actually I lied to you the only two we're taking off are 0 and
103:17 the only two we're taking off are 0 and 255 you actually have dot zero through
103:20 255 you actually have dot zero through 255 1.0 through 255 all the way we're
103:25 255 1.0 through 255 all the way we're only subtracting these two so if you do
103:27 only subtracting these two so if you do that math that will add up to 10 22.
103:30 that math that will add up to 10 22. okay so a slash 26 we've got a
103:41 255.255.255.192 fill in the blanks fill in the X's 64 hosts we got 62 in reality
103:45 in the X's 64 hosts we got 62 in reality and we're gonna say 192. 168.1.0
103:50 and we're gonna say 192. 168.1.0 and 192.168.1.63.
103:58 again if we wanted to create a second Network we could start here with a
104:01 Network we could start here with a 64-26 and we would start with 64 as the
104:05 64-26 and we would start with 64 as the network ID and then 127 as the broadcast
104:09 network ID and then 127 as the broadcast and lastly
104:19 255.255.255.224 for a slash 27. we've got 30 potential hosts
104:21 we've got 30 potential hosts because we got 32 minus 2. 192 168.1.0
104:26 because we got 32 minus 2. 192 168.1.0 and then we're going to do 192.168.1.31.
104:33 same thing here if we wanted to create a second Network we could we could say
104:40 192.168.1.32-27 and then this would start at 32 and this one would end at
104:44 start at 32 and this one would end at 63. we can make however many networks
104:47 63. we can make however many networks within that four to eight I think eight
104:49 within that four to eight I think eight eight different segmented networks with
104:51 eight different segmented networks with the Slash 27.
104:53 the Slash 27. so that is it again as I said last video
104:56 so that is it again as I said last video this can be confusing and all we're
105:00 this can be confusing and all we're taking away here is identifying what the
105:03 taking away here is identifying what the cider notation looks like identifying
105:05 cider notation looks like identifying the base that to me is slash 24 being
105:08 the base that to me is slash 24 being the most common what you'll see
105:10 the most common what you'll see understanding what a subnet mask is and
105:12 understanding what a subnet mask is and why it's important especially in
105:14 why it's important especially in relation to hosts and the number of
105:15 relation to hosts and the number of devices that you can have on a network
105:16 devices that you can have on a network and why you might see something like a
105:19 and why you might see something like a slash 28 or a slash 23 or more commonly
105:21 slash 28 or a slash 23 or more commonly something like a slash 16. so understand
105:24 something like a slash 16. so understand again that slash 24 as you see a bigger
105:28 again that slash 24 as you see a bigger number there or you see even you know
105:30 number there or you see even you know something other than 3 255s in a row
105:33 something other than 3 255s in a row understand the number of hosts are
105:34 understand the number of hosts are getting smaller the last 255s you see on
105:37 getting smaller the last 255s you see on your screen the number is getting bigger
105:39 your screen the number is getting bigger for the number of hosts okay and just
105:41 for the number of hosts okay and just understand how to read this that's all
105:43 understand how to read this that's all you need to take away again I'm going to
105:45 you need to take away again I'm going to provide additional resources as I
105:46 provide additional resources as I provide in the last video go review them
105:49 provide in the last video go review them if you don't understand them you can
105:50 if you don't understand them you can always come to the Discord Channel you
105:52 always come to the Discord Channel you can always ask q a questions this is not
105:54 can always ask q a questions this is not an easy topic to pick up but it is a
105:56 an easy topic to pick up but it is a topic that I had to show you as part of
105:57 topic that I had to show you as part of networking
106:06 all right so in order to be successful in this course we are going to be
106:08 in this course we are going to be utilizing what is called a virtual
106:10 utilizing what is called a virtual machine now virtual machines are known
106:12 machine now virtual machines are known as VMS for short and a VM is just a
106:16 as VMS for short and a VM is just a machine on top of a machine and to give
106:19 machine on top of a machine and to give you an example I'm actually running this
106:20 you an example I'm actually running this Windows 10 instance that you see here
106:23 Windows 10 instance that you see here on top of my Windows 10 instance so here
106:26 on top of my Windows 10 instance so here you can see if I scroll up that I have a
106:28 you can see if I scroll up that I have a Windows 10 machine I also have a Linux
106:30 Windows 10 machine I also have a Linux machine sitting here if I were to
106:33 machine sitting here if I were to demaximize this you can see that I'm
106:36 demaximize this you can see that I'm actually running here a Windows machine
106:38 actually running here a Windows machine in the back this is my wife and I and
106:42 in the back this is my wife and I and you come through here we just blow it
106:43 you come through here we just blow it back up and we're back inside of our
106:45 back up and we're back inside of our machine so a virtual machine is just a
106:48 machine so a virtual machine is just a machine inside of a machine so what
106:50 machine inside of a machine so what we're going to be doing is we're going
106:51 we're going to be doing is we're going to be utilizing this to build out Labs
106:54 to be utilizing this to build out Labs that way we don't have to actually have
106:55 that way we don't have to actually have a bunch of Hardware we can just use this
106:57 a bunch of Hardware we can just use this for our our course and run what we need
107:00 for our our course and run what we need to on top of our own machine already now
107:03 to on top of our own machine already now this can get resource intensive so if
107:06 this can get resource intensive so if you are only utilizing something like
107:08 you are only utilizing something like eight gigabytes of RAM then you might
107:11 eight gigabytes of RAM then you might have some issues with this but you can
107:13 have some issues with this but you can still follow along when we get into the
107:15 still follow along when we get into the active directory portion you might run
107:17 active directory portion you might run into issues if you do not have at least
107:19 into issues if you do not have at least 16 gigabytes of RAM to utilize but we'll
107:22 16 gigabytes of RAM to utilize but we'll worry about that when we we get there
107:23 worry about that when we we get there there's still plenty of ways to follow
107:25 there's still plenty of ways to follow along throughout this whole course so
107:27 along throughout this whole course so another thing to note is that I use VMS
107:30 another thing to note is that I use VMS every single day this machine that you
107:32 every single day this machine that you see here is actually my day-to-day pen
107:35 see here is actually my day-to-day pen testing machine so I run a Kali Linux
107:38 testing machine so I run a Kali Linux instance on top of my Windows machine
107:40 instance on top of my Windows machine and utilize that to do penetration
107:43 and utilize that to do penetration testing so I'm going to demonstrate that
107:46 testing so I'm going to demonstrate that to you and how we're going to build out
107:47 to you and how we're going to build out our Labs with that and a lot of us in
107:50 our Labs with that and a lot of us in the industry run through VMS as opposed
107:52 the industry run through VMS as opposed to running it directly on metal or on a
107:55 to running it directly on metal or on a machine
107:55 machine so in order to utilize virtual machines
107:59 so in order to utilize virtual machines we first need some sort of virtual
108:01 we first need some sort of virtual machine software to play these so there
108:04 machine software to play these so there are two different ways that we can do
108:05 are two different ways that we can do this if you are on a Windows machine or
108:08 this if you are on a Windows machine or a Linux machine you can utilize VMware
108:11 a Linux machine you can utilize VMware Workstation player now if you type in
108:13 Workstation player now if you type in VMware Workstation player in Google the
108:16 VMware Workstation player in Google the first one here that says download VMware
108:19 first one here that says download VMware Workstation player you just click on
108:20 Workstation player you just click on that
108:22 that and if you are in a Mac environment
108:24 and if you are in a Mac environment you're going to be utilizing Oracle
108:26 you're going to be utilizing Oracle virtualbox so if you type in Oracle
108:28 virtualbox so if you type in Oracle virtualbox you come here and you go to
108:30 virtualbox you come here and you go to downloads
108:31 downloads you have your option there as well so in
108:35 you have your option there as well so in this course I will be using VMware
108:37 this course I will be using VMware Workstation player I'm going to be
108:39 Workstation player I'm going to be running it on top of Windows if you are
108:41 running it on top of Windows if you are using Mac that is absolutely fine you're
108:44 using Mac that is absolutely fine you're going to be following along just the
108:45 going to be following along just the same all you need to be able to do is
108:48 same all you need to be able to do is follow the same instructions that I give
108:50 follow the same instructions that I give you and you will be a-okay so if you
108:53 you and you will be a-okay so if you scroll down here you can see try
108:55 scroll down here you can see try workstation player for windows or try a
108:56 workstation player for windows or try a workstation player for Linux go ahead
108:58 workstation player for Linux go ahead and just select download now
109:00 and just select download now that should bring up a download and go
109:02 that should bring up a download and go ahead and save it
109:04 ahead and save it if you're doing virtualbox go ahead and
109:07 if you're doing virtualbox go ahead and download for OS X I will download the
109:10 download for OS X I will download the windows version just so that we can uh
109:13 windows version just so that we can uh we can see what that looks like as well
109:15 we can see what that looks like as well so I'll save both of these
109:17 so I'll save both of these so let's view our downloads and we've
109:19 so let's view our downloads and we've got VMware Workstation player here
109:22 got VMware Workstation player here I'm going to go ahead and open this one
109:26 I'm going to go ahead and open this one and we're going to install this
109:34 and this will be very point and click so next accept the agreement possibly
109:37 so next accept the agreement possibly give away our first child uh yeah we
109:39 give away our first child uh yeah we should go ahead and install the enhanced
109:41 should go ahead and install the enhanced keyboard driver while we have this
109:47 and then we don't need to enjoy join any Improvement programs or check for
109:49 Improvement programs or check for product update that's okay we will
109:52 product update that's okay we will install desktop start menu you check
109:54 install desktop start menu you check check your preferences as you like it
109:56 check your preferences as you like it I'm just going to install this
109:58 I'm just going to install this and this should just finish here in just
110:01 and this should just finish here in just a second
110:05 okay then you'll be brought to this screen once everything's done it should
110:07 screen once everything's done it should take about a minute or two and we're
110:08 take about a minute or two and we're going to go ahead and hit finish
110:11 going to go ahead and hit finish and it's going to want a restart to take
110:13 and it's going to want a restart to take effect you can go ahead and restart your
110:15 effect you can go ahead and restart your system I'm going to say no right now
110:17 system I'm going to say no right now let's go ahead and install virtualbox if
110:19 let's go ahead and install virtualbox if you are a Mac User
110:22 you are a Mac User we'll hit next
110:24 we'll hit next here
110:26 here next and yes and install
110:31 next and yes and install except
110:32 except and again vary point and click with the
110:35 and again vary point and click with the installation
110:36 installation select install and any options that do
110:39 select install and any options that do pop up
110:41 pop up and then we can start Oracle VM if we
110:43 and then we can start Oracle VM if we want let's go ahead and just start that
110:45 want let's go ahead and just start that this is what Oracle VM looks like
110:48 this is what Oracle VM looks like and let's see if we can start the VMware
110:51 and let's see if we can start the VMware Player here even though we need to
110:53 Player here even though we need to restart
110:59 and this is what VMware Workstation player looks like so here you can see
111:01 player looks like so here you can see that we have virtual machines we can
111:03 that we have virtual machines we can create new virtual machines open ones
111:05 create new virtual machines open ones Etc we'll get into that in the next
111:07 Etc we'll get into that in the next video so again if you are using Windows
111:09 video so again if you are using Windows or Linux this is probably what your view
111:11 or Linux this is probably what your view is going to look like for the rest of
111:12 is going to look like for the rest of the time if you are using Oracle on a
111:16 the time if you are using Oracle on a Mac this is what your view is going to
111:17 Mac this is what your view is going to look like another site Pro tip here is
111:21 look like another site Pro tip here is that I am using workstation Pro and I
111:23 that I am using workstation Pro and I might utilize this in some instances
111:25 might utilize this in some instances throughout the course other instances
111:27 throughout the course other instances I'll be utilizing the workstation player
111:29 I'll be utilizing the workstation player they are not much of a difference
111:31 they are not much of a difference especially in the beginning when we get
111:32 especially in the beginning when we get into the active directory portion it
111:34 into the active directory portion it might actually be worth it for you all
111:36 might actually be worth it for you all to download the VMware Pro trial because
111:40 to download the VMware Pro trial because the trial is 30 days and you can utilize
111:42 the trial is 30 days and you can utilize that to get through some sections and
111:43 that to get through some sections and actually have nice little Windows here
111:45 actually have nice little Windows here to to be clean and just have a pro
111:49 to to be clean and just have a pro Edition you can do everything that I'm
111:51 Edition you can do everything that I'm going to show you in the course on the
111:52 going to show you in the course on the player it just is that you have to open
111:55 player it just is that you have to open if you want to run more than one machine
111:56 if you want to run more than one machine you you'll just have to reopen the
111:58 you you'll just have to reopen the VMware Workstation player several times
112:01 VMware Workstation player several times to run multiple machines but that's okay
112:03 to run multiple machines but that's okay it just won't look like this nice clean
112:04 it just won't look like this nice clean layout where you could transfer between
112:06 layout where you could transfer between machines like I can do just here
112:08 machines like I can do just here so with that being said let's go ahead
112:10 so with that being said let's go ahead and move on to the next video we're
112:11 and move on to the next video we're going to be installing Kali Linux onto
112:14 going to be installing Kali Linux onto our VMware Workstation player
112:24 now that we've installed VMware or virtualbox we need to install Linux
112:27 virtualbox we need to install Linux we're going to be using a version of
112:29 we're going to be using a version of Linux called Kali Linux throughout this
112:31 Linux called Kali Linux throughout this course
112:32 course this version of Linux is a Debian based
112:35 this version of Linux is a Debian based distribution which is geared towards
112:37 distribution which is geared towards ethical hacking and penetration testing
112:39 ethical hacking and penetration testing so it's a special version of Linux that
112:42 so it's a special version of Linux that allows us to have all the tools in one
112:45 allows us to have all the tools in one place that will allow us to hack without
112:47 place that will allow us to hack without having to download these tools and
112:49 having to download these tools and install them on our own custom Linux
112:51 install them on our own custom Linux distribution so it's all kind of nicely
112:53 distribution so it's all kind of nicely built into one package
112:55 built into one package so if you go out to Google and you type
112:57 so if you go out to Google and you type in Kali Linux download you should see
113:00 in Kali Linux download you should see this link I'll put the link in the
113:01 this link I'll put the link in the description below as well but you should
113:04 description below as well but you should just be able to go to get Cali right
113:05 just be able to go to get Cali right here
113:07 here and you're going to be presented with a
113:09 and you're going to be presented with a couple of options here we're going to be
113:11 couple of options here we're going to be using a virtual machine in this course
113:12 using a virtual machine in this course so we're just going to go ahead and
113:13 so we're just going to go ahead and click on this virtual machine option
113:16 click on this virtual machine option and that's going to take us down just a
113:18 and that's going to take us down just a little bit here what you're going to do
113:20 little bit here what you're going to do is you're going to download the
113:22 is you're going to download the respective version that you need so if
113:25 respective version that you need so if you need VMware you download VMware
113:26 you need VMware you download VMware you're using virtualbox go ahead and
113:28 you're using virtualbox go ahead and download the virtualbox one
113:30 download the virtualbox one now they have a direct download which is
113:32 now they have a direct download which is a 7-Zip and they also have a torrent if
113:34 a 7-Zip and they also have a torrent if you know how to torrent
113:35 you know how to torrent what you're going to do is go ahead and
113:37 what you're going to do is go ahead and download the file that you need and
113:39 download the file that you need and while you're doing that if you do choose
113:42 while you're doing that if you do choose to download directly you're also going
113:44 to download directly you're also going to need a tool called 7-Zip or a way to
113:47 to need a tool called 7-Zip or a way to unzip this file so go ahead and start
113:50 unzip this file so go ahead and start your download while it's downloading
113:52 your download while it's downloading let's also go ahead and navigate to
113:55 let's also go ahead and navigate to 7-Zip so if you go to Google and you
113:57 7-Zip so if you go to Google and you look at 7-Zip you'll see this page here
114:00 look at 7-Zip you'll see this page here comes up you just go to download in here
114:03 comes up you just go to download in here you're going to download the file that
114:05 you're going to download the file that is for your respective system so here
114:08 is for your respective system so here I'm using Windows on 64-bit I would
114:11 I'm using Windows on 64-bit I would download this executable right here now
114:13 download this executable right here now if you're running on Linux here's where
114:15 if you're running on Linux here's where you download Linux if you're running on
114:17 you download Linux if you're running on Mac OS here's where you download for Mac
114:18 Mac OS here's where you download for Mac OS very straightforward I've already got
114:21 OS very straightforward I've already got this installed but what you need to do
114:23 this installed but what you need to do is just download this and literally
114:24 is just download this and literally click next through it make sure you get
114:27 click next through it make sure you get it installed
114:28 it installed go ahead and pause the video once that
114:31 go ahead and pause the video once that is installed 7zip that is and once you
114:34 is installed 7zip that is and once you have the actual Cali image downloaded go
114:38 have the actual Cali image downloaded go ahead and unpause the video I'll be here
114:39 ahead and unpause the video I'll be here waiting for you
114:41 waiting for you okay so your next step should look
114:43 okay so your next step should look something like this
114:45 something like this you have your 7-Zip file open you should
114:49 you have your 7-Zip file open you should see a folder located in there and the
114:51 see a folder located in there and the easiest thing is to just drag and drop
114:53 easiest thing is to just drag and drop this you can also right click and
114:55 this you can also right click and extract if you know where you want to
114:56 extract if you know where you want to extract it I created a folder called
114:59 extract it I created a folder called Cali I'm just going to grab this and I'm
115:01 Cali I'm just going to grab this and I'm going to drag it over and it's going to
115:03 going to drag it over and it's going to take a minute here just a few seconds
115:04 take a minute here just a few seconds honestly to unzip the file size of this
115:08 honestly to unzip the file size of this one at least for the VMware version is
115:10 one at least for the VMware version is around 11 gigabytes or 11 gigabytes
115:13 around 11 gigabytes or 11 gigabytes exactly unzip so make sure you have the
115:15 exactly unzip so make sure you have the space on your hard drive in order to do
115:17 space on your hard drive in order to do this
115:18 this now once you have it unzipped you can go
115:22 now once you have it unzipped you can go ahead and just double click in here
115:23 ahead and just double click in here you'll see a bunch of files if you have
115:26 you'll see a bunch of files if you have VMware installed you can actually just
115:28 VMware installed you can actually just double click on this vmx file and that
115:30 double click on this vmx file and that should open things up for you I'm just
115:33 should open things up for you I'm just going to show you the other way around
115:34 going to show you the other way around doing this as well
115:37 doing this as well so with VMware Workstation player open
115:40 so with VMware Workstation player open what you're going to want to do is go to
115:42 what you're going to want to do is go to open a virtual machine
115:48 and in the folder that you have you should see this vmx file as well again
115:50 should see this vmx file as well again you could double click it or you could
115:52 you could double click it or you could just open it through this what's going
115:54 just open it through this what's going to happen is it's going to open that
115:57 to happen is it's going to open that file here and you're going to want to
115:58 file here and you're going to want to edit this virtual machine settings once
116:01 edit this virtual machine settings once you have it loaded click on edit virtual
116:03 you have it loaded click on edit virtual machine settings
116:04 machine settings and in here we're going to want to First
116:07 and in here we're going to want to First change the amount of ram that we have
116:09 change the amount of ram that we have now this is dependent on your system if
116:12 now this is dependent on your system if you have like eight gigs of RAM or maybe
116:15 you have like eight gigs of RAM or maybe even 16 gigs of RAM you might want to
116:17 even 16 gigs of RAM you might want to try leaving it at 2 at first I'm going
116:19 try leaving it at 2 at first I'm going to bump mine up to four gigs which is
116:22 to bump mine up to four gigs which is 40.96 and I have a 128 gigs of RAM so I
116:27 40.96 and I have a 128 gigs of RAM so I have more than enough space to allocate
116:29 have more than enough space to allocate for this but if you again if you're on
116:31 for this but if you again if you're on like eight gigs of RAM probably not the
116:33 like eight gigs of RAM probably not the best idea to Jack this up Beyond two
116:36 best idea to Jack this up Beyond two honestly I would try it at one maybe two
116:38 honestly I would try it at one maybe two see how it works the other thing you're
116:40 see how it works the other thing you're going to make sure of is that you're
116:42 going to make sure of is that you're running on Nat Network so if you click
116:44 running on Nat Network so if you click on network adapter make sure that it
116:46 on network adapter make sure that it says Nat and that's selected once that's
116:49 says Nat and that's selected once that's selected go ahead and hit OK
116:51 selected go ahead and hit OK and then you're just going to hit play
116:52 and then you're just going to hit play Virtual Machine
116:54 Virtual Machine when it asks you what to do just say I
116:57 when it asks you what to do just say I copied it
116:59 copied it now from here it's going to take a
117:00 now from here it's going to take a minute for this to load you can just let
117:03 minute for this to load you can just let this run through it'll boot on its own
117:05 this run through it'll boot on its own once you are presented with the login
117:07 once you are presented with the login screen go ahead and unpause the video
117:09 screen go ahead and unpause the video but until then pause and I'll meet you
117:11 but until then pause and I'll meet you back when you're at the login screen
117:16 okay I'm at the login screen I'm going to make this a little bit bigger just so
117:18 to make this a little bit bigger just so we can see
117:19 we can see and from here what I'm going to do is
117:22 and from here what I'm going to do is I'm just going to type in the username
117:23 I'm just going to type in the username of Cali k-a-l-i and the password of Cali
117:27 of Cali k-a-l-i and the password of Cali k-a-l-i
117:30 k-a-l-i hit enter
117:35 and if you see this screen congratulations you have successfully
117:37 congratulations you have successfully installed the Kali Linux and you now
117:39 installed the Kali Linux and you now have it up and running
117:41 have it up and running in later videos we're going to cover
117:43 in later videos we're going to cover what we're going to be doing and how to
117:45 what we're going to be doing and how to use this and how to use Linux and all
117:47 use this and how to use Linux and all this but for now pat yourself on the
117:49 this but for now pat yourself on the back you've got Linux installed and
117:52 back you've got Linux installed and we're going to pause here and move on to
117:53 we're going to pause here and move on to the next video
118:02 okay so this video pertains to some updates we need to make to virtualbox
118:04 updates we need to make to virtualbox for quality of life so if you're not
118:07 for quality of life so if you're not using virtualbox you can go ahead and
118:09 using virtualbox you can go ahead and skip this video if you are Buckle in we
118:12 skip this video if you are Buckle in we just need to do a couple of quick
118:14 just need to do a couple of quick updates and then we should be good for
118:16 updates and then we should be good for the rest of the course
118:17 the rest of the course so go ahead and go out to Google and
118:20 so go ahead and go out to Google and Google virtualbox extension pack what
118:23 Google virtualbox extension pack what it's going to bring up is just the
118:24 it's going to bring up is just the downloads page of virtualbox so we're
118:26 downloads page of virtualbox so we're going to want to go here
118:28 going to want to go here and on this page if you look kind of
118:31 and on this page if you look kind of towards the middle you'll see that there
118:33 towards the middle you'll see that there is a virtual box extension pack here
118:36 is a virtual box extension pack here we're going to just click all supported
118:38 we're going to just click all supported platforms and that will automatically
118:40 platforms and that will automatically download the file that we need
118:43 download the file that we need so once that is downloaded and pause if
118:46 so once that is downloaded and pause if you need to go ahead and open virtualbox
118:50 you need to go ahead and open virtualbox and you can come in here and up at the
118:53 and you can come in here and up at the top we're going to go ahead and click on
118:54 top we're going to go ahead and click on preferences
118:56 preferences and from here we are interested in
118:58 and from here we are interested in extensions see extensions right here go
119:01 extensions see extensions right here go ahead and click on that there's a little
119:03 ahead and click on that there's a little plus sign we're going to go ahead and
119:04 plus sign we're going to go ahead and click on that
119:05 click on that and then you should have your downloads
119:08 and then you should have your downloads right here so we're going to take the
119:09 right here so we're going to take the downloads and just go ahead and install
119:12 downloads and just go ahead and install that hit install
119:15 that hit install read this give away your firstborn
119:18 read this give away your firstborn accept all the terms and you should be
119:21 accept all the terms and you should be good very quick install okay
119:24 good very quick install okay the second thing we need to do is we
119:26 the second thing we need to do is we need to come to the one tab appear above
119:29 need to come to the one tab appear above which is Network
119:31 which is Network we're going to go ahead and hit the
119:32 we're going to go ahead and hit the network button or this add button and
119:34 network button or this add button and we're going to add what is called a Nat
119:36 we're going to add what is called a Nat Network
119:37 Network okay and we're going to come in here and
119:39 okay and we're going to come in here and we're going to double click
119:41 we're going to double click and you can go ahead and keep these
119:44 and you can go ahead and keep these defaults I'm going to actually change
119:45 defaults I'm going to actually change them to
119:50 192.168.57.0 because that's what's going to be used through the rest of the
119:52 to be used through the rest of the course and that is what the cider
119:54 course and that is what the cider notation of my Cali machine and my key
119:57 notation of my Cali machine and my key Optics which you'll see later Etc all
120:00 Optics which you'll see later Etc all fell into this 57.0 so we're going to go
120:03 fell into this 57.0 so we're going to go ahead and keep it on this Nat Network
120:04 ahead and keep it on this Nat Network make sure you support the hcp go ahead
120:07 make sure you support the hcp go ahead and just hit OK hit OK
120:11 and just hit OK hit OK and then for a machine and make sure any
120:13 and then for a machine and make sure any machine that you use again any machine
120:16 machine that you use again any machine that you use in this course make sure
120:18 that you use in this course make sure you set it to Nat network if you're
120:20 you set it to Nat network if you're using virtualbox so you can come in here
120:22 using virtualbox so you can come in here click on a machine like this mail
120:23 click on a machine like this mail machine I have here you can just click
120:25 machine I have here you can just click on that settings go to network and then
120:29 on that settings go to network and then you can go ahead and just go to Nat
120:31 you can go ahead and just go to Nat Network all right and that name right
120:34 Network all right and that name right here you see name that Network that's
120:36 here you see name that Network that's all we're going to use that'll
120:37 all we're going to use that'll automatically set it up so when you have
120:39 automatically set it up so when you have a Cali machine running later and you
120:41 a Cali machine running later and you have kiopteryx or another box running or
120:44 have kiopteryx or another box running or even when we build out an active
120:45 even when we build out an active directory lab you need to make sure that
120:47 directory lab you need to make sure that you're running that net Network so that
120:49 you're running that net Network so that all the machines are on the same subnet
120:51 all the machines are on the same subnet if you don't you might run into a
120:54 if you don't you might run into a situation where the same IP comes up for
120:57 situation where the same IP comes up for the same machine and then they're
120:59 the same machine and then they're conflicting with each other or you get
121:01 conflicting with each other or you get on different networks and some weird
121:02 on different networks and some weird stuff happens so make sure again that
121:05 stuff happens so make sure again that it's imperative that you're setting that
121:06 it's imperative that you're setting that net Network for every single machine
121:08 net Network for every single machine that you're setting up so with that said
121:11 that you're setting up so with that said we're going to go ahead and move on to
121:13 we're going to go ahead and move on to the next video in this section
121:22 the first thing I'd like to do before we get started with any commands or
121:24 get started with any commands or anything like that is just take a look
121:25 anything like that is just take a look around Kali Linux and kind of
121:28 around Kali Linux and kind of demonstrate why a pen tester or ethical
121:31 demonstrate why a pen tester or ethical hacker might use this distribution of 1x
121:34 hacker might use this distribution of 1x now throughout the course as stated in
121:37 now throughout the course as stated in the last video you might see a different
121:39 the last video you might see a different version of this pop up as I recorded
121:42 version of this pop up as I recorded videos on some of the older versions
121:44 videos on some of the older versions everything should still work just as is
121:47 everything should still work just as is you just might see a different look and
121:50 you just might see a different look and feel to some of the Cali interface but
121:52 feel to some of the Cali interface but all the commands I'm going to show you
121:53 all the commands I'm going to show you everything that we do is going to be the
121:56 everything that we do is going to be the same so let's take a look and just
121:58 same so let's take a look and just explore Kali Linux just for a bit so if
122:01 explore Kali Linux just for a bit so if we come up here into the corner and we
122:03 we come up here into the corner and we just click on the little Cali logo you
122:05 just click on the little Cali logo you can see that we have nice things broken
122:07 can see that we have nice things broken out for us so we've got these favorites
122:09 out for us so we've got these favorites up here which we have our terminal which
122:12 up here which we have our terminal which we're going to be living in essentially
122:13 we're going to be living in essentially we've got a text editor we've got a web
122:16 we've got a text editor we've got a web browser which is basically Firefox we've
122:19 browser which is basically Firefox we've got some other tool down here docs Etc
122:22 got some other tool down here docs Etc the other thing that we can come scroll
122:24 the other thing that we can come scroll through is we can see that we have
122:25 through is we can see that we have different applications in here if we
122:28 different applications in here if we look at the different sections these
122:29 look at the different sections these kind of go in order which we haven't
122:30 kind of go in order which we haven't covered quite yet but in the order of
122:33 covered quite yet but in the order of how a hack might go down so information
122:35 how a hack might go down so information gathering is usually the first step you
122:37 gathering is usually the first step you can come in here look through this and
122:39 can come in here look through this and here's a bunch of tools related to
122:41 here's a bunch of tools related to information gathering you can even click
122:43 information gathering you can even click into these and go deeper if you wanted
122:45 into these and go deeper if you wanted to related to specific things so DNS or
122:48 to related to specific things so DNS or SMB or open source intelligence
122:51 SMB or open source intelligence all of this that's in here this is just
122:54 all of this that's in here this is just built in tools so let's say we're coming
122:56 built in tools so let's say we're coming in here we want to do a wireless attack
122:58 in here we want to do a wireless attack well we go to wireless Stacks got a
123:00 well we go to wireless Stacks got a bunch of tools already built in so Kali
123:03 bunch of tools already built in so Kali Linux is just essentially a ethical
123:06 Linux is just essentially a ethical hacking distribution of Linux and it's
123:09 hacking distribution of Linux and it's built on Debian so if you've ever used
123:11 built on Debian so if you've ever used something like Ubuntu or anything along
123:13 something like Ubuntu or anything along those lines of a Debian distribution
123:14 those lines of a Debian distribution this is all going to feel really
123:16 this is all going to feel really familiar to you with just a bunch of
123:18 familiar to you with just a bunch of tools built in on top of it so fairly
123:21 tools built in on top of it so fairly straightforward they do have some nice
123:23 straightforward they do have some nice Tools in here you can come through and
123:25 Tools in here you can come through and utilize these a lot of this is already
123:28 utilize these a lot of this is already built in and we're going to take a look
123:29 built in and we're going to take a look at that as we go okay so the next thing
123:32 at that as we go okay so the next thing that we're going to do is and throughout
123:34 that we're going to do is and throughout the rest of this course is start looking
123:35 the rest of this course is start looking at the terminal so if you come up here
123:38 at the terminal so if you come up here you'll see that we have a terminal now
123:40 you'll see that we have a terminal now mostly everything that we do is going to
123:41 mostly everything that we do is going to be done in this terminal here now this
123:44 be done in this terminal here now this is almost like accessing the command
123:47 is almost like accessing the command line so if you're using a command line
123:49 line so if you're using a command line like in Windows for example if you've
123:52 like in Windows for example if you've ever used a command line if not that's
123:53 ever used a command line if not that's okay but we do a lot of this from this
123:56 okay but we do a lot of this from this interface as opposed to maybe utilizing
123:59 interface as opposed to maybe utilizing a GUI bass interface where if we clicked
124:02 a GUI bass interface where if we clicked a folder this might look more familiar
124:03 a folder this might look more familiar to you if you're a Windows or Mac User
124:05 to you if you're a Windows or Mac User you come in here you have this kind of
124:07 you come in here you have this kind of area yeah yeah we can do that and
124:09 area yeah yeah we can do that and sometimes we'll utilize this but a lot
124:11 sometimes we'll utilize this but a lot of times we're going to be living right
124:12 of times we're going to be living right here okay so as we move forward we're
124:16 here okay so as we move forward we're going to start talking about this
124:17 going to start talking about this command line how we can utilize it and
124:19 command line how we can utilize it and use it to our advantage and then we'll
124:21 use it to our advantage and then we'll do some tips and tricks and hopefully
124:23 do some tips and tricks and hopefully learn some pretty neat stuff as we go so
124:25 learn some pretty neat stuff as we go so in the next video I'm going going to
124:27 in the next video I'm going going to cover the sudo feature which I think is
124:29 cover the sudo feature which I think is important it's something that was
124:31 important it's something that was brought in now originally we had
124:33 brought in now originally we had something called a root permission and
124:34 something called a root permission and we'll talk about that that has changed
124:37 we'll talk about that that has changed since 2020.1 moving forward so we're
124:39 since 2020.1 moving forward so we're introducing that into this course and
124:41 introducing that into this course and we'll talk options that you have so
124:43 we'll talk options that you have so let's go ahead and move to the next
124:45 let's go ahead and move to the next video where we talk about the sudo
124:47 video where we talk about the sudo feature
124:54 all right so before we look at any commands or learn any command line we
124:57 commands or learn any command line we have to talk about sudo Sudo is very
125:01 have to talk about sudo Sudo is very important and what had happened
125:03 important and what had happened previously was that in the earlier
125:06 previously was that in the earlier versions of Kali Linux we ran as a user
125:09 versions of Kali Linux we ran as a user called root root is the ultimate user
125:12 called root root is the ultimate user you could think of it as the
125:13 you could think of it as the administrator of the machine now we're
125:15 administrator of the machine now we're running as a user called Cali so we
125:18 running as a user called Cali so we don't have root privileges directly this
125:20 don't have root privileges directly this is as an improved security feature
125:22 is as an improved security feature because we should be running only
125:24 because we should be running only certain commands when we need to as the
125:27 certain commands when we need to as the root user
125:28 root user so what we're going to see is we're
125:30 so what we're going to see is we're going to see how we can run commands as
125:32 going to see how we can run commands as an elevated privilege and we're going to
125:34 an elevated privilege and we're going to do that with sudo which stands for super
125:37 do that with sudo which stands for super user do they just kind of shortened it
125:39 user do they just kind of shortened it so we just have sudo now okay now with
125:42 so we just have sudo now okay now with sudo what we're doing is we're saying
125:44 sudo what we're doing is we're saying Hey I want to run a command elevated I
125:47 Hey I want to run a command elevated I want to run this as a higher user in
125:50 want to run this as a higher user in this instance we can say I want to run
125:51 this instance we can say I want to run the command as root why is that
125:54 the command as root why is that important well let's take a look at an
125:57 important well let's take a look at an example let's say that I wanted to look
125:59 example let's say that I wanted to look at a very sensitive file now one
126:02 at a very sensitive file now one sensitive file in our system is the Etsy
126:04 sensitive file in our system is the Etsy Shadow file you can see cat
126:07 Shadow file you can see cat Etsy like this Etsy Shadow and you don't
126:10 Etsy like this Etsy Shadow and you don't have to follow along right now you don't
126:12 have to follow along right now you don't have to really understand what's going
126:13 have to really understand what's going on if you've never seen Linux all I'm
126:15 on if you've never seen Linux all I'm doing is saying hey I want to print out
126:16 doing is saying hey I want to print out this file I want to look at it okay and
126:19 this file I want to look at it okay and for here I can't see it it says
126:21 for here I can't see it it says permission denied you don't have the
126:23 permission denied you don't have the access to see this file that's a good
126:25 access to see this file that's a good thing but if I was the root user or
126:29 thing but if I was the root user or somebody that had elevated privileges I
126:31 somebody that had elevated privileges I could see it so I could say sudo
126:34 could see it so I could say sudo cat
126:36 cat Etsy Shadow like this
126:38 Etsy Shadow like this okay and it's going to say what is your
126:40 okay and it's going to say what is your password for Cali I'm gonna go ahead and
126:42 password for Cali I'm gonna go ahead and say Cali k-a-l-i
126:45 say Cali k-a-l-i hit enter
126:46 hit enter and now I can see that I have access to
126:49 and now I can see that I have access to this file and this file is very
126:50 this file and this file is very sensitive we'll talk about this later on
126:52 sensitive we'll talk about this later on in the course but sensitive file okay so
126:55 in the course but sensitive file okay so when we're looking at it I ran that
126:58 when we're looking at it I ran that command specifically as the root user as
127:01 command specifically as the root user as the root user I'm able to see okay this
127:05 the root user I'm able to see okay this file now
127:07 file now why or what's going on here well we're
127:11 why or what's going on here well we're running that specific Command right and
127:13 running that specific Command right and we're still staying as Cali we're doing
127:16 we're still staying as Cali we're doing this in a kind of one-off scenario so
127:19 this in a kind of one-off scenario so there will be times where something that
127:22 there will be times where something that you run in this course might require
127:24 you run in this course might require sudo or you can run the command without
127:26 sudo or you can run the command without sudo but you notice something doesn't
127:29 sudo but you notice something doesn't work so best practice for this is saying
127:32 work so best practice for this is saying hey let's go ahead and just run mostly
127:35 hey let's go ahead and just run mostly everything that I'm showing you
127:37 everything that I'm showing you command-wise in this course that's not
127:39 command-wise in this course that's not best practice overall usually you should
127:41 best practice overall usually you should run things just as a regular user if you
127:43 run things just as a regular user if you get permissions blocked then run it as
127:45 get permissions blocked then run it as pseudo as necessary now the other thing
127:49 pseudo as necessary now the other thing to point out and we'll talk about this
127:50 to point out and we'll talk about this again in later on in the course but why
127:53 again in later on in the course but why can we do this is because this user is
127:55 can we do this is because this user is part of what's called a pseudors file
127:57 part of what's called a pseudors file meaning we can have this permission not
128:00 meaning we can have this permission not any user can come in here say we made a
128:03 any user can come in here say we made a new user and we just called the user
128:04 new user and we just called the user John we can't just take John and just go
128:07 John we can't just take John and just go ahead and then just run these commands
128:08 ahead and then just run these commands as root no John has to have the
128:10 as root no John has to have the permission to do this so you can think
128:12 permission to do this so you can think of Cali as being an administrator but
128:15 of Cali as being an administrator but only when we utilize that access or that
128:18 only when we utilize that access or that privilege okay the other thing I want to
128:20 privilege okay the other thing I want to show you though is that we can switch
128:22 show you though is that we can switch over to root if we want to we can come
128:25 over to root if we want to we can come in here and we can say sudo switch user
128:29 in here and we can say sudo switch user Dash just like that and then I'll put us
128:31 Dash just like that and then I'll put us into root now you can see okay we're
128:33 into root now you can see okay we're running root at Cali and that's only for
128:36 running root at Cali and that's only for this instance
128:37 this instance you can if you want I'm not going to
128:40 you can if you want I'm not going to demonstrate how to do this but you can
128:41 demonstrate how to do this but you can if you want change the root password log
128:44 if you want change the root password log out and log back in as root and run
128:47 out and log back in as root and run through this course as root again that's
128:49 through this course as root again that's not best security practice but that
128:52 not best security practice but that feature is available to you if you are a
128:54 feature is available to you if you are a Linux user that is comfortable with
128:56 Linux user that is comfortable with Linux comfortable with running as root
128:57 Linux comfortable with running as root and you want the easy path otherwise I
129:01 and you want the easy path otherwise I highly recommend just staying as Cali
129:03 highly recommend just staying as Cali running as pseudo privileges as you need
129:04 running as pseudo privileges as you need it and then moving forward but this is a
129:07 it and then moving forward but this is a quick way to switch into root if you
129:09 quick way to switch into root if you need to sometimes even running sudo
129:11 need to sometimes even running sudo causes some issues so switching to root
129:13 causes some issues so switching to root to run a command is Okay what we can do
129:16 to run a command is Okay what we can do here too is the demonstration is we can
129:19 here too is the demonstration is we can go file new tab and look at a new
129:21 go file new tab and look at a new instance and you'll see that this
129:23 instance and you'll see that this instance of root is only good for this
129:25 instance of root is only good for this tab here once we start a new tab we're
129:28 tab here once we start a new tab we're going to be brought back right back to
129:30 going to be brought back right back to Cali Cali you can see that from the Top
129:31 Cali Cali you can see that from the Top Line in the tab as well so just keep
129:34 Line in the tab as well so just keep note of this when you're running
129:35 note of this when you're running commands in this course if you see
129:37 commands in this course if you see something again try running it with sudo
129:40 something again try running it with sudo if it's not working or if it says access
129:43 if it's not working or if it says access denied then you know hey I need to run
129:45 denied then you know hey I need to run sudo very very very important okay I'm
129:48 sudo very very very important okay I'm trying to drive that in into your brains
129:50 trying to drive that in into your brains right now so from here we're going to
129:52 right now so from here we're going to move on we're going to start looking at
129:53 move on we're going to start looking at how to navigate around the file system
129:55 how to navigate around the file system taking a look at everything from a
129:58 taking a look at everything from a bigger picture and diving into terminal
130:01 bigger picture and diving into terminal so I will see you over in the next video
130:10 now we're going to take a look at the Linux terminal and if you're a user of a
130:14 Linux terminal and if you're a user of a regular computer like Windows or even
130:16 regular computer like Windows or even Mac OS you are probably used to using
130:19 Mac OS you are probably used to using what is called a GUI or a graphical user
130:22 what is called a GUI or a graphical user interface
130:24 interface and we can do this with our version of
130:26 and we can do this with our version of Linux we can come in here and if we want
130:28 Linux we can come in here and if we want to like go to folders We can absolutely
130:30 to like go to folders We can absolutely open this and go to folders we've got
130:33 open this and go to folders we've got the ability to go to Firefox we've got
130:35 the ability to go to Firefox we've got all of our Tools in here that we want to
130:37 all of our Tools in here that we want to use or look at and we have a graphical
130:40 use or look at and we have a graphical user interface
130:41 user interface however a lot of our time is going to be
130:44 however a lot of our time is going to be spent on the command line and using a
130:46 spent on the command line and using a terminal so it's very important that we
130:49 terminal so it's very important that we learn how to use a terminal in Linux
130:51 learn how to use a terminal in Linux so looking at our terminal here we can
130:54 so looking at our terminal here we can see a few things before we even get
130:56 see a few things before we even get started
130:57 started the first thing is that we have a Cali
130:59 the first thing is that we have a Cali at Cali
131:01 at Cali what does that mean well the first
131:04 what does that mean well the first instance here is Cali that is your user
131:07 instance here is Cali that is your user so remember when we first logged in we
131:09 so remember when we first logged in we logged in as Cali and that is our user
131:11 logged in as Cali and that is our user so if we ever switch over to root we'll
131:14 so if we ever switch over to root we'll see root here the second part of this is
131:17 see root here the second part of this is our hostname so our computer name
131:19 our hostname so our computer name happens to also be Cali if you change
131:22 happens to also be Cali if you change your host name you could say whatever
131:24 your host name you could say whatever you wanted to say here
131:26 you wanted to say here the last little part of this is this
131:27 the last little part of this is this attilda this is actually the directory
131:30 attilda this is actually the directory that you are currently in so this is a
131:32 that you are currently in so this is a quick way to say what user am I what
131:35 quick way to say what user am I what workstation am I on and what directory
131:37 workstation am I on and what directory am I in
131:39 am I in now we can take a look at what directory
131:41 now we can take a look at what directory we are in with the PWD command and that
131:44 we are in with the PWD command and that stands for print working directory and
131:47 stands for print working directory and in this instance you can see we are in
131:49 in this instance you can see we are in the home forward slash Cali folder and
131:52 the home forward slash Cali folder and that is the equivalent of being in the
131:54 that is the equivalent of being in the attilda so if you see the Attila that
131:56 attilda so if you see the Attila that just means you are in your users home
131:59 just means you are in your users home folder so if we were a root user we
132:02 folder so if we were a root user we would actually be in the forward slash
132:03 would actually be in the forward slash root folder as opposed to the home Cali
132:05 root folder as opposed to the home Cali folder so the attilda means something
132:07 folder so the attilda means something different for every user that you're on
132:09 different for every user that you're on the next thing we're going to look at is
132:11 the next thing we're going to look at is the change directory feature so imagine
132:14 the change directory feature so imagine that we are in our folder here so if we
132:17 that we are in our folder here so if we go to like I don't know our desktop
132:20 go to like I don't know our desktop and we're sitting in our Cali folder
132:22 and we're sitting in our Cali folder this is really what we're looking at so
132:24 this is really what we're looking at so we're looking at Cali right here and we
132:27 we're looking at Cali right here and we want to get out of this Cali folder and
132:29 want to get out of this Cali folder and change into another folder say like I
132:31 change into another folder say like I don't know downloads for example if we
132:33 don't know downloads for example if we go into downloads it's very easy to
132:35 go into downloads it's very easy to click into but how do we navigate around
132:37 click into but how do we navigate around on the terminal I'm going to show you
132:40 on the terminal I'm going to show you how to do that so the first thing we're
132:41 how to do that so the first thing we're going to do is use the CD command that
132:43 going to do is use the CD command that stands for change directory now if we do
132:46 stands for change directory now if we do change directory dot dot that says I
132:49 change directory dot dot that says I want to go backwards so if I do that
132:53 want to go backwards so if I do that now you can see that we are in the
132:55 now you can see that we are in the forward slash home folder but we can
132:57 forward slash home folder but we can also do a PWD print the working
132:59 also do a PWD print the working directory and you can see that we are in
133:01 directory and you can see that we are in the home folder
133:02 the home folder now can we go any further back well
133:05 now can we go any further back well let's try CD dot dot again
133:07 let's try CD dot dot again and now you can see we are at a forward
133:09 and now you can see we are at a forward slash if we do a PWD we are at a forward
133:12 slash if we do a PWD we are at a forward slash and one more time I'm going to CD
133:15 slash and one more time I'm going to CD dot dot and see if anything happens
133:16 dot dot and see if anything happens nothing happens here we cannot change
133:19 nothing happens here we cannot change any further we are in what is called our
133:22 any further we are in what is called our base directory so if you see a forward
133:24 base directory so if you see a forward slash think of that as the base folder
133:27 slash think of that as the base folder you cannot go any further back from that
133:30 you cannot go any further back from that now I'm going to clear my screen if you
133:32 now I'm going to clear my screen if you want to clear your screen you just hit
133:33 want to clear your screen you just hit Ctrl l
133:35 Ctrl l like that and that'll clear the screen
133:37 like that and that'll clear the screen and from here we are going to look at
133:39 and from here we are going to look at what is in our base folder and to do
133:42 what is in our base folder and to do that we can use a tool called list which
133:45 that we can use a tool called list which is LS
133:47 is LS so from here we can see different colors
133:50 so from here we can see different colors and different things and we can tell
133:53 and different things and we can tell based on the colors though these color
133:55 based on the colors though these color schemes are not the greatest in the
133:56 schemes are not the greatest in the newest Kali Linux we could still see
133:59 newest Kali Linux we could still see like hey this darker version of Blue is
134:01 like hey this darker version of Blue is actually a folder where some of these
134:03 actually a folder where some of these other things are actually files we don't
134:06 other things are actually files we don't have to worry too much about that right
134:07 have to worry too much about that right now but we just came out of the home
134:09 now but we just came out of the home folder so we can see here that we have a
134:12 folder so we can see here that we have a bunch of files and folders and let's say
134:14 bunch of files and folders and let's say we want to go back to the home folder
134:15 we want to go back to the home folder well we can see the home
134:18 well we can see the home and I'm going to start typing H and I'm
134:20 and I'm going to start typing H and I'm just going to hit Tab and because
134:22 just going to hit Tab and because there's nothing else in here with an H
134:24 there's nothing else in here with an H we don't have to worry too much it will
134:26 we don't have to worry too much it will just auto-complete to the home folder
134:27 just auto-complete to the home folder now for example if there's a bunch of
134:30 now for example if there's a bunch of L's I'm going to back up really quick
134:31 L's I'm going to back up really quick before I hit enter
134:33 before I hit enter if I wanted to try something that has
134:35 if I wanted to try something that has multiple items in here if I tried the L
134:37 multiple items in here if I tried the L and I hit tab you're going to see that
134:39 and I hit tab you're going to see that there's going to be a lot of options for
134:42 there's going to be a lot of options for me to go through and depending on what
134:45 me to go through and depending on what you have is when you can auto complete
134:47 you have is when you can auto complete so if I start typing l o it should know
134:50 so if I start typing l o it should know that there's only one Lo and I can Tab
134:53 that there's only one Lo and I can Tab and autocomplete the rest so you just
134:55 and autocomplete the rest so you just have to be able to get to a point where
134:56 have to be able to get to a point where you can Tab out or if you know the first
134:58 you can Tab out or if you know the first letter of the file that you're looking
134:59 letter of the file that you're looking for you can hit tab on that and you can
135:01 for you can hit tab on that and you can see okay here's where I need to be or
135:03 see okay here's where I need to be or here's what I can look at with
135:04 here's what I can look at with everything that starts with that letter
135:06 everything that starts with that letter I'm going to delete this and we're going
135:07 I'm going to delete this and we're going to CD back into home
135:10 to CD back into home we're going to LS to list the contents
135:12 we're going to LS to list the contents of home which is just our Cali folder so
135:15 of home which is just our Cali folder so I'm going to CD into Cali
135:21 and if I LS from here you can see that I have our desktop documents downloads
135:23 have our desktop documents downloads similar to what we saw in the graphical
135:26 similar to what we saw in the graphical user interface when we were in the
135:27 user interface when we were in the folder now we can see it from our
135:30 folder now we can see it from our terminal now before we go diving deeper
135:32 terminal now before we go diving deeper into these folders
135:34 into these folders something that I want to look at is what
135:37 something that I want to look at is what if I wanted to get to this Etsy folder
135:39 if I wanted to get to this Etsy folder over here so there's this Etsy folder
135:42 over here so there's this Etsy folder that was in our base
135:43 that was in our base now if I try to CD into Etsy from here
135:47 now if I try to CD into Etsy from here nothing's going to work I'm tabbing
135:49 nothing's going to work I'm tabbing nothing works if I try CD Etsy it's
135:51 nothing works if I try CD Etsy it's going to say I can't find it
135:52 going to say I can't find it so what does that mean well when we
135:55 so what does that mean well when we change directories we can only change
135:57 change directories we can only change directories from the folders that we
135:59 directories from the folders that we have available to us so I can only
136:01 have available to us so I can only change directories into these folders by
136:04 change directories into these folders by using that sort of nomenclature however
136:07 using that sort of nomenclature however if I can provide a full directory or a
136:11 if I can provide a full directory or a full path then I can CD from any folder
136:14 full path then I can CD from any folder that I'm in so if I go CD forward slash
136:17 that I'm in so if I go CD forward slash because remember we have the base here
136:19 because remember we have the base here well then I can say forward slash
136:22 well then I can say forward slash ET start typing that out and guess what
136:24 ET start typing that out and guess what I get Etsy here and if I wanted to dive
136:26 I get Etsy here and if I wanted to dive deeper into what folders are in there I
136:28 deeper into what folders are in there I could hit Tab and I could see all the
136:30 could hit Tab and I could see all the folders that are available in the Etsy
136:32 folders that are available in the Etsy folder to complete my task now if I hit
136:35 folder to complete my task now if I hit enter
136:36 enter I will be brought into the Etsy folder
136:38 I will be brought into the Etsy folder and similarly I can hit LS and see all
136:42 and similarly I can hit LS and see all the files and folders that are in here
136:44 the files and folders that are in here now let's just CD here and I'm going to
136:47 now let's just CD here and I'm going to use the attilda and that's going to get
136:48 use the attilda and that's going to get us back to our home folder
136:50 us back to our home folder I'm going to control L to clear screen
136:52 I'm going to control L to clear screen and then I'm going to LS again you're
136:54 and then I'm going to LS again you're going to see we're back where we just
136:55 going to see we're back where we just were
136:56 were now in this case what if I wanted to
136:59 now in this case what if I wanted to list the files of the Etsy folder well
137:01 list the files of the Etsy folder well it's the same thing I could do LS
137:03 it's the same thing I could do LS forward slash Etsy
137:05 forward slash Etsy and that will list all the files as if I
137:08 and that will list all the files as if I were sitting in that folder so just know
137:10 were sitting in that folder so just know that you can list folders and files you
137:13 that you can list folders and files you can change directories from being it
137:15 can change directories from being it within another directory it doesn't have
137:17 within another directory it doesn't have to be in that same up and down tree that
137:19 to be in that same up and down tree that I was showing you there's a lot more
137:20 I was showing you there's a lot more robustness to these commands same thing
137:23 robustness to these commands same thing if we LS in here we could take a look at
137:26 if we LS in here we could take a look at the folders and we don't have to change
137:27 the folders and we don't have to change the directory to see what's in these
137:29 the directory to see what's in these folders We can just LS desktop for
137:32 folders We can just LS desktop for example and start Auto tab completing
137:34 example and start Auto tab completing there's nothing in there I do have
137:36 there's nothing in there I do have something in the downloads folder just
137:37 something in the downloads folder just because I changed my picture I put our
137:40 because I changed my picture I put our TCM security logo in there so I have
137:43 TCM security logo in there so I have that in the downloads folder but it's
137:44 that in the downloads folder but it's completely normal not to have anything
137:46 completely normal not to have anything in your desktop or downloads when you
137:48 in your desktop or downloads when you first install Cali and again we can
137:50 first install Cali and again we can achieve the same thing by seeding into
137:52 achieve the same thing by seeding into downloads and then hitting LS
137:55 downloads and then hitting LS you have the same object here as you saw
137:57 you have the same object here as you saw before except we're just now in that
137:59 before except we're just now in that folder so you have to declare the folder
138:01 folder so you have to declare the folder or be within the folder to see the
138:03 or be within the folder to see the contents okay now let's go ahead and CD
138:06 contents okay now let's go ahead and CD back to the base folder you could CD dot
138:08 back to the base folder you could CD dot dot or just use the attilda I'm going to
138:11 dot or just use the attilda I'm going to clear my screen
138:12 clear my screen and from here we want to talk about
138:14 and from here we want to talk about making a directory so let's make a
138:18 making a directory so let's make a directory I'm going to make a directory
138:19 directory I'm going to make a directory called Heath you can just use your first
138:21 called Heath you can just use your first name if you want
138:23 name if you want and then when you LS in here
138:25 and then when you LS in here you can see now that the heath directory
138:28 you can see now that the heath directory is here
138:29 is here and I could see the end of that heat
138:30 and I could see the end of that heat directory I can LS in that directory and
138:33 directory I can LS in that directory and there's not going to be anything in
138:34 there's not going to be anything in there
138:35 there so I'm going to go ahead and backup one
138:37 so I'm going to go ahead and backup one and now I'm going to show you how to
138:40 and now I'm going to show you how to remove a directory or remove a folder so
138:42 remove a directory or remove a folder so you say rmdir
138:44 you say rmdir and you're going to go ahead and just
138:46 and you're going to go ahead and just say he
138:48 say he and that will remove that these commands
138:51 and that will remove that these commands work exactly the same as everything else
138:53 work exactly the same as everything else if I wanted to make a directory in the
138:55 if I wanted to make a directory in the base folder I could totally make dur
138:57 base folder I could totally make dur forward slash eat if I wanted to and I
138:59 forward slash eat if I wanted to and I could also remove that from here so
139:02 could also remove that from here so again it doesn't matter exactly where
139:04 again it doesn't matter exactly where you're at as long as you're using full
139:05 you're at as long as you're using full file path
139:07 file path okay so I've cleared my screen and now I
139:09 okay so I've cleared my screen and now I want to run LS
139:11 want to run LS and you see in LS that we just have a
139:13 and you see in LS that we just have a bunch of folders that's not entirely
139:15 bunch of folders that's not entirely true
139:16 true what we're going to do is we're going to
139:18 what we're going to do is we're going to do an ls-la
139:21 do an ls-la and I like to think of this as list all
139:24 and I like to think of this as list all but really it stands for long all
139:27 but really it stands for long all and if we hit enter you can see that
139:30 and if we hit enter you can see that there's a bunch of new files in here and
139:33 there's a bunch of new files in here and folders actually so from this we can see
139:36 folders actually so from this we can see that we have
139:37 that we have a like a bash history we've got uh dot
139:40 a like a bash history we've got uh dot Java folder anything with a DOT is
139:43 Java folder anything with a DOT is considered a hidden file we won't see
139:46 considered a hidden file we won't see that when we're using the ls command we
139:48 that when we're using the ls command we actually have to do a dash La command
139:50 actually have to do a dash La command and this is a great time to actually
139:52 and this is a great time to actually take a look at what these sub commands
139:55 take a look at what these sub commands are and how are some ways that we can
139:57 are and how are some ways that we can identify what these things mean so I'm
140:00 identify what these things mean so I'm going to show you a website first and I
140:02 going to show you a website first and I think this website is awesome we can go
140:04 think this website is awesome we can go to something like explain shell.com so
140:06 to something like explain shell.com so it is
140:08 it is explain shell you can see it
140:11 explain shell you can see it autocompleting up there but explain
140:12 autocompleting up there but explain shell.com
140:14 shell.com and if you came in here and you wanted
140:16 and if you came in here and you wanted to take a look let me make this a little
140:18 to take a look let me make this a little bit bigger if you wanted to take a look
140:19 bit bigger if you wanted to take a look at like ls-la you could say okay explain
140:23 at like ls-la you could say okay explain this to me
140:24 this to me and it'll tell you okay the first part
140:26 and it'll tell you okay the first part is LS that means list directory contents
140:29 is LS that means list directory contents remember I called it the list command
140:31 remember I called it the list command that's what it is now what does that La
140:33 that's what it is now what does that La do well the L you hover over it says use
140:36 do well the L you hover over it says use long listing format and the a says use
140:39 long listing format and the a says use all okay so do not ignore entries
140:42 all okay so do not ignore entries starting with a DOT which is what we're
140:44 starting with a DOT which is what we're looking for and the long listing just
140:47 looking for and the long listing just gives us more detail gives us these file
140:50 gives us more detail gives us these file permissions which we'll get into a
140:51 permissions which we'll get into a little bit later and who owns it and
140:53 little bit later and who owns it and what the file size is the directory
140:56 what the file size is the directory Etc et cetera we'll get down into that
140:58 Etc et cetera we'll get down into that in just a few videos
141:00 in just a few videos we can also use what are called Man
141:03 we can also use what are called Man pages I'm going to control L again if we
141:05 pages I'm going to control L again if we do man LS man stands for manual so man
141:09 do man LS man stands for manual so man LS we can see in here that LS means list
141:12 LS we can see in here that LS means list directory contents great Dash a stands
141:15 directory contents great Dash a stands for all do not ignore entry starting
141:17 for all do not ignore entry starting with the period same thing as we saw
141:19 with the period same thing as we saw before we could scroll down look for the
141:21 before we could scroll down look for the L portion of this and we'll see that we
141:24 L portion of this and we'll see that we have used a long listing format you can
141:27 have used a long listing format you can hit Q to quit this
141:29 hit Q to quit this so if you don't have internet access for
141:31 so if you don't have internet access for example you can use the Man pages I like
141:34 example you can use the Man pages I like using explain shell.com I think it's
141:35 using explain shell.com I think it's pretty awesome but man works very quick
141:37 pretty awesome but man works very quick and from the terminal you don't have to
141:39 and from the terminal you don't have to leave or do anything another thing that
141:41 leave or do anything another thing that you can do is LS dash dash help
141:45 you can do is LS dash dash help and that will give you similar to The
141:47 and that will give you similar to The Man pages though not as old detail I
141:51 Man pages though not as old detail I guess is the best way to say it and you
141:53 guess is the best way to say it and you come in here and you can see the same
141:54 come in here and you can see the same kind of switches and commands that were
141:56 kind of switches and commands that were in here so dash dash help works for a
141:59 in here so dash dash help works for a lot of commands it's one of those that
142:01 lot of commands it's one of those that you should know and you should try if
142:03 you should know and you should try if you have any questions about what you're
142:04 you have any questions about what you're trying to do it's a great resource so if
142:07 trying to do it's a great resource so if we LS la
142:09 we LS la we can CD into one of these hidden
142:11 we can CD into one of these hidden folders like we can CD into dot cache
142:14 folders like we can CD into dot cache for example
142:15 for example and we just LS that you can see that
142:18 and we just LS that you can see that there's actually stuff in the cache in
142:20 there's actually stuff in the cache in here so we're not going to get into this
142:22 here so we're not going to get into this I just want to show you that hidden
142:24 I just want to show you that hidden files and folders do exist so if you're
142:26 files and folders do exist so if you're looking for something especially pen
142:28 looking for something especially pen test related something might be hidden
142:30 test related something might be hidden if you're on a Linux machine you might
142:32 if you're on a Linux machine you might need to do ls-la to see a hidden file
142:34 need to do ls-la to see a hidden file and they're incredibly easy to see as
142:37 and they're incredibly easy to see as you can see for yourself let's go ahead
142:39 you can see for yourself let's go ahead and CD back to our home folder and from
142:43 and CD back to our home folder and from here I'm going to show you a couple of
142:45 here I'm going to show you a couple of things that we're going to explain later
142:47 things that we're going to explain later on but I just kind of want to get you
142:49 on but I just kind of want to get you familiar with it the first thing I want
142:50 familiar with it the first thing I want to show you is the echo command if we go
142:52 to show you is the echo command if we go Echo and we use a single apostrophe and
142:55 Echo and we use a single apostrophe and we say hi like this that's just going to
142:57 we say hi like this that's just going to Echo out to the screen we'll get into
143:00 Echo out to the screen we'll get into the echo command a little bit later on
143:01 the echo command a little bit later on in the course what we're doing here is
143:04 in the course what we're doing here is we're going to Echo this into a file so
143:07 we're going to Echo this into a file so I'm going to say hi and then I'm going
143:10 I'm going to say hi and then I'm going to put that file I'm going to use this
143:12 to put that file I'm going to use this greater than symbol and that's going to
143:14 greater than symbol and that's going to be a region Direction operator and I'm
143:16 be a region Direction operator and I'm going to say hey just go ahead and make
143:18 going to say hey just go ahead and make a file called test.txt
143:21 a file called test.txt and while you don't need to know this
143:22 and while you don't need to know this yet if I ran Cat on this on test.txt
143:25 yet if I ran Cat on this on test.txt you'll see that it prints back out High
143:28 you'll see that it prints back out High okay so I just want to have this file
143:31 okay so I just want to have this file here that we created and what we're
143:33 here that we created and what we're going to do is we're going to just
143:34 going to do is we're going to just quickly LS we're going to see that it's
143:37 quickly LS we're going to see that it's there you can see that there are color
143:38 there you can see that there are color differences for files and folders again
143:40 differences for files and folders again and the reason we're making this in this
143:43 and the reason we're making this in this video is I want to show you the copy
143:44 video is I want to show you the copy command so if we run copy on this we
143:48 command so if we run copy on this we could say copy test.txt what I want to
143:51 could say copy test.txt what I want to do is I want to copy this into the
143:53 do is I want to copy this into the downloads folder so I can just say copy
143:55 downloads folder so I can just say copy test.txt into downloads
143:58 test.txt into downloads if we LS we'll see that test.text is
144:01 if we LS we'll see that test.text is here we're making a copy if we LS
144:04 here we're making a copy if we LS downloads we can see that test.text is
144:07 downloads we can see that test.text is actually in there as well
144:09 actually in there as well so similar with the remove directory we
144:12 so similar with the remove directory we can use the RM command and what we're
144:14 can use the RM command and what we're going to do is remove that file and
144:17 going to do is remove that file and again we don't have to be in the
144:18 again we don't have to be in the directory to remove it we can call the
144:20 directory to remove it we can call the directory path and then test.text
144:23 directory path and then test.text if we hit LS on downloads again we can
144:28 if we hit LS on downloads again we can just go ahead and hit enter and you're
144:30 just go ahead and hit enter and you're going to see that there is no test.txt
144:33 going to see that there is no test.txt in there anymore but if we LS here
144:35 in there anymore but if we LS here you'll see that test.text does exist so
144:39 you'll see that test.text does exist so I'm going to go ahead and control l
144:41 I'm going to go ahead and control l the opposite of this is the move command
144:44 the opposite of this is the move command now if I move test.txt and I put that
144:48 now if I move test.txt and I put that into downloads
144:50 into downloads if I LS now
144:52 if I LS now you're going to see that there is no
144:55 you're going to see that there is no test.txt in here why is that well if we
144:58 test.txt in here why is that well if we LS downloads you're gonna see that we
145:00 LS downloads you're gonna see that we moved it so remember copy leaves an
145:03 moved it so remember copy leaves an original version wherever you copied
145:05 original version wherever you copied from move completely moves it so the CP
145:09 from move completely moves it so the CP and the MV commands are what you need to
145:11 and the MV commands are what you need to know there now while we're on this what
145:13 know there now while we're on this what we're going to do is we're going to look
145:15 we're going to do is we're going to look at a command called locate so locate's
145:18 at a command called locate so locate's pretty awesome if we did locate and say
145:20 pretty awesome if we did locate and say I wanted to find out where that
145:22 I wanted to find out where that test.text file is I could do locate
145:24 test.text file is I could do locate test.text and we're probably not going
145:26 test.text and we're probably not going to get anything back quite yet now if
145:29 to get anything back quite yet now if we're looking through this none of these
145:31 we're looking through this none of these files are where we're at so there are
145:33 files are where we're at so there are some test.text files on this machine but
145:36 some test.text files on this machine but we're not seeing the one that we created
145:38 we're not seeing the one that we created so say that we created a file we can't
145:40 so say that we created a file we can't remember where we put it and we just
145:41 remember where we put it and we just want to go search for it and find it
145:43 want to go search for it and find it what we can do is we can say update DB
145:46 what we can do is we can say update DB and you're going to see that we actually
145:48 and you're going to see that we actually get a denied why are we getting
145:51 get a denied why are we getting permission denied well this comes back
145:52 permission denied well this comes back to sudo so let's go ahead and sudo
145:54 to sudo so let's go ahead and sudo update
145:55 update DB
145:57 DB you're going to enter in your sudo
145:58 you're going to enter in your sudo password
145:59 password it's going to update the database and
146:02 it's going to update the database and now if we do locate test.txt and you can
146:04 now if we do locate test.txt and you can just when you see a screen like this by
146:06 just when you see a screen like this by the way where it's kind of semi-gray if
146:08 the way where it's kind of semi-gray if you just hit the right arrow that will
146:10 you just hit the right arrow that will go ahead and autocomplete because it
146:12 go ahead and autocomplete because it remembers your last command
146:14 remembers your last command you can hit that
146:16 you can hit that and you can now see that the first entry
146:18 and you can now see that the first entry in here is home Cali downloads test.text
146:20 in here is home Cali downloads test.text so now the database is updated and it
146:22 so now the database is updated and it finds it one other thing to mention I
146:25 finds it one other thing to mention I just talked about Auto completing with
146:27 just talked about Auto completing with the right arrow if you hit the up Arrow
146:29 the right arrow if you hit the up Arrow you can go through your previous
146:31 you can go through your previous commands you can see all the commands
146:34 commands you can see all the commands that I've been running through so we can
146:36 that I've been running through so we can also use the down arrow to scroll back
146:37 also use the down arrow to scroll back down through those commands so say I
146:39 down through those commands so say I wanted to run that locate test.txt
146:41 wanted to run that locate test.txt command again instead of typing it out I
146:43 command again instead of typing it out I just hit the up arrow and then I hit
146:45 just hit the up arrow and then I hit enter easy breezy okay so we're gonna go
146:48 enter easy breezy okay so we're gonna go ahead and remove downloads test.txt
146:52 ahead and remove downloads test.txt and now that file should be gone we can
146:54 and now that file should be gone we can LS one more time into downloads just to
146:57 LS one more time into downloads just to make sure and you can see that PCM
146:59 make sure and you can see that PCM security finals the only thing that's in
147:01 security finals the only thing that's in there
147:02 there one other thing to point out that I just
147:04 one other thing to point out that I just noticed actually is
147:06 noticed actually is these files are case sensitive and the
147:08 these files are case sensitive and the folders are case sensitive so if I try
147:10 folders are case sensitive so if I try to CD into downloads
147:12 to CD into downloads it's not going to work because downloads
147:14 it's not going to work because downloads doesn't exist so if I CD into downloads
147:17 doesn't exist so if I CD into downloads I could spell
147:19 I could spell then you can see that I actually get
147:21 then you can see that I actually get into the downloads folder so note that
147:23 into the downloads folder so note that it's case sensitive autocomplete if I go
147:25 it's case sensitive autocomplete if I go back we'll do a pretty decent job at
147:28 back we'll do a pretty decent job at trying on newer versions of Cali that is
147:30 trying on newer versions of Cali that is if I hit do for example and then I tab
147:32 if I hit do for example and then I tab it'll realize that I'm trying to get to
147:34 it'll realize that I'm trying to get to downloads so the last thing I'm going to
147:36 downloads so the last thing I'm going to show you is the password command and
147:38 show you is the password command and that is p-a-s-swd
147:40 that is p-a-s-swd we are going to be good security
147:42 we are going to be good security engineers and change our password we're
147:44 engineers and change our password we're going to make it a strong password
147:45 going to make it a strong password because we're good security engineers
147:48 because we're good security engineers I am going to be the bad security
147:50 I am going to be the bad security engineer and make my password password
147:52 engineer and make my password password and I'm doing that because later on the
147:54 and I'm doing that because later on the course will talk about cracking Linux
147:57 course will talk about cracking Linux passwords and we're going to use my bad
147:59 passwords and we're going to use my bad password as an example so here we're
148:02 password as an example so here we're going to type our current password Kali
148:03 going to type our current password Kali is a terrible password by the way and
148:05 is a terrible password by the way and we're going to go ahead and type in our
148:07 we're going to go ahead and type in our new password you can make your password
148:08 new password you can make your password whatever you want I'm making mine
148:11 whatever you want I'm making mine password and now we have updated
148:13 password and now we have updated successfully and we have finished all
148:15 successfully and we have finished all the commands that we need to know for
148:17 the commands that we need to know for this video I'll go ahead and see you in
148:19 this video I'll go ahead and see you in the next lesson
148:27 now we're going to talk about users and privileges
148:28 privileges so in the last video we learned about
148:31 so in the last video we learned about ls-la so I am in my home folder which is
148:34 ls-la so I am in my home folder which is the attilda here and all I'm going to do
148:37 the attilda here and all I'm going to do is just say ls-la
148:40 is just say ls-la I'm going to hit enter
148:42 I'm going to hit enter and we're going to see a bunch of stuff
148:44 and we're going to see a bunch of stuff over here on the left hand side we've
148:47 over here on the left hand side we've got this we've got the details kind of
148:50 got this we've got the details kind of of ownership we've got some file size in
148:52 of ownership we've got some file size in here and we'll talk about all of this
148:54 here and we'll talk about all of this but we do ls-la we're getting so much
148:57 but we do ls-la we're getting so much more information than whether or not a
148:59 more information than whether or not a file is hidden which is kind of the
149:01 file is hidden which is kind of the purpose we looked at it for last time
149:03 purpose we looked at it for last time but now we can take it and look at it
149:05 but now we can take it and look at it from a different scope or a lens we can
149:08 from a different scope or a lens we can see that we have this column here the
149:11 see that we have this column here the First Column now the First Column tells
149:13 First Column now the First Column tells us something interesting
149:15 us something interesting it first tells us whether or not we are
149:18 it first tells us whether or not we are looking at a file or a directory so if
149:21 looking at a file or a directory so if we see a d here we are seeing that this
149:23 we see a d here we are seeing that this is a directory note that these are also
149:25 is a directory note that these are also color coded right so we have blue for
149:28 color coded right so we have blue for directories it looks like and then white
149:30 directories it looks like and then white ear or files and then we also have links
149:34 ear or files and then we also have links which we're not going to get into much
149:36 which we're not going to get into much right now but a link looks like it's a
149:38 right now but a link looks like it's a lighter blue
149:39 lighter blue so we have the indicator here first it
149:43 so we have the indicator here first it says okay it's either a d or maybe a
149:45 says okay it's either a d or maybe a dash or an L there are other settings
149:47 dash or an L there are other settings that could be here but for now this is
149:49 that could be here but for now this is all we need to worry about the next set
149:51 all we need to worry about the next set of things that we're going to look at
149:52 of things that we're going to look at are these rwx's or our blank x what does
149:57 are these rwx's or our blank x what does that all mean well rwx means read write
150:00 that all mean well rwx means read write execute when we're missing one of those
150:03 execute when we're missing one of those like a dash here that just means we have
150:05 like a dash here that just means we have a read and execute and there are
150:08 a read and execute and there are actually three groups that we're looking
150:09 actually three groups that we're looking at here so we have the first group which
150:12 at here so we have the first group which is the owner of our file so this first
150:15 is the owner of our file so this first group says read write execute for the
150:17 group says read write execute for the owner of this file and if we look at the
150:19 owner of this file and if we look at the owner of the file we can actually see
150:20 owner of the file we can actually see that the owner is going to be Cali well
150:23 that the owner is going to be Cali well in this instance it's the directory but
150:25 in this instance it's the directory but here we're looking at Cali you can see
150:27 here we're looking at Cali you can see that one of these has root listed but in
150:30 that one of these has root listed but in this instance or since we're using the
150:31 this instance or since we're using the Cali user and we're in our home folder
150:33 Cali user and we're in our home folder we're looking at mostly Cali being the
150:35 we're looking at mostly Cali being the file owner for this
150:37 file owner for this the next one we're going to look at is
150:39 the next one we're going to look at is we're going to say okay group membership
150:41 we're going to say okay group membership so anybody that is a part of this group
150:45 so anybody that is a part of this group what do they get ownership to or what do
150:49 what do they get ownership to or what do they get to do with this directory or
150:51 they get to do with this directory or this file well anybody in this group can
150:55 this file well anybody in this group can read or execute but they cannot write to
150:58 read or execute but they cannot write to this directory or file and lastly we
151:01 this directory or file and lastly we have the third setting which is all
151:03 have the third setting which is all other users what can all other users do
151:06 other users what can all other users do all of the users can read and execute
151:08 all of the users can read and execute but they cannot write here and we don't
151:11 but they cannot write here and we don't have anything in here besides this link
151:13 have anything in here besides this link that is read write execute we don't have
151:15 that is read write execute we don't have a world read write execute in this
151:18 a world read write execute in this folder and that's okay
151:21 folder and that's okay this does come into play when we're
151:22 this does come into play when we're doing penetration testing however when
151:24 doing penetration testing however when we want to find some sort of file that
151:27 we want to find some sort of file that has read write access or read write
151:30 has read write access or read write execute access if we have full access
151:32 execute access if we have full access that is ideal especially if there are
151:35 that is ideal especially if there are some sensitive files that we're not
151:36 some sensitive files that we're not supposed to see or maybe were
151:38 supposed to see or maybe were misconfigured or if we need somewhere to
151:40 misconfigured or if we need somewhere to write to on the disk for example if I
151:43 write to on the disk for example if I clear the screen here and we do an ls-la
151:47 clear the screen here and we do an ls-la of the temp folder
151:53 we could see that temp actually has read write execute privileges throughout this
151:56 write execute privileges throughout this is a great place when we're doing pen
151:58 is a great place when we're doing pen testing and we're working on a Linux
152:00 testing and we're working on a Linux machine that if we need to come drop a
152:03 machine that if we need to come drop a file we know that this temp folder can
152:05 file we know that this temp folder can be written to we can write whatever file
152:08 be written to we can write whatever file we want and execute these files from
152:09 we want and execute these files from here without having to worry about too
152:11 here without having to worry about too many permissions so for attacking
152:13 many permissions so for attacking machines later on especially as we get
152:15 machines later on especially as we get on into the Practical ethical hacking
152:17 on into the Practical ethical hacking course you may see me go and use the
152:20 course you may see me go and use the temp folder to upload malware or write a
152:23 temp folder to upload malware or write a malicious file or something that I can
152:26 malicious file or something that I can do from a folder that is read write
152:28 do from a folder that is read write executable so let's clear the screen
152:30 executable so let's clear the screen again
152:31 again now another reason and importance for
152:34 now another reason and importance for the read write execute is that if we
152:36 the read write execute is that if we write a script we won't be able to
152:38 write a script we won't be able to execute that script until we have full
152:39 execute that script until we have full access to do so that's going to become
152:42 access to do so that's going to become more important as we download files and
152:44 more important as we download files and try to run them against machines but
152:46 try to run them against machines but even in this little section when we're
152:48 even in this little section when we're looking at the bash scripting we're
152:50 looking at the bash scripting we're going to need to be able to execute our
152:52 going to need to be able to execute our script and we're going to need to be
152:54 script and we're going to need to be able to change the permissions on that
152:55 able to change the permissions on that let's go ahead and do that here we're
152:57 let's go ahead and do that here we're going to create a little text file and
152:59 going to create a little text file and just look at the permissions and how
153:00 just look at the permissions and how things change
153:01 things change so similar to the last video we're going
153:03 so similar to the last video we're going to do an echo and we're just going to
153:05 to do an echo and we're just going to say hello
153:07 say hello and in this we are going to use our
153:09 and in this we are going to use our directional operator and we are going to
153:11 directional operator and we are going to just put this in a hello.txt file
153:15 just put this in a hello.txt file if we ls-la
153:23 we can see that hello.txt is in here but look at the permissions that are set
153:25 look at the permissions that are set we have read write permissions we don't
153:27 we have read write permissions we don't have any execute permissions if this was
153:29 have any execute permissions if this was a script or anything that we're trying
153:30 a script or anything that we're trying to run the machine will not let us run
153:32 to run the machine will not let us run it because we do not have to execute
153:34 it because we do not have to execute permissions
153:35 permissions same thing here everybody else can only
153:37 same thing here everybody else can only read this file they cannot write or
153:39 read this file they cannot write or execute this file so we can change the
153:41 execute this file so we can change the permissions on this and we can do that
153:42 permissions on this and we can do that with the chmod which stands for change
153:46 with the chmod which stands for change mode
153:47 mode so I'm going to go ahead and clear
153:48 so I'm going to go ahead and clear screen again and we can do a CH mod
153:51 screen again and we can do a CH mod and there's two different ways to do
153:53 and there's two different ways to do this the first way is to do something
153:55 this the first way is to do something like a plus sign and then give the
153:57 like a plus sign and then give the permissions that you want set for that
153:59 permissions that you want set for that file so we could do something like rwx
154:02 file so we could do something like rwx that is read write execute if you want
154:05 that is read write execute if you want to just read access or read write access
154:07 to just read access or read write access or just write access you would put the
154:10 or just write access you would put the appropriate lettering there and let's go
154:13 appropriate lettering there and let's go ahead and just give this a read write
154:14 ahead and just give this a read write execute and I'm going to say hello.txt
154:17 execute and I'm going to say hello.txt and hit enter
154:18 and hit enter and we're going to go ahead and ls-la
154:21 and we're going to go ahead and ls-la again
154:22 again and now you can see that the color of
154:24 and now you can see that the color of this has changed why it is fully read
154:27 this has changed why it is fully read write executable for us as the user
154:31 write executable for us as the user okay as the owner I should say
154:33 okay as the owner I should say so that's one way of doing it however
154:36 so that's one way of doing it however there is another way of doing this as
154:39 there is another way of doing this as well we can say chmod
154:42 well we can say chmod 777
154:45 777 hello.txt hit enter
154:47 hello.txt hit enter do an ls-la
154:50 do an ls-la and you'll see now that everything has
154:54 and you'll see now that everything has read write execute here well what
154:56 read write execute here well what changed what is this 777 and why is it
155:00 changed what is this 777 and why is it so important
155:01 so important okay for that we're going to jump over
155:04 okay for that we're going to jump over to PowerPoint for just a second
155:06 to PowerPoint for just a second okay so we have different numbers that
155:08 okay so we have different numbers that we can set for the CH mod and remember
155:11 we can set for the CH mod and remember we did 777 because we gave a seven to
155:14 we did 777 because we gave a seven to each group we had the first second and
155:16 each group we had the first second and third groups remember that well what
155:19 third groups remember that well what does 7 mean well 7 means read write
155:22 does 7 mean well 7 means read write execute so for a read permission we get
155:25 execute so for a read permission we get four points or a right we get 2 and for
155:29 four points or a right we get 2 and for execute we get one so as you can see
155:31 execute we get one so as you can see down here we have four plus two plus one
155:33 down here we have four plus two plus one that equals seven well if we had no
155:35 that equals seven well if we had no permissions that would be zero so we
155:37 permissions that would be zero so we could do something like a seven zero
155:39 could do something like a seven zero zero you might see something like read
155:41 zero you might see something like read only and then you would just give it
155:43 only and then you would just give it four four four across the board for
155:46 four four four across the board for example or I've seen something like an
155:48 example or I've seen something like an SSH pem file and those files require
155:52 SSH pem file and those files require specific permissions typically it is six
155:54 specific permissions typically it is six four four so that would say that the
155:57 four four so that would say that the owner has read write but no execute and
156:00 owner has read write but no execute and then the rest of everybody else has just
156:02 then the rest of everybody else has just read access to that file so that would
156:04 read access to that file so that would be a 644 permission so if you ever
156:07 be a 644 permission so if you ever wonder what the permissions mean you can
156:09 wonder what the permissions mean you can always refer back to a chart like this
156:10 always refer back to a chart like this or quickly Google what do the CH mod
156:13 or quickly Google what do the CH mod numbers mean just know if you want to
156:15 numbers mean just know if you want to give something full permissions you are
156:17 give something full permissions you are going to set 777 across the board and if
156:20 going to set 777 across the board and if we're doing hacking or doing penetration
156:22 we're doing hacking or doing penetration testing that's often what we're going to
156:23 testing that's often what we're going to use with the exception of pem files
156:26 use with the exception of pem files where they have to have more restricted
156:28 where they have to have more restricted permissions sometimes 644 sometimes
156:31 permissions sometimes 644 sometimes actually four zero zero is what I've
156:33 actually four zero zero is what I've seen as well from here let's go back to
156:35 seen as well from here let's go back to our Cali machine and I'm going to go
156:37 our Cali machine and I'm going to go ahead and control L to clear the screen
156:40 ahead and control L to clear the screen here we want to take a look at adding a
156:42 here we want to take a look at adding a user
156:43 user so we're going to do a pseudo
156:46 so we're going to do a pseudo add user
156:48 add user and you can give whatever username you
156:50 and you can give whatever username you want I'm going to just call this user
156:51 want I'm going to just call this user John
156:53 John it's going to ask for our sudo password
156:55 it's going to ask for our sudo password remember we changed our password so make
156:57 remember we changed our password so make sure you put in the right password and
156:59 sure you put in the right password and now it's going to say okay what password
157:01 now it's going to say okay what password do you want to use for John
157:04 do you want to use for John I'm going to go ahead and enter that and
157:06 I'm going to go ahead and enter that and I'm going to enter it again
157:11 and then you could just hit enter through all of this
157:13 through all of this and get back to the screen where it says
157:15 and get back to the screen where it says Cali at Cali from here we're going to go
157:18 Cali at Cali from here we're going to go ahead and switch user and go into John
157:21 ahead and switch user and go into John so just do s u John
157:24 so just do s u John I'm going to ask for John's password go
157:25 I'm going to ask for John's password go ahead and give that password
157:27 ahead and give that password and now you can see
157:29 and now you can see that we are John at Cali so what is
157:32 that we are John at Cali so what is special about John well we've made a new
157:34 special about John well we've made a new user and John has some permissions now
157:38 user and John has some permissions now if we wanted to cat out like the at the
157:42 if we wanted to cat out like the at the password file
157:44 password file we can and this is a very common file
157:47 we can and this is a very common file that you're going to look at as a pen
157:48 that you're going to look at as a pen tester if you come in here the Etsy
157:50 tester if you come in here the Etsy password file is important this is
157:53 password file is important this is something that we can see a lot of
157:54 something that we can see a lot of information about this machine now the
157:56 information about this machine now the Etsy password file is called the
157:58 Etsy password file is called the password file not because it has our
157:59 password file not because it has our password in it but because it used to
158:02 password in it but because it used to store our password in it in a very very
158:04 store our password in it in a very very long time ago now what is being done is
158:06 long time ago now what is being done is they put an X here for a placeholder and
158:09 they put an X here for a placeholder and that placeholder is then filled in with
158:11 that placeholder is then filled in with the shadow file we'll take a look at
158:13 the shadow file we'll take a look at that here in a second so we are using
158:15 that here in a second so we are using the cat command and you've seen me use
158:17 the cat command and you've seen me use this several times throughout the course
158:18 this several times throughout the course we are using that to basically print out
158:21 we are using that to basically print out a file so when we print out the file we
158:24 a file so when we print out the file we can read the file so from here we're
158:26 can read the file so from here we're reading the file and we're saying okay I
158:28 reading the file and we're saying okay I see root root is the zero user ID and
158:32 see root root is the zero user ID and that is important that's telling us they
158:34 that is important that's telling us they are the ultimate user on the machine
158:36 are the ultimate user on the machine they are user zero
158:39 they are user zero if we scroll way down to the bottom we
158:41 if we scroll way down to the bottom we should see some users that were created
158:43 should see some users that were created here for example we see Cali Cali's user
158:46 here for example we see Cali Cali's user 1000 pretty common we can also see that
158:49 1000 pretty common we can also see that John is in use here and John is user
158:51 John is in use here and John is user 1001 we could see what type of shell
158:54 1001 we could see what type of shell type they're using and what their home
158:56 type they're using and what their home folder is as well you could see the zsh
158:59 folder is as well you could see the zsh shell type compared to John's bin bash
159:01 shell type compared to John's bin bash so they are different shell types and
159:04 so they are different shell types and we'll get into those a little later on
159:05 we'll get into those a little later on but from here we can also see Roots here
159:09 but from here we can also see Roots here we could see the root shell type and we
159:11 we could see the root shell type and we can also see what kind of services are
159:13 can also see what kind of services are running on this machine so if you want
159:15 running on this machine so if you want to find the users I typically look at
159:17 to find the users I typically look at root and then I look and scroll all the
159:18 root and then I look and scroll all the way to the bottom to see what's been
159:20 way to the bottom to see what's been installed besides what's on this machine
159:23 installed besides what's on this machine so in here we can see some things like
159:25 so in here we can see some things like SSH which is important we know okay this
159:28 SSH which is important we know okay this has the capability of running SSH maybe
159:30 has the capability of running SSH maybe has an SSH service maybe it has a SQL
159:34 has an SSH service maybe it has a SQL service here with the MySQL openvpn so
159:37 service here with the MySQL openvpn so it's a little bit of information
159:38 it's a little bit of information gathering
159:39 gathering if we were to land on a machine for
159:42 if we were to land on a machine for example and we're a low-level user with
159:43 example and we're a low-level user with no privileges we could start to look at
159:46 no privileges we could start to look at who are the other users on the computer
159:47 who are the other users on the computer why are they important how can we get a
159:50 why are they important how can we get a hold of them where are their files
159:52 hold of them where are their files located what kind of services are
159:54 located what kind of services are running on this machine this is all part
159:56 running on this machine this is all part of the information gathering stage of
159:59 of the information gathering stage of ethical hacking and this file leads to a
160:02 ethical hacking and this file leads to a lot of clues for us
160:03 lot of clues for us now clearing the screen let's say I want
160:06 now clearing the screen let's say I want to view the shadow file the shadow file
160:09 to view the shadow file the shadow file is the file that contains the password
160:11 is the file that contains the password hashes for this machine
160:13 hashes for this machine I'm going to go ahead and try to type in
160:16 I'm going to go ahead and try to type in cat
160:25 remission denied okay maybe I need to use sudo
160:32 let's try it here enter our password oh John is not in the suitors file this
160:36 oh John is not in the suitors file this is also called the Sue doers file and
160:38 is also called the Sue doers file and you can also call sudo Sudo depends on
160:41 you can also call sudo Sudo depends on your nomenclature and how you pronounce
160:42 your nomenclature and how you pronounce it I'm a pseudo person so from here I'm
160:45 it I'm a pseudo person so from here I'm going to go ahead and control L we're
160:48 going to go ahead and control L we're going to switch user back into Cali and
160:51 going to switch user back into Cali and we're gonna take a look at some stuff so
160:52 we're gonna take a look at some stuff so if I go switch user
160:54 if I go switch user Cali it's going to ask me for the
160:56 Cali it's going to ask me for the password I'm gonna enter our password in
160:59 password I'm gonna enter our password in and first thing I want to show you the
161:02 and first thing I want to show you the shadow file before we move on to the
161:04 shadow file before we move on to the sudoers file so if we go pseudo cat
161:07 sudoers file so if we go pseudo cat let's see Shadow I think this is
161:09 let's see Shadow I think this is important to see
161:11 important to see you can come in here and remember how I
161:13 you can come in here and remember how I said with a hash that this is set here
161:16 said with a hash that this is set here so our root password has not been set
161:18 so our root password has not been set there's no hash in here and this is
161:20 there's no hash in here and this is security best practice we don't really
161:22 security best practice we don't really want to have a root password unless we
161:24 want to have a root password unless we absolutely need to in this instance we
161:26 absolutely need to in this instance we might just want to have certain users
161:28 might just want to have certain users that can Elevate into root and then if
161:30 that can Elevate into root and then if logging is enabled we can then see from
161:33 logging is enabled we can then see from our logs who access that root account at
161:35 our logs who access that root account at what time you really don't want to have
161:37 what time you really don't want to have a root password where anybody can just
161:39 a root password where anybody can just log in with a known password because
161:41 log in with a known password because then that eliminates some accountability
161:43 then that eliminates some accountability so best practice would say hey if we
161:46 so best practice would say hey if we have a Linux machine you get all regular
161:48 have a Linux machine you get all regular user accounts and then if you want to
161:49 user accounts and then if you want to run something as an elevated privilege
161:52 run something as an elevated privilege you're going to do that with your
161:53 you're going to do that with your account and then use sudo for that
161:56 account and then use sudo for that but looking down here we can see the
161:59 but looking down here we can see the hashes for this computer okay and what's
162:03 hashes for this computer okay and what's interesting actually is Cali and John
162:06 interesting actually is Cali and John have the same password but they have
162:08 have the same password but they have different hashes and that is sort of
162:10 different hashes and that is sort of unique if you saw this in a Windows
162:12 unique if you saw this in a Windows machine if the password was the same on
162:15 machine if the password was the same on the local machine you would see the
162:16 the local machine you would see the exact same hash and that is a clear
162:18 exact same hash and that is a clear indicator that password reuse is in play
162:21 indicator that password reuse is in play but here it's not so the hashing
162:23 but here it's not so the hashing algorithm that's being used is a little
162:25 algorithm that's being used is a little bit different and it's generating
162:26 bit different and it's generating different hashes even though the
162:27 different hashes even though the password is the same regardless the
162:29 password is the same regardless the password for both of these accounts is
162:31 password for both of these accounts is password and that's very weak and can
162:33 password and that's very weak and can easily be cracked as we'll find out
162:35 easily be cracked as we'll find out later on okay now on to the Sue doers
162:38 later on okay now on to the Sue doers file what we're going to do is we're
162:41 file what we're going to do is we're going to do a pseudo cat and we're going
162:43 going to do a pseudo cat and we're going to look at
162:44 to look at Etsy
162:45 Etsy sudoers just like that and I might have
162:48 sudoers just like that and I might have typed that a little fast so I'm going to
162:49 typed that a little fast so I'm going to go ahead and scroll back up for a second
162:51 go ahead and scroll back up for a second pseudo cat
162:53 pseudo cat Etsy sudoers
162:55 Etsy sudoers okay just like that it should Auto tab
162:57 okay just like that it should Auto tab complete and from there we're gonna go
162:59 complete and from there we're gonna go in here and we're going to look at who
163:01 in here and we're going to look at who has what privileges
163:02 has what privileges well if you see allow members of a group
163:05 well if you see allow members of a group pseudo to execute any command and you
163:08 pseudo to execute any command and you see percent pseudo so it's calling sudo
163:10 see percent pseudo so it's calling sudo from somewhere else sometimes we can
163:12 from somewhere else sometimes we can just include users in here we could say
163:13 just include users in here we could say hey the user Cali I want to do these
163:16 hey the user Cali I want to do these things instead this is saying hey
163:18 things instead this is saying hey anybody a part of this group I want to
163:20 anybody a part of this group I want to be able to do whatever they want they
163:21 be able to do whatever they want they can execute any commands like they were
163:23 can execute any commands like they were the root user essentially
163:25 the root user essentially so with that what we're going to do is
163:28 so with that what we're going to do is we're going to take a look at who is in
163:30 we're going to take a look at who is in that percent pseudo group and we can do
163:33 that percent pseudo group and we can do that by using the grep command
163:36 that by using the grep command so we can say grep and we're going to
163:37 so we can say grep and we're going to get really familiar with grep in The
163:39 get really familiar with grep in The Bash scripting video but basically think
163:41 Bash scripting video but basically think of grep as pulling out a specific string
163:45 of grep as pulling out a specific string or element out of a file or some
163:48 or element out of a file or some contents that you want to see it's a
163:50 contents that you want to see it's a great way to narrow down specifics and
163:52 great way to narrow down specifics and pull down only the information that you
163:54 pull down only the information that you want and we're going to get really
163:55 want and we're going to get really familiar with it here in a couple videos
163:57 familiar with it here in a couple videos so we're going to say grep and then
163:59 so we're going to say grep and then we're going to say sudo just like this
164:01 we're going to say sudo just like this and we're going to do that from Etsy
164:03 and we're going to do that from Etsy group
164:08 okay and it says who has a pseudo privilege here all we see is Cali so our
164:11 privilege here all we see is Cali so our user has pseudo privilege if we wanted
164:13 user has pseudo privilege if we wanted to give privileges to John we'd have to
164:15 to give privileges to John we'd have to add John to the pseudo group in the Etsy
164:19 add John to the pseudo group in the Etsy group or we could add John specifically
164:21 group or we could add John specifically to the sudoers file and give him
164:24 to the sudoers file and give him specific permissions as well and as we
164:27 specific permissions as well and as we move on in the course and we get into
164:29 move on in the course and we get into privilege escalation and if you ever go
164:31 privilege escalation and if you ever go into more of the privilege escalation
164:33 into more of the privilege escalation courses that we have you'll see that we
164:35 courses that we have you'll see that we look at pseudo-privileges immediately
164:38 look at pseudo-privileges immediately when we get onto a machine by doing
164:40 when we get onto a machine by doing something like sudo-l and we'll take a
164:42 something like sudo-l and we'll take a look at those and say okay what commands
164:45 look at those and say okay what commands can I run and in this instance we could
164:46 can I run and in this instance we could see okay all commands can be run here
164:49 see okay all commands can be run here but sometimes that's not the case
164:51 but sometimes that's not the case sometimes we can only run one specific
164:53 sometimes we can only run one specific command or maybe John for example we
164:56 command or maybe John for example we want John to be able to run python
164:57 want John to be able to run python because John's a developer so John can
165:00 because John's a developer so John can run python with pseudo privileges but
165:01 run python with pseudo privileges but cannot run anything else so something to
165:04 cannot run anything else so something to think about depending on the individual
165:06 think about depending on the individual and who we want to give permissions to
165:08 and who we want to give permissions to on that machine they might not have
165:10 on that machine they might not have privileges to access everything as sudo
165:12 privileges to access everything as sudo they can actually be limited in what
165:13 they can actually be limited in what they can run as well so that is it for
165:15 they can run as well so that is it for this video I'm going to go ahead and
165:17 this video I'm going to go ahead and catch you in the next one
165:25 now we're going to touch on networking commands that are relevant to
165:27 commands that are relevant to penetration testing and relevant to this
165:30 penetration testing and relevant to this course
165:31 course so the first thing that we're going to
165:32 so the first thing that we're going to do is we're going to use the IP Command
165:36 do is we're going to use the IP Command and that is IPA
165:39 and that is IPA IPA lists all is the way I like to think
165:42 IPA lists all is the way I like to think about it and you can see here that we
165:45 about it and you can see here that we have a loopback address and we have our
165:48 have a loopback address and we have our eth0 this is our ethernet address
165:50 eth0 this is our ethernet address and you can see that we have an IP
165:52 and you can see that we have an IP address here ipv4 of
165:55 address here ipv4 of 192.168.138140 we are on a slash 24
165:58 192.168.138140 we are on a slash 24 subnet and here is our broadcast address
166:03 subnet and here is our broadcast address here we can also see our IPv6 here which
166:07 here we can also see our IPv6 here which is nice and we can see our Mac address
166:09 is nice and we can see our Mac address here
166:11 here so we can also look at this through the
166:13 so we can also look at this through the i f config command
166:19 and that will show us the same things here's ethernet zero here is the
166:22 here's ethernet zero here is the loopback all the same information here
166:25 loopback all the same information here ifconfig is the old school way of doing
166:27 ifconfig is the old school way of doing it IPA is the newer way of doing it IPA
166:30 it IPA is the newer way of doing it IPA is nice and colorful if I'm being honest
166:33 is nice and colorful if I'm being honest I still use ifconfig because I like the
166:35 I still use ifconfig because I like the old school way of doing things but IPA
166:38 old school way of doing things but IPA is the new way of doing things and in
166:40 is the new way of doing things and in some instances I have config requires
166:43 some instances I have config requires sudo to even run or may no longer be on
166:45 sudo to even run or may no longer be on a machine but in some instances IP is
166:48 a machine but in some instances IP is not a machine depending on what type of
166:50 not a machine depending on what type of machine you're on and what you access
166:52 machine you're on and what you access you may need either one of these so it's
166:54 you may need either one of these so it's great to show you both
166:55 great to show you both now while the IPA does all
166:59 now while the IPA does all if only shows the ethernet connection so
167:03 if only shows the ethernet connection so the hardwired connections if we want to
167:05 the hardwired connections if we want to see wireless connections we need to do
167:07 see wireless connections we need to do IW config
167:09 IW config and in this instance you're going to see
167:10 and in this instance you're going to see down here that we have no wireless
167:13 down here that we have no wireless connections right now when we get into
167:15 connections right now when we get into Wireless hacking we'll see that we have
167:17 Wireless hacking we'll see that we have connections established and we'll use
167:19 connections established and we'll use the IW config command but just know for
167:22 the IW config command but just know for now that it's for wireless and if you
167:24 now that it's for wireless and if you ever need to use it that's what it's for
167:26 ever need to use it that's what it's for let's clear our screen and the next
167:28 let's clear our screen and the next thing I want to cover is the ipn and n
167:32 thing I want to cover is the ipn and n stands for neighbor the alternative to
167:36 stands for neighbor the alternative to this is the ARP Dash a
167:39 this is the ARP Dash a okay what is ARP if you do not know what
167:42 okay what is ARP if you do not know what ARP is that is the address resolution
167:44 ARP is that is the address resolution protocol this comes from your networking
167:47 protocol this comes from your networking if you are not familiar with networking
167:49 if you are not familiar with networking then you may need to go study up on a
167:51 then you may need to go study up on a little bit of this now ARP says what IP
167:55 little bit of this now ARP says what IP address is associated with what Mac
167:58 address is associated with what Mac address and what happens is a broadcast
168:01 address and what happens is a broadcast message goes out when we are trying to
168:04 message goes out when we are trying to identify an IP address and a MAC address
168:07 identify an IP address and a MAC address so broadcast goes out and it says who
168:09 so broadcast goes out and it says who has this IP address and whoever has the
168:12 has this IP address and whoever has the IP address will come back and it'll say
168:14 IP address will come back and it'll say hey that's me I have that IP address and
168:17 hey that's me I have that IP address and here is my Mac address so now you can
168:20 here is my Mac address so now you can associate my Mac address with this IP
168:23 associate my Mac address with this IP address
168:24 address and it is a way to identify these two
168:28 and it is a way to identify these two items together and link them up so again
168:31 items together and link them up so again in this instance we can use the IAP
168:32 in this instance we can use the IAP command or the old ARP command now the
168:35 command or the old ARP command now the IP Command is a little bit prettier and
168:37 IP Command is a little bit prettier and a little bit more colorful I think
168:39 a little bit more colorful I think easier to read in my opinion but either
168:42 easier to read in my opinion but either will work in this situation
168:45 will work in this situation another IP Command that we're going to
168:47 another IP Command that we're going to want to run and know is the IPR command
168:51 want to run and know is the IPR command now R stands for route you could also
168:54 now R stands for route you could also type in route
168:55 type in route and you'll get similar feedback here so
168:59 and you'll get similar feedback here so what we're looking at is what is called
169:01 what we're looking at is what is called a routing table we want to know where
169:04 a routing table we want to know where our traffic is routing and here you can
169:06 our traffic is routing and here you can see on either one of these that we're
169:08 see on either one of these that we're routing through
169:10 routing through 192.168.138.0 we have an open Gateway we
169:14 192.168.138.0 we have an open Gateway we can see the Gateway here is
169:16 can see the Gateway here is 138.2 we can see our mask here and we
169:20 138.2 we can see our mask here and we can find all that information out up
169:22 can find all that information out up here as well so it's important to know
169:24 here as well so it's important to know the routing and what's going on
169:26 the routing and what's going on especially if you are in a network or
169:29 especially if you are in a network or example where you might have multiple
169:31 example where you might have multiple routes say if we come in and we say oh
169:34 routes say if we come in and we say oh IPA okay we're on the
169:37 IPA okay we're on the 192.168.138 network but we just try to
169:40 192.168.138 network but we just try to connect to only the machines on this
169:42 connect to only the machines on this network we see a slash 24 we think okay
169:44 network we see a slash 24 we think okay well I know a slash 24 has 255 potential
169:49 well I know a slash 24 has 255 potential IEP addresses and I'm going to go ahead
169:51 IEP addresses and I'm going to go ahead and just stick to scanning that subnet
169:54 and just stick to scanning that subnet and looking for those IPS on that subnet
169:57 and looking for those IPS on that subnet well if you looked at the routing table
170:00 well if you looked at the routing table you might actually see that there's a
170:01 you might actually see that there's a 137 in here or 136 or maybe a 10 dot IP
170:06 137 in here or 136 or maybe a 10 dot IP address or something different than what
170:09 address or something different than what you have here maybe you have the ability
170:11 you have here maybe you have the ability to talk to other networks even though
170:13 to talk to other networks even though you're on this one slash 24 Network
170:16 you're on this one slash 24 Network very important to look at the routing
170:18 very important to look at the routing table it's also important because in
170:21 table it's also important because in real life pen tests we have been on a
170:24 real life pen tests we have been on a quote unquote segmented Network and in
170:27 quote unquote segmented Network and in reality it really wasn't a segmented
170:29 reality it really wasn't a segmented Network there just wasn't a route to
170:31 Network there just wasn't a route to that Network so they said that we were
170:33 that Network so they said that we were isolated and we couldn't access anything
170:35 isolated and we couldn't access anything and all we had to do was say okay we're
170:38 and all we had to do was say okay we're going to go add that Network to our
170:40 going to go add that Network to our routing table and what do you know we
170:42 routing table and what do you know we were able to scan and connect to the
170:43 were able to scan and connect to the network so being able to know your
170:46 network so being able to know your routing table being able to understand
170:48 routing table being able to understand what a route is and how to add routes
170:51 what a route is and how to add routes how to remove routes can become
170:52 how to remove routes can become important as well these are things that
170:54 important as well these are things that you should already know from General
170:57 you should already know from General networking I'm showing you the commands
171:00 networking I'm showing you the commands here for basic routing and how to
171:03 here for basic routing and how to display the routing tables
171:05 display the routing tables if you need further information on
171:07 if you need further information on routing tables you should go look that
171:09 routing tables you should go look that up and research that before continuing
171:11 up and research that before continuing on with the ethical hacking course okay
171:14 on with the ethical hacking course okay last command I want to get through that
171:16 last command I want to get through that is the Ping command so I'm going to do
171:19 is the Ping command so I'm going to do an ifconfig again and in this instance
171:21 an ifconfig again and in this instance I'm just going to Ping
171:24 I'm just going to Ping 192.168.138 and I believe earlier I saw
171:27 192.168.138 and I believe earlier I saw a DOT 2 was my Gateway so I'm going to
171:30 a DOT 2 was my Gateway so I'm going to go ahead and just hit enter that should
171:32 go ahead and just hit enter that should talk back to me and it does now if you
171:35 talk back to me and it does now if you are a Windows user and you've ever used
171:37 are a Windows user and you've ever used ping before it will only send four
171:39 ping before it will only send four packets out so it'll check four times
171:42 packets out so it'll check four times as you can see here we are getting more
171:45 as you can see here we are getting more than four packets sent we are sending
171:47 than four packets sent we are sending indefinitely and I'm going to go ahead
171:49 indefinitely and I'm going to go ahead and just hit Ctrl C and stop that we are
171:52 and just hit Ctrl C and stop that we are definitely seeing that we're getting
171:53 definitely seeing that we're getting responses back now there is a way to
171:55 responses back now there is a way to limit the amount that we send in the
171:57 limit the amount that we send in the amount of traffic that we're sending but
171:59 amount of traffic that we're sending but basically what we're doing with the Ping
172:00 basically what we're doing with the Ping command is we're saying hey are you
172:03 command is we're saying hey are you there are you alive can you respond to
172:05 there are you alive can you respond to me let me know you're there so I asked
172:07 me let me know you're there so I asked the machine at this IP address to
172:09 the machine at this IP address to respond and tell me yes I am here now
172:12 respond and tell me yes I am here now this is called
172:14 this is called icmp traffic not all machines permit
172:18 icmp traffic not all machines permit icmp traffic just because we ping a
172:21 icmp traffic just because we ping a machine and it does not respond does not
172:24 machine and it does not respond does not mean that it's not online okay there are
172:28 mean that it's not online okay there are machines that have icmp disabled and
172:31 machines that have icmp disabled and will not respond to Ping requests but
172:33 will not respond to Ping requests but ping is a quick way to see if a machine
172:35 ping is a quick way to see if a machine is online and typically by default ping
172:38 is online and typically by default ping or icmp is enabled on most machine means
172:42 or icmp is enabled on most machine means just as a further example we can ping a
172:45 just as a further example we can ping a machine that we do not believe to be
172:46 machine that we do not believe to be alive so I'm going to change this to a
172:48 alive so I'm going to change this to a three I don't think there's a three on
172:50 three I don't think there's a three on my network
172:51 my network and you're gonna see it's going to try
172:52 and you're gonna see it's going to try to send data and it's just going to get
172:54 to send data and it's just going to get stuck here and say host unreachable
172:57 stuck here and say host unreachable now again that could potentially mean
173:00 now again that could potentially mean that that host is not there or it could
173:02 that that host is not there or it could potentially mean that the host has icmp
173:04 potentially mean that the host has icmp disabled but we're going to be using
173:07 disabled but we're going to be using ping sweeping to identify host in our
173:09 ping sweeping to identify host in our Network and we'll do that here in just a
173:12 Network and we'll do that here in just a couple of videos but I wanted you to get
173:14 couple of videos but I wanted you to get familiar with the Ping command if you
173:16 familiar with the Ping command if you weren't familiar already
173:18 weren't familiar already now there are some commands in this
173:19 now there are some commands in this video that we did not talk about for
173:21 video that we did not talk about for example the netstat command now the
173:24 example the netstat command now the netsack command is used to identify what
173:27 netsack command is used to identify what open ports and services are there we'll
173:29 open ports and services are there we'll take a look at that more later on but
173:32 take a look at that more later on but just know that that command exists and
173:34 just know that that command exists and that we're going to do due diligence on
173:36 that we're going to do due diligence on a command later so any of you that are
173:39 a command later so any of you that are watching that have networking background
173:40 watching that have networking background or like hey you didn't show netstat
173:42 or like hey you didn't show netstat that's so important you're correct it's
173:44 that's so important you're correct it's coming later on in the course so that's
173:46 coming later on in the course so that's it for this video we're going to go
173:47 it for this video we're going to go ahead and move on to the next one
173:57 let's now talk about viewing creating and editing files and we've done a
174:00 and editing files and we've done a little bit of this in the course already
174:02 little bit of this in the course already you've seen me do something like Echo
174:05 you've seen me do something like Echo hello and remember that prints out to
174:08 hello and remember that prints out to the screen
174:09 the screen and we could just Echo that again like a
174:13 and we could just Echo that again like a hello and put that into a file and
174:16 hello and put that into a file and you've seen me do that we'll just call
174:17 you've seen me do that we'll just call this one hey.txt
174:20 this one hey.txt and if we LS we should see hey.txt right
174:24 and if we LS we should see hey.txt right here
174:24 here if we do a cat
174:27 if we do a cat a DOT txt we should print out to the
174:29 a DOT txt we should print out to the screen hello
174:31 screen hello all these should be pretty familiar to
174:33 all these should be pretty familiar to you
174:34 you so let's build upon this let's talk
174:37 so let's build upon this let's talk about how we can append to this and
174:40 about how we can append to this and overwrite these files in different ways
174:43 overwrite these files in different ways that we can actually create and edit
174:45 that we can actually create and edit files I'm going to clear the screen here
174:48 files I'm going to clear the screen here now what if I wanted to add to this file
174:50 now what if I wanted to add to this file and I'm just tapping up by the way what
174:53 and I'm just tapping up by the way what if I want to say hello again
174:55 if I want to say hello again so I want to say Echo hello again into
174:58 so I want to say Echo hello again into this hey.txt file that already exists
175:00 this hey.txt file that already exists what do we think is going to happen here
175:02 what do we think is going to happen here so I'm going to go ahead and hit enter
175:04 so I'm going to go ahead and hit enter and then I'm going to cut out the
175:07 and then I'm going to cut out the hey.txt
175:09 hey.txt well now it says hello again it used to
175:11 well now it says hello again it used to say hello well that is because when we
175:14 say hello well that is because when we use one greater than symbol like this
175:18 use one greater than symbol like this what's going to happen is that
175:19 what's going to happen is that overwrites the file
175:21 overwrites the file so if we tab up and if we go over and we
175:24 so if we tab up and if we go over and we just write hey again again just for fun
175:27 just write hey again again just for fun and let's add a second one of these so
175:30 and let's add a second one of these so now there should be two of these greater
175:32 now there should be two of these greater than symbols we hit enter we cat out
175:37 than symbols we hit enter we cat out a DOT dxt
175:39 a DOT dxt and now you can see it says hello again
175:41 and now you can see it says hello again and hello again again
175:43 and hello again again why do we care why are we doing this
175:46 why do we care why are we doing this well when we are using
175:48 well when we are using scripting for example and we want to
175:51 scripting for example and we want to Loop through a bunch of information and
175:52 Loop through a bunch of information and we want to add that information to a
175:54 we want to add that information to a file we might use something like this
175:57 file we might use something like this where if we're Gathering say i p
175:59 where if we're Gathering say i p addresses this is foreshadowing by the
176:01 addresses this is foreshadowing by the way if they were gathering IP addresses
176:03 way if they were gathering IP addresses and we are wanting to put them all in a
176:05 and we are wanting to put them all in a file we're going to need to use
176:07 file we're going to need to use something like a double greater than in
176:10 something like a double greater than in order to not overwrite the file with one
176:12 order to not overwrite the file with one IP address we want to list all the IP
176:14 IP address we want to list all the IP addresses in the file
176:16 addresses in the file so you're going to see that when we get
176:17 so you're going to see that when we get into the bash scripting of this section
176:20 into the bash scripting of this section let's clear our screen another way that
176:23 let's clear our screen another way that we can make a new file is just to say
176:25 we can make a new file is just to say touch
176:26 touch new file.txt
176:29 new file.txt and if we LS you can see that new
176:32 and if we LS you can see that new file.txt is here we can cat out new
176:36 file.txt is here we can cat out new file.txt
176:37 file.txt [Music]
176:38 [Music] and nothing is going to be in there
176:41 and nothing is going to be in there because we didn't tell it to do anything
176:42 because we didn't tell it to do anything we just said touch which creates a file
176:45 we just said touch which creates a file so we can use a different type of Editor
176:48 so we can use a different type of Editor to try and edit this and save the file
176:52 to try and edit this and save the file now there are a few editors that we can
176:55 now there are a few editors that we can use within our terminal so we can use
176:57 use within our terminal so we can use something called Nano which is my
176:59 something called Nano which is my personal favorite
177:00 personal favorite you may hear other people talk about VI
177:03 you may hear other people talk about VI in Vim you may hear lots of jokes about
177:06 in Vim you may hear lots of jokes about quitting them and how it's impossible to
177:08 quitting them and how it's impossible to quit them and for that reason honestly
177:11 quit them and for that reason honestly because of the complications and because
177:13 because of the complications and because I like Simplicity I just use Nano so we
177:17 I like Simplicity I just use Nano so we can Nano new file
177:20 can Nano new file and in here you can type whatever you
177:23 and in here you can type whatever you want I'm going to literally say I can
177:25 want I'm going to literally say I can type whatever I want in here
177:33 and now I'm going to hit Ctrl X and throughout this course you're going to
177:34 throughout this course you're going to actually see me
177:36 actually see me use Nano quite a bit and we're going to
177:38 use Nano quite a bit and we're going to use it for updating files and Shell Code
177:41 use it for updating files and Shell Code and it's beneficial if we log into a
177:44 and it's beneficial if we log into a machine remotely for example and we
177:47 machine remotely for example and we won't have the ability to have a
177:49 won't have the ability to have a graphical user interface type notepad
177:51 graphical user interface type notepad which I'm going to show you here in a
177:53 which I'm going to show you here in a second we might not have the luxury of
177:56 second we might not have the luxury of having something like that we might have
177:57 having something like that we might have to use Nano or Bim or in in terminal
178:01 to use Nano or Bim or in in terminal text editor so we're going to go ahead
178:03 text editor so we're going to go ahead and hit Ctrl X here I'm going to hit Y
178:05 and hit Ctrl X here I'm going to hit Y which is going to say yes I want to save
178:06 which is going to say yes I want to save this file and then I'm going to hit
178:08 this file and then I'm going to hit enter
178:09 enter and now if I cut out newfile.txt
178:13 and now if I cut out newfile.txt you can see it says I can type whatever
178:15 you can see it says I can type whatever I want in here
178:17 I want in here lastly we're going to look at a
178:18 lastly we're going to look at a graphical notepad so we're going to use
178:21 graphical notepad so we're going to use mouse pad we can type in mouse pad
178:25 mouse pad we can type in mouse pad and we can just say new file dot txt
178:28 and we can just say new file dot txt just like we created and hidden here you
178:32 just like we created and hidden here you can see that it says I can type whatever
178:34 can see that it says I can type whatever I want in here and that's true I can
178:37 I want in here and that's true I can also modify it's just like a notepad if
178:40 also modify it's just like a notepad if you had on Windows machine or if you've
178:42 you had on Windows machine or if you've used leafpad or any sort of notepad type
178:45 used leafpad or any sort of notepad type material this one's just called mouse
178:46 material this one's just called mouse pad so we can control s and save and
178:50 pad so we can control s and save and then just exit out if we cat out our new
178:53 then just exit out if we cat out our new file again you can see I can also modify
178:57 file again you can see I can also modify now throughout this course you might see
178:59 now throughout this course you might see me use a tool called G edit it is not
179:01 me use a tool called G edit it is not installed on this machine yet though we
179:04 installed on this machine yet though we are making updates to the course we will
179:06 are making updates to the course we will be using G edit anytime you see me use G
179:08 be using G edit anytime you see me use G edit feel free to use mouse pad instead
179:10 edit feel free to use mouse pad instead of G edit it's become deprecated
179:13 of G edit it's become deprecated offensive security got rid of it in Kali
179:15 offensive security got rid of it in Kali Linux and now if you go hit G edit it'll
179:18 Linux and now if you go hit G edit it'll say it's not found but you can install
179:19 say it's not found but you can install it we're not going to do that right now
179:21 it we're not going to do that right now but when we install Tools in a upcoming
179:25 but when we install Tools in a upcoming video you will be able to install that
179:27 video you will be able to install that with one of the tools that we're running
179:28 with one of the tools that we're running so anyway just note that we're going to
179:31 so anyway just note that we're going to be using mouse pad instead of G edit
179:33 be using mouse pad instead of G edit because it's the new and latest and
179:35 because it's the new and latest and greatest
179:36 greatest one last thing with Nano or any of these
179:40 one last thing with Nano or any of these tools
179:41 tools you can make a brand new file so you can
179:43 you can make a brand new file so you can say like brand new file.txt and then you
179:48 say like brand new file.txt and then you can type whatever in here and control X
179:53 can type whatever in here and control X hit Y hit enter and then you can cat out
179:57 hit Y hit enter and then you can cat out brand new file and guess what it's there
179:59 brand new file and guess what it's there so the file doesn't have to be existing
180:02 so the file doesn't have to be existing to use Nano or existing to use mouse pad
180:06 to use Nano or existing to use mouse pad you can create new files with these
180:08 you can create new files with these commands as well
180:10 commands as well so that is it for this video I'm gonna
180:12 so that is it for this video I'm gonna go ahead and catch you in the next one
180:22 another topic we need to talk about is starting and stopping services
180:24 starting and stopping services we may have a service like a web server
180:27 we may have a service like a web server or SSH or maybe SQL or some sort of
180:30 or SSH or maybe SQL or some sort of database that we need to start while
180:33 database that we need to start while we're already running Cali or we might
180:36 we're already running Cali or we might want to start a service on boot every
180:39 want to start a service on boot every single time that our computer loads if
180:41 single time that our computer loads if you've ever used Windows this is similar
180:43 you've ever used Windows this is similar to installing a program and then having
180:46 to installing a program and then having that boot up on launch it's kind of the
180:48 that boot up on launch it's kind of the same thing here if we're installing
180:50 same thing here if we're installing something we want that service to start
180:52 something we want that service to start on launch we have to tell our machine to
180:54 on launch we have to tell our machine to do that so we're going to look at how to
180:56 do that so we're going to look at how to start a service and how to have a
180:57 start a service and how to have a service start on launch so the first
181:00 service start on launch so the first service that we're going to look at is
181:01 service that we're going to look at is the Apache service and this is what I
181:04 the Apache service and this is what I used to use when I first started out as
181:07 used to use when I first started out as an ethical hacker and the reason is is
181:09 an ethical hacker and the reason is is that we can spin up our own web server
181:11 that we can spin up our own web server fairly easily and host malicious data or
181:15 fairly easily and host malicious data or files or things that we might want to
181:16 files or things that we might want to access or might want somebody else to
181:18 access or might want somebody else to access so before we run that command I
181:21 access so before we run that command I do want to do a proof of concept so
181:22 do want to do a proof of concept so let's do an ifconfig
181:24 let's do an ifconfig and we're going to grab our IP address
181:26 and we're going to grab our IP address here I'm going to copy this
181:29 here I'm going to copy this and then I want to open up Firefox
181:33 and then I want to open up Firefox from within Firefox I'm going to go
181:35 from within Firefox I'm going to go ahead and try to navigate to that IP
181:37 ahead and try to navigate to that IP address
181:39 address and you're going to see that it says
181:40 and you're going to see that it says it's unable to connect this is exactly
181:42 it's unable to connect this is exactly what we expected
181:43 what we expected so now what we're going to do is we're
181:45 so now what we're going to do is we're going to come in here and we're going to
181:48 going to come in here and we're going to say sudo service
181:51 say sudo service Apache to
181:54 Apache to start
181:55 start we hit enter it's going to ask for our
181:57 we hit enter it's going to ask for our sudo password
182:04 and then we have no confirmation of anything so let's go ahead and come in
182:06 anything so let's go ahead and come in back into the browser
182:07 back into the browser and we're going to refresh
182:10 and we're going to refresh and let's take away the https and now
182:14 and let's take away the https and now you can see that this is here on Port
182:16 you can see that this is here on Port 80. so we are actually on HTTP not https
182:19 80. so we are actually on HTTP not https and we have an Apache server running now
182:22 and we have an Apache server running now now let's say we wanted to stop this
182:25 now let's say we wanted to stop this service we could we can go in here and
182:27 service we could we can go in here and say sudo service Apache to stop and
182:32 say sudo service Apache to stop and before we do that I want to show you
182:33 before we do that I want to show you something so if we come back into the
182:36 something so if we come back into the Apache 2 I'm going to make this a little
182:38 Apache 2 I'm going to make this a little bit bigger
182:39 bit bigger you could see that our files are located
182:42 you could see that our files are located in the VAR
182:44 in the VAR www.html folder and what that is if we
182:48 www.html folder and what that is if we come to our home folder here
182:50 come to our home folder here and we just go to file system
182:53 and we just go to file system we scroll down and go to bar
182:57 we scroll down and go to bar and then we go to www
182:59 and then we go to www .html all I'm doing is going to the same
183:02 .html all I'm doing is going to the same location here
183:04 location here why I'm doing this is this is where if I
183:06 why I'm doing this is this is where if I wanted to host like a picture or a file
183:09 wanted to host like a picture or a file or malware I could put that in here this
183:12 or malware I could put that in here this index.html is the same index page that's
183:14 index.html is the same index page that's loaded here like if I open that that's
183:16 loaded here like if I open that that's literally the same page that's being
183:18 literally the same page that's being hosted you're seeing it here from a file
183:20 hosted you're seeing it here from a file format but now if I go back you can see
183:22 format but now if I go back you can see I'm hosting it at this IP address so if
183:25 I'm hosting it at this IP address so if I wanted to host something malicious I
183:26 I wanted to host something malicious I could do that now in order to stop the
183:29 could do that now in order to stop the service all we have to do is say stop
183:30 service all we have to do is say stop hit enter then we come back and we
183:33 hit enter then we come back and we refresh this page
183:35 refresh this page you can see that we're now again unable
183:37 you can see that we're now again unable to connect
183:38 to connect now I did mention the beginning of this
183:40 now I did mention the beginning of this video that this was my favorite way to
183:43 video that this was my favorite way to host malicious stuff or just host files
183:45 host malicious stuff or just host files for whatever purpose now that has
183:48 for whatever purpose now that has changed
183:49 changed I now use Python to do this so we can
183:53 I now use Python to do this so we can create a file let's go ahead and just
183:54 create a file let's go ahead and just say Echo hello and we're going to do
183:58 say Echo hello and we're going to do [Music]
183:59 [Music] hello.txt
184:01 hello.txt so if we LS we can see that we've got a
184:03 so if we LS we can see that we've got a bunch of stuff in here
184:05 bunch of stuff in here um hello.txt being one of them so what
184:07 um hello.txt being one of them so what I'm going to do is I'm going to spin up
184:09 I'm going to do is I'm going to spin up a web server on the fly with python so
184:14 a web server on the fly with python so I'm going to say python three
184:17 I'm going to say python three Dash m http.server
184:24 and then I'm going to give it port 80. now what we're saying is we want to run
184:26 now what we're saying is we want to run the module HTTP server and we're going
184:28 the module HTTP server and we're going to run Port 80 here you can put whatever
184:31 to run Port 80 here you can put whatever Port you want
184:32 Port you want and you can see now it says hey it's
184:34 and you can see now it says hey it's hosting up HTTP on Port 80 and what's
184:37 hosting up HTTP on Port 80 and what's going to happen is any file within the
184:39 going to happen is any file within the directory that I'm in is going to now be
184:41 directory that I'm in is going to now be hosted so you can see that I'm hosting
184:43 hosted so you can see that I'm hosting all this stuff here pretty awesome it's
184:46 all this stuff here pretty awesome it's a quick way to host up a web server
184:49 a quick way to host up a web server without having to start and stop
184:50 without having to start and stop services and you can on the fly from
184:52 services and you can on the fly from within a folder just start a web server
184:55 within a folder just start a web server so I think this is the cooler and better
184:57 so I think this is the cooler and better way to do it so I wanted to show you how
184:59 way to do it so I wanted to show you how to start a service but also that python
185:01 to start a service but also that python has some robust capabilities as well if
185:04 has some robust capabilities as well if you follow into the python section we'll
185:07 you follow into the python section we'll cover how to run an FTP server as well
185:10 cover how to run an FTP server as well which is also fun stuff so I'm going to
185:13 which is also fun stuff so I'm going to hit Ctrl C which is going to again shut
185:15 hit Ctrl C which is going to again shut down the server if I come here refresh
185:17 down the server if I come here refresh you'll see that it's now shut down
185:19 you'll see that it's now shut down and we can go ahead and talk about one
185:22 and we can go ahead and talk about one more thing before we go so let's say
185:25 more thing before we go so let's say that we wanted a service to start when
185:27 that we wanted a service to start when we started our machine well for that
185:29 we started our machine well for that we're going to use the system CTL
185:32 we're going to use the system CTL command system CTL
185:34 command system CTL and we can say enable if we wanted to
185:38 and we can say enable if we wanted to for example enable SSH we can come in
185:41 for example enable SSH we can come in here and just enable SSH and we just hit
185:44 here and just enable SSH and we just hit enter on this
185:45 enter on this and now you can see that it's enabled so
185:47 and now you can see that it's enabled so when we restart the computer SSH will
185:50 when we restart the computer SSH will always be enabled for us now I'm going
185:52 always be enabled for us now I'm going to disable that this isn't like security
185:54 to disable that this isn't like security best practice
186:00 and now you can see that we have disabled it and we're good to go so if
186:03 disabled it and we're good to go so if you ever have a service that you want to
186:04 you ever have a service that you want to run you just need to figure out the name
186:06 run you just need to figure out the name of the service and enable that and there
186:08 of the service and enable that and there may be times that you want things to run
186:09 may be times that you want things to run like historically I have ran SSH with it
186:12 like historically I have ran SSH with it enabled or I used to run the Apache 2
186:15 enabled or I used to run the Apache 2 server so I didn't have to spin it up
186:16 server so I didn't have to spin it up every time I just had a place to go
186:18 every time I just had a place to go immediately host that but your mileage
186:20 immediately host that but your mileage may vary depending on what it is you
186:22 may vary depending on what it is you want to run but knowing these commands
186:23 want to run but knowing these commands is important in case you need to start
186:25 is important in case you need to start or stop a service maybe restart a
186:27 or stop a service maybe restart a service same thing with enabling a
186:29 service same thing with enabling a service at boot up or disabling a
186:32 service at boot up or disabling a service at boot up so that's it for this
186:34 service at boot up so that's it for this video I'll go ahead and see you over in
186:36 video I'll go ahead and see you over in the next one
186:44 now let's talk about installing and updating tools
186:46 updating tools so the first thing that we're going to
186:47 so the first thing that we're going to do for Mark command line is we're going
186:49 do for Mark command line is we're going to look at how we would update our
186:53 to look at how we would update our current machine so just like other
186:56 current machine so just like other operating systems Linux machines require
186:59 operating systems Linux machines require updates as well and patching can be best
187:02 updates as well and patching can be best practice
187:03 practice so in order to update and upgrade our
187:07 so in order to update and upgrade our machine we're going to use the sudo
187:08 machine we're going to use the sudo command
187:09 command and we're going to say apt apt
187:14 and we're going to say apt apt and then we're going to say update and
187:17 and then we're going to say update and upgrade just like that so make sure you
187:20 upgrade just like that so make sure you use two Ampersand symbols here we're
187:22 use two Ampersand symbols here we're going to do two commands we're going to
187:24 going to do two commands we're going to say first I want you to update second I
187:26 say first I want you to update second I want you to upgrade
187:28 want you to upgrade well why are we doing this why are we
187:29 well why are we doing this why are we running two commands in the first place
187:31 running two commands in the first place well what we do when we actually install
187:34 well what we do when we actually install items on our Cali machine we are going
187:38 items on our Cali machine we are going out to what are called repositories and
187:40 out to what are called repositories and we're looking through packages and the
187:43 we're looking through packages and the update command is going out to the known
187:45 update command is going out to the known repositories and it is updating those
187:47 repositories and it is updating those repositories and then it's going to look
187:50 repositories and then it's going to look at those repositories and say okay what
187:53 at those repositories and say okay what needs upgraded here so what tools have
187:56 needs upgraded here so what tools have upgrades or updates available for them
187:59 upgrades or updates available for them that we need so if we run this command
188:02 that we need so if we run this command you're going to see that it's going to
188:03 you're going to see that it's going to go through these repositories you can
188:05 go through these repositories you can see it going through these Cali rolling
188:07 see it going through these Cali rolling and release AMD 64 packages and contents
188:12 and release AMD 64 packages and contents etc etc it'll take some time as it goes
188:15 etc etc it'll take some time as it goes through and it updates these
188:16 through and it updates these repositories it's going to find what
188:19 repositories it's going to find what programs we need and it'll provide it in
188:21 programs we need and it'll provide it in a list now what you can see is it's
188:24 a list now what you can see is it's asking us are you rude so this is a
188:26 asking us are you rude so this is a lesson here sometimes we have to be the
188:30 lesson here sometimes we have to be the root user we can't be just a pseudo user
188:33 root user we can't be just a pseudo user to run the command so what we're going
188:35 to run the command so what we're going to do in this instance is we're going to
188:37 to do in this instance is we're going to sudo switch user into root now we're
188:41 sudo switch user into root now we're root and we're going to run that command
188:42 root and we're going to run that command again we're going to say apt update
188:45 again we're going to say apt update and apt upgrade
188:52 okay and it's going to run through this and then it should provide us with a
188:54 and then it should provide us with a list of what we're going to install
188:55 list of what we're going to install which if we scroll back up to the top
188:57 which if we scroll back up to the top you can see that it says hey these
189:00 you can see that it says hey these packages were automatically installed
189:02 packages were automatically installed and no longer required and it says we
189:04 and no longer required and it says we can use the APT Auto remove command to
189:07 can use the APT Auto remove command to do that it's saying here are the brand
189:09 do that it's saying here are the brand new packages that need to be installed
189:11 new packages that need to be installed and then here are the packages that are
189:13 and then here are the packages that are going to be upgraded so these are
189:14 going to be upgraded so these are already installed such as like Apache 2
189:16 already installed such as like Apache 2 has some updates that are required and
189:19 has some updates that are required and it's going to go through and install all
189:20 it's going to go through and install all these now when you scroll down to the
189:22 these now when you scroll down to the bottom it's going to say you need 801
189:25 bottom it's going to say you need 801 megabytes and yours might be different
189:27 megabytes and yours might be different depending on when you watch this video
189:28 depending on when you watch this video it's going to say do you want to
189:30 it's going to say do you want to continue this operation
189:31 continue this operation in this instance I'm going to say no
189:34 in this instance I'm going to say no and the reason that I'm going to say no
189:37 and the reason that I'm going to say no is because updating on Kali Linux can
189:40 is because updating on Kali Linux can break things you should always have
189:43 break things you should always have almost two copies of your Linux right
189:45 almost two copies of your Linux right you should take a backup copy before you
189:47 you should take a backup copy before you ever make an update and there are some
189:50 ever make an update and there are some limitations on being able to make
189:52 limitations on being able to make backups depending on if you're using
189:54 backups depending on if you're using VMware or virtualbox and we're not going
189:55 VMware or virtualbox and we're not going to get into that right now but just know
189:57 to get into that right now but just know that tools can easily get broken by
190:00 that tools can easily get broken by pushing updates and we'll talk about a
190:03 pushing updates and we'll talk about a tool that you can use that is up to date
190:05 tool that you can use that is up to date and kind of makes your Cali the latest
190:08 and kind of makes your Cali the latest and greatest without breaking anything
190:10 and greatest without breaking anything even the current version of Cali right
190:12 even the current version of Cali right now 2022.2 not all the tools work out of
190:16 now 2022.2 not all the tools work out of the box as the way they should
190:18 the box as the way they should we'll talk about that in just a little
190:20 we'll talk about that in just a little bit so let's say that you wanted to
190:22 bit so let's say that you wanted to install a tool we're just going to go
190:25 install a tool we're just going to go grab one as an example so let's say that
190:27 grab one as an example so let's say that there was a tool you wanted to install
190:29 there was a tool you wanted to install like this cron Damon common I'm just
190:31 like this cron Damon common I'm just going to copy that
190:33 going to copy that you could come in here and you could say
190:35 you could come in here and you could say apt install Ron Damon common like this
190:39 apt install Ron Damon common like this hit enter and it's going to say oh you
190:42 hit enter and it's going to say oh you want to install this just hit yes and it
190:44 want to install this just hit yes and it will install and it will also upgrade
190:46 will install and it will also upgrade this cron package here I'm not going to
190:49 this cron package here I'm not going to do that but just know that you can also
190:51 do that but just know that you can also install applications as a one-time thing
190:53 install applications as a one-time thing if they're a part of the repository that
190:56 if they're a part of the repository that you have we're not going to get into
190:57 you have we're not going to get into updating repositories and adding manual
191:00 updating repositories and adding manual repositories we don't need to know that
191:02 repositories we don't need to know that at this point in our Linux careers we
191:04 at this point in our Linux careers we just need to understand that we're going
191:06 just need to understand that we're going out to repository and we can download
191:07 out to repository and we can download those items or packages based on what is
191:10 those items or packages based on what is in the repository so updating the
191:12 in the repository so updating the repository is always good and then we
191:14 repository is always good and then we checked for upgrades available to our
191:16 checked for upgrades available to our packages
191:17 packages in this instance we're not going to do
191:18 in this instance we're not going to do any updating or upgrading but there may
191:21 any updating or upgrading but there may be a time where we need to install a
191:22 be a time where we need to install a specific tool we go out to the web and
191:24 specific tool we go out to the web and we have to grab a tool and it says Hey
191:26 we have to grab a tool and it says Hey run this app install command this is
191:29 run this app install command this is what it's going to be doing this is how
191:30 what it's going to be doing this is how we would install something if we need to
191:32 we would install something if we need to now the next thing that we're going to
191:34 now the next thing that we're going to look at is we're going to look at the
191:37 look at is we're going to look at the get command
191:38 get command and git is a tool that runs with GitHub
191:42 and git is a tool that runs with GitHub I'm going to open up a new Firefox and
191:45 I'm going to open up a new Firefox and I'm going to make this a little bit
191:46 I'm going to make this a little bit bigger we're going to go to GitHub
191:47 bigger we're going to go to GitHub actually let's just go to Google we're
191:49 actually let's just go to Google we're going to go to Google
191:51 going to go to Google and a lot of times in our ethical
191:54 and a lot of times in our ethical hacking careers we're going to be
191:57 hacking careers we're going to be searching for tools we're going to come
191:58 searching for tools we're going to come out here and we're going to say oh I
192:00 out here and we're going to say oh I really want to find a tool maybe that
192:02 really want to find a tool maybe that does brute force Office 365 and then I
192:07 does brute force Office 365 and then I might say something like GitHub and you
192:09 might say something like GitHub and you can see it's already starting to
192:11 can see it's already starting to fill out and we might go find something
192:13 fill out and we might go find something like okay there's this Daft hack tool we
192:17 like okay there's this Daft hack tool we might click on that and we come in here
192:19 might click on that and we come in here and it might tell you how to install
192:21 and it might tell you how to install this well this is Powershell so that's
192:22 this well this is Powershell so that's not a great example uh we might come
192:24 not a great example uh we might come into here we might say okay here's one
192:26 into here we might say okay here's one how to install so you go through and
192:28 how to install so you go through and it'll say here's the usage on how to use
192:30 it'll say here's the usage on how to use this and sometimes we'll give you
192:32 this and sometimes we'll give you installation instructions but a lot of
192:34 installation instructions but a lot of times all you will need to do is you'll
192:36 times all you will need to do is you'll need to come in here and just download
192:38 need to come in here and just download the code to install the file so I'm
192:41 the code to install the file so I'm going to show you a tool that we're
192:42 going to show you a tool that we're going to install and run we go to Google
192:47 going to install and run we go to Google and we search for hemp my Cali
192:52 and we search for hemp my Cali just like that you're going to see that
192:54 just like that you're going to see that we can click in here and this tool is
192:57 we can click in here and this tool is available to us to download now
193:00 available to us to download now one way to look at a tool and see if it
193:03 one way to look at a tool and see if it has any relevancy on GitHub is to look
193:06 has any relevancy on GitHub is to look up at the number of stars that it has in
193:08 up at the number of stars that it has in the forks that it has
193:10 the forks that it has anything with like 700 stars like this
193:12 anything with like 700 stars like this is pretty reputable and you also should
193:15 is pretty reputable and you also should look at when it was last updated you can
193:17 look at when it was last updated you can see that this was last updated last
193:19 see that this was last updated last month now full disclosure DeWalt
193:21 month now full disclosure DeWalt actually works for TCM security and is a
193:26 actually works for TCM security and is a fantastic person if you never got to
193:27 fantastic person if you never got to interact with DeWalt he is somebody that
193:29 interact with DeWalt he is somebody that is awesome and a great resource he built
193:32 is awesome and a great resource he built this out because there were so many
193:35 this out because there were so many issues with Kali Linux and the tools
193:38 issues with Kali Linux and the tools that were coming freshly installed like
193:40 that were coming freshly installed like in 2022.2 don't always work in the way
193:43 in 2022.2 don't always work in the way that we intend them to work so a lot of
193:46 that we intend them to work so a lot of tools are broken some things need
193:47 tools are broken some things need downgraded and there's a lot of options
193:49 downgraded and there's a lot of options in here that can tell you hey here's
193:52 in here that can tell you hey here's what we can fix like we can fix
193:53 what we can fix like we can fix different missing issues that are going
193:56 different missing issues that are going on or we can fix go laying or fix impack
193:59 on or we can fix go laying or fix impack it and you don't have to worry about
194:00 it and you don't have to worry about what any of that means right now until
194:02 what any of that means right now until we get into pen testing but this is
194:04 we get into pen testing but this is something that we actually do install
194:07 something that we actually do install and run when we build out our lab
194:09 and run when we build out our lab machines or we build out our machines
194:11 machines or we build out our machines for even hacking on clients this is such
194:14 for even hacking on clients this is such a well done tool and he tells you in
194:17 a well done tool and he tells you in here how to install it he says hey get
194:19 here how to install it he says hey get clone right here off of this address we
194:23 clone right here off of this address we can also come up here we can go to the
194:24 can also come up here we can go to the code and we can just copy we say copy my
194:27 code and we can just copy we say copy my Cali right here and then we'll come in
194:29 Cali right here and then we'll come in and we can just say get clone
194:32 and we can just say get clone actually let's switch user I'm sorry
194:34 actually let's switch user I'm sorry let's sudo or let's switch user back to
194:36 let's sudo or let's switch user back to Cali
194:38 Cali and we'll enter here and then what I
194:41 and we'll enter here and then what I like to do when I install tools is I
194:43 like to do when I install tools is I like to install them into the op folder
194:45 like to install them into the op folder the opt folder so from here we're going
194:48 the opt folder so from here we're going to run get clone
194:51 to run get clone paste that
194:56 actually we're going to run sudo get clone I apologize
194:58 clone I apologize and then enter your password
195:06 and now if we look in here we should have Pimp My Cali which we do so if we
195:08 have Pimp My Cali which we do so if we CD to Pimp My Cali
195:11 CD to Pimp My Cali and now we LS we can see that we have
195:14 and now we LS we can see that we have the pimp mycali.sh script if you come
195:17 the pimp mycali.sh script if you come back into the website it will tell you
195:19 back into the website it will tell you how to run and operate this any decent
195:23 how to run and operate this any decent GitHub will say hey here's how you run
195:26 GitHub will say hey here's how you run this script so it says hey just run sudo
195:29 this script so it says hey just run sudo hit my Cali this is for a new Cali VM
195:31 hit my Cali this is for a new Cali VM you just need to run menu option n we're
195:35 you just need to run menu option n we're going to copy this and paste it
195:37 going to copy this and paste it and then we're gonna run it
195:40 and then we're gonna run it so now this tells you what do you want
195:42 so now this tells you what do you want to do well here's all the different
195:44 to do well here's all the different options N is a new VM setup run this
195:47 options N is a new VM setup run this option as your first time running Pimp
195:48 option as your first time running Pimp My Cali okay so that's going to fix all
195:52 My Cali okay so that's going to fix all the things for you I'm going to go ahead
195:55 the things for you I'm going to go ahead and hit n and let this run it's going to
195:57 and hit n and let this run it's going to go out and fetch some stuff from
195:59 go out and fetch some stuff from repositories and it's running apt update
196:01 repositories and it's running apt update and now it's going to install certain
196:03 and now it's going to install certain tools and packages and uninstall certain
196:06 tools and packages and uninstall certain tools and packages as you can see it's
196:08 tools and packages as you can see it's rolling through here so go ahead and let
196:10 rolling through here so go ahead and let this run I'm going to pause the video
196:11 this run I'm going to pause the video here for a second and then meet me back
196:14 here for a second and then meet me back when you're at the next screen where you
196:16 when you're at the next screen where you can actually enter in any sort of
196:18 can actually enter in any sort of command
196:19 command okay so it's been about five minutes and
196:22 okay so it's been about five minutes and we get to this page here and you can see
196:24 we get to this page here and you can see that it's asking us if we want to run
196:26 that it's asking us if we want to run root login installation it explains that
196:30 root login installation it explains that in Cali 2019 point x the default user
196:33 in Cali 2019 point x the default user used to be root which we talked about
196:34 used to be root which we talked about early on in this course and now that
196:37 early on in this course and now that they've switched it to Cali which is
196:38 they've switched it to Cali which is what we've been using now do we want to
196:40 what we've been using now do we want to re-enable the ability to log in as root
196:43 re-enable the ability to log in as root in Cali in this instance I'm going to
196:45 in Cali in this instance I'm going to choose yes however
196:48 choose yes however you need to make sure that you are
196:51 you need to make sure that you are comfortable and capable of running as
196:54 comfortable and capable of running as root
196:55 root in Linux if you do not feel comfortable
196:58 in Linux if you do not feel comfortable stick with running as Cali you're going
197:01 stick with running as Cali you're going to see me throughout the course as we
197:03 to see me throughout the course as we get into the ethical hacking section
197:04 get into the ethical hacking section running as root just know that there may
197:07 running as root just know that there may be times where you might need to use
197:09 be times where you might need to use sudo or you may need to switch user into
197:12 sudo or you may need to switch user into root as you saw me do with upgrading
197:14 root as you saw me do with upgrading packages just a few minutes ago that may
197:17 packages just a few minutes ago that may be required so if you're understanding
197:19 be required so if you're understanding of that you can hit no on this screen
197:21 of that you can hit no on this screen and that's perfectly okay security best
197:23 and that's perfectly okay security best practice to just to hit no I'm going to
197:26 practice to just to hit no I'm going to hit yes because I feel comfortable
197:27 hit yes because I feel comfortable running as root I'm the only user on
197:29 running as root I'm the only user on this machine and I don't have any
197:31 this machine and I don't have any accountability or repudiation to worry
197:33 accountability or repudiation to worry about so I'm going to give a new
197:35 about so I'm going to give a new password for this
197:41 and I'm going to enter it again and now it's going to ask if we want to
197:43 and now it's going to ask if we want to copy everything over from our Cali
197:45 copy everything over from our Cali folder into our root folder I'm going to
197:47 folder into our root folder I'm going to say no
197:53 and now it's going to continue on installing so we're going to let this
197:55 installing so we're going to let this run again go ahead and pause the video
197:57 run again go ahead and pause the video if you need to and then we'll meet you
197:59 if you need to and then we'll meet you back when this is all said and done
198:03 back when this is all said and done okay and when everything is said and
198:05 okay and when everything is said and done which it took about 10 minutes to
198:07 done which it took about 10 minutes to get through all that you should get to
198:09 get through all that you should get to this all done happy hacking screen right
198:12 this all done happy hacking screen right here and everything should be installed
198:14 here and everything should be installed for you if you chose to go the root
198:17 for you if you chose to go the root route that's a weird thing to say if you
198:19 route that's a weird thing to say if you chose to go the root route you can log
198:21 chose to go the root route you can log out and log back in as root and begin
198:24 out and log back in as root and begin using Linux as root otherwise you can
198:27 using Linux as root otherwise you can continue on with this lesson using Cali
198:30 continue on with this lesson using Cali as your main user so we're going to go
198:32 as your main user so we're going to go ahead and move on to the next video
198:40 last video in the section and this is going to be one of my favorites so what
198:43 going to be one of my favorites so what we're going to be talking about is
198:44 we're going to be talking about is scripting with bash I'm going to show
198:47 scripting with bash I'm going to show you some cool tricks that we can do to
198:49 you some cool tricks that we can do to kind of narrow down some of the results
198:51 kind of narrow down some of the results that we get and then I'm going to show
198:53 that we get and then I'm going to show you how you can automate some of that
198:54 you how you can automate some of that process and we'll take that and even
198:56 process and we'll take that and even write out some for loops and one line
198:58 write out some for loops and one line Loops which this might not make any
199:01 Loops which this might not make any sense right now and that's absolutely
199:02 sense right now and that's absolutely okay but by the time the video is done
199:04 okay but by the time the video is done hopefully it does so the first thing I
199:07 hopefully it does so the first thing I want to show you is I want to show you
199:08 want to show you is I want to show you how we're going to write a ping sweep so
199:12 how we're going to write a ping sweep so we're going to write a pink sweeper
199:13 we're going to write a pink sweeper basically we're going to go out and say
199:14 basically we're going to go out and say I want to Ping a device if that device
199:16 I want to Ping a device if that device is alive go ahead and show me that
199:18 is alive go ahead and show me that result and we're going to sweep an
199:20 result and we're going to sweep an entire network
199:21 entire network so what we're going to do first is we're
199:23 so what we're going to do first is we're going to identify a device that's alive
199:25 going to identify a device that's alive so we can test this out and then build
199:27 so we can test this out and then build upon that so you can go ahead and type
199:29 upon that so you can go ahead and type in ifconfig
199:31 in ifconfig and then just hit enter
199:33 and then just hit enter now my ethernet here is on a netted
199:37 now my ethernet here is on a netted Network so I'm running through a
199:40 Network so I'm running through a different IP address subnet here so this
199:43 different IP address subnet here so this one is 192.168 57 150 my actual IP
199:47 one is 192.168 57 150 my actual IP address is on a dot four dot X here so
199:52 address is on a dot four dot X here so I'm going to for this example I'm going
199:55 I'm going to for this example I'm going to be pinging
200:02 192.168.4.29 however and you can see here's the Ping that we're getting back
200:03 here's the Ping that we're getting back however if you are unsure of a IP
200:08 however if you are unsure of a IP address in your house that is active or
200:10 address in your house that is active or your Subnet in your house that's okay
200:12 your Subnet in your house that's okay you can just run 57.1 for this example
200:15 you can just run 57.1 for this example you might not get a lot of return
200:17 you might not get a lot of return results however you might only get one
200:19 results however you might only get one or two when we do this sweep so I advise
200:22 or two when we do this sweep so I advise you to figure out what your IP address
200:23 you to figure out what your IP address is that's a good challenge anyway and if
200:26 is that's a good challenge anyway and if you are familiar with networking which
200:27 you are familiar with networking which you should be at this point then you
200:29 you should be at this point then you should be able to determine the IP
200:30 should be able to determine the IP address of your home network but if you
200:32 address of your home network but if you do not do that then you can use 57.1 or
200:36 do not do that then you can use 57.1 or whatever your IP address is here on this
200:37 whatever your IP address is here on this third octet so that will also work if
200:40 third octet so that will also work if you see that
200:41 you see that all right so I'm going to clear this now
200:43 all right so I'm going to clear this now what are we noticing when we're pinging
200:46 what are we noticing when we're pinging we're pinging this address and we're
200:47 we're pinging this address and we're getting some data back now if we ping an
200:50 getting some data back now if we ping an active address you can see that we get
200:52 active address you can see that we get okay 64 bytes from 192 1684.29 it's
200:56 okay 64 bytes from 192 1684.29 it's saying it's active we're getting details
200:58 saying it's active we're getting details back if we were to Ping something let me
201:01 back if we were to Ping something let me do like 41.
201:03 do like 41. where we just don't get any data back
201:06 where we just don't get any data back okay and let's try this one more time
201:08 okay and let's try this one more time let's try this a different way let's do
201:09 let's try this a different way let's do like a count of one dash C of one we'll
201:11 like a count of one dash C of one we'll do a count of one
201:13 do a count of one it's going to try to send one packet
201:14 it's going to try to send one packet over and see if it works nothing's
201:17 over and see if it works nothing's happening right it's trying to transmit
201:19 happening right it's trying to transmit that packet you could see that it's
201:21 that packet you could see that it's getting zero received here where here is
201:23 getting zero received here where here is getting four received no data is coming
201:25 getting four received no data is coming back it's just not doing anything for us
201:27 back it's just not doing anything for us so the thing that we can identify here
201:30 so the thing that we can identify here is what's the big difference if we look
201:32 is what's the big difference if we look at line one and two versus line one and
201:37 at line one and two versus line one and two what are we seeing when we get data
201:39 two what are we seeing when we get data back well the big difference here is
201:41 back well the big difference here is we're well two of them I guess we see
201:43 we're well two of them I guess we see that we get this response right that's a
201:45 that we get this response right that's a big difference and then down here it'll
201:47 big difference and then down here it'll say hey we received some packets if it's
201:49 say hey we received some packets if it's not zero now the easy way to do this is
201:52 not zero now the easy way to do this is to look at a line that says hey we
201:54 to look at a line that says hey we receive data which is this line here
201:56 receive data which is this line here okay now what I want to do is I want to
201:59 okay now what I want to do is I want to narrow this down just a little bit what
202:01 narrow this down just a little bit what we're going to say is we're just going
202:02 we're going to say is we're just going to do a ping of one time so I'm going to
202:05 to do a ping of one time so I'm going to clear this I'm going to bring it back to
202:07 clear this I'm going to bring it back to this like this
202:08 this like this I'm gonna do a count of one
202:10 I'm gonna do a count of one and that should just ping once and
202:12 and that should just ping once and that's perfect we don't need to Ping
202:13 that's perfect we don't need to Ping endlessly we just want to make sure we
202:15 endlessly we just want to make sure we can ping once and then we're done okay
202:17 can ping once and then we're done okay and then from here I'm gonna put this
202:18 and then from here I'm gonna put this into a text file I'm just going to call
202:20 into a text file I'm just going to call this ip.txt just like that
202:23 this ip.txt just like that so when I cat out ip.txt
202:26 so when I cat out ip.txt now you can see that I have this file
202:29 now you can see that I have this file it's stored I don't have to run the
202:30 it's stored I don't have to run the command again we're good to go so what
202:33 command again we're good to go so what we're going to do now is we can take
202:34 we're going to do now is we can take this and then we can start Gathering
202:36 this and then we can start Gathering data based off of what we see here
202:39 data based off of what we see here so what I want to do
202:41 so what I want to do is I want to just extract this one line
202:44 is I want to just extract this one line here the 64 bytes from 192
202:47 here the 64 bytes from 192 168.4.29 and the best way to do that is
202:51 168.4.29 and the best way to do that is with a command called grep so grep is
202:54 with a command called grep so grep is going to look for a specific term or
202:57 going to look for a specific term or phrase and we can do that and it's going
202:59 phrase and we can do that and it's going to pull down any line that has that term
203:01 to pull down any line that has that term or phrase so if I say grep here and then
203:04 or phrase so if I say grep here and then I just put in quotation 64 bytes like
203:07 I just put in quotation 64 bytes like this
203:09 this now when I cut out this all I'm pulling
203:11 now when I cut out this all I'm pulling down is this line and it's even
203:13 down is this line and it's even highlighting it for us it's saying
203:14 highlighting it for us it's saying here's the line that we see 64 bytes
203:16 here's the line that we see 64 bytes from 192.168 Okay so we've extracted
203:19 from 192.168 Okay so we've extracted just the one line and why am I
203:21 just the one line and why am I extracting this line well if we're
203:22 extracting this line well if we're building out a ping sweeper what I want
203:25 building out a ping sweeper what I want to do is I want to sweep every single IP
203:28 to do is I want to sweep every single IP within a specific subnet so say this dot
203:32 within a specific subnet so say this dot four right I want to Ping
203:35 four right I want to Ping 4.1.2.3 all the way through 254 255. I
203:40 4.1.2.3 all the way through 254 255. I want to see if I can get through all the
203:42 want to see if I can get through all the IP addresses in a subnet so what we're
203:45 IP addresses in a subnet so what we're going to do is we're going to Ping every
203:46 going to do is we're going to Ping every single one of them and say hey are you
203:48 single one of them and say hey are you you up are you there and we're going to
203:50 you up are you there and we're going to do it with a count of one and we're
203:52 do it with a count of one and we're going to say are you there okay and if
203:54 going to say are you there okay and if they're there they're going to say yeah
203:55 they're there they're going to say yeah I'm here 64 bytes here's my response and
203:57 I'm here 64 bytes here's my response and it's going to say 64 bytes from this IP
204:00 it's going to say 64 bytes from this IP address so we want to extract the IP
204:02 address so we want to extract the IP addresses to say yeah we're alive that's
204:05 addresses to say yeah we're alive that's basically our goal here so when we run
204:07 basically our goal here so when we run this on a bigger scale which is what
204:09 this on a bigger scale which is what we're going to do we're going to need to
204:11 we're going to do we're going to need to grep out this information and extract
204:13 grep out this information and extract this information to where we only just
204:15 this information to where we only just get the IP address back
204:17 get the IP address back okay so what we're going to do now is
204:19 okay so what we're going to do now is we're going to start narrowing down and
204:21 we're going to start narrowing down and grabbing this IP address and then I'm
204:22 grabbing this IP address and then I'm going to show you how we're going to
204:23 going to show you how we're going to take this all in one instance and run it
204:27 take this all in one instance and run it and then extract IP addresses so from
204:29 and then extract IP addresses so from here what I want to do is I want to do
204:32 here what I want to do is I want to do another command so every time we pipe
204:35 another command so every time we pipe we're saying hey run this command then
204:37 we're saying hey run this command then with that command run this command then
204:40 with that command run this command then also run this command too so we're going
204:43 also run this command too so we're going to keep running this command on top of
204:45 to keep running this command on top of this to narrow things down so here's
204:47 this to narrow things down so here's what we're doing here we're going to run
204:49 what we're doing here we're going to run a command called cut
204:51 a command called cut and with cut we're going to say I want
204:53 and with cut we're going to say I want to cut something out of this we need to
204:55 to cut something out of this we need to provide it what is called a delimiter so
204:57 provide it what is called a delimiter so we do a Dash D like this
204:59 we do a Dash D like this and the delimiter I'm going to use is a
205:01 and the delimiter I'm going to use is a space
205:02 space and then I'm going to say Dash f for
205:04 and then I'm going to say Dash f for field and then I'm going to say 4.
205:07 field and then I'm going to say 4. okay what is this doing well it's saying
205:09 okay what is this doing well it's saying Hey I want to cut this line that you're
205:12 Hey I want to cut this line that you're getting back on a space so the delimiter
205:15 getting back on a space so the delimiter is a space so here's a space Here's a
205:17 is a space so here's a space Here's a space Here's a space and it says I want
205:20 space Here's a space and it says I want to count up to 4 to grab that data so
205:23 to count up to 4 to grab that data so one two three four right here so if we
205:28 one two three four right here so if we say 4 here like this we hit enter we're
205:31 say 4 here like this we hit enter we're grabbing that specific IP address
205:32 grabbing that specific IP address because we're doing it by spaces if we
205:36 because we're doing it by spaces if we did it on three what do you think we're
205:38 did it on three what do you think we're going to grab we're going to grab the
205:39 going to grab we're going to grab the word from so you can see here's from so
205:42 word from so you can see here's from so what I want to do is grab the IP so
205:44 what I want to do is grab the IP so we're going to use this cut just like
205:46 we're going to use this cut just like this use our delimiter and then get to
205:48 this use our delimiter and then get to the correct field position that we want
205:50 the correct field position that we want to grab the IP address
205:52 to grab the IP address all right so we've got the IP address
205:54 all right so we've got the IP address now there's only one thing wrong here
205:57 now there's only one thing wrong here with this IP address is that there is a
205:59 with this IP address is that there is a little colon on the end of it we just
206:01 little colon on the end of it we just want this without a colon at all we want
206:03 want this without a colon at all we want it just like this now there's a couple
206:05 it just like this now there's a couple ways we can do this we could use
206:06 ways we can do this we could use something called said said it's a little
206:08 something called said said it's a little bit complicated and a little bit
206:10 bit complicated and a little bit Advanced I would say for where we're at
206:11 Advanced I would say for where we're at right now
206:13 right now um so I'd rather teach you an easier way
206:14 um so I'd rather teach you an easier way to do this and that is called translate
206:17 to do this and that is called translate so with translate all we're going to do
206:19 so with translate all we're going to do is we're going to do one more pipe like
206:22 is we're going to do one more pipe like this and we're just going to say TR for
206:24 this and we're just going to say TR for translate a Dash D for a delimiter again
206:27 translate a Dash D for a delimiter again and then we're going to say we want to
206:28 and then we're going to say we want to get rid of this
206:31 get rid of this and that's it we're just getting rid of
206:32 and that's it we're just getting rid of this okay so if we run this one more
206:34 this okay so if we run this one more time
206:35 time now you can see that we've successfully
206:37 now you can see that we've successfully extracted this IP address out that's our
206:40 extracted this IP address out that's our goal that's all we wanted to do
206:42 goal that's all we wanted to do now how can we apply this to something
206:44 now how can we apply this to something bigger how can we make this part of a
206:46 bigger how can we make this part of a bigger script that is the question and
206:49 bigger script that is the question and we're going to do that so what I want
206:51 we're going to do that so what I want you to do is I just want you to copy
206:53 you to do is I just want you to copy this okay copy this entire line
206:56 this okay copy this entire line and we're going to go into a mouse pad
207:01 and we're going to go into a mouse pad so let's copy the selection and I'm
207:03 so let's copy the selection and I'm going to clear my screen I'm just going
207:04 going to clear my screen I'm just going to say mouse pad
207:05 to say mouse pad and we're going to call this ipsweep.sh
207:13 okay so this is going to be a bash script
207:14 script and I'm going to make this bigger
207:17 and I'm going to make this bigger and the first thing we're going to do
207:18 and the first thing we're going to do with our bash script is we have to
207:19 with our bash script is we have to declare that it's a batch script we're
207:22 declare that it's a batch script we're going to say hash bang right here
207:23 going to say hash bang right here shebang is what we'd call this forward
207:25 shebang is what we'd call this forward slash bin forward slash bash this allows
207:28 slash bin forward slash bash this allows the machine to know when we run this
207:31 the machine to know when we run this this allows bash to know hey we're
207:32 this allows bash to know hey we're calling this here's the location to bash
207:34 calling this here's the location to bash this is what we're running with the
207:35 this is what we're running with the script you're also going to see this
207:36 script you're also going to see this when we we use python as well you'll see
207:39 when we we use python as well you'll see the the Declaration hip here at the top
207:41 the the Declaration hip here at the top or when we're calling this out so I'm
207:43 or when we're calling this out so I'm going to go ahead and control s and save
207:45 going to go ahead and control s and save this that'll add some nice color to this
207:47 this that'll add some nice color to this so when we're coding this out we get to
207:49 so when we're coding this out we get to see in color I like that a lot I'm going
207:52 see in color I like that a lot I'm going to actually make this a little bit
207:53 to actually make this a little bit smaller and then make this like this
207:54 smaller and then make this like this here so we can get the whole picture
207:56 here so we can get the whole picture okay so what I want to do is I want to
207:59 okay so what I want to do is I want to paste in what we just wrote so I'm just
208:01 paste in what we just wrote so I'm just going to control V here and paste that
208:02 going to control V here and paste that in
208:03 in so
208:05 so we don't need to do a cat of an IP
208:08 we don't need to do a cat of an IP address here
208:09 address here in this instance instead we're going to
208:11 in this instance instead we're going to change this back we're going to Ping
208:12 change this back we're going to Ping remember we want to Ping every device in
208:15 remember we want to Ping every device in the network so we want to Ping say if
208:17 the network so we want to Ping say if we're pinging 192 1684 dot X okay we
208:22 we're pinging 192 1684 dot X okay we want to Ping that and we can leave this
208:24 want to Ping that and we can leave this like this for now don't worry about
208:26 like this for now don't worry about changing anything here this is just
208:27 changing anything here this is just going to be a placeholder we're going to
208:29 going to be a placeholder we're going to do a little bit of extra
208:31 do a little bit of extra syntax here to make this work so we're
208:35 syntax here to make this work so we're going to write what is called a for Loop
208:38 going to write what is called a for Loop so we're going to say 4 and I'll explain
208:41 so we're going to say 4 and I'll explain what this does here in a second you're
208:43 what this does here in a second you're also going to see this again when we get
208:44 also going to see this again when we get into python encoding and so you'll be
208:47 into python encoding and so you'll be able to understand more and more about
208:49 able to understand more and more about loops and what for Loops are while Loops
208:51 loops and what for Loops are while Loops Etc they're very very useful and very
208:53 Etc they're very very useful and very common in coding and scripting so I'm
208:55 common in coding and scripting so I'm going to say 4 IP in and then I'm going
208:59 going to say 4 IP in and then I'm going to say sequence
209:01 to say sequence 1 through 254.
209:03 1 through 254. now
209:04 now very important this character here is
209:07 very important this character here is not an apostrophe okay this is not an
209:09 not an apostrophe okay this is not an apostrophe
209:10 apostrophe this is the little line I don't know
209:13 this is the little line I don't know what it's called it's above the attilda
209:14 what it's called it's above the attilda next to your escape button on your
209:16 next to your escape button on your keyboard so it's this right here okay
209:18 keyboard so it's this right here okay it's like a backwards apostrophe almost
209:20 it's like a backwards apostrophe almost I'm sure there's a term for it I just
209:22 I'm sure there's a term for it I just don't know it uh so you come in here and
209:24 don't know it uh so you come in here and you say okay four IP address in sequence
209:27 you say okay four IP address in sequence one through 254 and I'm going to explain
209:30 one through 254 and I'm going to explain what all this does in a second I want
209:31 what all this does in a second I want you just to type this out for now I want
209:33 you just to type this out for now I want you to say do
209:36 you to say do all right and then I want you to come
209:38 all right and then I want you to come down here
209:39 down here and we're going to say Ampersand on this
209:42 and we're going to say Ampersand on this line and we're going to say done I'm
209:43 line and we're going to say done I'm going to explain what all this means
209:45 going to explain what all this means okay so this is a loop that we've just
209:48 okay so this is a loop that we've just created
209:49 created what we're saying is for the IP address
209:51 what we're saying is for the IP address and we're just declaring this this could
209:53 and we're just declaring this this could be Bob if you wanted to we're just I'm
209:55 be Bob if you wanted to we're just I'm just making it a name or a term that's
209:57 just making it a name or a term that's easy for us to remember so we're going
209:59 easy for us to remember so we're going to say for IP but if you want to call
210:01 to say for IP but if you want to call this Bob call Bob for IP in sequence 1
210:05 this Bob call Bob for IP in sequence 1 through 254. so what sequence is doing
210:07 through 254. so what sequence is doing is it's saying Hey I want to count
210:09 is it's saying Hey I want to count everything from 1 to 254. so one two
210:12 everything from 1 to 254. so one two three four five six seven eight all the
210:14 three four five six seven eight all the way to 254. this for Loop means I'm
210:17 way to 254. this for Loop means I'm going to do this every single time so
210:20 going to do this every single time so for IP in one for ipn2 for ipn3 we're
210:24 for IP in one for ipn2 for ipn3 we're going to run this command until we're
210:26 going to run this command until we're done so until this sequence has run up
210:28 done so until this sequence has run up 255 times it's done
210:32 255 times it's done okay and now we're going to say I want
210:34 okay and now we're going to say I want to do a count of
210:37 to do a count of dollar sign IP
210:39 dollar sign IP so what we're saying here is for IP in
210:42 so what we're saying here is for IP in sequence 1 through 254 go ahead and do a
210:45 sequence 1 through 254 go ahead and do a ping Dash C for a count of one 192.1684
210:49 ping Dash C for a count of one 192.1684 254 and here we're going to say dot
210:52 254 and here we're going to say dot 1.2.3 every time this Loops over and
210:55 1.2.3 every time this Loops over and over and over it's going to be
210:56 over and over it's going to be incrementing that number through this
210:58 incrementing that number through this sequence that's all we're doing this is
211:00 sequence that's all we're doing this is a basic Loop okay so we're going to keep
211:02 a basic Loop okay so we're going to keep going through and through and through
211:03 going through and through and through now this will work if you plugged in
211:06 now this will work if you plugged in your hard-coded IP address here this
211:09 your hard-coded IP address here this will absolutely work now we can improve
211:11 will absolutely work now we can improve this just a little bit if we want to so
211:14 this just a little bit if we want to so what's going on here is what we're going
211:16 what's going on here is what we're going to say is if we wanted to run this we
211:18 to say is if we wanted to run this we would just do dot forward slash and then
211:20 would just do dot forward slash and then I P Suite okay and this would work
211:23 I P Suite okay and this would work that's fine but we can make this a
211:25 that's fine but we can make this a little bit better from a coding
211:26 little bit better from a coding perspective we can come in here and we
211:28 perspective we can come in here and we can give this a dollar sign one
211:32 can give this a dollar sign one and that means argument one so what
211:35 and that means argument one so what we're saying here is I want to give an
211:37 we're saying here is I want to give an argument instead so if you want to be
211:40 argument instead so if you want to be technical this first dot forward slash
211:43 technical this first dot forward slash ipsweep.sh that is argument zero so you
211:47 ipsweep.sh that is argument zero so you can consider this dollar sign zero
211:49 can consider this dollar sign zero argument one would be what you type
211:51 argument one would be what you type after that so this would be argument one
211:53 after that so this would be argument one argument two
211:55 argument two Etc so in this case what we can do is we
211:57 Etc so in this case what we can do is we could say I want to run
211:59 could say I want to run 192.1684 like this and this will run the
212:03 192.1684 like this and this will run the dot 1.2.3 after it so you provide the
212:06 dot 1.2.3 after it so you provide the argument it places that here in argument
212:09 argument it places that here in argument one and then it does the rest for you so
212:13 one and then it does the rest for you so this way you can specify your network
212:15 this way you can specify your network and if you wanted to Ping multiple
212:16 and if you wanted to Ping multiple networks you don't have to come back in
212:18 networks you don't have to come back in here and keep changing this it just
212:20 here and keep changing this it just works so super easy this is a great
212:22 works so super easy this is a great little script for a slash 24 type subnet
212:26 little script for a slash 24 type subnet okay
212:28 okay okay so let's go ahead and try running
212:30 okay so let's go ahead and try running this really quick I'm going to just
212:31 this really quick I'm going to just control s save this I'm going to close
212:35 control s save this I'm going to close it we're going to do a CH mod plus X on
212:39 it we're going to do a CH mod plus X on ipsweep if it'll allow us to we might
212:42 ipsweep if it'll allow us to we might have to do a
212:44 have to do a okay let's do LS La real quick make sure
212:46 okay let's do LS La real quick make sure it worked
212:47 it worked it sure did okay so here's what we're
212:49 it sure did okay so here's what we're gonna do we're going to run the ipsweep
212:53 gonna do we're going to run the ipsweep and we're going to say
212:55 and we're going to say 192.168 you just put in your IP here I'm
212:58 192.168 you just put in your IP here I'm going to run that all right
213:01 going to run that all right and you can see all the devices that are
213:03 and you can see all the devices that are coming back within my network here
213:05 coming back within my network here I'm going to go ahead and hit Ctrl C
213:07 I'm going to go ahead and hit Ctrl C cancel this out
213:10 cancel this out and so this is grabbing all the
213:11 and so this is grabbing all the different devices in my network now
213:13 different devices in my network now that's great
213:14 that's great that works out really well but what we
213:17 that works out really well but what we can do is improve this what if I typed
213:19 can do is improve this what if I typed in a what if I didn't type anything at
213:21 in a what if I didn't type anything at all what if I just hit enter here now
213:23 all what if I just hit enter here now I'm just getting all kinds of pings
213:24 I'm just getting all kinds of pings unknown and it's going off of some of
213:27 unknown and it's going off of some of the stuff I was doing before but it just
213:29 the stuff I was doing before but it just causes all kinds of issues and errors
213:31 causes all kinds of issues and errors right so you can see I'm trying to hit
213:32 right so you can see I'm trying to hit Ctrl C it's it's taking its time to
213:34 Ctrl C it's it's taking its time to Break
213:35 Break um here we get issues because we're not
213:37 um here we get issues because we're not we're just allowing any sort of argument
213:39 we're just allowing any sort of argument here what we need to do is we need to
213:42 here what we need to do is we need to fix this up just a little bit so what we
213:44 fix this up just a little bit so what we can say is we can come back in here and
213:46 can say is we can come back in here and just go mouse pad ipsweep.sh
213:53 and come in here and let's add a little bit extra oh and I also left this in
213:55 bit extra oh and I also left this in here don't leave this in here that's why
213:57 here don't leave this in here that's why that was running twice
213:58 that was running twice um okay so what we're doing here is we
214:02 um okay so what we're doing here is we need to add in a statement what we're
214:04 need to add in a statement what we're going to do is we're going to add in a
214:05 going to do is we're going to add in a if statement if statements are
214:07 if statement if statements are conditions we're saying hey if this
214:09 conditions we're saying hey if this condition is met do something for us if
214:12 condition is met do something for us if it's not met then go ahead and do
214:15 it's not met then go ahead and do something else all right so we're going
214:18 something else all right so we're going to say
214:19 to say if
214:22 if and we're gonna just put in here dollar
214:24 and we're gonna just put in here dollar sign one
214:25 sign one is equal to nothing
214:29 is equal to nothing then we're gonna go ahead and just say
214:30 then we're gonna go ahead and just say then
214:32 then Echo
214:33 Echo you forgot and IP address
214:40 Echo syntax something like this we'll just
214:43 syntax something like this we'll just say
214:44 say IP
214:46 IP sweep.sh and we'll go
214:50 sweep.sh and we'll go 192.1684 like that
214:53 192.1684 like that okay
214:54 okay and then if we did do this correctly
214:59 and then if we did do this correctly if we do have an argument inside of
215:01 if we do have an argument inside of argument one then we're going to say
215:03 argument one then we're going to say else do all of this here
215:05 else do all of this here and be done and then we're going to end
215:07 and be done and then we're going to end our if statement with f i
215:09 our if statement with f i now this script or this resemblance of
215:13 now this script or this resemblance of this script is not one of my own by the
215:16 this script is not one of my own by the way this is goes credit to something
215:18 way this is goes credit to something I've modified over time but the original
215:20 I've modified over time but the original credit definitely goes to Georgia
215:21 credit definitely goes to Georgia Weidman I remember seeing this in her
215:24 Weidman I remember seeing this in her course a long long time ago when I was
215:26 course a long long time ago when I was first getting started and she did a
215:28 first getting started and she did a great job of teaching this this is just
215:29 great job of teaching this this is just a modification of this script so I just
215:31 a modification of this script so I just want to make sure that all credit goes
215:33 want to make sure that all credit goes to her but looking at this let's break
215:36 to her but looking at this let's break this down really quick before we run
215:37 this down really quick before we run this again we've got an if statement we
215:40 this again we've got an if statement we said if
215:41 said if argument one doesn't equal anything then
215:43 argument one doesn't equal anything then you're gonna Echo back out and say hey
215:46 you're gonna Echo back out and say hey you forgot an IP address here's the
215:48 you forgot an IP address here's the syntax
215:49 syntax if it does include something then we're
215:51 if it does include something then we're gonna go ahead and come in here and say
215:53 gonna go ahead and come in here and say let's run our for statement our for Loop
215:55 let's run our for statement our for Loop and run through it and then we're going
215:57 and run through it and then we're going to end our if here
215:58 to end our if here the only thing that I'm doing uniquely
216:00 the only thing that I'm doing uniquely here is I'm including this Ampersand
216:02 here is I'm including this Ampersand which is going to run this command
216:05 which is going to run this command um multiple times at once this is a good
216:07 um multiple times at once this is a good way to explain it basically we have a
216:10 way to explain it basically we have a couple ways of doing this we could say
216:12 couple ways of doing this we could say like this so we could put a command here
216:14 like this so we could put a command here and this will run one at a time it'll
216:16 and this will run one at a time it'll say okay four one four two four three
216:20 say okay four one four two four three this allows multiple instances of this
216:24 this allows multiple instances of this Loop to run at once and just speeds
216:25 Loop to run at once and just speeds things up I can show you the difference
216:27 things up I can show you the difference between that so I'm going to go ahead
216:28 between that so I'm going to go ahead and just Ctrl s save this
216:31 and just Ctrl s save this I'm going to go ahead and just run this
216:32 I'm going to go ahead and just run this script real quick now let's try running
216:34 script real quick now let's try running it with without anything here
216:36 it with without anything here okay now look it says you forgot an IP
216:38 okay now look it says you forgot an IP address so look we did that correctly
216:40 address so look we did that correctly now let's go ahead and add the 192.168.4
216:43 now let's go ahead and add the 192.168.4 run it and you can see okay it's
216:45 run it and you can see okay it's sweeping but it's taking its sweet time
216:48 sweeping but it's taking its sweet time especially for the IP addresses that are
216:51 especially for the IP addresses that are going to hang like
216:52 going to hang like um like if I don't have a DOT two or dot
216:54 um like if I don't have a DOT two or dot three it's going to take a while so I'm
216:56 three it's going to take a while so I'm going to control C and get out of this
216:58 going to control C and get out of this if it'll let me and it looks like it's
216:59 if it'll let me and it looks like it's actually going to hang so what we can do
217:01 actually going to hang so what we can do is we can come back in I'm going to open
217:03 is we can come back in I'm going to open a new tab real quick just while that's
217:04 a new tab real quick just while that's waiting and I'm just going to say mouse
217:06 waiting and I'm just going to say mouse pad and we're just going to go back into
217:09 pad and we're just going to go back into ipsweep dot sh fits in this folder there
217:13 ipsweep dot sh fits in this folder there we go okay
217:15 we go okay so from here I'm going to change this
217:17 so from here I'm going to change this back to the Ampersand and I'm going to
217:19 back to the Ampersand and I'm going to save it I just want you to see the
217:21 save it I just want you to see the difference really quick and why I run it
217:24 difference really quick and why I run it like this so ipsweep
217:32 .sh192168.4 you can see it's picking everything up really fast all right what
217:35 everything up really fast all right what I can do now is I can run this and then
217:38 I can do now is I can run this and then store this into like ips.txt something
217:41 store this into like ips.txt something like that just like found IP addresses
217:43 like that just like found IP addresses okay so now if I cat IPS dot txt I have
217:48 okay so now if I cat IPS dot txt I have all the IP addresses I just found and I
217:49 all the IP addresses I just found and I found them that fast
217:51 found them that fast versus this which may still be going and
217:54 versus this which may still be going and it is and I can't even kill I'm just
217:55 it is and I can't even kill I'm just going to close this out okay so this is
217:58 going to close this out okay so this is the big difference there with that
217:59 the big difference there with that Ampersand and the speed what it is
218:01 Ampersand and the speed what it is capable of doing so
218:03 capable of doing so with all that being said we could take
218:05 with all that being said we could take this and do one more thing so I want to
218:08 this and do one more thing so I want to show you how we can utilize a one-liner
218:12 show you how we can utilize a one-liner these are called one line statements in
218:15 these are called one line statements in um in bash and we can do similar to what
218:17 um in bash and we can do similar to what we just did and accomplish that in this
218:19 we just did and accomplish that in this command line so now we have an IP
218:21 command line so now we have an IP address we have a list of IP addresses
218:23 address we have a list of IP addresses let's say that we want to run nmap now
218:27 let's say that we want to run nmap now we haven't gotten to nmap yet you don't
218:29 we haven't gotten to nmap yet you don't need to really know about it just know
218:30 need to really know about it just know that it is a tool that allows us to go
218:33 that it is a tool that allows us to go out and do Port scanning okay so
218:36 out and do Port scanning okay so typically we would just say something
218:37 typically we would just say something like nmap and we might do something like
218:40 like nmap and we might do something like uh Dash T4 Dash a dash p dash like this
218:45 uh Dash T4 Dash a dash p dash like this this is just saying I want to run a map
218:48 this is just saying I want to run a map scan I want to look at everything and I
218:49 scan I want to look at everything and I want to scan all ports this is just an
218:51 want to scan all ports this is just an example you can just run mmap IP address
218:53 example you can just run mmap IP address like this and that would be fine too
218:56 like this and that would be fine too like we could just go 192.168 4.29 and
219:00 like we could just go 192.168 4.29 and we'll do a quick M map scan okay but
219:03 we'll do a quick M map scan okay but what we can't do here is we can't just
219:05 what we can't do here is we can't just say hey I want to run uh well we could
219:08 say hey I want to run uh well we could we could say I want to run nmap for
219:10 we could say I want to run nmap for everything in dot zero 24.
219:14 everything in dot zero 24. the issue is it's going to take time
219:16 the issue is it's going to take time looking and finding what IP addresses
219:19 looking and finding what IP addresses are valid here if we have a list we can
219:21 are valid here if we have a list we can automate this process quite a bit we can
219:24 automate this process quite a bit we can just come in here and we can say
219:26 just come in here and we can say something a little bit different we can
219:27 something a little bit different we can say hey for IP we're using the same kind
219:31 say hey for IP we're using the same kind of syntax in dollar sign and we're going
219:35 of syntax in dollar sign and we're going to put parentheses here we're going to
219:36 to put parentheses here we're going to say cat
219:38 say cat and then we're going to say ips.txt
219:41 and then we're going to say ips.txt and then we're just going to do this
219:43 and then we're just going to do this we're going to say do and map
219:46 we're going to say do and map dollar sign IP and then again we have
219:50 dollar sign IP and then again we have the option of doing done or we can do
219:53 the option of doing done or we can do Ampersand done just like this okay I'm
219:57 Ampersand done just like this okay I'm just going to do done here as an example
219:59 just going to do done here as an example and just show you so this is really easy
220:01 and just show you so this is really easy we're saying hey for every IP address in
220:04 we're saying hey for every IP address in this list and all we're doing is we're
220:06 this list and all we're doing is we're cutting out this IP list that we just
220:07 cutting out this IP list that we just had so it's going to take the first IP
220:10 had so it's going to take the first IP then run the M Maps again it's going to
220:12 then run the M Maps again it's going to come back run the next one so until this
220:13 come back run the next one so until this list is completely done it's going to
220:15 list is completely done it's going to keep going through this Loop that's all
220:17 keep going through this Loop that's all it is a simple Loop then we're going to
220:19 it is a simple Loop then we're going to say done it's going to take that IP
220:21 say done it's going to take that IP address it's going to start scanning it
220:22 address it's going to start scanning it it's going to go through and hopefully
220:25 it's going to go through and hopefully find information and go in a loop so
220:28 find information and go in a loop so this is a quick way to automate some of
220:29 this is a quick way to automate some of this process I actually do this with a
220:31 this process I actually do this with a lot of my scripts where I will do some
220:33 lot of my scripts where I will do some probing see if anything is out there
220:35 probing see if anything is out there that's alive put it into an IP file and
220:38 that's alive put it into an IP file and you're going to see this later in the
220:39 you're going to see this later in the course and then nmap scan that
220:41 course and then nmap scan that so think about this hopefully this gets
220:44 so think about this hopefully this gets your wheels spinning on what you can do
220:46 your wheels spinning on what you can do to really start scripting some of this
220:49 to really start scripting some of this stuff out and this is going to be the
220:50 stuff out and this is going to be the first time you get your hands dirty with
220:52 first time you get your hands dirty with scripting we're going to go on again
220:54 scripting we're going to go on again with this and we're going to get more
220:56 with this and we're going to get more advanced as we go but this should be a
220:58 advanced as we go but this should be a good introductory lesson to you on how
221:00 good introductory lesson to you on how we can build a simple tool and automate
221:02 we can build a simple tool and automate a lot of this process fairly easily with
221:05 a lot of this process fairly easily with just a little bit of command line syntax
221:07 just a little bit of command line syntax so we're going to go ahead and move on
221:09 so we're going to go ahead and move on to the next section and I will see you
221:11 to the next section and I will see you over there
221:19 welcome to this module on python so if you've never used python before or even
221:21 you've never used python before or even heard of python before python is a
221:24 heard of python before python is a coding and scripting language it is
221:27 coding and scripting language it is commonly used in ethical hacking and
221:30 commonly used in ethical hacking and it's commonly used all around the world
221:31 it's commonly used all around the world it is actually considered one of the
221:33 it is actually considered one of the best beginner languages to start with if
221:36 best beginner languages to start with if you've never learned coding before so
221:38 you've never learned coding before so that's exactly what we're going to do
221:40 that's exactly what we're going to do we're going to cover some of the basics
221:42 we're going to cover some of the basics of python so we'll cover everything you
221:45 of python so we'll cover everything you see on this screen here strings math
221:48 see on this screen here strings math functions we're going to get into
221:50 functions we're going to get into conditional statements and looping we'll
221:53 conditional statements and looping we'll get into some more advanced items and
221:55 get into some more advanced items and eventually we're going to build our own
221:57 eventually we're going to build our own tools so we're going to be building a
222:00 tools so we're going to be building a port scanner at the end of the lesson
222:03 port scanner at the end of the lesson and then when we get into the exploit
222:05 and then when we get into the exploit development section of this course we're
222:07 development section of this course we're going to use Python again to write our
222:09 going to use Python again to write our own exploits so it's going to be used
222:12 own exploits so it's going to be used throughout the course you're going to
222:13 throughout the course you're going to see it again as a ethical hacker as well
222:16 see it again as a ethical hacker as well well you're going to go on to websites
222:18 well you're going to go on to websites and you might need to download python
222:20 and you might need to download python code or something to utilize against a
222:23 code or something to utilize against a host or a client and it's just going to
222:26 host or a client and it's just going to be frequently seen for you so very
222:29 be frequently seen for you so very important topic to cover especially for
222:31 important topic to cover especially for the foundations one very big thing to
222:34 the foundations one very big thing to point out you do not have to be a
222:37 point out you do not have to be a developer to be successful in
222:39 developer to be successful in penetration testing the important thing
222:42 penetration testing the important thing is that you understand what you're
222:43 is that you understand what you're seeing and understand how to read code
222:45 seeing and understand how to read code if when you come away from this module
222:48 if when you come away from this module you have a better understanding on how
222:50 you have a better understanding on how to read what you are seeing in code
222:53 to read what you are seeing in code you'll be much better off by no means do
222:56 you'll be much better off by no means do you have to be a developer I am still to
222:58 you have to be a developer I am still to this day nowhere near a developer level
223:01 this day nowhere near a developer level and I'm very very successful in what I
223:03 and I'm very very successful in what I do you don't have to be a developer so
223:06 do you don't have to be a developer so the big takeaway here is to take very
223:08 the big takeaway here is to take very good notes understand what you're seeing
223:10 good notes understand what you're seeing if you need to watch a video multiple
223:12 if you need to watch a video multiple times in this section absolutely okay
223:15 times in this section absolutely okay just make sure you understand everything
223:17 just make sure you understand everything in front of you and understand that the
223:20 in front of you and understand that the lessons are going to build upon each
223:21 lessons are going to build upon each other and it should all come together in
223:23 other and it should all come together in the end and you're going to get to see
223:25 the end and you're going to get to see it over and over through the course
223:26 it over and over through the course especially in the exploit development
223:28 especially in the exploit development section where we write our own python
223:29 section where we write our own python script so I look forward to teaching you
223:31 script so I look forward to teaching you this module on Python and look forward
223:34 this module on Python and look forward to seeing you in the next video
223:43 okay on to our first lesson the first thing that we're going to cover is going
223:46 thing that we're going to cover is going to be strings
223:48 to be strings and in order to do that I'm going to go
223:50 and in order to do that I'm going to go ahead and make a directory on my Linux
223:52 ahead and make a directory on my Linux machine you can make a folder in your
223:55 machine you can make a folder in your Mac or your Windows machine if you're
223:57 Mac or your Windows machine if you're using those operating systems I'm just
224:00 using those operating systems I'm just going to go in here and just say make
224:01 going to go in here and just say make dirt Python and then I'm going to go
224:04 dirt Python and then I'm going to go ahead and go into that directory
224:07 ahead and go into that directory so from here I'm going to go ahead and
224:09 so from here I'm going to go ahead and make my first script so I'm going to
224:13 make my first script so I'm going to clear my screen with Ctrl l
224:15 clear my screen with Ctrl l and I'm going to say mouse pad
224:20 and I'm going to say mouse pad and I'm just going to call this script
224:22 and I'm just going to call this script first dot pi and I'm going to give it
224:25 first dot pi and I'm going to give it the Ampersand here at the end that's
224:27 the Ampersand here at the end that's just going to allow me to open up this
224:29 just going to allow me to open up this process of mouse pad and also have the
224:33 process of mouse pad and also have the terminal available to me when I need it
224:36 terminal available to me when I need it so you'll see why I do that here in a
224:38 so you'll see why I do that here in a little bit now if you're not on Linux
224:40 little bit now if you're not on Linux that's okay you can use something like
224:42 that's okay you can use something like notepad plus plus or code runner for Mac
224:46 notepad plus plus or code runner for Mac which we showed earlier in this course
224:48 which we showed earlier in this course so from here what I'm going to do is I'm
224:51 so from here what I'm going to do is I'm going to go ahead and enter in a shebang
224:55 going to go ahead and enter in a shebang which is a hash an exclamation forward
224:59 which is a hash an exclamation forward slash bin or slash python3
225:02 slash bin or slash python3 and this is important for Linux here
225:06 and this is important for Linux here because we are calling out the directory
225:08 because we are calling out the directory if you are familiar with Linux What's
225:11 if you are familiar with Linux What's Happening Here is we have two options we
225:14 Happening Here is we have two options we can come in here and we can say
225:16 can come in here and we can say python3 and we can say first.pi and
225:19 python3 and we can say first.pi and that'll execute our script or in theory
225:21 that'll execute our script or in theory we can come in here we can just do a DOT
225:23 we can come in here we can just do a DOT forward slash first dot pi and run it
225:26 forward slash first dot pi and run it that way if we run it like this our
225:30 that way if we run it like this our script will not know where to go unless
225:32 script will not know where to go unless we declare that so up here we're giving
225:34 we declare that so up here we're giving the shebang forward slash bin forward
225:36 the shebang forward slash bin forward slash python3 that is where python3 is
225:39 slash python3 that is where python3 is located in this machine so it will come
225:41 located in this machine so it will come up here and it will look for this first
225:43 up here and it will look for this first and say okay I'm going to execute this
225:46 and say okay I'm going to execute this based on python 3. so that is a little
225:48 based on python 3. so that is a little bit of a Linux Nuance here and something
225:50 bit of a Linux Nuance here and something you should know in case you are ever
225:52 you should know in case you are ever coding in Linux or an environment that
225:54 coding in Linux or an environment that is similar like Unix which Macs do run
225:57 is similar like Unix which Macs do run off of so from here if you've ever taken
226:00 off of so from here if you've ever taken a coding class the first thing you do in
226:03 a coding class the first thing you do in every single coding class is what is
226:05 every single coding class is what is known as hello world so we're going to
226:08 known as hello world so we're going to print out hello world and print it to
226:11 print out hello world and print it to our terminal so in order to do that
226:14 our terminal so in order to do that we're going to go ahead and do some
226:16 we're going to go ahead and do some thing like this we're going to say print
226:18 thing like this we're going to say print and then we'll do a parenthesis and
226:20 and then we'll do a parenthesis and we'll say hello
226:28 I'm gonna go ahead and save this and if we run this and I'm going to run
226:31 and if we run this and I'm going to run this with python3 if we run this python3
226:33 this with python3 if we run this python3 first.pi
226:36 first.pi you'll see that it says hello world
226:39 you'll see that it says hello world now one thing that we can do in here
226:41 now one thing that we can do in here is good practice for being a developer
226:44 is good practice for being a developer is add some notes in so we're going to
226:46 is add some notes in so we're going to add a comment in here we're going to do
226:49 add a comment in here we're going to do a
226:50 a #or a pound symbol and we're just going
226:53 #or a pound symbol and we're just going to say print string
226:55 to say print string now when we run this again this isn't
226:58 now when we run this again this isn't going to print out comments are just for
227:00 going to print out comments are just for us inside of the script and I can prove
227:02 us inside of the script and I can prove that to you by Saving this and running
227:03 that to you by Saving this and running it again you'll see all we have in here
227:06 it again you'll see all we have in here is Hello World perfect
227:09 is Hello World perfect so comments
227:10 so comments with a hash are just meant for whoever
227:13 with a hash are just meant for whoever is reading your script or your code and
227:17 is reading your script or your code and that could be you or
227:19 that could be you or bad scenario but what if you get hit by
227:21 bad scenario but what if you get hit by a bus tomorrow you're the main developer
227:24 a bus tomorrow you're the main developer and nobody knows how to read your code
227:26 and nobody knows how to read your code because you didn't leave any comments
227:27 because you didn't leave any comments that'd be very bad so good coding
227:30 that'd be very bad so good coding practice suggests to leave good comments
227:32 practice suggests to leave good comments and make sure that people can come in
227:34 and make sure that people can come in and read your code and understand what
227:36 and read your code and understand what is going on in here so we're going to
227:38 is going on in here so we're going to add comments along the way so that way
227:39 add comments along the way so that way we understand what we're doing and
227:41 we understand what we're doing and practice good habits as well so what
227:43 practice good habits as well so what you're seeing here is what's called a
227:44 you're seeing here is what's called a string you're seeing a string in
227:47 string you're seeing a string in quotations and you can see a string
227:50 quotations and you can see a string printed out
227:52 printed out with single quotes as well so we can
227:54 with single quotes as well so we can just do hello world
227:56 just do hello world I'll add the exclamation for consistency
227:58 I'll add the exclamation for consistency and if we save this and print this
228:00 and if we save this and print this you'll see that it also prints
228:03 you'll see that it also prints hello world
228:04 hello world so it really doesn't matter if you have
228:06 so it really doesn't matter if you have single quotes or double quotes until we
228:08 single quotes or double quotes until we get into more advanced strings and we'll
228:10 get into more advanced strings and we'll talk about those a little bit later on
228:13 talk about those a little bit later on in the course but for now just know that
228:15 in the course but for now just know that you can use single quotes or double
228:17 you can use single quotes or double quotes when printing out a string
228:19 quotes when printing out a string another thing that we can do with
228:20 another thing that we can do with strings is print on multiple lines so if
228:23 strings is print on multiple lines so if we say print
228:24 we say print and we do triple quotes like this we say
228:29 and we do triple quotes like this we say this string runs and then we hit enter
228:33 this string runs and then we hit enter multiple lines with an exclamation and
228:36 multiple lines with an exclamation and and add in three more double quotes
228:38 and add in three more double quotes there and close this off
228:41 there and close this off we can add a note here as well that says
228:43 we can add a note here as well that says triple quote for multi-line
228:47 triple quote for multi-line and if we save this with Ctrl s and we
228:49 and if we save this with Ctrl s and we run this again
228:51 run this again you're going to see this string runs
228:53 you're going to see this string runs multiple lines awesome another thing
228:56 multiple lines awesome another thing that we can do is concatenate strings so
228:59 that we can do is concatenate strings so we can print out something like
229:02 we can print out something like this string
229:04 this string is and now we're going to add a space at
229:07 is and now we're going to add a space at the end of it make sure you have a space
229:08 the end of it make sure you have a space right here
229:09 right here we're going to do a plus sign and then
229:11 we're going to do a plus sign and then we're going to say awesome
229:14 we're going to say awesome just like that and we can say we can
229:17 just like that and we can say we can also concat innate
229:20 also concat innate it's always hard for me to spell that so
229:22 it's always hard for me to spell that so what's going to happen here is it's
229:24 what's going to happen here is it's going to take this string
229:26 going to take this string plus this string when it prints out so
229:29 plus this string when it prints out so the reason we have a space is it's got
229:31 the reason we have a space is it's got to have the space because there's no
229:32 to have the space because there's no space here and this will just add a
229:34 space here and this will just add a space for us even though in our heads we
229:36 space for us even though in our heads we might want it to so we're going to go
229:38 might want it to so we're going to go ahead and save this print it out one
229:40 ahead and save this print it out one more time
229:41 more time and you can see that it concatenated and
229:43 and you can see that it concatenated and said this string is awesome
229:45 said this string is awesome now one last thing
229:49 now one last thing we can also print out a new line so we
229:52 we can also print out a new line so we can just do something like this
229:55 can just do something like this and we can use a single quote this time
229:57 and we can use a single quote this time just to do a proof of concept do a
230:00 just to do a proof of concept do a backslash n like this
230:03 backslash n like this and this will print out a new line
230:06 and this will print out a new line and we'll get familiar with that later
230:08 and we'll get familiar with that later on as we get into functions we'll write
230:10 on as we get into functions we'll write our own function to make a new line but
230:13 our own function to make a new line but for now if we wanted to add another line
230:15 for now if we wanted to add another line we could and then we can just print
230:18 we could and then we can just print test that new line out
230:25 and let's see if it actually gave us a line printed in between this
230:27 line printed in between this concatenation and this new print
230:29 concatenation and this new print statement here let's go ahead and save
230:31 statement here let's go ahead and save that
230:32 that print it and you can see there is a line
230:35 print it and you can see there is a line here so the backslash n will print out a
230:40 here so the backslash n will print out a new line for us
230:42 new line for us and that is all we need to know for
230:44 and that is all we need to know for basic string so we're going to go ahead
230:45 basic string so we're going to go ahead and move on to math you can go ahead and
230:48 and move on to math you can go ahead and leave this open we're going to run
230:50 leave this open we're going to run through this as we go and then you'll
230:52 through this as we go and then you'll have a long script which will also make
230:55 have a long script which will also make for very good notes let's go ahead and
230:58 for very good notes let's go ahead and move on to math
231:01 move on to math so math
231:02 so math python actually has a built-in math
231:06 python actually has a built-in math interpreter
231:08 interpreter so we can do a bunch of fun stuff with
231:10 so we can do a bunch of fun stuff with python and with math that's
231:13 python and with math that's automatically built in so I'm going to
231:16 automatically built in so I'm going to go ahead and just call this section math
231:19 go ahead and just call this section math and if you want to like keep track of
231:21 and if you want to like keep track of sections you can come up here and just
231:22 sections you can come up here and just call this strings
231:24 call this strings and just capitalize it like that and
231:26 and just capitalize it like that and then that way we kind of have an idea of
231:28 then that way we kind of have an idea of where we're at you can even add an extra
231:30 where we're at you can even add an extra line here if we want to so from here
231:34 line here if we want to so from here let's go ahead and play around with math
231:36 let's go ahead and play around with math just a little bit so if I wanted to do a
231:40 just a little bit so if I wanted to do a print of 50 plus 50
231:43 print of 50 plus 50 we can definitely add
231:45 we can definitely add we can also subtract so if you want to
231:49 we can also subtract so if you want to do 50 minus 50 you could do that
231:51 do 50 minus 50 you could do that and I'll give you some time to catch up
231:53 and I'll give you some time to catch up here in just a second
231:55 here in just a second I'm just going to do a few print
231:56 I'm just going to do a few print statements then we'll take a look at
231:58 statements then we'll take a look at them and then we'll move on to some more
232:00 them and then we'll move on to some more math as well we can also do 50 times 50.
232:03 math as well we can also do 50 times 50. and we'll just use the little star or
232:06 and we'll just use the little star or the asterisks we'll just say multiply
232:09 the asterisks we'll just say multiply and we'll also do 50 divided by 50.
232:14 and we'll also do 50 divided by 50. we'll just say divide
232:20 so if we save that you could take a second to catch up you could see we are
232:22 second to catch up you could see we are just doing Simple Math here we should
232:24 just doing Simple Math here we should expect 100 we should expect zero we
232:27 expect 100 we should expect zero we should expect one here and 2500 if my
232:30 should expect one here and 2500 if my math is mental math is correct so I'm
232:33 math is mental math is correct so I'm going to go ahead and print this out
232:42 okay we've got 100 0 2500 and 1.0 so this 1.0 is a little bit different this
232:45 this 1.0 is a little bit different this is what's known as a float everything
232:48 is what's known as a float everything else that is come out so far is just an
232:51 else that is come out so far is just an integer and we'll talk a little bit
232:53 integer and we'll talk a little bit about that here in just a few minutes
232:55 about that here in just a few minutes but know that integers are on the left
232:58 but know that integers are on the left hand side and if we don't have a decimal
233:01 hand side and if we don't have a decimal point here we're looking at integers and
233:03 point here we're looking at integers and on the right hand side when we see
233:05 on the right hand side when we see anything on the right hand side of the
233:06 anything on the right hand side of the decimal we're looking at what is called
233:08 decimal we're looking at what is called a float and that becomes very important
233:10 a float and that becomes very important depending on when we need it
233:13 depending on when we need it for now we're going to keep worrying
233:15 for now we're going to keep worrying about math we'll get into integers and
233:17 about math we'll get into integers and floats in just a little bit
233:19 floats in just a little bit so another thing that math built into
233:22 so another thing that math built into python can do
233:23 python can do is it can do PEMDAS if you've never
233:26 is it can do PEMDAS if you've never heard of PEMDAS please excuse my dear
233:29 heard of PEMDAS please excuse my dear Aunt Sally so parentheses exponents
233:33 Aunt Sally so parentheses exponents multiply divide add subtract
233:36 multiply divide add subtract you may have had it something different
233:38 you may have had it something different within your educational experience but
233:41 within your educational experience but it will do that for you so if you do 50
233:44 it will do that for you so if you do 50 plus 50 minus 50
233:46 plus 50 minus 50 times 50 divided by 50.
233:50 times 50 divided by 50. it will give you the answer
233:53 it will give you the answer I don't know that Mental Math off hand
233:56 I don't know that Mental Math off hand another thing that we can do are
233:58 another thing that we can do are exponents so we can print say 50 to the
234:03 exponents so we can print say 50 to the second power which is same thing as 50
234:06 second power which is same thing as 50 times 50 which would be 2500 as well and
234:09 times 50 which would be 2500 as well and we can get exponents out of this
234:12 we can get exponents out of this and we'll actually go ahead and save
234:15 and we'll actually go ahead and save this and run this here because the next
234:17 this and run this here because the next step I want to be able to lay out
234:18 step I want to be able to lay out clearly
234:19 clearly you can see that we have successfully
234:22 you can see that we have successfully done the math here and did it for us
234:24 done the math here and did it for us awesome and it also did the exponent for
234:27 awesome and it also did the exponent for us as well
234:29 us as well so now a couple weird things with the
234:32 so now a couple weird things with the vision so you saw the 1.0 before
234:35 vision so you saw the 1.0 before well we have a few things that we can do
234:37 well we have a few things that we can do for example the 50 divided by 6 but
234:41 for example the 50 divided by 6 but using a percentage sign is what's called
234:45 using a percentage sign is what's called a medullo
234:48 a medullo and that it just takes what is left over
234:53 and that it just takes what is left over so 50 divided by 6 is not divisible
234:57 so 50 divided by 6 is not divisible there is a leftover so if we print that
235:00 there is a leftover so if we print that you'll see we get a leftover of two
235:02 you'll see we get a leftover of two which makes sense because 6 goes into 58
235:06 which makes sense because 6 goes into 58 times 6 times 8 is 48 and then we have 2
235:09 times 6 times 8 is 48 and then we have 2 left over so if we want to know what the
235:11 left over so if we want to know what the remainder is we can use a percentage
235:14 remainder is we can use a percentage sign here
235:16 sign here we can also do something like 50 divided
235:19 we can also do something like 50 divided by 6 like we saw earlier and this will
235:22 by 6 like we saw earlier and this will have division with remainder
235:26 have division with remainder so we can say or or float
235:31 so we can say or or float we'll save that and take a look at that
235:33 we'll save that and take a look at that really quick
235:38 you can see we get 8.3 and then it rounds up eventually to a four
235:45 and lastly what if we wanted no remainder so if we just did 50 divided
235:47 remainder so if we just did 50 divided by 6
235:49 by 6 we say no remainder
235:52 we say no remainder we could do this and we should get
235:55 we could do this and we should get eight here
235:58 eight here so depending on the situation and what
236:00 so depending on the situation and what we want we might want a situation where
236:03 we want we might want a situation where we only want the integer
236:05 we only want the integer or we only might want what's left over
236:07 or we only might want what's left over or perhaps we actually want the whole
236:11 or perhaps we actually want the whole number of what's being divided so there
236:13 number of what's being divided so there are a few different ways to divide with
236:15 are a few different ways to divide with math in Python and it's good to know all
236:18 math in Python and it's good to know all of them depending on the situation that
236:20 of them depending on the situation that you run into so for now just take notes
236:22 you run into so for now just take notes on this and know that there are a few
236:24 on this and know that there are a few ways to do math and division and you can
236:27 ways to do math and division and you can do PEMDAS and exponents and all kinds of
236:30 do PEMDAS and exponents and all kinds of fun stuff and this is just scratching
236:32 fun stuff and this is just scratching the surface of math with python
236:34 the surface of math with python so that's it for this lesson we're going
236:38 so that's it for this lesson we're going to go ahead and move on to the next one
236:40 to go ahead and move on to the next one which is going to start covering
236:42 which is going to start covering variables and methods
236:51 so I'm going to come in here and I'm just going to
236:59 call this section variables and methods and if we want to make our script a
237:01 and if we want to make our script a little bit clean we can just come in
237:02 little bit clean we can just come in here and copy this new line
237:05 here and copy this new line it'll be a lot easier once we write a
237:08 it'll be a lot easier once we write a function for this but we haven't gotten
237:09 function for this but we haven't gotten there quite yet so we're going to print
237:11 there quite yet so we're going to print out this new line and that way when we
237:13 out this new line and that way when we print this out
237:15 print this out you can see that we have kind of gaps in
237:17 you can see that we have kind of gaps in between the sections that we're working
237:19 between the sections that we're working on
237:20 on so now we're going to work on variables
237:22 so now we're going to work on variables and methods
237:25 and methods so variables
237:27 so variables variable means something can vary it can
237:30 variable means something can vary it can change and we're going to look at that
237:32 change and we're going to look at that here in a second so if we have something
237:34 here in a second so if we have something like quote and we make quote equal to
237:37 like quote and we make quote equal to All is fair in Love and War
237:43 All is fair in Love and War and this is what this is a string we are
237:48 and this is what this is a string we are storing the string inside of this
237:50 storing the string inside of this variable
237:51 variable called quote
237:53 called quote and we can just come in here now we can
237:55 and we can just come in here now we can print out whoa
237:57 print out whoa and if we do that we should get this
238:00 and if we do that we should get this returned back to us
238:01 returned back to us you can see all is fair and Love and War
238:03 you can see all is fair and Love and War if we didn't print this just go ahead
238:07 if we didn't print this just go ahead actually we'll just comment this out
238:08 actually we'll just comment this out this is a great way to test the script
238:10 this is a great way to test the script if we just save this now with a comment
238:13 if we just save this now with a comment and we hit enter there's nothing here we
238:16 and we hit enter there's nothing here we haven't given it any instructions to
238:18 haven't given it any instructions to actually print out so now we can print
238:20 actually print out so now we can print this out and it's printing whatever is
238:22 this out and it's printing whatever is stored inside of that variable in this
238:25 stored inside of that variable in this instance we have a string stored in
238:28 instance we have a string stored in there
238:29 there now when we talk about methods
238:31 now when we talk about methods methods are just functions that are
238:34 methods are just functions that are available for a given object now you
238:38 available for a given object now you could think of functions as something
238:39 could think of functions as something built in to python that allows us to do
238:44 built in to python that allows us to do something and it'll make sense here when
238:46 something and it'll make sense here when we get into using methods so we have
238:49 we get into using methods so we have this quote All is fair in Love and War
238:52 this quote All is fair in Love and War well what if we wanted to print this in
238:55 well what if we wanted to print this in a few different ways well we can use
238:56 a few different ways well we can use methods to do that for example we can
239:00 methods to do that for example we can print quote in uppercase and just do
239:04 print quote in uppercase and just do upper like that
239:06 upper like that and this is going to make it all
239:08 and this is going to make it all uppercase because we're giving it this
239:10 uppercase because we're giving it this period upper and then open close
239:13 period upper and then open close parentheses right here and that is
239:15 parentheses right here and that is allowing us to use that method so we can
239:17 allowing us to use that method so we can say uppercase
239:19 say uppercase and we can also print in lowercase if we
239:22 and we can also print in lowercase if we do lower
239:29 and just for one more we can also do print
239:31 print and we'll say quote dot title
239:34 and we'll say quote dot title and this is what's known as title cakes
239:38 and this is what's known as title cakes and title case will capitalize every
239:40 and title case will capitalize every single letter like it is the title uh in
239:43 single letter like it is the title uh in this instance here we're going to get
239:45 this instance here we're going to get like the a capitalize which wouldn't
239:47 like the a capitalize which wouldn't really be true in a title but still just
239:50 really be true in a title but still just know that title case is meant to
239:52 know that title case is meant to capitalize every first letter within
239:54 capitalize every first letter within your string or your sentence in this
239:57 your string or your sentence in this case we're going to call this lowercase
239:59 case we're going to call this lowercase here
240:00 here okay so let's go ahead and save this and
240:03 okay so let's go ahead and save this and we're going to print this out
240:08 and you can see the differences that we have we have it here
240:11 have we have it here in its normal quote and then we have it
240:13 in its normal quote and then we have it in uppercase all lowercase and then
240:16 in uppercase all lowercase and then every single first letter capitalized
240:20 every single first letter capitalized perfect these are methods these are just
240:23 perfect these are methods these are just a small example methods we're going to
240:24 a small example methods we're going to get into more a little bit later
240:27 get into more a little bit later here's another example what if we wanted
240:29 here's another example what if we wanted to print the length of quote
240:32 to print the length of quote let's say we wanted to know how many
240:34 let's say we wanted to know how many characters were within this sentence so
240:37 characters were within this sentence so this is going to count the characters
240:40 this is going to count the characters and this will also count spaces so we're
240:43 and this will also count spaces so we're trying to get a total count of what's
240:44 trying to get a total count of what's going on inside this string we print
240:47 going on inside this string we print that you'll see that we get 28 return so
240:50 that you'll see that we get 28 return so if you want to check that you can go
240:52 if you want to check that you can go count every single character within here
240:54 count every single character within here and you'll get the length of that and
240:56 and you'll get the length of that and that could become important as you're
240:58 that could become important as you're doing python later on and this is just
241:01 doing python later on and this is just yet another example of a method now
241:04 yet another example of a method now let's go back to looking at variables
241:07 let's go back to looking at variables and why they're called variables
241:10 and why they're called variables so let's say that we have a variable of
241:12 so let's say that we have a variable of a name and in this instance I'm going to
241:14 a name and in this instance I'm going to use my name and I'm going to make it a
241:16 use my name and I'm going to make it a string
241:17 string and I'm going to use my age
241:21 and I'm going to use my age I am 33 and
241:24 I am 33 and here we're going to say string just so
241:26 here we're going to say string just so we can make sure we notate the
241:27 we can make sure we notate the differences this is an INT or an integer
241:31 differences this is an INT or an integer and we're also going to give a GPA let's
241:34 and we're also going to give a GPA let's say I went to school I'm going to use
241:36 say I went to school I'm going to use the American grading system let's say I
241:40 the American grading system let's say I had a 3.7 GPA
241:43 had a 3.7 GPA and this is what's known as a float
241:46 and this is what's known as a float and that has a decimal so make sure you
241:49 and that has a decimal so make sure you notate that
241:52 notate that so if we print these out if we print out
241:55 so if we print these out if we print out the integer of age
241:59 the integer of age that'll still print
242:01 that'll still print 33.
242:02 33. what if we print out the integer of
242:08 what if we print out the integer of 30.1 save that
242:11 30.1 save that take a look
242:13 take a look and you'll see that we just get
242:16 and you'll see that we just get 30.
242:17 30. all right
242:19 all right and you can see that this rounded down
242:21 and you can see that this rounded down again integer just the first number just
242:24 again integer just the first number just what's on the left side of the decimal
242:26 what's on the left side of the decimal point
242:26 point doesn't care about the right side what
242:29 doesn't care about the right side what if we printed integer
242:32 if we printed integer of 30.9
242:37 will it round will it round
242:40 will it round no
242:42 no so if we save that
242:44 so if we save that and we print again you'll see it's still
242:46 and we print again you'll see it's still 30. it doesn't care what's on the right
242:49 30. it doesn't care what's on the right side of the number it's only going to
242:50 side of the number it's only going to take what the integer is so anytime you
242:52 take what the integer is so anytime you print an integer you're only going to
242:54 print an integer you're only going to get the first or what's on the left hand
242:56 get the first or what's on the left hand side of the decimal point so make sure
242:58 side of the decimal point so make sure you know that
243:00 you know that now a few cool things that we can do
243:03 now a few cool things that we can do let's say that we wanted to print
243:05 let's say that we wanted to print something like this if we print
243:09 something like this if we print my name is with a space
243:12 my name is with a space and then we'll do plus name
243:15 and then we'll do plus name and we'll say
243:17 and we'll say space again and I
243:22 space again and I m space
243:25 m space age
243:27 age Plus
243:29 Plus space years old make sure you have your
243:32 space years old make sure you have your spacing in there properly that way you
243:34 spacing in there properly that way you can account for the spaces before and
243:36 can account for the spaces before and after these variables but what are we
243:39 after these variables but what are we doing here we are concatenating
243:41 doing here we are concatenating variables now if I try to run this I'm
243:45 variables now if I try to run this I'm actually going to get an error if I run
243:47 actually going to get an error if I run it
243:49 it we're getting a type error and this is a
243:52 we're getting a type error and this is a great example by the way of
243:54 great example by the way of understanding what python is telling you
243:56 understanding what python is telling you I get emails all the time from students
243:59 I get emails all the time from students saying I don't understand why my script
244:02 saying I don't understand why my script isn't working and the first thing I'll
244:04 isn't working and the first thing I'll ask them is I will say did you read the
244:07 ask them is I will say did you read the output of the error because it tells you
244:09 output of the error because it tells you it says Hey on line 44 by control tab
244:13 it says Hey on line 44 by control tab look this is line 44 it tells you where
244:15 look this is line 44 it tells you where your mistake is and then it also says it
244:18 your mistake is and then it also says it only concatenate string not int to
244:21 only concatenate string not int to string so if you didn't know what this
244:24 string so if you didn't know what this meant and maybe you don't you can copy
244:27 meant and maybe you don't you can copy this go to Google and search it and I
244:30 this go to Google and search it and I promise you somebody will have had this
244:32 promise you somebody will have had this error before
244:34 error before as much as if we wish to be special uh
244:37 as much as if we wish to be special uh there's not in many situations that will
244:39 there's not in many situations that will come up where there hasn't been this
244:42 come up where there hasn't been this error or an issue that we run into that
244:43 error or an issue that we run into that somebody hasn't already had before so
244:46 somebody hasn't already had before so with that in mind
244:48 with that in mind we can fix this so it's saying that it
244:51 we can fix this so it's saying that it can only concatenate strings not
244:53 can only concatenate strings not integers well name is a string but age
244:56 integers well name is a string but age is an integer so we need to make in this
244:59 is an integer so we need to make in this situation age or string so what we're
245:02 situation age or string so what we're going to do is just say Str like this
245:05 going to do is just say Str like this and give it like that
245:08 and give it like that and now if we print this save it print
245:11 and now if we print this save it print it
245:13 it you can see my name is Heath and I am 33
245:16 you can see my name is Heath and I am 33 years old perfect
245:18 years old perfect now what happens if I am a year older
245:22 now what happens if I am a year older well I could take age and do something
245:25 well I could take age and do something like plus equals one
245:29 like plus equals one something like that
245:30 something like that and if I print age now hopefully
245:35 and if I print age now hopefully we are seeing 34. you could see 34. now
245:40 we are seeing 34. you could see 34. now this is what comes into play this is a
245:43 this is what comes into play this is a variable variables can change
245:47 variable variables can change at this point in the script we Define
245:48 at this point in the script we Define that we are 33 and as we run through it
245:52 that we are 33 and as we run through it I am still 33 when I print this
245:54 I am still 33 when I print this statement out however I've had a
245:56 statement out however I've had a birthday now age has increased by one
245:59 birthday now age has increased by one printing age out now will say that I'm
246:02 printing age out now will say that I'm 34.
246:04 34. so variables can change variables can
246:07 so variables can change variables can store different numbers at different
246:08 store different numbers at different times that's why they are called
246:10 times that's why they are called variables because they vary now
246:13 variables because they vary now we could also do something like birthday
246:16 we could also do something like birthday and set birthday equal to one and I
246:18 and set birthday equal to one and I could say age plus equals birthday
246:23 could say age plus equals birthday and then print days and guess what now
246:25 and then print days and guess what now it's going to return
246:27 it's going to return 35.
246:30 35. so just know that you can store a number
246:33 so just know that you can store a number within a variable we've shown that
246:35 within a variable we've shown that before already we can add two integers
246:39 before already we can add two integers together and we can print them out so
246:42 together and we can print them out so we're adding those together and it's
246:44 we're adding those together and it's taking that total and adding that to age
246:45 taking that total and adding that to age and now
246:47 and now it's saying we're 35 years old
246:49 it's saying we're 35 years old so that is it for this lesson we're
246:51 so that is it for this lesson we're going to go ahead and move on to
246:53 going to go ahead and move on to functions and fix this new line issue
246:56 functions and fix this new line issue that we've had plus write some pretty
246:58 that we've had plus write some pretty cool stuff out and build some other cool
247:00 cool stuff out and build some other cool functions out as well so I'll go ahead
247:03 functions out as well so I'll go ahead and see you over in the next lesson
247:06 and see you over in the next lesson all right moving on to functions so
247:09 all right moving on to functions so let's go ahead and print out a new line
247:12 let's go ahead and print out a new line really quick
247:20 and we're going to call this functions now I like to think of functions as many
247:24 now I like to think of functions as many programs what they are is an organized
247:28 programs what they are is an organized block of code that you define and then
247:30 block of code that you define and then you can call it later instead of
247:32 you can call it later instead of repeatedly typing the code out
247:35 repeatedly typing the code out so we're going to take a look at some
247:37 so we're going to take a look at some examples of that
247:39 examples of that so let's go ahead and write a function
247:42 so let's go ahead and write a function so let's do a Define Def and that's how
247:46 so let's do a Define Def and that's how we start a function and in this one I'm
247:49 we start a function and in this one I'm going to say who am I
247:52 going to say who am I and I'm going to do closed parentheses
247:55 and I'm going to do closed parentheses and here we're going to say
247:59 and here we're going to say this is a function without parameters
248:03 this is a function without parameters and we'll talk about that here in just a
248:05 and we'll talk about that here in just a little bit
248:06 little bit now indentation is incredibly important
248:10 now indentation is incredibly important in Python if we do not indent we will
248:14 in Python if we do not indent we will throw an error here and you're going to
248:16 throw an error here and you're going to see a lot of situations where
248:18 see a lot of situations where indentation becomes incredibly important
248:20 indentation becomes incredibly important it's one of the most important things in
248:22 it's one of the most important things in python python does not have a lot of
248:25 python python does not have a lot of rules that apply to it but indentation
248:28 rules that apply to it but indentation is one of them that you must follow so
248:32 is one of them that you must follow so we're going to go ahead and hit the tab
248:34 we're going to go ahead and hit the tab to indent and I'm going to say my name
248:38 to indent and I'm going to say my name is Heath
248:44 and this is what is known as a local variable we'll talk about that here in a
248:46 variable we'll talk about that here in a second as well
248:47 second as well age is equal to 30.
248:51 age is equal to 30. and we're going to go ahead and print
248:55 and we're going to go ahead and print same thing we did before we can actually
248:57 same thing we did before we can actually just kind of copy this up here we'll say
248:59 just kind of copy this up here we'll say my name is
249:02 my name is just like this okay copy all that paste
249:06 just like this okay copy all that paste it and then
249:07 it and then add the closed parentheses there I'll
249:09 add the closed parentheses there I'll let you catch up
249:11 let you catch up and then we can just call down here
249:14 and then we can just call down here who am I
249:21 so what's going on in here well we have a function that we're
249:23 well we have a function that we're defining we're calling it who am I
249:26 defining we're calling it who am I and it has no parameters we'll get into
249:28 and it has no parameters we'll get into parameters here in just a second
249:30 parameters here in just a second now we're giving it some items within
249:33 now we're giving it some items within this in this instance what we're doing
249:36 this in this instance what we're doing is we're giving this local variables
249:38 is we're giving this local variables we're saying hey
249:40 we're saying hey in this instance when we have a variable
249:43 in this instance when we have a variable of name it's going to be Heat and the
249:45 of name it's going to be Heat and the age is going to be 30.
249:47 age is going to be 30. well whatever is stored in here is only
249:51 well whatever is stored in here is only stored within the function
249:54 stored within the function that's why this is a local variable if
249:57 that's why this is a local variable if we print
249:58 we print age
250:00 age as well we'll see that so we know that
250:03 as well we'll see that so we know that age was 35 we called age over here is 30
250:06 age was 35 we called age over here is 30 and let's see what happens first of all
250:11 and let's see what happens first of all we called our function here we said who
250:14 we called our function here we said who am I called that and all it does is run
250:17 am I called that and all it does is run our mini program our mini program says
250:19 our mini program our mini program says hey I'm going to print out
250:21 hey I'm going to print out these variables into this string here
250:24 these variables into this string here okay and that's exactly what it did but
250:27 okay and that's exactly what it did but when we printed age again you could see
250:29 when we printed age again you could see that we're actually still 35 so this
250:32 that we're actually still 35 so this variable or the variables that are
250:34 variable or the variables that are within a function are local and do not
250:36 within a function are local and do not apply outside of the function so make
250:39 apply outside of the function so make sure to remember that okay so I'm going
250:41 sure to remember that okay so I'm going to delete this print statement we don't
250:43 to delete this print statement we don't need it
250:44 need it and we're going to write some more
250:46 and we're going to write some more functions so let's do one where we add
250:49 functions so let's do one where we add some parameters
250:51 some parameters so we're going to do add 100
250:56 so we're going to do add 100 and we're going to give this a parameter
250:58 and we're going to give this a parameter of num n-u-m and that's just going to
251:01 of num n-u-m and that's just going to stand for number
251:03 stand for number okay we're going to indent make sure we
251:05 okay we're going to indent make sure we indent and all we're going to do is
251:07 indent and all we're going to do is print num Plus 100.
251:12 print num Plus 100. so when we call our function we say add
251:16 so when we call our function we say add 100
251:17 100 just like last time
251:19 just like last time this time we have to actually give it
251:21 this time we have to actually give it what is called an argument so our
251:23 what is called an argument so our argument goes with our parameter here
251:26 argument goes with our parameter here when we're calling it so our argument is
251:28 when we're calling it so our argument is going to be a hundred and when we print
251:30 going to be a hundred and when we print this out this is going to be 200
251:33 this out this is going to be 200 hopefully so we'll save this
251:35 hopefully so we'll save this run it
251:37 run it you can see that we got 200 because
251:39 you can see that we got 200 because we're doing print 100 plus 100. that's
251:44 we're doing print 100 plus 100. that's all we're doing is this mini program
251:46 all we're doing is this mini program okay let's try another one let's say we
251:49 okay let's try another one let's say we want to have multiple parameters
251:52 want to have multiple parameters let's do Define
252:02 add and we're just going to add X and Y this one's going to be easy we're just
252:03 this one's going to be easy we're just going to say print
252:05 going to say print X Plus y
252:08 X Plus y and now we can add whatever we want so
252:11 and now we can add whatever we want so let's add Seven and Seven
252:14 let's add Seven and Seven and one will take the place of X the
252:17 and one will take the place of X the other one will take the place of Y
252:19 other one will take the place of Y X Plus y 7 plus 7 should be 14. let's go
252:24 X Plus y 7 plus 7 should be 14. let's go ahead and run that
252:25 ahead and run that you'll see we get 14 here beautiful
252:29 you'll see we get 14 here beautiful all right let's make it a little bit
252:30 all right let's make it a little bit more complicated then
252:33 more complicated then all right let's try adding in here
252:37 all right let's try adding in here another function this time we're going
252:39 another function this time we're going to do multiply we're going to do X and Y
252:41 to do multiply we're going to do X and Y again
252:42 again and instead of doing a print I want to
252:44 and instead of doing a print I want to show you something a little bit
252:45 show you something a little bit different let's say we just return
252:49 different let's say we just return X
252:50 X times y
252:52 times y and now in this instance
252:54 and now in this instance if we multiply
253:01 7 times 7 do we get 49
253:03 do we get 49 we don't
253:05 we don't okay
253:06 okay there's a reason for this this is just
253:09 there's a reason for this this is just calling back so when this is saying
253:11 calling back so when this is saying return this isn't saying print remember
253:14 return this isn't saying print remember this says print this is going to return
253:16 this says print this is going to return x times y so we can call this here this
253:21 x times y so we can call this here this function and it knows that this function
253:24 function and it knows that this function is equal to 49 and perhaps we can put
253:27 is equal to 49 and perhaps we can put that into something else like we could
253:29 that into something else like we could put that maybe into a variable or
253:31 put that maybe into a variable or whatever it is we might want to do with
253:32 whatever it is we might want to do with it however if we wanted to return to the
253:35 it however if we wanted to return to the screen we actually have to call that so
253:38 screen we actually have to call that so sometimes we're going to actually store
253:40 sometimes we're going to actually store something instead of printing it we do a
253:42 something instead of printing it we do a lot of printing in Python tutorials just
253:45 lot of printing in Python tutorials just so that you can see it on the screen and
253:47 so that you can see it on the screen and make sure that you're seeing what you're
253:49 make sure that you're seeing what you're doing and that everything's printing out
253:51 doing and that everything's printing out okay so that's why we're doing this but
253:54 okay so that's why we're doing this but please understand that the return option
253:56 please understand that the return option does exist and is used quite frequently
253:59 does exist and is used quite frequently so I'm going to save this
254:01 so I'm going to save this and run this you can see now that we get
254:04 and run this you can see now that we get 49. perfect
254:08 49. perfect okay two more
254:10 okay two more let's say we want to do a square root
254:14 let's say we want to do a square root okay so let's define square root
254:19 okay so let's define square root and we're just going to give it one
254:22 and we're just going to give it one parameter
254:24 parameter and in this instance we're going to
254:25 and in this instance we're going to print out the square root so we're going
254:28 print out the square root so we're going to take X
254:29 to take X and a square root an exponent format is
254:34 and a square root an exponent format is just to
254:35 just to the power of 0.5
254:38 the power of 0.5 that's all we're doing and we can test
254:40 that's all we're doing and we can test that theory by doing something like
254:43 that theory by doing something like square root
254:45 square root of 64.
254:53 which we should return as 8 because 8 times 8 is 64. so if we save that
254:57 times 8 is 64. so if we save that come in here print it and you can see we
254:59 come in here print it and you can see we get a float of 8.0
255:04 get a float of 8.0 now I told you we would create our own
255:06 now I told you we would create our own function for a new line and we're going
255:08 function for a new line and we're going to do just that
255:10 to do just that let's go ahead and Define new line
255:14 let's go ahead and Define new line and we could call this like new line if
255:16 and we could call this like new line if we wanted to or whatever but I think to
255:19 we wanted to or whatever but I think to make it simple as long as we understand
255:20 make it simple as long as we understand what it is we can make comments and
255:23 what it is we can make comments and notes in here if we wanted to we could
255:25 notes in here if we wanted to we could just say defined NL
255:27 just say defined NL and then we can just say that when we do
255:30 and then we can just say that when we do that we're just going to print out
255:36 our n for our new line and then we call a new line we'll get
255:39 and then we call a new line we'll get one very simple so we can just even say
255:43 one very simple so we can just even say in here
255:44 in here new line okay so now we know and we save
255:48 new line okay so now we know and we save that and we can print it
255:51 that and we can print it you'll see it
255:52 you'll see it it's here but we really don't have
255:54 it's here but we really don't have anything after it to really show it but
255:57 anything after it to really show it but we do have that space there
255:59 we do have that space there so that is it for this lesson I'll go
256:01 so that is it for this lesson I'll go ahead and see you over in the next one
256:04 ahead and see you over in the next one next up we're going to learn about
256:06 next up we're going to learn about Boolean expressions and also relational
256:09 Boolean expressions and also relational and Boolean operators
256:12 and Boolean operators so let's go ahead and type in here
256:15 so let's go ahead and type in here Boolean expressions
256:18 Boolean expressions and when we think of these we can just
256:20 and when we think of these we can just think that this as true or false
256:24 think that this as true or false that's really what it is
256:26 that's really what it is so from here let's do a few variables so
256:30 so from here let's do a few variables so we could set Bowl one equal to true
256:35 we could set Bowl one equal to true we're just going to say hey this
256:36 we're just going to say hey this variable is true
256:38 variable is true bull 2 we could set equal to three times
256:42 bull 2 we could set equal to three times three
256:43 three is equal to 9. so the double equals
256:47 is equal to 9. so the double equals means that something is equal to
256:50 means that something is equal to something so we have three times three
256:52 something so we have three times three that's nine equal equal that means that
256:55 that's nine equal equal that means that equals nine do not confuse that with
256:59 equals nine do not confuse that with setting up your variable this is saying
257:01 setting up your variable this is saying hey my variable is equal to this but
257:02 hey my variable is equal to this but this is saying this is equal to this
257:06 this is saying this is equal to this number okay and that is a true statement
257:09 number okay and that is a true statement we could also say Bool 3 and make that
257:13 we could also say Bool 3 and make that false
257:15 false or we can give it a statement that makes
257:18 or we can give it a statement that makes it false so something like 3 times 3
257:21 it false so something like 3 times 3 does not equal nine exclamation equals
257:25 does not equal nine exclamation equals means does not equal nine
257:28 means does not equal nine now if we print it out
257:31 now if we print it out bull one bull two bull three ample four
257:36 bull one bull two bull three ample four just like that
257:38 just like that and save it
257:40 and save it and if we come
257:42 and if we come in here you'll see that it says true
257:45 in here you'll see that it says true true false false
257:46 true false false again Boolean Expressions is something
257:49 again Boolean Expressions is something true is something false
257:52 true is something false why do we need to know this well we need
257:54 why do we need to know this well we need to know if something is true
257:58 to know if something is true then we might want to continue on or if
258:00 then we might want to continue on or if something is false we might want to do
258:01 something is false we might want to do something and we'll get into that when
258:03 something and we'll get into that when we get into conditional statements like
258:05 we get into conditional statements like if something is true then go ahead and
258:08 if something is true then go ahead and do this if something is false do this or
258:11 do this if something is false do this or there's something called while Loops
258:13 there's something called while Loops which will allow us to continue as long
258:16 which will allow us to continue as long as something is true we're going to get
258:18 as something is true we're going to get there when we get to conditional
258:19 there when we get to conditional statements as well or looping I should
258:21 statements as well or looping I should say and we'll talk about that but that
258:23 say and we'll talk about that but that is why we might want to know these
258:25 is why we might want to know these things among other stuff we might want
258:27 things among other stuff we might want to know if something's true or set that
258:29 to know if something's true or set that parameter or that variable to True until
258:30 parameter or that variable to True until it becomes false
258:32 it becomes false etc etc so right now just understand
258:35 etc etc so right now just understand that Boolean expressions are true or
258:37 that Boolean expressions are true or false and we're going to come in here
258:38 false and we're going to come in here and we're going to print
258:40 and we're going to print and we're going to say type
258:42 and we're going to say type and we're going to do Bowl One
258:45 and we're going to do Bowl One okay and this will tell us now this is a
258:48 okay and this will tell us now this is a nice thing so if we come in here and say
258:50 nice thing so if we come in here and say type it'll give us the class this class
258:52 type it'll give us the class this class is Boolean awesome and another example
258:56 is Boolean awesome and another example of that is if we say like Rule 5 is
258:58 of that is if we say like Rule 5 is equal to true and we print the type so
259:02 equal to true and we print the type so if you see true and you're like I wonder
259:03 if you see true and you're like I wonder what that is is that Boolean or is it
259:06 what that is is that Boolean or is it actually just a string we come in here
259:07 actually just a string we come in here and say pull five let's save that
259:11 and say pull five let's save that save that there and then you should see
259:13 save that there and then you should see that that class is actually a string
259:16 that that class is actually a string here so you can check with the type to
259:19 here so you can check with the type to see what is this okay so the type
259:21 see what is this okay so the type feature is very nice and we can see that
259:23 feature is very nice and we can see that we are dealing with a Boolean here and
259:25 we are dealing with a Boolean here and this one is actually a straight so
259:27 this one is actually a straight so please note that if you put it in
259:28 please note that if you put it in quotations that makes the string
259:31 quotations that makes the string you leave it like this that makes it a
259:32 you leave it like this that makes it a Boolean expression
259:34 Boolean expression let's go ahead and make a new line
259:37 let's go ahead and make a new line and we're going to talk about
259:41 and we're going to talk about relational
259:43 relational and Boolean operators
259:49 okay so we can think of that as let's make a
259:52 so we can think of that as let's make a variable here we say
259:54 variable here we say greater than
260:02 we say 7 is greater than 5. well that would be true
260:04 would be true and we are using an operator here so the
260:06 and we are using an operator here so the operator is the greater than sign
260:09 operator is the greater than sign we're also using a Boolean expression
260:11 we're also using a Boolean expression because it's going to result in a true
260:14 because it's going to result in a true return if we were to print that out
260:16 return if we were to print that out now we can do a few other things we can
260:18 now we can do a few other things we can say like less than
260:21 say like less than is equal to 5 is less than seven we can
260:25 is equal to 5 is less than seven we can do greater than
260:28 do greater than or equal to
260:30 or equal to which would be 7 is greater than or
260:34 which would be 7 is greater than or equal to seven that's true
260:37 equal to seven that's true we can also do less than or equal to
260:41 we can also do less than or equal to and in that case we can do 7 is less
260:44 and in that case we can do 7 is less than or equal to seven which is also
260:47 than or equal to seven which is also true
260:48 true so all of these statements here are true
260:50 so all of these statements here are true now we can get into some other type of
260:54 now we can get into some other type of operators and statements here what if we
260:58 operators and statements here what if we did
260:58 did and so let's just call this test and
261:02 and so let's just call this test and we're going to do test and
261:03 we're going to do test and we say 7 is greater than five well
261:07 we say 7 is greater than five well that's true
261:09 that's true and
261:11 and 5 is less than seven that's also true
261:15 5 is less than seven that's also true both statements are true thus this is
261:18 both statements are true thus this is true
261:19 true do another one
261:21 do another one test and two
261:24 test and two and for some students this does take a
261:26 and for some students this does take a little bit to get your head wrapped
261:27 little bit to get your head wrapped around I'm going to provide a table for
261:30 around I'm going to provide a table for you here just in a second but just
261:32 you here just in a second but just follow along and I'll explain this as we
261:34 follow along and I'll explain this as we go let's say we have 7 is greater than
261:36 go let's say we have 7 is greater than five
261:38 five and
261:40 and five is greater than seven
261:42 five is greater than seven all right let me fix that syntax five is
261:44 all right let me fix that syntax five is greater than seven this now becomes
261:46 greater than seven this now becomes false
261:48 false why well seven is greater than five
261:52 why well seven is greater than five and 5 is greater than seven that's not
261:55 and 5 is greater than seven that's not true so because it's not true because
261:57 true so because it's not true because all statements are not true
262:00 all statements are not true this becomes false
262:02 this becomes false there's an alternative to this what if
262:05 there's an alternative to this what if we had an or we said or so 7 is greater
262:09 we had an or we said or so 7 is greater than 5 or
262:12 than 5 or 5 is less than seven well both
262:15 5 is less than seven well both statements are true thus this is true
262:19 statements are true thus this is true but we can have the same situation as
262:21 but we can have the same situation as before where we have 7 is greater than 5
262:25 before where we have 7 is greater than 5 or 5 is greater than seven and guess
262:29 or 5 is greater than seven and guess what this statement is actually true
262:32 what this statement is actually true because all we need is one condition to
262:34 because all we need is one condition to be true for this to be true so in this
262:37 be true for this to be true so in this situation this is true
262:39 situation this is true or if this is true then the whole thing
262:42 or if this is true then the whole thing becomes true
262:44 becomes true so just because this is false this would
262:46 so just because this is false this would also have to be false for this to be
262:48 also have to be false for this to be false
262:49 false hopefully that makes sense one other
262:51 hopefully that makes sense one other thing here before I show you the cool
262:53 thing here before I show you the cool little table is we could do test not so
262:57 little table is we could do test not so if we said something was not true
263:00 if we said something was not true guess what that becomes false
263:04 guess what that becomes false same thing if we said it was not false
263:06 same thing if we said it was not false then it's true not is just the opposite
263:08 then it's true not is just the opposite so not true in this situation is false
263:10 so not true in this situation is false now if we go out to the internet
263:14 now if we go out to the internet and we go to Google
263:17 and we go to Google we could come in here and we can just
263:19 we could come in here and we can just search something like python truth table
263:24 search something like python truth table and if we go to images we should be able
263:27 and if we go to images we should be able to find one that works out pretty well
263:30 to find one that works out pretty well in our favor here's a good example right
263:32 in our favor here's a good example right here
263:34 here so if you ever take a coding class you
263:36 so if you ever take a coding class you might be quizzed on this
263:38 might be quizzed on this this will tell you truth tables right
263:40 this will tell you truth tables right here so if it's not false it's true it's
263:43 here so if it's not false it's true it's not true it's false we can look at or
263:45 not true it's false we can look at or statements so true or false is true the
263:49 statements so true or false is true the only situation and or statement becomes
263:51 only situation and or statement becomes false is when both are false now the and
263:54 false is when both are false now the and we looked at that if it's true and false
263:56 we looked at that if it's true and false it's false if it's false and true or
263:58 it's false if it's false and true or false and false it's still False only
264:00 false and false it's still False only situation for and where it can be true
264:02 situation for and where it can be true is when both are true there's also not
264:05 is when both are true there's also not or not and
264:07 or not and there is does not equal or equals so
264:11 there is does not equal or equals so it's good to know these types of Truth
264:14 it's good to know these types of Truth tables and you can come and just again
264:16 tables and you can come and just again Google python truth table and come look
264:18 Google python truth table and come look at this pretty straightforward once you
264:21 at this pretty straightforward once you get the hang of it but it's completely
264:22 get the hang of it but it's completely okay for right now for it to be
264:24 okay for right now for it to be confusing just wanted you to know that
264:26 confusing just wanted you to know that these are out there and exist in case
264:29 these are out there and exist in case you are a little bit confused by this
264:31 you are a little bit confused by this lesson
264:32 lesson so we're going to go ahead and move on
264:34 so we're going to go ahead and move on to the next lesson which is going to
264:35 to the next lesson which is going to cover conditional statements
264:37 cover conditional statements okay we'll come in here we'll do a new
264:40 okay we'll come in here we'll do a new line
264:41 line and we'll just say conditional
264:44 and we'll just say conditional statements
264:47 statements and we can think of this as if then
264:53 and we can think of this as if then or if then else or if else either way
264:56 or if then else or if else either way you want to write this this is fine
264:59 you want to write this this is fine so think about this
265:01 so think about this if you go to the store and you want to
265:03 if you go to the store and you want to buy a drink and that drink is two
265:06 buy a drink and that drink is two dollars
265:07 dollars if you have two dollars or more you can
265:10 if you have two dollars or more you can buy the drink
265:11 buy the drink if you do not have two dollars you will
265:14 if you do not have two dollars you will not be able to buy the drink
265:16 not be able to buy the drink so let's take a look at that
265:18 so let's take a look at that so if we write a function and we call it
265:20 so if we write a function and we call it Define drink
265:22 Define drink and we give it a parameter of money we
265:25 and we give it a parameter of money we come in here and we say if
265:28 come in here and we say if money
265:31 money is greater than or equal to two
265:34 is greater than or equal to two then we're going to return
265:37 then we're going to return look at the indentation again
265:39 look at the indentation again we need an indent here after our
265:42 we need an indent here after our function and we need an indent after our
265:44 function and we need an indent after our if statement so make sure you're
265:45 if statement so make sure you're indenting correctly
265:48 indenting correctly return you
265:51 return you got yourself a drink
265:55 got yourself a drink and here we come back we can say else
266:00 and here we come back we can say else we're going to return
266:09 kind of like Seinfeld no soup for you all right so if we come in here and we
266:11 all right so if we come in here and we print drink
266:14 print drink of three meaning we had three dollars at
266:17 of three meaning we had three dollars at the time and we print drink of one
266:21 the time and we print drink of one meaning we had one dollar at the time
266:22 meaning we had one dollar at the time we're gonna have two different results
266:25 we're gonna have two different results if we have two or more dollars we're
266:27 if we have two or more dollars we're going to return you've got yourself a
266:28 going to return you've got yourself a drink otherwise if we have less than two
266:31 drink otherwise if we have less than two dollars we're gonna say no drink for you
266:34 dollars we're gonna say no drink for you let's save that
266:40 you've got yourself a drink when we print out three dollars because we had
266:41 print out three dollars because we had enough money here you can see with one
266:43 enough money here you can see with one dollar we did not have enough money thus
266:45 dollar we did not have enough money thus no drink or us
266:48 no drink or us okay let's take a look at a little bit
266:50 okay let's take a look at a little bit more of a complicated one we're gonna
266:53 more of a complicated one we're gonna come in here we're gonna say Define now
266:56 come in here we're gonna say Define now I'm going to make this alcoholic
266:59 I'm going to make this alcoholic beverages if you do not drink that's
267:02 beverages if you do not drink that's okay you can just follow along still you
267:04 okay you can just follow along still you can change it into whatever you want to
267:06 can change it into whatever you want to be I think this is a good example
267:08 be I think this is a good example because we have a couple parameters and
267:10 because we have a couple parameters and we can use those to make different sort
267:12 we can use those to make different sort of conditional statements so let's
267:15 of conditional statements so let's define alcohol
267:17 define alcohol now in the United States
267:19 now in the United States we have two things that we need in order
267:21 we have two things that we need in order to purchase alcohol one we have to be
267:24 to purchase alcohol one we have to be old enough
267:25 old enough we also have to have enough money
267:28 we also have to have enough money similar to the drink before that was
267:29 similar to the drink before that was non-alcoholic we assume
267:31 non-alcoholic we assume well we have to actually be old enough
267:33 well we have to actually be old enough to purchase the strength in the United
267:35 to purchase the strength in the United States you have to be 21. so if
267:46 our age is greater than or equal to 21. they put a space here by the way sorry
267:52 and look the and is coming into play money
267:56 look the and is coming into play money is greater than or equal to five
268:07 we're getting a drink all right
268:09 all right now we're gonna say else if
268:11 now we're gonna say else if because there's a few situations that we
268:13 because there's a few situations that we can be in there's actually four
268:14 can be in there's actually four situations here so we're going to say
268:16 situations here so we're going to say e-l-i-f which stands for else if
268:20 e-l-i-f which stands for else if what happens if our age is greater than
268:23 what happens if our age is greater than or equal to 21
268:25 or equal to 21 and we don't have enough money so we say
268:29 and we don't have enough money so we say money is less than five
268:32 money is less than five well in that situation we're going to
268:34 well in that situation we're going to return
268:36 return come back with more money
268:44 okay and then what if we have another situation where we say
268:46 situation where we say age is less than 21.
268:49 age is less than 21. and we actually have money
268:53 and we actually have money we're just an underage person trying to
268:55 we're just an underage person trying to buy a drink and we say five dollars
268:58 buy a drink and we say five dollars well we're gonna return
269:05 nice try kid and then lastly if we have no monies and
269:10 and then lastly if we have no monies and we're not old enough well then we can
269:13 we're not old enough well then we can just return something like your
269:17 just return something like your too young
269:19 too young and two poor
269:23 and two poor yay and then let's try these out so
269:26 yay and then let's try these out so we've got these different situations
269:27 we've got these different situations here again if we have our age and money
269:31 here again if we have our age and money we meet both criteria we're getting a
269:33 we meet both criteria we're getting a drink
269:34 drink otherwise if we meet the age but no
269:36 otherwise if we meet the age but no money let's come back with more money we
269:39 money let's come back with more money we don't meet the age but we have the money
269:41 don't meet the age but we have the money nice try kid and then lastly if you
269:44 nice try kid and then lastly if you don't have the money and you're not old
269:46 don't have the money and you're not old enough you're gonna be too young and too
269:47 enough you're gonna be too young and too poor so we're gonna print out a few
269:50 poor so we're gonna print out a few different
269:52 different statements here of this function so
269:54 statements here of this function so let's give it 21 and 5.
269:57 let's give it 21 and 5. we'll print alcohol again of 21 and 4.
270:02 we'll print alcohol again of 21 and 4. friends alcohol of 20 and 5.
270:07 friends alcohol of 20 and 5. and these should all meet different
270:09 and these should all meet different criteria alcohol of 20 and 4.
270:13 criteria alcohol of 20 and 4. so we should expect to get these in
270:16 so we should expect to get these in order we meet what we need here we don't
270:19 order we meet what we need here we don't we don't we don't different criteria for
270:21 we don't we don't different criteria for each of these we'll save this go ahead
270:24 each of these we'll save this go ahead and run this
270:29 and you can see it says no drink for you actually that's the last one uh we're
270:31 actually that's the last one uh we're getting a drink come back with more
270:33 getting a drink come back with more money nice try kid and you're too young
270:35 money nice try kid and you're too young and too poor
270:38 and too poor so you can see that we can make
270:40 so you can see that we can make conditional statements based on
270:42 conditional statements based on everything that we're starting to put
270:43 everything that we're starting to put together here we have now used a
270:45 together here we have now used a function we've used multiple parameters
270:48 function we've used multiple parameters we've used the conditional statement
270:50 we've used the conditional statement we've used relational operators
270:53 we've used relational operators okay we've got the Boolean right this is
270:57 okay we've got the Boolean right this is true and true we're returning something
271:00 true and true we're returning something this is
271:01 this is true and true in this situation then
271:03 true and true in this situation then we're going to return something else so
271:05 we're going to return something else so we have different situations that can
271:07 we have different situations that can come back
271:08 come back so we need to meet those criteria and
271:11 so we need to meet those criteria and we're starting to use that look we're
271:12 we're starting to use that look we're using the return instead of the print
271:13 using the return instead of the print feature there's a bunch of different
271:15 feature there's a bunch of different things that we're doing here that's all
271:17 things that we're doing here that's all starting to tie in and hopefully that's
271:19 starting to tie in and hopefully that's starting to make sense why we do things
271:21 starting to make sense why we do things we're starting to build upon it and it's
271:22 we're starting to build upon it and it's starting to get a little bit more fun
271:24 starting to get a little bit more fun so from here we're going to go ahead and
271:26 so from here we're going to go ahead and move on to lists and move on with our
271:31 move on to lists and move on with our journey into python so I'll see you in
271:33 journey into python so I'll see you in the next lesson
271:35 the next lesson let's move on to lists so let's go ahead
271:39 let's move on to lists so let's go ahead and do our new line
271:41 and do our new line and we'll call it lists
271:44 and we'll call it lists and the best way to think of lists in my
271:46 and the best way to think of lists in my opinion is that they have brackets
271:49 opinion is that they have brackets something like this
271:51 something like this now lists are data structures they are
271:55 now lists are data structures they are changeable we can reorder them they are
271:59 changeable we can reorder them they are basically just a group of elements
272:01 basically just a group of elements now everything within a list is called
272:05 now everything within a list is called an item and as I mentioned the best way
272:07 an item and as I mentioned the best way to think about lists is that they have
272:09 to think about lists is that they have brackets just like a string might have
272:11 brackets just like a string might have quotes around it lists will have
272:13 quotes around it lists will have brackets around it
272:15 brackets around it now again we need to remember these are
272:18 now again we need to remember these are changeable we'll talk about something
272:19 changeable we'll talk about something here in a little bit that is not
272:21 here in a little bit that is not changeable which is called the Tuple now
272:24 changeable which is called the Tuple now here
272:25 here let's go ahead and declare a list we're
272:28 let's go ahead and declare a list we're going to say movies and I'm just going
272:31 going to say movies and I'm just going to list out some movies that I like
272:33 to list out some movies that I like and we can do a bracket and I can say
272:37 and we can do a bracket and I can say when Harry
272:39 when Harry Met Sally we'll just give these as
272:41 Met Sally we'll just give these as strings
272:42 strings I like The Hangover
272:46 I like The Hangover and I like
272:49 and I like The Perks of Being a Wallflower now you
272:54 The Perks of Being a Wallflower now you can add whatever you like here and my
272:57 can add whatever you like here and my hangover here by the way that I have to
273:00 hangover here by the way that I have to hang over here my hangover on the line
273:02 hang over here my hangover on the line here is just because my notepad here is
273:05 here is just because my notepad here is not wide enough if I made it wider it
273:07 not wide enough if I made it wider it would actually just continue on so a
273:09 would actually just continue on so a don't confuse this if I hit enter you'll
273:11 don't confuse this if I hit enter you'll see it goes to 148 so my wrapping does
273:14 see it goes to 148 so my wrapping does not mean I went into a new line
273:16 not mean I went into a new line and lastly we'll just say The Exorcist
273:24 and we'll close the list off with a close bracket
273:26 close bracket so if I wanted to print
273:29 so if I wanted to print the first movie in the list
273:32 the first movie in the list I wanted to print When Harry Met Sally
273:35 I wanted to print When Harry Met Sally I come in here and I print movies and I
273:37 I come in here and I print movies and I wanted to say one do we think that would
273:40 wanted to say one do we think that would print the first item in the list go
273:43 print the first item in the list go ahead and hit save print
273:46 ahead and hit save print and you're going to see that it actually
273:48 and you're going to see that it actually prints The Hangover so what am I doing
273:51 prints The Hangover so what am I doing here I am calling an index
273:54 here I am calling an index and our index actually starts with the
273:57 and our index actually starts with the number zero so when we look at an index
274:00 number zero so when we look at an index we need to think of it as 0 1 2 3.
274:05 we need to think of it as 0 1 2 3. always count starting with zero not one
274:09 always count starting with zero not one otherwise you can return the wrong
274:12 otherwise you can return the wrong numbers and this can get very confusing
274:14 numbers and this can get very confusing let's make sure we add no to this
274:16 let's make sure we add no to this Returns the second
274:18 Returns the second item in the list okay we're looking at
274:22 item in the list okay we're looking at the second item with the index of one if
274:26 the second item with the index of one if we printed
274:28 we printed for example movies and we gave it zero
274:31 for example movies and we gave it zero then we would see that this will return
274:34 then we would see that this will return the first item in the list
274:38 the first item in the list okay we'll save that take a look real
274:40 okay we'll save that take a look real quick
274:42 quick you could see that the first item is
274:43 you could see that the first item is When Harry Met Sally and that's exactly
274:45 When Harry Met Sally and that's exactly what we're getting returned which is
274:46 what we're getting returned which is what we want
274:48 what we want now let's look at a few tricks to
274:51 now let's look at a few tricks to splicing an index or indices uh we can
274:55 splicing an index or indices uh we can say something like print movies and if
274:58 say something like print movies and if we printed movies one to three what
275:00 we printed movies one to three what would happen here
275:02 would happen here well what's gonna happen is it's going
275:05 well what's gonna happen is it's going to return
275:06 to return the first
275:09 the first item given
275:11 item given so this is going to be index number one
275:14 so this is going to be index number one which is item two so first I should say
275:17 which is item two so first I should say first index number given
275:22 first index number given right until
275:25 right until the last number given it's not going to
275:29 the last number given it's not going to include the last number
275:32 include the last number well let's even say but not include the
275:35 well let's even say but not include the last number
275:36 last number so
275:38 so no it's a lot it's just printed out take
275:40 no it's a lot it's just printed out take a look so one to three will print The
275:44 a look so one to three will print The Hangover starting at one and The Perks
275:46 Hangover starting at one and The Perks of Being a Wallflower which is two it
275:49 of Being a Wallflower which is two it will not print three
275:51 will not print three okay so make sure you understand if you
275:53 okay so make sure you understand if you go one to three you're only going to
275:55 go one to three you're only going to include two items three items
275:58 include two items three items now you can also do one to four which
276:02 now you can also do one to four which would print all of those
276:03 would print all of those if you wanted to print everything from
276:06 if you wanted to print everything from the beginning of a number so say we've
276:08 the beginning of a number so say we've wanted to print movies one and we wanted
276:11 wanted to print movies one and we wanted to go all the way to the end we could
276:13 to go all the way to the end we could just do something like this
276:16 just do something like this so you can start from a certain point in
276:18 so you can start from a certain point in index print The Hangover versus Being a
276:20 index print The Hangover versus Being a Wallflower The Exorcist and we're
276:22 Wallflower The Exorcist and we're skipping When Harry Met Sally because
276:24 skipping When Harry Met Sally because we're not stirring at zero
276:26 we're not stirring at zero okay
276:28 okay we could also do in the opposite of that
276:31 we could also do in the opposite of that movies
276:32 movies and remember if we go to one it's not
276:36 and remember if we go to one it's not going to include one it's only going to
276:39 going to include one it's only going to include
276:40 include the first item here everything before so
276:43 the first item here everything before so When Harry Met Sally everything up until
276:46 When Harry Met Sally everything up until this point is another way to think about
276:49 this point is another way to think about it
276:49 it okay so we wanted to print two items
276:53 okay so we wanted to print two items we'd actually have to add a second or
276:55 we'd actually have to add a second or put the number two here and that would
276:57 put the number two here and that would include The Hangover that's what we
276:59 include The Hangover that's what we wanted to do
277:00 wanted to do now another thing that we can do is if
277:02 now another thing that we can do is if we wanted to print the very last item
277:05 we wanted to print the very last item we could do a movies
277:08 we could do a movies negative one and you don't need to
277:10 negative one and you don't need to commit All This to Memory right now
277:12 commit All This to Memory right now especially if you're not working with
277:13 especially if you're not working with lists but if you ever do work with lists
277:16 lists but if you ever do work with lists you need to pull specific items down
277:18 you need to pull specific items down from the list this becomes very
277:19 from the list this becomes very important so important to know that
277:21 important so important to know that indexes or indices exist you start at
277:24 indexes or indices exist you start at zero and then you move forward and then
277:27 zero and then you move forward and then the way that you can spice these just
277:29 the way that you can spice these just depends on how you call these now this
277:31 depends on how you call these now this will return last item in list we save
277:36 will return last item in list we save that
277:36 that take a look
277:38 take a look you'll see It'll return The Exorcist
277:40 you'll see It'll return The Exorcist here
277:42 here now we can apply methods to lists just
277:44 now we can apply methods to lists just like printing length of movies
277:48 like printing length of movies we'll print count the items in the list
277:51 we'll print count the items in the list right and the list and we'll save that
277:53 right and the list and we'll save that just take a quick look
278:00 I never close this sorry so you can see it tells you your mistakes and even I
278:03 it tells you your mistakes and even I make mistakes come in here try it again
278:06 make mistakes come in here try it again you can see that we have four items
278:08 you can see that we have four items within our list
278:10 within our list all right so and that is true we have
278:12 all right so and that is true we have four items in the list
278:13 four items in the list we can also
278:16 we can also add to the list so we can use something
278:18 add to the list so we can use something like movies dot append we'll add to
278:21 like movies dot append we'll add to lists and if we wanted to add the movie
278:23 lists and if we wanted to add the movie Jaws we could
278:25 Jaws we could and if we printed movies you'll see
278:29 and if we printed movies you'll see that this appends to the end of the list
278:34 that this appends to the end of the list let's go ahead and save that
278:44 and you'll see now that Jaws is here at the end
278:45 the end now we could also insert a movie into
278:48 now we could also insert a movie into the list so if we did movies dot insert
278:51 the list so if we did movies dot insert and we wanted to put in a specific spot
278:54 and we wanted to put in a specific spot so say we want to put it in index two we
278:56 so say we want to put it in index two we could say two and then we could give it
278:59 could say two and then we could give it a movie Hustle the movie I just watched
279:01 a movie Hustle the movie I just watched recently and really liked and we can
279:04 recently and really liked and we can come in here and print movies now we
279:06 come in here and print movies now we save that
279:07 save that you can see that we can actually insert
279:09 you can see that we can actually insert hustle here into position two on the
279:12 hustle here into position two on the index so pretty neat
279:15 index so pretty neat now we can also remove movies we did
279:18 now we can also remove movies we did movies.pop
279:20 movies.pop come in here and that will remove
279:31 so if we come in here add a print statement
279:32 come in here add a print statement really quick save that and then print
279:35 really quick save that and then print this out
279:37 this out you'll see that Jaws is now gone
279:46 we can also specify specific spots we want to remove so if we want to remove
279:47 want to remove so if we want to remove index 0 we could and then this will
279:50 index 0 we could and then this will remove
279:52 remove the first item
279:54 the first item print movies
279:57 print movies save
279:58 save go ahead
280:00 go ahead and When Harry Met Sally is now gone
280:02 and When Harry Met Sally is now gone from our list
280:04 from our list we can also combine two lists so if we
280:07 we can also combine two lists so if we come in here and let's say that my wife
280:10 come in here and let's say that my wife has favorite movies and she definitely
280:12 has favorite movies and she definitely does
280:13 does and we'll just go with a couple of her
280:16 and we'll just go with a couple of her favorite movies she likes
280:18 favorite movies she likes Just Go With It
280:21 Just Go With It and she also likes 50 First Dates
280:27 and she also likes 50 First Dates come in here and close that off well we
280:30 come in here and close that off well we can combine movies let's say we wanted
280:33 can combine movies let's say we wanted to know our favorite movies
280:35 to know our favorite movies what we can do we can combine lists I
280:37 what we can do we can combine lists I should say come in here and I could say
280:39 should say come in here and I could say I want to add movies plus
280:41 I want to add movies plus Amber movies
280:43 Amber movies and I can print
280:47 and I can print our favorite
280:50 our favorite movies and then I have now combined
280:52 movies and then I have now combined lists let's go ahead and take a look at
280:53 lists let's go ahead and take a look at that hopefully I did it right
280:55 that hopefully I did it right and you can see now the hangover hustle
280:58 and you can see now the hangover hustle perks a big Wildfire Exorcist just go
281:00 perks a big Wildfire Exorcist just go with the 50 First Dates you could also
281:02 with the 50 First Dates you could also just come in here if you copied this by
281:05 just come in here if you copied this by the way
281:05 the way and just pasted this you don't have to
281:07 and just pasted this you don't have to put it into a variable you could totally
281:09 put it into a variable you could totally do it like that but I think storing in
281:11 do it like that but I think storing in variables is a better practice so I'm
281:13 variables is a better practice so I'm going to go ahead and just Ctrl Z here
281:16 going to go ahead and just Ctrl Z here and
281:17 and one more thing so we can also have what
281:21 one more thing so we can also have what are called 2D lists
281:23 are called 2D lists so two dimensional lists so let's say
281:26 so two dimensional lists so let's say for example we have grades
281:28 for example we have grades and we have a list of grades and we're
281:30 and we have a list of grades and we're going to say that
281:31 going to say that inside this list we have Bob and his
281:34 inside this list we have Bob and his grade is an 82.
281:37 grade is an 82. and then we have
281:39 and then we have Alice
281:44 and she has a 90.
281:46 a 90. okay and then we've got Jeff
281:50 okay and then we've got Jeff 's not doing so hot Jeff's got a 73.
281:54 's not doing so hot Jeff's got a 73. okay
281:55 okay and let's say we wanted to pull down
281:59 and let's say we wanted to pull down Bob's grade we could make a variable
282:02 Bob's grade we could make a variable like it's called Bob's grade
282:05 like it's called Bob's grade and we could set that to grades and then
282:07 and we could set that to grades and then do something like zero one like this and
282:11 do something like zero one like this and what are we doing here well we're saying
282:13 what are we doing here well we're saying I want to pull from the first index
282:16 I want to pull from the first index okay index one or zero right
282:19 okay index one or zero right first index 0 1 2 so I'm pulling from
282:23 first index 0 1 2 so I'm pulling from zero
282:24 zero and within that I want to pull the
282:27 and within that I want to pull the second item which is this zero one so we
282:30 second item which is this zero one so we have a two dimensional index here and if
282:33 have a two dimensional index here and if we went ahead and printed
282:36 we went ahead and printed Bob's grade you can see now we save this
282:45 we get an 82. well that's correct what if we screwed
282:48 well that's correct what if we screwed up Bob's grade and we wanted to fix it
282:50 up Bob's grade and we wanted to fix it well we could also do something like
282:51 well we could also do something like grades 0 1 just kind of like we called
282:55 grades 0 1 just kind of like we called and we could just set it equal to 83
282:56 and we could just set it equal to 83 maybe it wasn't 83.
282:58 maybe it wasn't 83. okay we come in here and we print out
283:01 okay we come in here and we print out grades
283:03 grades you should see that this has changed so
283:05 you should see that this has changed so let's go ahead and print this you can
283:08 let's go ahead and print this you can see now Bob has an 83. so we can modify
283:12 see now Bob has an 83. so we can modify our 2D lists as well
283:16 our 2D lists as well so that is it for list remember lists
283:19 so that is it for list remember lists have brackets lists are data structures
283:22 have brackets lists are data structures we can change lists as you saw we were
283:26 we can change lists as you saw we were able to append pop insert remove okay we
283:30 able to append pop insert remove okay we can modify many different ways we're
283:33 can modify many different ways we're going to move on here in a second to
283:36 going to move on here in a second to what are called tuples and tuples cannot
283:38 what are called tuples and tuples cannot be changed even though they look very
283:40 be changed even though they look very much like lists they are different so
283:43 much like lists they are different so I'll go ahead and see you over in the
283:45 I'll go ahead and see you over in the next lesson when we cover duples
283:49 next lesson when we cover duples okay let's talk about tuples very
283:51 okay let's talk about tuples very quickly and then we're gonna move on so
283:54 quickly and then we're gonna move on so do a new line
283:56 do a new line say tuples
283:59 say tuples and these are like lists but they do not
284:03 and these are like lists but they do not change we'll say do not change
284:05 change we'll say do not change and then they get parentheses as opposed
284:09 and then they get parentheses as opposed to getting brackets
284:11 to getting brackets okay so we might want to have something
284:13 okay so we might want to have something that doesn't change and when something
284:15 that doesn't change and when something can't change we say that they are not
284:19 can't change we say that they are not mutable
284:21 mutable m-u-t-a-b-l-e they're not mutable so
284:24 m-u-t-a-b-l-e they're not mutable so that means that they're immutable and
284:27 that means that they're immutable and tuples are immutable meaning we can't
284:30 tuples are immutable meaning we can't change them so we think of list list
284:34 change them so we think of list list mutable tuples not mutable or immutable
284:36 mutable tuples not mutable or immutable so if we have a tuple of grades we can
284:40 so if we have a tuple of grades we can say something like grades are equal to a
284:43 say something like grades are equal to a b
284:46 b see this is the American grading system
284:50 see this is the American grading system d
284:52 d and F
284:54 and F coming here if we did something like
284:57 coming here if we did something like grades.pop like we saw before
284:59 grades.pop like we saw before or grades dot append something like that
285:03 or grades dot append something like that neither of these are not going to work
285:06 neither of these are not going to work or neither of these will work I should
285:08 or neither of these will work I should say proper English what's going to
285:11 say proper English what's going to happen is they're not mutable we can't
285:12 happen is they're not mutable we can't change them once we have this and we
285:15 change them once we have this and we store it it does not change so if we
285:18 store it it does not change so if we want something that is like a list but
285:20 want something that is like a list but we don't want it to change it's better
285:22 we don't want it to change it's better to use a tuple we can set something in
285:25 to use a tuple we can set something in stone like our grade letterings and then
285:28 stone like our grade letterings and then we can call those when we need to we can
285:30 we can call those when we need to we can just say something like print grades
285:32 just say something like print grades and give it a one
285:34 and give it a one and save it and we should get a B back
285:38 and save it and we should get a B back okay and we get a B back so that's it
285:41 okay and we get a B back so that's it just know the difference between tuples
285:43 just know the difference between tuples and lists and that tuples do not change
285:46 and lists and that tuples do not change but they are very similar in how they
285:49 but they are very similar in how they can function and there are pros and cons
285:51 can function and there are pros and cons to each of those
285:52 to each of those so we're gonna go ahead and move on to
285:55 so we're gonna go ahead and move on to the next lesson which is going to be
285:57 the next lesson which is going to be looping
285:59 looping okay so let's come in here make a new
286:02 okay so let's come in here make a new line
286:03 line and we're going to call this looping
286:07 and we're going to call this looping so we're going to talk about two
286:08 so we're going to talk about two different types of Loops the first type
286:10 different types of Loops the first type of loop that we're going to talk about
286:12 of loop that we're going to talk about is what's called a for Loop
286:15 is what's called a for Loop and four Loops are start to finish of an
286:20 and four Loops are start to finish of an iterate
286:22 iterate and here's what a loop looks like and
286:25 and here's what a loop looks like and we'll take a look so let's go ahead and
286:27 we'll take a look so let's go ahead and get a list we're going to say vegetables
286:30 get a list we're going to say vegetables and you can put whatever vegetables you
286:32 and you can put whatever vegetables you want in here I'm going to go with a
286:33 want in here I'm going to go with a cucumber
286:36 cucumber I'll do some spinach
286:38 I'll do some spinach and then we'll do some cabbage as well
286:42 and then we'll do some cabbage as well and now what we're gonna do is we're
286:44 and now what we're gonna do is we're gonna come in here and we're going to
286:46 gonna come in here and we're going to write a four Loop we're going to say 4 x
286:50 write a four Loop we're going to say 4 x and x could be whatever you want it to
286:52 and x could be whatever you want it to be you could say for veggies
286:56 be you could say for veggies it could be whatever you want to call it
286:57 it could be whatever you want to call it in this instance I'm just going to call
286:58 in this instance I'm just going to call it X
287:00 it X in vegetables
287:02 in vegetables the 4X in this list
287:05 the 4X in this list we're going to go ahead and print out
287:09 we're going to go ahead and print out so what do you think this is going to do
287:11 so what do you think this is going to do all this is going to do is just Loop
287:14 all this is going to do is just Loop through the iterates start to finish up
287:17 through the iterates start to finish up and iterate so it's going to say
287:18 and iterate so it's going to say cucumber spinach cabbage go ahead and
287:20 cucumber spinach cabbage go ahead and give it a go save it print it
287:24 give it a go save it print it cucumber spinach cabbage all we did was
287:26 cucumber spinach cabbage all we did was go through a list iterate through it
287:28 go through a list iterate through it until we reached the end of the list and
287:30 until we reached the end of the list and then it stopped so that is a for Loop
287:33 then it stopped so that is a for Loop another good example of a loop if you
287:35 another good example of a loop if you want to think about it might be trying
287:38 want to think about it might be trying to Ping an IEP address like a 192 168
287:43 to Ping an IEP address like a 192 168 1.1 or maybe you have 1.x maybe there's
287:48 1.1 or maybe you have 1.x maybe there's a whole slew of ips that you want to
287:50 a whole slew of ips that you want to Ping maybe it's one through 254. okay if
287:55 Ping maybe it's one through 254. okay if you wanted to Ping all of those you
287:57 you wanted to Ping all of those you might want to do something like a 4X in
288:01 might want to do something like a 4X in IP and where IP is just equal to like a
288:05 IP and where IP is just equal to like a sequence like say IP is like a sequence
288:08 sequence like say IP is like a sequence of one to 254 and don't worry about this
288:12 of one to 254 and don't worry about this I'm just logically writing this out so
288:14 I'm just logically writing this out so if you say IPS 1 to 254 for x and IEP
288:18 if you say IPS 1 to 254 for x and IEP and then you want to do something you
288:20 and then you want to do something you might want to like Ping
288:29 192.168.1.x and then X will be one then two then three then four okay so you
288:32 two then three then four okay so you could write something like this for a
288:35 could write something like this for a pink sweeper again it's the start to
288:37 pink sweeper again it's the start to finish of an iterate one through two
288:39 finish of an iterate one through two fifty four with a stop at 254 when the
288:42 fifty four with a stop at 254 when the iterate is done now another example of
288:45 iterate is done now another example of this or another example of a loop is
288:48 this or another example of a loop is what we call a while loop let me say
288:50 what we call a while loop let me say wall loops
288:52 wall loops these execute as long
288:56 these execute as long as true
288:59 as true I should probably capitalize true so
289:01 I should probably capitalize true so that way it makes sense that we're
289:03 that way it makes sense that we're talking booleans so let's think about
289:05 talking booleans so let's think about this situation what about we set I equal
289:09 this situation what about we set I equal to one so we've got a variable of I
289:11 to one so we've got a variable of I equal to one
289:13 equal to one while I is less than 10.
289:16 while I is less than 10. we're going to go ahead and print out I
289:21 we're going to go ahead and print out I and then we're going to say I Plus
289:25 and then we're going to say I Plus equals 1.
289:28 equals 1. so what's going to happen
289:29 so what's going to happen well while I is less than 10
289:32 well while I is less than 10 . so right now I is equal to 1 1 is less
289:36 . so right now I is equal to 1 1 is less than 10 that is true we're going to go
289:38 than 10 that is true we're going to go ahead and print I increase the value of
289:41 ahead and print I increase the value of I by 1. so the next time it Loops
289:43 I by 1. so the next time it Loops through it's going to be 2 and it's
289:45 through it's going to be 2 and it's going to continue on until this is no
289:48 going to continue on until this is no longer true so if we save this this
289:51 longer true so if we save this this should print out one through nine
289:53 should print out one through nine because we're not looking for 10 just
289:55 because we're not looking for 10 just one through nine so we're going to say
289:57 one through nine so we're going to say that hit enter one two three four five
290:00 that hit enter one two three four five six seven eight nine and it looks like
290:02 six seven eight nine and it looks like the loop actually did its job so again
290:05 the loop actually did its job so again we have two types of Loops all we need
290:07 we have two types of Loops all we need to know about right now is we have a
290:08 to know about right now is we have a start to finish of an iterate that's the
290:10 start to finish of an iterate that's the for Loop a little while loop executes as
290:13 for Loop a little while loop executes as long as true we may see these later on
290:16 long as true we may see these later on as we do our project work so keep these
290:19 as we do our project work so keep these in mind as we go on through the course
290:21 in mind as we go on through the course so from here we're going to go ahead and
290:23 so from here we're going to go ahead and move on to Advanced strings so I'll see
290:25 move on to Advanced strings so I'll see you over in the next lesson
290:28 you over in the next lesson okay let's take a look at some Advanced
290:31 okay let's take a look at some Advanced strings so if we come in here
290:34 strings so if we come in here again we do a new line
290:37 again we do a new line go ahead and enter Advanced strings
290:41 go ahead and enter Advanced strings and let's create a variable of my name
290:45 and let's create a variable of my name I'm going to say my name is Heath
290:49 I'm going to say my name is Heath now let's say we wanted to print
290:52 now let's say we wanted to print my name and we wanted to grab the first
290:55 my name and we wanted to grab the first letter of my name how do you think we
290:58 letter of my name how do you think we might do that
291:00 might do that well if you're saying index of 0 you are
291:03 well if you're saying index of 0 you are absolutely correct
291:05 absolutely correct and we can say in here first letter
291:08 and we can say in here first letter what about printing the last letter of
291:10 what about printing the last letter of my name
291:12 my name well if you say negative one you have
291:15 well if you say negative one you have remembered your index lessons great job
291:17 remembered your index lessons great job that's going to be the last letter
291:20 that's going to be the last letter we can save this and we can go ahead and
291:23 we can save this and we can go ahead and print
291:28 and if I made this a string that would be very helpful go ahead and save this
291:32 be very helpful go ahead and save this you can see that we get the capital H
291:34 you can see that we get the capital H and the lowercase H here because my name
291:36 and the lowercase H here because my name starts with an h and ends with an H
291:39 starts with an h and ends with an H so another thing to note about strings
291:42 so another thing to note about strings much like tuples they are also immutable
291:46 much like tuples they are also immutable you cannot change a string we cannot
291:49 you cannot change a string we cannot modify the string we can join strings we
291:52 modify the string we can join strings we could split strings and we'll talk about
291:53 could split strings and we'll talk about that here in a second but once I have
291:55 that here in a second but once I have set this variable in this string this
291:58 set this variable in this string this string is here forever I can always
292:00 string is here forever I can always change the value of this variable but
292:03 change the value of this variable but you cannot change this string so again
292:05 you cannot change this string so again strings are immutable
292:07 strings are immutable now let's go ahead and say we have a
292:10 now let's go ahead and say we have a sentence
292:11 sentence we give that
292:14 we give that something like this is a sentence
292:18 something like this is a sentence if I can type today
292:20 if I can type today and we print out sentence
292:28 with something like this what do we think that's going to look
292:29 what do we think that's going to look like let's save this print it
292:32 like let's save this print it you can see that we get this what are we
292:35 you can see that we get this what are we doing well we're just grabbing this
292:37 doing well we're just grabbing this first word however we have the benefit
292:40 first word however we have the benefit of knowing what the first word is and
292:43 of knowing what the first word is and how long it is so we went 0 1 2 3.
292:48 how long it is so we went 0 1 2 3. remember we stopped at four so we grab
292:50 remember we stopped at four so we grab the word this
292:51 the word this well what if we were in a situation
292:53 well what if we were in a situation where we didn't know what the word was
292:56 where we didn't know what the word was or how long the first word was we could
292:58 or how long the first word was we could use something like a delimiter so we
293:01 use something like a delimiter so we could say print
293:03 could say print we could do sentence dot split
293:07 we could do sentence dot split and if we do a DOT split we can just do
293:10 and if we do a DOT split we can just do it like this and then this is a
293:14 it like this and then this is a delimiter and a delimiter says we're
293:17 delimiter and a delimiter says we're going to take something and we're going
293:19 going to take something and we're going to split based on that now the default
293:22 to split based on that now the default delimiter in Python if we just give it a
293:24 delimiter in Python if we just give it a split is a space
293:27 split is a space if we save this
293:29 if we save this come in here
293:31 come in here this is a sentence now look at it it's
293:35 this is a sentence now look at it it's in a list we could pull the first item
293:37 in a list we could pull the first item if we wanted to and know the first word
293:39 if we wanted to and know the first word instead of having to split it like this
293:41 instead of having to split it like this or pull it out like that
293:42 or pull it out like that so
293:44 so we could do something like this as well
293:46 we could do something like this as well this is just a proof of concept that's a
293:49 this is just a proof of concept that's a little bit fun we go sentence
293:51 little bit fun we go sentence split
293:53 split and we say that is equal to sentence
293:57 and we say that is equal to sentence dot split
293:59 dot split okay and then we also create another
294:01 okay and then we also create another variable we call that sentence join and
294:05 variable we call that sentence join and we say that is equal to
294:07 we say that is equal to space we're giving it a delimiter to
294:09 space we're giving it a delimiter to join on actually we're telling you what
294:12 join on actually we're telling you what to add in between the different words
294:15 to add in between the different words that we're pulling out so we're adding a
294:16 that we're pulling out so we're adding a space here and we're going to say join
294:20 space here and we're going to say join sentence split like this
294:24 sentence split like this and if we print out
294:27 and if we print out sentence join what do you think we're
294:30 sentence join what do you think we're gonna actually have happen here let's
294:32 gonna actually have happen here let's save it
294:34 save it guess what this is a sentence so all we
294:38 guess what this is a sentence so all we did was deconstruct this sentence based
294:42 did was deconstruct this sentence based on the delimiter it came out to this is
294:44 on the delimiter it came out to this is a sentence and then we joined it back
294:46 a sentence and then we joined it back together with a space so every one of
294:48 together with a space so every one of those got a space in between and that's
294:51 those got a space in between and that's it so that's just a Nifty little way to
294:53 it so that's just a Nifty little way to show you that splitting and joining is
294:55 show you that splitting and joining is possible and again this is still
294:59 possible and again this is still immutable even though we're messing
295:01 immutable even though we're messing around with the strings the strings are
295:02 around with the strings the strings are immutable let's take a look at a few
295:05 immutable let's take a look at a few other things here
295:08 other things here I mentioned in the beginning of the
295:09 I mentioned in the beginning of the first lesson when we were talking about
295:11 first lesson when we were talking about strings initially that we might have
295:15 strings initially that we might have different ways of using single quotes
295:17 different ways of using single quotes and double quotes and think about this
295:20 and double quotes and think about this like what if we had a situation of quote
295:22 like what if we had a situation of quote and we wanted to say something like he
295:25 and we wanted to say something like he said
295:27 said give me all your money
295:31 give me all your money well with this situation what are we
295:35 well with this situation what are we gonna do what if we wanted to add quotes
295:37 gonna do what if we wanted to add quotes here and say give me all your money we
295:41 here and say give me all your money we do that because that is a quote well
295:43 do that because that is a quote well looks like it's kind of messed up we're
295:45 looks like it's kind of messed up we're not seeing it in green it kind of looks
295:46 not seeing it in green it kind of looks funny what we can do in this situation
295:49 funny what we can do in this situation is we can use single quotes if we wanted
295:51 is we can use single quotes if we wanted to
295:52 to or we could flip this around by the way
295:54 or we could flip this around by the way we could use single quotes on the
295:55 we could use single quotes on the outside and then double quotes on the
295:57 outside and then double quotes on the inside if we wanted to use double quotes
295:58 inside if we wanted to use double quotes here and I could save this so let's
296:01 here and I could save this so let's print out quote just to show you and
296:03 print out quote just to show you and then we can save this
296:09 another thing that we can do though is we can say something like quote
296:18 and then we can just do he said and we can do character escaping so we can do
296:23 can do character escaping so we can do give me all your money like this
296:28 give me all your money like this and now python knows that everything
296:31 and now python knows that everything within these escaped characters
296:34 within these escaped characters is ignoring it's ignoring this double
296:37 is ignoring it's ignoring this double quote here and ignoring this double
296:39 quote here and ignoring this double quote here so we're escaping that and
296:42 quote here so we're escaping that and then we can print it
296:43 then we can print it and hopefully we did this right go ahead
296:47 and hopefully we did this right go ahead and print
296:48 and print you can see now it says he said give me
296:50 you can see now it says he said give me all your money in double quotes while we
296:53 all your money in double quotes while we also use double quotes on the outside so
296:55 also use double quotes on the outside so we can use character escaping if we want
296:58 we can use character escaping if we want to just know that we'll have to use this
297:00 to just know that we'll have to use this backslash in front of each of the
297:02 backslash in front of each of the characters that we want to escape okay
297:05 characters that we want to escape okay let's take a few more examples here so
297:08 let's take a few more examples here so if we say
297:10 if we say something like a variable of too much
297:12 something like a variable of too much space what happens in the situation
297:14 space what happens in the situation where we have
297:15 where we have like you can just add as much space as
297:18 like you can just add as much space as you want in here it doesn't really
297:19 you want in here it doesn't really matter we have a string with a lot of
297:21 matter we have a string with a lot of space in there well we can strip this
297:23 space in there well we can strip this out we can print too much space and then
297:28 out we can print too much space and then we can do a DOT strip
297:30 we can do a DOT strip and the strip is going to take the
297:32 and the strip is going to take the delimiter of a space as default
297:35 delimiter of a space as default and that will also strip this out you
297:38 and that will also strip this out you can see there's just hello there nothing
297:40 can see there's just hello there nothing else so that's kind of nice
297:43 else so that's kind of nice few more items what if we have the
297:45 few more items what if we have the letter of a
297:48 letter of a and we have the word
297:51 and we have the word of
297:53 of Apple
297:55 Apple okay
297:56 okay well what if we wanted to know something
297:59 well what if we wanted to know something like this let's actually go up a little
298:01 like this let's actually go up a little bit
298:01 bit and let's say we wanted to know like
298:03 and let's say we wanted to know like print
298:05 print a and Apple
298:09 a and Apple okay what is this going to return
298:12 okay what is this going to return go ahead and if I could type sorry
298:15 go ahead and if I could type sorry and this is going to return something
298:18 and this is going to return something let's go ahead and save that
298:20 let's go ahead and save that that's going to return true
298:23 that's going to return true so we'll just say true
298:26 so we'll just say true now if we print
298:28 now if we print a in apple
298:35 you're going to see that this is going to return false
298:38 to return false save this
298:41 save this y
298:42 y well this here is a lowercase a and that
298:45 well this here is a lowercase a and that does not exist with an apple so even
298:47 does not exist with an apple so even though we're looking for a specific
298:49 though we're looking for a specific letter Within A Word we have to match
298:52 letter Within A Word we have to match case sensitivity in order for that to
298:54 case sensitivity in order for that to return true so if we wanted to know if
298:57 return true so if we wanted to know if the letter A was in the word apple and
298:59 the letter A was in the word apple and we weren't concerned about case
299:01 we weren't concerned about case sensitivity then what do we do in that
299:05 sensitivity then what do we do in that situation
299:06 situation well this brings something up that we
299:08 well this brings something up that we did a little bit early on which is using
299:12 did a little bit early on which is using lowercase remember the lowercase method
299:14 lowercase remember the lowercase method we can say print
299:16 we can say print and then we can come in here and say
299:17 and then we can come in here and say letter dot lower you could also do upper
299:20 letter dot lower you could also do upper if you wanted to but what we're doing is
299:22 if you wanted to but what we're doing is we're converting all of this to
299:24 we're converting all of this to lowercase so this is not going to be a
299:26 lowercase so this is not going to be a lowercase a and then we could say in
299:28 lowercase a and then we could say in word dot lower
299:31 word dot lower and we can just say this is an improved
299:34 and we can just say this is an improved way of doing this
299:36 way of doing this so if we print that out we save this
299:38 so if we print that out we save this this should come back as true
299:41 this should come back as true so think about when you're trying to
299:44 so think about when you're trying to match a word or a string or anything and
299:48 match a word or a string or anything and if somebody came in and you were
299:49 if somebody came in and you were expecting like I don't know like think
299:51 expecting like I don't know like think about school and we're thinking about uh
299:54 about school and we're thinking about uh a word maybe like
299:56 a word maybe like Manhattan I don't know and somebody
299:59 Manhattan I don't know and somebody types in
300:01 types in Manhattan like this
300:03 Manhattan like this okay we still want to be able to accept
300:05 okay we still want to be able to accept that answer is true even though they may
300:08 that answer is true even though they may have screwed up a little bit on the
300:10 have screwed up a little bit on the punctuation now there could be instances
300:12 punctuation now there could be instances where we want a capitalized letter and
300:14 where we want a capitalized letter and it has to be very specific in that case
300:17 it has to be very specific in that case this kind of syntax works but if we're
300:19 this kind of syntax works but if we're looking to just accept an answer like
300:22 looking to just accept an answer like Manhattan for Manhattan then we might
300:25 Manhattan for Manhattan then we might want to consider using lowercase or
300:27 want to consider using lowercase or uppercase in that situation just to
300:30 uppercase in that situation just to match those words or letters or whatever
300:33 match those words or letters or whatever it might be
300:34 it might be so one more thing let's look at what is
300:38 so one more thing let's look at what is called string formatting so if we do
300:41 called string formatting so if we do something like movie we'll pick the
300:43 something like movie we'll pick the hangover again
300:45 hangover again we say The Hangover you can pick
300:47 we say The Hangover you can pick whatever movie you want here there's a
300:49 whatever movie you want here there's a few ways that we can print this out
300:51 few ways that we can print this out remember we concatenated early on and we
300:54 remember we concatenated early on and we said like print
300:57 said like print we did something like my favorite movie
301:00 we did something like my favorite movie [Music]
301:01 [Music] is space
301:04 is space plus
301:05 plus you know movie something like that right
301:08 you know movie something like that right well we can actually write this in a
301:12 well we can actually write this in a certain way that is a little bit easier
301:14 certain way that is a little bit easier so there's a few things that we can do
301:16 so there's a few things that we can do for example we can do my favorite movie
301:18 for example we can do my favorite movie is add a couple brackets in here like
301:21 is add a couple brackets in here like that
301:22 that and then we can add
301:25 and then we can add period at the end just because we're
301:26 period at the end just because we're going to close our sentence we'll say
301:28 going to close our sentence we'll say dot format
301:30 dot format and we'll say movie and close that off
301:34 and we'll say movie and close that off that's one way of doing it
301:36 that's one way of doing it if we save that
301:39 if we save that it's a my favorite movie is The Hangover
301:43 it's a my favorite movie is The Hangover okay this is called using the string
301:46 okay this is called using the string format method now what we can do there's
301:49 format method now what we can do there's another type of method we can use is we
301:52 another type of method we can use is we could say print my favorite movie is
301:56 could say print my favorite movie is percent s
301:58 percent s and we say
302:00 and we say percent really
302:02 percent really just like this
302:04 just like this save that
302:06 save that this is using percent formatting and
302:09 this is using percent formatting and look the same thing happens I just
302:11 look the same thing happens I just forgot my period in there
302:13 forgot my period in there so no big deal
302:15 so no big deal lastly if we print out
302:19 lastly if we print out an F in the front this is called an F
302:21 an F in the front this is called an F string or what's known as a string
302:23 string or what's known as a string literal we can do my favorite movie is
302:28 literal we can do my favorite movie is and then just do a movie like this
302:31 and then just do a movie like this super easy
302:34 super easy and we have moved off of using the
302:37 and we have moved off of using the format method and the percent method
302:40 format method and the percent method into this F string or string literal let
302:44 into this F string or string literal let me come in here we save this
302:46 me come in here we save this tab up print and you can see my favorite
302:49 tab up print and you can see my favorite movie is The Hangover that worked out
302:52 movie is The Hangover that worked out perfectly well you can use any of these
302:54 perfectly well you can use any of these to format but just know that the F
302:57 to format but just know that the F strings are the latest and the greatest
302:59 strings are the latest and the greatest way of doing it in Python 3.
303:02 way of doing it in Python 3. so that is it for this lesson we're
303:04 so that is it for this lesson we're going to go ahead and move on to
303:06 going to go ahead and move on to dictionaries
303:08 dictionaries okay so we'll add new lines in here
303:12 okay so we'll add new lines in here and we'll say dictionaries
303:16 and we'll say dictionaries and we could think of these as key value
303:18 and we could think of these as key value pairs
303:24 and also think of these with the curly braces like this so we've seen lists
303:28 braces like this so we've seen lists like that we've seen tuples now we can
303:31 like that we've seen tuples now we can think of dictionaries with the curly
303:32 think of dictionaries with the curly braces
303:34 braces so let's go ahead and we're going to put
303:37 so let's go ahead and we're going to put some drinks and again I'm going to use
303:40 some drinks and again I'm going to use alcoholic beverages you do not have to
303:42 alcoholic beverages you do not have to do that you can use whatever drinks and
303:45 do that you can use whatever drinks and prices in here that you want but we're
303:47 prices in here that you want but we're going to have a key value pair so our
303:49 going to have a key value pair so our key is going to be the drink so first
303:52 key is going to be the drink so first drink I'm going to pick up is a White
303:54 drink I'm going to pick up is a White Russian
303:55 Russian and the value is going to be seven let's
303:59 and the value is going to be seven let's say that a White Russian costs seven
304:01 say that a White Russian costs seven dollars
304:02 dollars if we do an Old Fashioned
304:06 if we do an Old Fashioned we're going to say that this costs ten
304:08 we're going to say that this costs ten dollars
304:09 dollars and we'll do one more we'll do a lemon
304:12 and we'll do one more we'll do a lemon drop and we'll just say that this costs
304:15 drop and we'll just say that this costs eight dollars
304:16 eight dollars okay and we can make a note here to
304:18 okay and we can make a note here to ourselves that drink is the key
304:23 ourselves that drink is the key price is the value remember key value
304:27 price is the value remember key value pairs key value
304:31 pairs key value all right so we've got our drinks we can
304:33 all right so we've got our drinks we can print our drinks
304:35 print our drinks save this go ahead print
304:38 save this go ahead print and you can see we print out our
304:41 and you can see we print out our dictionary here
304:43 dictionary here now
304:44 now let's give it another example
304:48 let's give it another example let's say that we have employees
304:52 let's say that we have employees and this could be a good example so we
304:54 and this could be a good example so we say we have employees and I really like
304:57 say we have employees and I really like the show Bob's Burgers so I'm going to
304:58 the show Bob's Burgers so I'm going to use Bob's Burgers here as an example
305:00 use Bob's Burgers here as an example let's say we have different departments
305:03 let's say we have different departments we've got the finance department
305:06 we've got the finance department and in the finance department
305:09 and in the finance department we actually have a list of people what
305:12 we actually have a list of people what if we've got we've got Bob oops we've
305:15 if we've got we've got Bob oops we've got Linda
305:17 got Linda and we've got Tina
305:20 and we've got Tina all in finance
305:22 all in finance we can also have another department
305:24 we can also have another department let's have it
305:26 let's have it so again that's the key
305:28 so again that's the key and the value is going to be this list
305:31 and the value is going to be this list that we're putting in there so Gene
305:34 that we're putting in there so Gene Louise
305:36 Louise and we'll throw our Teddy in there as
305:38 and we'll throw our Teddy in there as well
305:40 well and that one and let's do one more we'll
305:44 and that one and let's do one more we'll do HR
305:45 do HR so HR and we'll put in here
305:49 so HR and we'll put in here Jimmy Jr
305:51 Jimmy Jr and we'll also put in Mort
305:54 and we'll also put in Mort again you can put whatever you want in
305:56 again you can put whatever you want in here and if you need to pause if you're
305:58 here and if you need to pause if you're trying to follow line for line word for
306:01 trying to follow line for line word for word you need to pause and type this out
306:02 word you need to pause and type this out feel free to do that
306:04 feel free to do that I'm gonna go ahead and print out our
306:07 I'm gonna go ahead and print out our employees just to show this make sure I
306:10 employees just to show this make sure I type this all right because this is a
306:11 type this all right because this is a lot of syntax
306:13 lot of syntax and we've got Finance it and HR looks
306:17 and we've got Finance it and HR looks like we did a great job awesome
306:20 like we did a great job awesome so let's say I wanted to add a new key
306:24 so let's say I wanted to add a new key value pair I could do that in a couple
306:26 value pair I could do that in a couple of different ways we can do something
306:28 of different ways we can do something like employees
306:30 like employees and we can just say something like we
306:33 and we can just say something like we want to add a legal department
306:35 want to add a legal department all right and in the legal department
306:38 all right and in the legal department we're gonna have
306:40 we're gonna have just one person we'll just have Mr frond
306:44 just one person we'll just have Mr frond he's our legal team
306:46 he's our legal team okay we'll just say it adds new e value
306:50 okay we'll just say it adds new e value pair
306:52 pair save that actually let's print employees
306:55 save that actually let's print employees so that way we can actually
306:57 so that way we can actually verify save
306:59 verify save print
307:01 print and you can see legal ads Mr frond so we
307:04 and you can see legal ads Mr frond so we are adding to the end of our dictionary
307:07 are adding to the end of our dictionary just like we added to the end of our
307:10 just like we added to the end of our list everything gets appended to the end
307:12 list everything gets appended to the end unless we specify otherwise
307:15 unless we specify otherwise let's go ahead and come in here another
307:18 let's go ahead and come in here another way that we can do this is we can say
307:20 way that we can do this is we can say something like employees
307:22 something like employees dot update
307:25 dot update and we can say something like give it a
307:28 and we can say something like give it a sales department
307:30 sales department and in the sales department we'll have
307:33 and in the sales department we'll have Andy
307:34 Andy we'll have Ollie
307:39 close that off we're also going to have to close off
307:41 we're also going to have to close off our curly braces and we'll close off our
307:44 our curly braces and we'll close off our parentheses and if you have a decent
307:48 parentheses and if you have a decent notepad it'll show you where your items
307:51 notepad it'll show you where your items are so that way you know you're closing
307:53 are so that way you know you're closing things off correctly so we've got three
307:55 things off correctly so we've got three different types of syntax going on there
307:57 different types of syntax going on there and it sometimes can be hard to read so
308:00 and it sometimes can be hard to read so here we could say adds new key value
308:04 here we could say adds new key value pair as well
308:05 pair as well so just another way of doing it we can
308:07 so just another way of doing it we can print employees and we'll see that
308:10 print employees and we'll see that Annie and Ollie should be added provided
308:13 Annie and Ollie should be added provided we typed everything correct which we did
308:14 we typed everything correct which we did so here's sales with Andy and Ollie
308:19 so here's sales with Andy and Ollie okay one more thing let's say that we
308:21 okay one more thing let's say that we wanted to update
308:24 wanted to update something in our dictionary we're going
308:25 something in our dictionary we're going to go ahead and update a value we're
308:28 to go ahead and update a value we're going to go back to drinks for this one
308:29 going to go back to drinks for this one let's say that inflation has happened
308:33 let's say that inflation has happened which it has and with inflation the
308:37 which it has and with inflation the price of a white russian has now gone up
308:40 price of a white russian has now gone up from Seven dollars to eight dollars we
308:43 from Seven dollars to eight dollars we can do something like that print drinks
308:45 can do something like that print drinks and you should see
308:47 and you should see that hopefully this has been updated
308:51 that hopefully this has been updated to eight dollars which it was seven
308:53 to eight dollars which it was seven before now it's eight perfect
308:55 before now it's eight perfect we can also grab the value of that so if
308:58 we can also grab the value of that so if we wanted to do something like print
309:01 we wanted to do something like print drinks dot get and then we do white
309:04 drinks dot get and then we do white Russian
309:05 Russian totally do something like this
309:08 totally do something like this and save and hopefully it will return
309:11 and save and hopefully it will return eight
309:13 eight and it does
309:15 and it does so that is it for this lesson we're
309:18 so that is it for this lesson we're going to go ahead and move into a new
309:21 going to go ahead and move into a new file here in the next video so let's go
309:24 file here in the next video so let's go ahead and save this and close this and
309:27 ahead and save this and close this and we'll prepare for the next video so I'll
309:29 we'll prepare for the next video so I'll catch you over in the next lesson
309:37 okay so I wanted to talk about importing we're going to talk about importing
309:39 we're going to talk about importing modules so I wanted to make a new file
309:42 modules so I wanted to make a new file for this let's just call this mouse pad
309:45 for this let's just call this mouse pad importing dot Pi or whatever you want to
309:48 importing dot Pi or whatever you want to call it and I'm going to do the
309:50 call it and I'm going to do the Ampersand here and again if you're using
309:53 Ampersand here and again if you're using Windows or Mac just make sure you create
309:55 Windows or Mac just make sure you create a new file for this
309:57 a new file for this I'm going to go in here and I'm going to
309:59 I'm going to go in here and I'm going to add my shebang like before
310:03 add my shebang like before I'm going to declare bin Python 3 and
310:06 I'm going to declare bin Python 3 and save this
310:07 save this and now we're going to go ahead and talk
310:10 and now we're going to go ahead and talk about importing so
310:14 about importing so importing let's type this importing
310:17 importing let's type this importing and we'll say importing is important
310:22 and we'll say importing is important now modules exist within python that are
310:26 now modules exist within python that are built in but not available to us without
310:28 built in but not available to us without importing them so like you saw us being
310:31 importing them so like you saw us being able to do math but we could import a
310:34 able to do math but we could import a more robust module of math and then use
310:38 more robust module of math and then use that to do more advanced calculations
310:40 that to do more advanced calculations outside of adding subtracting exponents
310:43 outside of adding subtracting exponents Etc in this instance we're going to talk
310:47 Etc in this instance we're going to talk about a couple of different Imports that
310:49 about a couple of different Imports that we can do and that you're going to see
310:51 we can do and that you're going to see again as we get into some of our
310:53 again as we get into some of our Hands-On stuff and we build out some
310:55 Hands-On stuff and we build out some projects
310:57 projects for example we might want to import
310:59 for example we might want to import something called CIS now let's say if we
311:01 something called CIS now let's say if we tried to print out sys dot version and
311:05 tried to print out sys dot version and we'll just save this and then we're
311:07 we'll just save this and then we're going to Python 3 importing dot pi
311:12 going to Python 3 importing dot pi and you're going to see that I get an
311:13 and you're going to see that I get an error back that says CIS is not defined
311:17 error back that says CIS is not defined name says not defined okay well CIS is
311:21 name says not defined okay well CIS is something that we're going to use quite
311:24 something that we're going to use quite often in Python you're going to see it
311:26 often in Python you're going to see it imported quite a bit and it does a lot
311:29 imported quite a bit and it does a lot of different unique items like it does
311:33 of different unique items like it does something called ARG V for example which
311:36 something called ARG V for example which we'll use as an example later on but if
311:39 we'll use as an example later on but if we want to specify a an amount of
311:42 we want to specify a an amount of arguments say we're trying to run uh
311:45 arguments say we're trying to run uh Python 3 we're going to do a port
311:47 Python 3 we're going to do a port scanner later so we'll just say
311:49 scanner later so we'll just say portscanner.pi and we need to supply an
311:51 portscanner.pi and we need to supply an IP address here right and this is
311:54 IP address here right and this is argument zero this is argument one so if
311:59 argument zero this is argument one so if we Supply no argument one then we're
312:03 we Supply no argument one then we're going to throw an error it's going to be
312:05 going to throw an error it's going to be an if else statement and that's going to
312:06 an if else statement and that's going to use something called RV now we'll get
312:09 use something called RV now we'll get into that later but that's very
312:10 into that later but that's very important it's a part of CIS another
312:13 important it's a part of CIS another part of CIS is doing something like the
312:16 part of CIS is doing something like the version type of python that we're used
312:17 version type of python that we're used using or another thing is the sys dot
312:21 using or another thing is the sys dot exit which you'll see later on as well
312:23 exit which you'll see later on as well which is going to allow us to gracefully
312:26 which is going to allow us to gracefully exit
312:27 exit when we encounter an error we tell the
312:29 when we encounter an error we tell the script to exit or whatever we're doing
312:31 script to exit or whatever we're doing so we might need to import something
312:34 so we might need to import something like sis or another one is OS which is
312:38 like sis or another one is OS which is very common to be imported as well so
312:40 very common to be imported as well so let's talk about importing
312:42 let's talk about importing in order to import we can say something
312:45 in order to import we can say something like import sys just like this and we
312:49 like import sys just like this and we can just say this is for system
312:51 can just say this is for system functions and parameters
312:56 functions and parameters save that
312:58 save that and let's go ahead and just print this
313:00 and let's go ahead and just print this now and see what happens
313:02 now and see what happens you can see now that sys has been
313:04 you can see now that sys has been imported even though it wasn't built in
313:06 imported even though it wasn't built in automatically we can import it and you
313:09 automatically we can import it and you can see now it tells us hey we are
313:11 can see now it tells us hey we are running on version 3.10.5 of python and
313:15 running on version 3.10.5 of python and it was downloaded on June 8th 2022 or
313:18 it was downloaded on June 8th 2022 or built on June 8th of 2022 so
313:21 built on June 8th of 2022 so from here let's go ahead and import
313:23 from here let's go ahead and import something else let's go ahead and import
313:27 something else let's go ahead and import date time
313:29 date time and we can import from something so I
313:32 and we can import from something so I know this is going to be confusing but
313:34 know this is going to be confusing but we can import specifics from a module so
313:37 we can import specifics from a module so we're just importing the date time
313:38 we're just importing the date time feature from date time even though
313:41 feature from date time even though they're named the same just know that we
313:42 they're named the same just know that we can import specifics we don't have to
313:44 can import specifics we don't have to import the whole thing even though we
313:46 import the whole thing even though we totally could just import the whole
313:48 totally could just import the whole thing as well so here
313:50 thing as well so here for example we can say print
313:54 for example we can say print date time dot now like this and you know
313:59 date time dot now like this and you know what this is going to do it's going to
314:01 what this is going to do it's going to tell you what the date and the time is
314:03 tell you what the date and the time is and I apologize this is backwards this
314:06 and I apologize this is backwards this is it's from date time import date time
314:09 is it's from date time import date time so again your syntax will tell you where
314:12 so again your syntax will tell you where it's wrong
314:13 it's wrong and it is perfectly normal to make
314:15 and it is perfectly normal to make mistakes I leave these in the video so
314:17 mistakes I leave these in the video so that you see that I am human too and
314:20 that you see that I am human too and it's completely normal to make mistakes
314:21 it's completely normal to make mistakes like this so go ahead and do your script
314:25 like this so go ahead and do your script now and you'll see that it gives the
314:27 now and you'll see that it gives the date and the time so right now it is
314:29 date and the time so right now it is July 6th and it is two o'clock in the
314:33 July 6th and it is two o'clock in the morning
314:34 morning I am a night owl
314:35 I am a night owl now one other thing that we can do is we
314:38 now one other thing that we can do is we can come in here and we can
314:41 can come in here and we can from daytime import date time
314:44 from daytime import date time and we can also give this an alias we
314:47 and we can also give this an alias we can say as
314:48 can say as DT what if we don't want to write date
314:51 DT what if we don't want to write date time out we just want to do DT just like
314:53 time out we just want to do DT just like we didn't want to write new line out we
314:54 we didn't want to write new line out we did NL same kind of concept so we can
314:57 did NL same kind of concept so we can just say import with alias
315:00 just say import with alias and instead of saying date time.now we
315:03 and instead of saying date time.now we could just say DT dot now save that
315:06 could just say DT dot now save that go ahead and print it
315:08 go ahead and print it you can see it still works so absolutely
315:11 you can see it still works so absolutely the same thing we're just giving an
315:13 the same thing we're just giving an alias making it a little bit easier to
315:15 alias making it a little bit easier to run okay so that is it for this video
315:18 run okay so that is it for this video let's go ahead and close this out and
315:21 let's go ahead and close this out and then I'm going to meet you in the next
315:23 then I'm going to meet you in the next video we're going to talk about sockets
315:25 video we're going to talk about sockets before we get into building out a port
315:28 before we get into building out a port scanner so I'll catch you over in the
315:30 scanner so I'll catch you over in the next video
315:31 next video okay so let's make a new file and we're
315:33 okay so let's make a new file and we're going to call this s dot pi
315:36 going to call this s dot pi and again create this however you want
315:39 and again create this however you want to if you're using Linux you can follow
315:40 to if you're using Linux you can follow along like this or just create a new
315:42 along like this or just create a new file in Linux or Windows
315:45 file in Linux or Windows again we're going to shebang this up
315:48 again we're going to shebang this up here I'm going to give this a bin python
315:51 here I'm going to give this a bin python 3. now this is an incredibly necessary
315:54 3. now this is an incredibly necessary if you're running on Windows or Mac but
315:57 if you're running on Windows or Mac but this is just best practice for me this
315:59 this is just best practice for me this is the location of my python even though
316:02 is the location of my python even though I'm not actually calling it I am calling
316:03 I'm not actually calling it I am calling it with python3 so this isn't incredibly
316:06 it with python3 so this isn't incredibly relevant as long as you're using python
316:08 relevant as long as you're using python 3. now we are going to deal with sockets
316:13 3. now we are going to deal with sockets oh sockets
316:15 oh sockets now sockets
316:17 now sockets are what can be used to connect two
316:20 are what can be used to connect two nodes together so we're going to use
316:23 nodes together so we're going to use this to connect to Ports and IP
316:25 this to connect to Ports and IP addresses if you're unfamiliar with
316:28 addresses if you're unfamiliar with computer networking that's okay but what
316:31 computer networking that's okay but what we're looking for is a port and we're
316:34 we're looking for is a port and we're going to look for that port on an IP
316:37 going to look for that port on an IP address and on that IP address that that
316:39 address and on that IP address that that port is open we're going to make a
316:40 port is open we're going to make a connection to this
316:42 connection to this we're going to build a port scanner in
316:44 we're going to build a port scanner in the next video or in later on in the
316:47 the next video or in later on in the lesson and you'll see this in action
316:50 lesson and you'll see this in action right now I just want you to notate
316:53 right now I just want you to notate understand what we're doing and then I'm
316:55 understand what we're doing and then I'm going to demonstrate an example that you
316:56 going to demonstrate an example that you do not have to follow along with and you
316:58 do not have to follow along with and you might not be able to follow along with
317:00 might not be able to follow along with so that's okay but just know that
317:02 so that's okay but just know that sockets are used to make a connection
317:03 sockets are used to make a connection between ports and IEP addresses and
317:06 between ports and IEP addresses and you'll see that here very shortly so you
317:10 you'll see that here very shortly so you do not name this by the way socket.pi if
317:12 do not name this by the way socket.pi if for some reason you came in here and you
317:14 for some reason you came in here and you named this socket.pi this will break
317:16 named this socket.pi this will break python because we are going to
317:19 python because we are going to import socket so make sure that you come
317:22 import socket so make sure that you come in here and you rename this if you named
317:25 in here and you rename this if you named it socket.pi it's very easy to do that
317:26 it socket.pi it's very easy to do that but that will break the socket dot Pi
317:30 but that will break the socket dot Pi which is but we're importing here
317:33 which is but we're importing here so with this we're going to set a couple
317:34 so with this we're going to set a couple of variables we're going to say host is
317:37 of variables we're going to say host is equal to 127.0.0.1
317:44 and this is our loopback address or our home address if you're not familiar with
317:46 home address if you're not familiar with computer networking I do recommend that
317:48 computer networking I do recommend that you go take a class on computer
317:50 you go take a class on computer networking because it will become very
317:51 networking because it will become very important as you get into python
317:54 important as you get into python development especially if you ever work
317:56 development especially if you ever work with nodes of any sort so other thing is
318:00 with nodes of any sort so other thing is ports so we have ports on our machine
318:03 ports so we have ports on our machine that we can connect to we're going to be
318:05 that we can connect to we're going to be using TCP uh if you do not know what TCP
318:09 using TCP uh if you do not know what TCP is or what the ports are that's okay you
318:11 is or what the ports are that's okay you can still follow along but know that
318:13 can still follow along but know that there are 65 535 available ports some
318:18 there are 65 535 available ports some ports are very common in what they use
318:20 ports are very common in what they use like Port 80 for example is a web server
318:23 like Port 80 for example is a web server over HTTP you have 443 which is https 21
318:28 over HTTP you have 443 which is https 21 is FTP there's a lot of common ports and
318:31 is FTP there's a lot of common ports and protocols that are out there we're going
318:33 protocols that are out there we're going to pick a non-standard port non-common
318:36 to pick a non-standard port non-common we're just going to say 7777 so what I'm
318:39 we're just going to say 7777 so what I'm going to tell this to do is I want to
318:41 going to tell this to do is I want to tell this to reach out to this host
318:44 tell this to reach out to this host which is just going to be us for this
318:46 which is just going to be us for this example and this port I want to make a
318:49 example and this port I want to make a connection on this port now I'm going to
318:52 connection on this port now I'm going to give a variable of s
318:54 give a variable of s and this is going to be a very long
318:56 and this is going to be a very long statement so if you say socket dot
318:59 statement so if you say socket dot socket I'm going to type this out and
319:01 socket I'm going to type this out and I'm going to explain everything okay so
319:02 I'm going to explain everything okay so socket
319:04 socket dot AF init
319:07 dot AF init then we're going to say socket
319:10 then we're going to say socket dot sock stream
319:16 and then just for your notes AF init is ipv4
319:21 AF init is ipv4 sock stream
319:23 sock stream is a port
319:27 is a port so we're giving it this s because we are
319:31 so we're giving it this s because we are not wanting to type this whole long
319:33 not wanting to type this whole long thing out all the time we're just
319:34 thing out all the time we're just shortening this what we're going to do
319:36 shortening this what we're going to do is we're going out to make a connection
319:38 is we're going out to make a connection to this AFI net which is ipv4 IP address
319:42 to this AFI net which is ipv4 IP address which is what this is and we're going to
319:45 which is what this is and we're going to also make a connection on a port which
319:47 also make a connection on a port which is our sock stream we're going to give
319:49 is our sock stream we're going to give it this port so we're going to say that
319:51 it this port so we're going to say that by doing s dot connect
319:54 by doing s dot connect and we're going to come in here and this
319:56 and we're going to come in here and this is going to be a tuple so we're actually
319:58 is going to be a tuple so we're actually going to use
320:00 going to use double parentheses here oh support
320:04 double parentheses here oh support okay and we could come in here by the
320:06 okay and we could come in here by the way and we could just put in one two
320:08 way and we could just put in one two seven zero zero one instead of using a
320:10 seven zero zero one instead of using a variable but I like to use variables
320:12 variable but I like to use variables because it's best practice but you could
320:14 because it's best practice but you could hard code this in if you wanted to but
320:17 hard code this in if you wanted to but here I just like using the variables
320:18 here I just like using the variables easier to change especially if you're
320:19 easier to change especially if you're coming in here and you're writing in a
320:22 coming in here and you're writing in a bunch of host Port calls so the variable
320:24 bunch of host Port calls so the variable is easy just to have in one place as
320:26 is easy just to have in one place as opposed to hard coding this
320:28 opposed to hard coding this okay so I'm going to go ahead and save
320:30 okay so I'm going to go ahead and save this this is where I do not expect you
320:32 this this is where I do not expect you to follow along because you might not
320:34 to follow along because you might not have the architecture behind it now as I
320:39 have the architecture behind it now as I stated in the beginning of this video I
320:42 stated in the beginning of this video I am an ethical hacker by trade which
320:45 am an ethical hacker by trade which means that this version of Cali that
320:47 means that this version of Cali that I've been running on her this version of
320:49 I've been running on her this version of Linux that I've been running on is
320:50 Linux that I've been running on is actually Cali Linux
320:52 actually Cali Linux and
320:54 and in Kali Linux we have a bunch of tools
320:57 in Kali Linux we have a bunch of tools available to us for pen testing and
320:59 available to us for pen testing and ethical hacking one of those tools is a
321:02 ethical hacking one of those tools is a tool called netcat now netcat is NC and
321:06 tool called netcat now netcat is NC and basically what it does is allows us to
321:08 basically what it does is allows us to connect to open ports or establish a
321:11 connect to open ports or establish a listener on an open port so what I'm
321:14 listener on an open port so what I'm going to do is actually I'm going to
321:15 going to do is actually I'm going to open up a new tab here make this bigger
321:18 open up a new tab here make this bigger and then I'm going to run this here
321:22 and then I'm going to run this here just understand if you've never used
321:23 just understand if you've never used netcat before that's fine I'm just
321:26 netcat before that's fine I'm just opening up a listener on a port that's
321:29 opening up a listener on a port that's all just worry about the L and the P for
321:31 all just worry about the L and the P for now listen on Port 7777 anybody makes a
321:35 now listen on Port 7777 anybody makes a connection on that Port we're listening
321:37 connection on that Port we're listening so we are going to connect to ourselves
321:39 so we are going to connect to ourselves because we wrote the script out to
321:42 because we wrote the script out to 127001 which is us and all we're going
321:46 127001 which is us and all we're going to do is python3 s dot pi
321:49 to do is python3 s dot pi hit enter nothing's going to happen we
321:51 hit enter nothing's going to happen we don't have any print statements anything
321:52 don't have any print statements anything crazy
321:53 crazy but you can see that a connection was
321:55 but you can see that a connection was made from one two seven zero zero one to
321:58 made from one two seven zero zero one to one two seven zero zero one and it made
322:01 one two seven zero zero one and it made a connection on this port and we
322:03 a connection on this port and we connected on the other side on this
322:04 connected on the other side on this other Port here which don't worry about
322:07 other Port here which don't worry about that too much if you're not familiar
322:08 that too much if you're not familiar with networking that's absolutely okay
322:10 with networking that's absolutely okay but there has to be two or it's being
322:12 but there has to be two or it's being connected
322:13 connected um one on one side one on the other so
322:16 um one on one side one on the other so here we made that connection we didn't
322:18 here we made that connection we didn't tell this to do anything else we just
322:20 tell this to do anything else we just said hey go out listen for this
322:22 said hey go out listen for this connection we made a connection we
322:24 connection we made a connection we established it we did our job we used
322:26 established it we did our job we used our socket and we are good to go here we
322:31 our socket and we are good to go here we close the connection because there was
322:32 close the connection because there was nothing no instructions given or
322:34 nothing no instructions given or anything else and that's all we needed
322:36 anything else and that's all we needed so what we're going to do now is we're
322:39 so what we're going to do now is we're going to in the next video build out
322:42 going to in the next video build out what I call a terrible Port scanner and
322:45 what I call a terrible Port scanner and we'll talk about why it's terrible but
322:47 we'll talk about why it's terrible but we're going to tie everything we've
322:48 we're going to tie everything we've learned so far together and build
322:51 learned so far together and build something out that is actually usable
322:54 something out that is actually usable with python so I've been throwing all
322:56 with python so I've been throwing all these lessons and terms and everything
322:58 these lessons and terms and everything out to you now we're going to apply that
323:01 out to you now we're going to apply that you're going to see how we can use that
323:03 you're going to see how we can use that all together and I'm very excited so
323:05 all together and I'm very excited so I'll catch you over in the next lesson
323:07 I'll catch you over in the next lesson when we start building out a port
323:09 when we start building out a port scanner
323:10 scanner it is time to create our first project
323:15 it is time to create our first project and this project is going to be building
323:18 and this project is going to be building out a terrible Port scanner and so let's
323:22 out a terrible Port scanner and so let's go ahead and create a new file I'm going
323:24 go ahead and create a new file I'm going to call this scanner.pi
323:30 give it the Ampersand here if you're on Linux
323:31 Linux and then we're just going to call this
323:39 in python3 save it get the pretty colors going
323:40 going and what we are going to do is we are
323:44 and what we are going to do is we are going to create a scanner that is going
323:48 going to create a scanner that is going to be something like this we're going to
323:49 to be something like this we're going to type in python3
323:51 type in python3 scanner.pi and then we're going to say
323:54 scanner.pi and then we're going to say IP address we want to provide an IEP
323:56 IP address we want to provide an IEP address and then it's going to go out
323:58 address and then it's going to go out and do Port scanning on the IP address
324:01 and do Port scanning on the IP address so hopefully we can build that out for
324:04 so hopefully we can build that out for now let's go ahead and import a couple
324:06 now let's go ahead and import a couple of things I should say a few things
324:08 of things I should say a few things we're going to import
324:10 we're going to import CIS talked about CIS
324:13 CIS talked about CIS I'm going to import socket talked about
324:16 I'm going to import socket talked about socket and from
324:19 socket and from date time we're going to go ahead and
324:21 date time we're going to go ahead and import
324:22 import date time so none of this should be new
324:25 date time so none of this should be new to you
324:27 to you so
324:29 so first thing that we're going to need to
324:30 first thing that we're going to need to do is Define our Target so we need to
324:35 do is Define our Target so we need to set up an if statement I'm just going to
324:37 set up an if statement I'm just going to say Define our Target
324:40 say Define our Target and what I want to say is if
324:44 and what I want to say is if the length of CIS ARG V and I'll explain
324:49 the length of CIS ARG V and I'll explain this in a second is equal to 2
324:53 this in a second is equal to 2 then we're going to set a Target
324:55 then we're going to set a Target variable Target is going to be equal to
324:58 variable Target is going to be equal to socket dot get host by name
325:03 socket dot get host by name and we're going to say sys dot ARG V1
325:13 and all this is going to do is Translate hostname to ipv4 all right
325:17 hostname to ipv4 all right let me make the else statements I'm
325:19 let me make the else statements I'm going to come back I'm going to explain
325:20 going to come back I'm going to explain everything okay so if we do else
325:24 everything okay so if we do else we're going to print out
325:27 we're going to print out invalid amount of arguments
325:37 and also print out syntax
325:39 syntax Python 3 scanner
325:43 Python 3 scanner dot pi
325:45 dot pi IP address
325:52 something like that okay go ahead and close that off okay
325:56 go ahead and close that off okay so we're taking a method of length and
325:59 so we're taking a method of length and we're saying CIS dot ARG V we spoke a
326:02 we're saying CIS dot ARG V we spoke a little bit about argb in the importing
326:04 little bit about argb in the importing section
326:05 section RV is going to be the amount of
326:07 RV is going to be the amount of arguments that we are giving so when we
326:10 arguments that we are giving so when we come in here and we type in python3
326:14 come in here and we type in python3 okay our first argument argument zero in
326:18 okay our first argument argument zero in theory is going to be scanner.pi
326:21 theory is going to be scanner.pi the second argument or second index
326:24 the second argument or second index index of one is going to be the IP
326:27 index of one is going to be the IP address that we give so 192.168 1.1 or
326:30 address that we give so 192.168 1.1 or whatever it might be
326:32 whatever it might be so we need to have two arguments if we
326:36 so we need to have two arguments if we have a third argument it's going to
326:38 have a third argument it's going to break if we don't have a second argument
326:40 break if we don't have a second argument it's going to break if we just type in
326:42 it's going to break if we just type in scanner.pi it'll break if we type in an
326:45 scanner.pi it'll break if we type in an IP address
326:47 IP address like 1.1 and then we type in something
326:49 like 1.1 and then we type in something here
326:51 here it's going to break because there's too
326:52 it's going to break because there's too many arguments so if it doesn't meet
326:55 many arguments so if it doesn't meet this specific length
326:58 this specific length then what we're going to do is print out
327:00 then what we're going to do is print out invalid amount of arguments
327:02 invalid amount of arguments here's the syntax give somebody some
327:05 here's the syntax give somebody some some help here
327:06 some help here if it does meet the length then what
327:08 if it does meet the length then what we're going to do is we're going to set
327:10 we're going to do is we're going to set our Target equal to socket dot get host
327:14 our Target equal to socket dot get host by name
327:15 by name and all this is saying is we're going to
327:17 and all this is saying is we're going to get host by name of CIS arcv1 that's our
327:20 get host by name of CIS arcv1 that's our IP address now this is going to
327:22 IP address now this is going to translate a hostname to an ipv4 so in
327:26 translate a hostname to an ipv4 so in case
327:27 case for example if you did
327:29 for example if you did python3scanner dot pi and you had a host
327:33 python3scanner dot pi and you had a host name like I have a host in my house
327:35 name like I have a host in my house called Punisher like if I gave it
327:37 called Punisher like if I gave it Punisher and my DNS knew internally that
327:41 Punisher and my DNS knew internally that that translated to a specific IP address
327:43 that translated to a specific IP address in my network that's fine this will
327:46 in my network that's fine this will translate
327:47 translate okay easy enough but we could also just
327:50 okay easy enough but we could also just give it an IP address so that's what
327:51 give it an IP address so that's what we're looking for here I highly
327:53 we're looking for here I highly recommend for this example using an IP
327:56 recommend for this example using an IP address
327:57 address in previous lessons when I've taught
327:59 in previous lessons when I've taught this before somebody has tried typing in
328:01 this before somebody has tried typing in a host name and it doesn't always go as
328:04 a host name and it doesn't always go as planned though we will talk about adding
328:07 planned though we will talk about adding error exceptions for that here in a
328:09 error exceptions for that here in a little bit so right now all we need to
328:12 little bit so right now all we need to know is we're trying to set this up with
328:14 know is we're trying to set this up with these arguments now this is not the best
328:17 these arguments now this is not the best logic this is something that will work
328:19 logic this is something that will work for our needs because we are building
328:21 for our needs because we are building this out but if we're building it out
328:24 this out but if we're building it out for somebody else this logic's not great
328:26 for somebody else this logic's not great and this is why I call this a crappy
328:27 and this is why I call this a crappy Port scanner is because it's not the
328:30 Port scanner is because it's not the best we're only doing it for proof of
328:32 best we're only doing it for proof of concept and to learn what we've learned
328:34 concept and to learn what we've learned so far but think about this in another
328:36 so far but think about this in another way think about if we're running two
328:39 way think about if we're running two arguments well I could give this an
328:42 arguments well I could give this an argument what if I if I come here and I
328:44 argument what if I if I come here and I say python3scanner dot pi and I give it
328:47 say python3scanner dot pi and I give it the second argument
328:49 the second argument but I give it like
328:50 but I give it like 192.1 or something like that well that's
328:53 192.1 or something like that well that's not a host name it's not going to
328:55 not a host name it's not going to translate to anything that's also not
328:57 translate to anything that's also not really an IP address so we should really
328:59 really an IP address so we should really add some other statements in here to say
329:01 add some other statements in here to say hey it needs to be a valid IP address it
329:06 hey it needs to be a valid IP address it needs to be like have four octets like
329:09 needs to be like have four octets like we expect and if we really wanted to get
329:12 we expect and if we really wanted to get critical about this we can make sure
329:15 critical about this we can make sure that it is a valid IP address because I
329:18 that it is a valid IP address because I P addresses can serve like 256. whatever
329:21 P addresses can serve like 256. whatever so we could say it must be between like
329:24 so we could say it must be between like you know each octet must be between 1
329:27 you know each octet must be between 1 and 254 and get really refined with that
329:30 and 254 and get really refined with that and say hey that's not a valid IP
329:32 and say hey that's not a valid IP address thus we're not going to scan
329:33 address thus we're not going to scan this but we don't have to worry about
329:35 this but we don't have to worry about that right now I'm just saying the logic
329:37 that right now I'm just saying the logic behind it we need to start thinking
329:39 behind it we need to start thinking about well how can a user break this we
329:43 about well how can a user break this we know how to run it but if we gave this
329:44 know how to run it but if we gave this to somebody else how would they run it
329:46 to somebody else how would they run it and how could they break it or how could
329:48 and how could they break it or how could they typo some something so these are
329:50 they typo some something so these are things to think about as we go
329:52 things to think about as we go so for now we've added this in we've got
329:54 so for now we've added this in we've got this in here we could test this if we
329:57 this in here we could test this if we just save it we come in here and we just
329:59 just save it we come in here and we just say Python 3 scanner dot Pi we don't
330:03 say Python 3 scanner dot Pi we don't give in any arguments you'll see that it
330:06 give in any arguments you'll see that it says invalid amount of arguments
330:08 says invalid amount of arguments python3scanner.pi is the syntax perfect
330:10 python3scanner.pi is the syntax perfect don't give it an argument right now
330:12 don't give it an argument right now because it's going to break if you don't
330:13 because it's going to break if you don't have DNS translating properly so
330:17 have DNS translating properly so from here let's go ahead and add a
330:21 from here let's go ahead and add a pretty Banner so just add a pretty
330:23 pretty Banner so just add a pretty Banner
330:24 Banner and all I'm going to do is do a print
330:27 and all I'm going to do is do a print command
330:28 command and I'm going to just do a bunch of
330:30 and I'm going to just do a bunch of dashes this is not really going to be
330:33 dashes this is not really going to be that pretty of a banner but it's still
330:34 that pretty of a banner but it's still going to be a banner and so when this
330:36 going to be a banner and so when this kicks off if if we've got a valid IP
330:39 kicks off if if we've got a valid IP that we're going to be scanning
330:41 that we're going to be scanning we're just going to do scanning Target
330:45 we're just going to do scanning Target and then we'll just do a space and you
330:48 and then we'll just do a space and you could just do a concatenation here of
330:50 could just do a concatenation here of plus Target you could do F string if you
330:52 plus Target you could do F string if you want completely up to you on how you
330:54 want completely up to you on how you want to do this so we just do scanning
330:56 want to do this so we just do scanning Target plus Target this will say what
330:58 Target plus Target this will say what the IP address is we can do like
331:00 the IP address is we can do like scanning Target
331:02 scanning Target of that something along those lines and
331:05 of that something along those lines and then we could say print
331:07 then we could say print time started
331:10 time started and then we can give this something like
331:12 and then we can give this something like a string
331:14 a string so we want to give plus a string of
331:18 so we want to give plus a string of date time dot now remember we can't
331:21 date time dot now remember we can't concatenate numbers and strings
331:24 concatenate numbers and strings so we're going to go ahead and do this
331:26 so we're going to go ahead and do this and then we'll just print out
331:29 and then we'll just print out this one more time
331:36 okay I'm going to save this let's go ahead and try running this with
331:38 let's go ahead and try running this with like
331:39 like I don't know 192 168 1.1
331:43 I don't know 192 168 1.1 okay
331:44 okay so this is what we get
331:46 so this is what we get we can see that we have scanning Target
331:49 we can see that we have scanning Target okay scan Target 192.168 1.1 here's the
331:53 okay scan Target 192.168 1.1 here's the time that it started perfect we've got a
331:55 time that it started perfect we've got a pretty Banner set up
331:57 pretty Banner set up so now let's actually start making it do
332:00 so now let's actually start making it do something
332:01 something so we're going to use what is called the
332:04 so we're going to use what is called the try command we're going to try something
332:06 try command we're going to try something and if it works perfect if it doesn't
332:09 and if it works perfect if it doesn't we're going to have exceptions for that
332:12 we're going to have exceptions for that so here's what we're going to do we're
332:14 so here's what we're going to do we're going to say try
332:15 going to say try or we're going to do a for Loop
332:18 or we're going to do a for Loop port in range remember we talked about a
332:22 port in range remember we talked about a range earlier we talked about well what
332:24 range earlier we talked about well what about a 4ip in range of 1 through 254.
332:28 about a 4ip in range of 1 through 254. we're doing the same concept here now
332:30 we're doing the same concept here now we're just giving it a range now there
332:32 we're just giving it a range now there are 65 535 potential ports
332:36 are 65 535 potential ports I'm not going to force you to scan all
332:38 I'm not going to force you to scan all those if you want to you can come in
332:40 those if you want to you can come in here and say 65 535 this is not threaded
332:44 here and say 65 535 this is not threaded we are not doing any sort of
332:46 we are not doing any sort of speed runs here this is could
332:49 speed runs here this is could potentially be a slow Port scanner so it
332:52 potentially be a slow Port scanner so it is best in my opinion to do like a port
332:54 is best in my opinion to do like a port scan between 50 and 85.
332:58 scan between 50 and 85. and the reason I do this is because
333:00 and the reason I do this is because we're going to scan or attempt to scan
333:02 we're going to scan or attempt to scan our home router and usually DNS is open
333:07 our home router and usually DNS is open on that and usually Port 80s open on
333:10 on that and usually Port 80s open on that so I'm trying to look and see if we
333:13 that so I'm trying to look and see if we can find a couple ports that might be
333:14 can find a couple ports that might be open
333:15 open so for port in this range what we're
333:18 so for port in this range what we're going to do is we're going to set our s
333:21 going to do is we're going to set our s equal to that lovely socket dot socket
333:25 equal to that lovely socket dot socket socket dot AF inet
333:29 socket dot AF inet and socket dot sock underscore stream
333:32 and socket dot sock underscore stream just like that
333:35 just like that and then we're also going to come in
333:37 and then we're also going to come in here and we're going to do a socket
333:41 here and we're going to do a socket dot set default
333:45 dot set default timeout to one
333:47 timeout to one so if it responds back or doesn't
333:50 so if it responds back or doesn't respond back within a second we're just
333:52 respond back within a second we're just going to move on we don't want to stick
333:54 going to move on we don't want to stick to scanning a port waiting waiting
333:56 to scanning a port waiting waiting waiting for not to respond back to us
333:58 waiting for not to respond back to us and then the script takes long and
334:00 and then the script takes long and longer and longer so we just want to
334:02 longer and longer so we just want to make sure that we set our default
334:03 make sure that we set our default timeout to one there and then what we're
334:06 timeout to one there and then what we're going to do is we're going to go ahead
334:08 going to do is we're going to go ahead and
334:09 and set a variable result
334:11 set a variable result and result is going to equal to
334:14 and result is going to equal to s dot connect
334:16 s dot connect underscore ex and I'll explain all this
334:19 underscore ex and I'll explain all this in a second
334:21 in a second Target import
334:24 Target import all right
334:25 all right so what this is doing here actually let
334:27 so what this is doing here actually let me type out the rest and then we'll go
334:29 me type out the rest and then we'll go back we're going to say if result is
334:32 back we're going to say if result is equal to zero
334:34 equal to zero we're going to print out
334:36 we're going to print out port
334:38 port we can do
334:44 is open so now we can come in here we can do a format Port if we want to you
334:46 can do a format Port if we want to you could use an F string here if you want
334:48 could use an F string here if you want to so we can just use an F string
334:52 to so we can just use an F string I'm just showing you examples but you
334:53 I'm just showing you examples but you can say port and just do an F in front
334:56 can say port and just do an F in front of this
335:02 okay Port whatever is open and then we're going to close the connection
335:09 all right let's read through this make sure we understand what's going on
335:12 sure we understand what's going on so we're gonna do a for Loop for a port
335:14 so we're gonna do a for Loop for a port in the range of 50 to 85 so we're going
335:17 in the range of 50 to 85 so we're going to start with 50 and 51 then 52 go
335:20 to start with 50 and 51 then 52 go through that process we are setting a
335:22 through that process we are setting a variable
335:23 variable of s equal to this because we're going
335:26 of s equal to this because we're going to gather the ipv4 address and we're
335:29 to gather the ipv4 address and we're going to gather the port that we're
335:31 going to gather the port that we're trying to connect to
335:33 trying to connect to now our ipv4 address here's our Tuple
335:36 now our ipv4 address here's our Tuple right here we are saying I want to
335:39 right here we are saying I want to connect on Target and Port Target is
335:42 connect on Target and Port Target is going to be supplied by us we're going
335:43 going to be supplied by us we're going to use rb1
335:45 to use rb1 so we're going to supply the IP address
335:48 so we're going to supply the IP address and the port is going to be this range
335:50 and the port is going to be this range here
335:51 here so for port in range we're declaring
335:54 so for port in range we're declaring Port here now this s.connect underscore
335:57 Port here now this s.connect underscore EX
335:58 EX this is an error indicator
336:01 this is an error indicator so if a port is open the error result
336:04 so if a port is open the error result returns zero
336:07 returns zero if a port is closed it returns a one so
336:12 if a port is closed it returns a one so if the result is a zero we're going to
336:14 if the result is a zero we're going to say hey this port was open
336:16 say hey this port was open if it's not it's going to close out and
336:19 if it's not it's going to close out and we're going to close this then we're
336:21 we're going to close this then we're going to go back to the loop and come
336:23 going to go back to the loop and come through and try it again so we're going
336:25 through and try it again so we're going to close out our socket connection on
336:27 to close out our socket connection on that Port come back try 51 52
336:31 that Port come back try 51 52 etc etc
336:33 etc etc now before we run this there are some
336:35 now before we run this there are some exceptions that we need to consider
336:38 exceptions that we need to consider so the first one we're going to try this
336:40 so the first one we're going to try this but we need exceptions so accept
336:43 but we need exceptions so accept what if we have a keyboard interrupt so
336:46 what if we have a keyboard interrupt so we'll say keyboard interrupt
336:49 we'll say keyboard interrupt and
336:51 and that just means what if we hit Ctrl C
336:53 that just means what if we hit Ctrl C while this is running we can stop this
336:55 while this is running we can stop this on our own so we're providing an
336:57 on our own so we're providing an exception of a keyboard interrupt and
337:00 exception of a keyboard interrupt and we're going to say exiting program on a
337:02 we're going to say exiting program on a new line
337:07 and then we're going to assist exit remember I talked about sysexit and
337:09 remember I talked about sysexit and we're going to allow us to exit
337:11 we're going to allow us to exit gracefully
337:13 gracefully we can also do an exception of a socket
337:16 we can also do an exception of a socket dot gai error
337:19 dot gai error now this
337:20 now this is what happens when the hostname does
337:22 is what happens when the hostname does not resolve so what if we say hostname
337:25 not resolve so what if we say hostname could not be resolved
337:29 could not be resolved so if we typed in a bunch of
337:31 so if we typed in a bunch of Mumble jumbo up here we say like Python
337:35 Mumble jumbo up here we say like Python 3
337:36 3 scanner dot pi
337:39 scanner dot pi and we just typed in something and that
337:41 and we just typed in something and that doesn't resolve to an IP address well
337:43 doesn't resolve to an IP address well guess what this is going to throw an
337:45 guess what this is going to throw an error now
337:46 error now and we can exit
337:52 we got to cover all of our bases lastly what if we have a socket dot
337:56 lastly what if we have a socket dot error so we have an error when we're
337:58 error so we have an error when we're doing this and we print out
338:00 doing this and we print out hey we could not connect to the server
338:02 hey we could not connect to the server just it's just not online what if we try
338:05 just it's just not online what if we try to connect to an IP address and it
338:06 to connect to an IP address and it doesn't talk back to us
338:08 doesn't talk back to us but not connect to the server
338:10 but not connect to the server so something to think about there again
338:13 so something to think about there again we'll assist dot exit
338:15 we'll assist dot exit so let's go ahead and save this
338:19 so let's go ahead and save this now you're going to need to run this
338:22 now you're going to need to run this against something so I'm going to show
338:25 against something so I'm going to show you an example of mine okay so in order
338:27 you an example of mine okay so in order to run this we need an IP address now if
338:31 to run this we need an IP address now if I type in ifconfig I'm actually on a
338:34 I type in ifconfig I'm actually on a virtual machine right now so
338:38 virtual machine right now so 192.168.138.140 is not my true IP
338:41 192.168.138.140 is not my true IP address
338:42 address I'm actually going to bring up my
338:44 I'm actually going to bring up my Windows machine that I'm on
338:46 Windows machine that I'm on and you can see here that I have a
338:49 and you can see here that I have a default gateway of
338:51 default gateway of 192.168.4.1 so make sure you know your
338:54 192.168.4.1 so make sure you know your gateway or what your router's IP address
338:56 gateway or what your router's IP address or that you have a machine that you can
338:58 or that you have a machine that you can scan that you know might have a port of
339:01 scan that you know might have a port of 53 or 80 open or you need to modify your
339:04 53 or 80 open or you need to modify your script to make sure that you can scan
339:06 script to make sure that you can scan for something but I'm going to go ahead
339:08 for something but I'm going to go ahead and scan my 4.1 because it should have
339:11 and scan my 4.1 because it should have some stuff open so if I do a Python 3
339:15 some stuff open so if I do a Python 3 scanner.pi I'm going to come in here and
339:17 scanner.pi I'm going to come in here and just do a 4.1
339:21 just do a 4.1 and I hit enter this could take some
339:24 and I hit enter this could take some time so what I'm going to do is I'm
339:25 time so what I'm going to do is I'm going to let this sit here actually it's
339:27 going to let this sit here actually it's already it's zooming through uh you can
339:29 already it's zooming through uh you can see it found Port 53 pretty quick
339:32 see it found Port 53 pretty quick um and then this might take time to find
339:34 um and then this might take time to find Port 80 if Port 80 is open but basically
339:37 Port 80 if Port 80 is open but basically what it's going to go through is go
339:38 what it's going to go through is go through 450 51 52 53 all the way through
339:42 through 450 51 52 53 all the way through the process and has that one second
339:45 the process and has that one second timeout as it goes through and checks
339:46 timeout as it goes through and checks each and every one of these ports so it
339:48 each and every one of these ports so it should take maybe up to a minute for
339:50 should take maybe up to a minute for this to work so I'm going to go ahead
339:52 this to work so I'm going to go ahead and pause right here looks like we're
339:54 and pause right here looks like we're almost done actually or 80 came back as
339:56 almost done actually or 80 came back as open too no need to pause it finished
339:58 open too no need to pause it finished while I was yapping so you can see I
340:00 while I was yapping so you can see I came back and said 453 is open port 80
340:03 came back and said 453 is open port 80 is open so our script worked
340:06 is open so our script worked it took forever to scan these ports but
340:09 it took forever to scan these ports but it is working so we were able to build
340:12 it is working so we were able to build out let's go back and look at this this
340:14 out let's go back and look at this this is awesome we were able to build out a
340:16 is awesome we were able to build out a port scanner that came in here and
340:19 port scanner that came in here and within two hours you now have the
340:21 within two hours you now have the knowledge to build out a basic Port
340:23 knowledge to build out a basic Port scanner you didn't think you would be
340:24 scanner you didn't think you would be able to do that well here you are look
340:26 able to do that well here you are look at you
340:27 at you you're awesome okay so we were able to
340:30 you're awesome okay so we were able to give it an argument
340:31 give it an argument we set our if conditional statement make
340:34 we set our if conditional statement make sure the length of the argument was two
340:37 sure the length of the argument was two valid otherwise we have an else here we
340:40 valid otherwise we have an else here we made a little pretty Banner we imported
340:42 made a little pretty Banner we imported some stuff got that all working we did a
340:44 some stuff got that all working we did a try statement which really was just a
340:46 try statement which really was just a for Loop in here and we had some logic
340:49 for Loop in here and we had some logic based on conditions that would happen
340:50 based on conditions that would happen within this for Loop we had a for Loop
340:53 within this for Loop we had a for Loop and an if statement together we used a F
340:57 and an if statement together we used a F string to print this out pretty cool
340:59 string to print this out pretty cool came through we had some exceptions as
341:01 came through we had some exceptions as well for example like the keyboard
341:03 well for example like the keyboard interrupt just as to show you if I come
341:05 interrupt just as to show you if I come and run this again if I wanted to stop
341:08 and run this again if I wanted to stop this scan in the middle of it I could
341:10 this scan in the middle of it I could just hit Ctrl C and it'll say hey
341:12 just hit Ctrl C and it'll say hey exiting program and that's exactly what
341:15 exiting program and that's exactly what we told it to do we could say in here it
341:17 we told it to do we could say in here it says exiting program so that's the
341:19 says exiting program so that's the keyboard interrupt same thing we had
341:21 keyboard interrupt same thing we had exceptions for not being able to connect
341:22 exceptions for not being able to connect or we had the hostname could not resolve
341:25 or we had the hostname could not resolve we would also have those sorts of things
341:27 we would also have those sorts of things as well so you could test out those
341:28 as well so you could test out those errors see if they work for you but
341:31 errors see if they work for you but other than that we built a scanner so
341:33 other than that we built a scanner so this is Project number one we're gonna
341:35 this is Project number one we're gonna go ahead and move on to learning a
341:36 go ahead and move on to learning a little bit more Python and then we'll go
341:38 little bit more Python and then we'll go ahead and get into some more Project
341:40 ahead and get into some more Project work so I'll see you over in the next
341:42 work so I'll see you over in the next video
341:44 video now we're going to take a look at
341:46 now we're going to take a look at accepting user input in our program and
341:48 accepting user input in our program and then how we can manipulate data with
341:51 then how we can manipulate data with that input
341:52 that input so let's go ahead and make a new file
341:54 so let's go ahead and make a new file I'm going to just say mouse pad and
341:57 I'm going to just say mouse pad and we'll call this input dot pi
342:01 we'll call this input dot pi and I'm going to bring this over we'll
342:03 and I'm going to bring this over we'll give this the shebang
342:06 give this the shebang then python3 here
342:08 then python3 here save it get the pretty colors
342:10 save it get the pretty colors and in order to take input in Python all
342:15 and in order to take input in Python all we actually need to do is just use input
342:18 we actually need to do is just use input something like this so we could say like
342:20 something like this so we could say like enter your name for input like this and
342:24 enter your name for input like this and put a space and we'll need to put this
342:26 put a space and we'll need to put this into a variable so if we come into the
342:29 into a variable so if we come into the front of this and we just say name is
342:31 front of this and we just say name is equal to
342:32 equal to we could do something like that and then
342:34 we could do something like that and then we can just print out like
342:37 we can just print out like hello
342:38 hello and give a space
342:41 and give a space do name
342:43 do name and then
342:45 and then we'll add an exclamation at the end or a
342:48 we'll add an exclamation at the end or a period at the end doesn't really matter
342:49 period at the end doesn't really matter and then we can just come in here and
342:52 and then we can just come in here and save that
342:54 save that and if we run this
342:59 close this out I forgot to add an ampersands we'll do that real quick and
343:01 ampersands we'll do that real quick and if we run this now we just say python3
343:04 if we run this now we just say python3 and we say input
343:07 and we say input dot Pi let's say enter your name I'll
343:09 dot Pi let's say enter your name I'll just say Heath
343:11 just say Heath and you can see it says hello Heath
343:13 and you can see it says hello Heath we can add upon this we can say like
343:16 we can add upon this we can say like what's your favorite drink so if we just
343:18 what's your favorite drink so if we just make a variable and we call it drink and
343:20 make a variable and we call it drink and we do input and say what's your favorite
343:25 we do input and say what's your favorite drink
343:28 drink and do a question mark something like
343:31 and do a question mark something like that
343:31 that we can come in here and then just add
343:33 we can come in here and then just add upon this if we want we can just say
343:36 upon this if we want we can just say have a space
343:40 have a space plus drink
343:42 plus drink less period
343:45 less period all right and it should say welcome
343:47 all right and it should say welcome Heath have a and then whatever drink we
343:49 Heath have a and then whatever drink we put in here so if we save this come back
343:52 put in here so if we save this come back and run it
343:54 and run it okay I'm gonna put Heath as my name and
343:57 okay I'm gonna put Heath as my name and then
343:58 then White Russian is my favorite drink
344:00 White Russian is my favorite drink and it says hello Heath have a White
344:02 and it says hello Heath have a White Russian so we can easily accept input
344:05 Russian so we can easily accept input like this
344:06 like this so let's think about if we wanted to
344:08 so let's think about if we wanted to build out a calculator I'm going to go
344:10 build out a calculator I'm going to go ahead and delete this what if we wanted
344:13 ahead and delete this what if we wanted to take input and make a mini calculator
344:16 to take input and make a mini calculator we could definitely do that
344:19 we could definitely do that so what if we had two numbers and we've
344:21 so what if we had two numbers and we've been taking X and Y so if we said X is
344:24 been taking X and Y so if we said X is equal to input
344:26 equal to input and we'll just say
344:28 and we'll just say give me a number
344:32 give me a number and then we'll do something like that
344:34 and then we'll do something like that and then we can also do y and also make
344:37 and then we can also do y and also make that input
344:39 that input give me yet another number
344:43 give me yet another number you put whatever you want here by the
344:45 you put whatever you want here by the way
344:46 way and if we do something like print
344:49 and if we do something like print X Plus y
344:52 X Plus y and we do that let's save it and let's
344:55 and we do that let's save it and let's see what happens here so I'm going to
344:56 see what happens here so I'm going to print this out
344:58 print this out we'll give a number we'll do three and
345:00 we'll give a number we'll do three and then we'll do two
345:02 then we'll do two and it gave us 32. why is it doing that
345:05 and it gave us 32. why is it doing that well what it's doing is it is taking
345:08 well what it's doing is it is taking these and giving this to us as a string
345:12 these and giving this to us as a string so we need to either do an integer here
345:15 so we need to either do an integer here and put this in an INT or we need to
345:18 and put this in an INT or we need to take this as a float so if we think
345:20 take this as a float so if we think about this from the past if we want to
345:23 about this from the past if we want to only take integers we can but if
345:25 only take integers we can but if somebody were to put in like 8.7 or some
345:29 somebody were to put in like 8.7 or some number here and they gave that to us
345:32 number here and they gave that to us well we would only take the eight and we
345:34 well we would only take the eight and we would leave off the 0.7 so I think if
345:36 would leave off the 0.7 so I think if we're building out a calculator it's
345:37 we're building out a calculator it's better to use floats so we can just come
345:40 better to use floats so we can just come in here and say float and we'll put this
345:42 in here and say float and we'll put this all in parentheses and then we'll do the
345:44 all in parentheses and then we'll do the same thing right here
345:50 so now when we come in here and we'd save this and run this again what should
345:53 save this and run this again what should happen is this should work properly so
345:55 happen is this should work properly so if we did like three
345:56 if we did like three and then 3.2
345:59 and then 3.2 you'll see that we get 6.2 which is
346:01 you'll see that we get 6.2 which is proper that's awesome
346:03 proper that's awesome well what if we wanted to build this out
346:06 well what if we wanted to build this out further
346:07 further we could make this into a situational
346:10 we could make this into a situational thing what if we not only wanted to do
346:13 thing what if we not only wanted to do an addition but what if we wanted to
346:15 an addition but what if we wanted to allow the user to say I want to add or
346:19 allow the user to say I want to add or subtract or divide or multiply or maybe
346:21 subtract or divide or multiply or maybe use an exponent we could do that so what
346:24 use an exponent we could do that so what if we added another variable and we just
346:26 if we added another variable and we just called this o for operator and we just
346:29 called this o for operator and we just took that input and we just said
346:33 took that input and we just said something along the lines of input
346:37 something along the lines of input give me an operator
346:40 give me an operator right and maybe we put this in the
346:44 right and maybe we put this in the middle here so that way we're not just
346:46 middle here so that way we're not just getting two numbers maybe we want to
346:48 getting two numbers maybe we want to take that and we want to say something
346:49 take that and we want to say something like this so that way you'll say give me
346:51 like this so that way you'll say give me your number give me an operator and then
346:53 your number give me an operator and then give me another number and we'll print
346:56 give me another number and we'll print that out so
346:57 that out so now let's think about how we want this
347:00 now let's think about how we want this to flow if we want this to work with a
347:04 to flow if we want this to work with a addition like we already have we might
347:06 addition like we already have we might want to come in here and just say
347:07 want to come in here and just say something like if o
347:09 something like if o or operator is equal to a plus sign
347:13 or operator is equal to a plus sign well then
347:15 well then we'll come in and just print out X Plus
347:17 we'll come in and just print out X Plus y
347:18 y remember the indentation is important
347:20 remember the indentation is important here
347:21 here else if or L if
347:24 else if or L if o is equal to a minus
347:28 o is equal to a minus guess what we're going to print x minus
347:30 guess what we're going to print x minus y
347:31 y and we can continue on here
347:34 and we can continue on here else if o is equal to
347:42 division we'll divide and then we'll multiply as well so x
347:44 and then we'll multiply as well so x divided by y
347:46 divided by y else if o is equal to
347:51 else if o is equal to multiply here
347:53 multiply here we'll go ahead and multiply that
347:56 we'll go ahead and multiply that let's throw in an exponent for good
347:58 let's throw in an exponent for good measure
347:59 measure so let's do L if o is equal to an
348:04 so let's do L if o is equal to an exponent so that's two
348:06 exponent so that's two asterisk there and then we'll just print
348:09 asterisk there and then we'll just print out
348:10 out X
348:11 X times y so we've got a mini little
348:13 times y so we've got a mini little calculator here and we need to end this
348:16 calculator here and we need to end this with
348:17 with an else statement so what if we take
348:20 an else statement so what if we take input that doesn't belong here if it
348:23 input that doesn't belong here if it doesn't match one of these operators
348:24 doesn't match one of these operators then we can just print something like
348:28 then we can just print something like unknown operator
348:31 unknown operator all right and period there save that and
348:35 all right and period there save that and this should work so let's go ahead and
348:36 this should work so let's go ahead and give this a try what if we come in here
348:38 give this a try what if we come in here we just say
348:40 we just say give me a number we'll do three and
348:42 give me a number we'll do three and let's say we want to multiply and we'll
348:45 let's say we want to multiply and we'll do by three
348:46 do by three and we get a 9 we can do it again we can
348:49 and we get a 9 we can do it again we can try something like
348:50 try something like we'll do uh four and this time we'll do
348:53 we'll do uh four and this time we'll do an exponent we'll do four
348:57 an exponent we'll do four so four to the fourth power is 256. so
349:01 so four to the fourth power is 256. so we have just quite easily built out a
349:03 we have just quite easily built out a little calculator that we take input
349:05 little calculator that we take input from a user and then utilize that to
349:09 from a user and then utilize that to calculate that expression given what is
349:11 calculate that expression given what is given to us by the user now let's think
349:14 given to us by the user now let's think of something else here just as an aside
349:17 of something else here just as an aside what if something is written differently
349:19 what if something is written differently like when I think of math with python
349:22 like when I think of math with python yes we think of two asterisks as an
349:26 yes we think of two asterisks as an exponent but what if we had a situation
349:29 exponent but what if we had a situation where we wanted to maybe use the up
349:32 where we wanted to maybe use the up Arrow or the carrot symbol which is how
349:34 Arrow or the carrot symbol which is how I've commonly seen it used online for
349:37 I've commonly seen it used online for Math and exponents well we could do
349:40 Math and exponents well we could do something like or
349:42 something like or o is equal to
349:44 o is equal to the up
349:46 the up Arrow like that and what if we save that
349:48 Arrow like that and what if we save that and ran this now
349:50 and ran this now and if we gave a 4 to the up Arrow of 4
349:55 and if we gave a 4 to the up Arrow of 4 guess what we still get 256 so we can
349:59 guess what we still get 256 so we can use our statement like that here our and
350:02 use our statement like that here our and or or other operators that we have
350:05 or or other operators that we have learned along the way so start thinking
350:07 learned along the way so start thinking about it like that as we start to piece
350:09 about it like that as we start to piece these things together we're starting to
350:11 these things together we're starting to build out little projects and we can use
350:12 build out little projects and we can use some of the logic that we have already
350:14 some of the logic that we have already learned throughout this course so that's
350:17 learned throughout this course so that's it for this lesson we're going to go
350:19 it for this lesson we're going to go ahead and move on to the next one
350:22 ahead and move on to the next one okay now we're going to talk about
350:24 okay now we're going to talk about reading and writing files using python
350:28 reading and writing files using python so let's go ahead and make a new file
350:31 so let's go ahead and make a new file I'm just going to mouse pad and we're
350:34 I'm just going to mouse pad and we're going to call this file months Dot txt
350:37 going to call this file months Dot txt and in here let's go ahead and just type
350:40 and in here let's go ahead and just type out the month so we'll do January
350:43 out the month so we'll do January February March
350:46 February March April if I could type May June July
350:52 April if I could type May June July August September October November
350:58 August September October November and December
351:00 and December if you need to take a break and catch up
351:03 if you need to take a break and catch up go ahead and do that
351:04 go ahead and do that save this and once you have it saved go
351:07 save this and once you have it saved go ahead and close the file out
351:11 ahead and close the file out so let's go ahead and create a new
351:13 so let's go ahead and create a new python file so call this mouse pad and I
351:17 python file so call this mouse pad and I think we'll just call this read write
351:20 think we'll just call this read write dot pi
351:22 dot pi it'll do an ampersand here
351:24 it'll do an ampersand here and for this what we're going to do is
351:28 and for this what we're going to do is we're going to go ahead and look at how
351:31 we're going to go ahead and look at how we can read and write files so the way
351:34 we can read and write files so the way that we do that is with the open command
351:37 that we do that is with the open command so we'll say something like open and
351:40 so we'll say something like open and with open and actually let's add the
351:42 with open and actually let's add the shebang up here really quick in python3
351:45 shebang up here really quick in python3 save it and with the open command we can
351:48 save it and with the open command we can say something like open
351:51 say something like open months.txt
351:57 and I need to add this here so if we open months.txt what we need to
352:01 so if we open months.txt what we need to do with this or what we typically do
352:02 do with this or what we typically do with this is we store this within a
352:06 with this is we store this within a variable so we might just call this
352:08 variable so we might just call this months equals open months.txt and if we
352:13 months equals open months.txt and if we want to read that file we can come in
352:15 want to read that file we can come in here and just print out months and
352:18 here and just print out months and you'll see what this does here in a
352:19 you'll see what this does here in a second now best practice says to also
352:23 second now best practice says to also close this out anytime we open this so
352:25 close this out anytime we open this so I'm going to go ahead and just add some
352:26 I'm going to go ahead and just add some lines in here because we're going to add
352:27 lines in here because we're going to add some more stuff to this but we can just
352:29 some more stuff to this but we can just do months Dot close
352:32 do months Dot close and we'll save this let's go ahead and
352:35 and we'll save this let's go ahead and run and see what happens here so if we
352:37 run and see what happens here so if we do Python 3
352:40 do Python 3 read write.pi
352:43 read write.pi you'll see we get this information back
352:45 you'll see we get this information back let me move this so it's readable and
352:48 let me move this so it's readable and what this tells us is hey this is the
352:51 what this tells us is hey this is the name of the file
352:52 name of the file we're in a certain mode in this mode
352:55 we're in a certain mode in this mode currently is read mode and we get the
352:58 currently is read mode and we get the default encoding here of utf-8
353:02 default encoding here of utf-8 so we're getting information back we're
353:04 so we're getting information back we're not actually reading the file that we
353:07 not actually reading the file that we wrote so
353:09 wrote so um some of the information that we can
353:10 um some of the information that we can get by the way we can come in here and
353:12 get by the way we can come in here and we can say it to ourselves well
353:15 we can say it to ourselves well is this file readable so we have mode
353:19 is this file readable so we have mode equals R and this is one way to check it
353:21 equals R and this is one way to check it there's a couple ways that we can check
353:22 there's a couple ways that we can check it as well we can print out
353:26 it as well we can print out month dot mode and that will tell us
353:28 month dot mode and that will tell us what mode we're in we can also print out
353:31 what mode we're in we can also print out months.readable and that should give us
353:34 months.readable and that should give us a Boolean statement whether that is true
353:36 a Boolean statement whether that is true or false so if we come in here and we
353:38 or false so if we come in here and we save this
353:40 save this and we do this again
353:42 and we do this again you'll see that we get months we print
353:45 you'll see that we get months we print that out we get the whole shebang here
353:47 that out we get the whole shebang here and we get the uh mode is equal to R
353:50 and we get the uh mode is equal to R which is readable you can see if we
353:52 which is readable you can see if we print out the mode we can also see it's
353:54 print out the mode we can also see it's readable or if we do months readable we
353:56 readable or if we do months readable we can see that it is readable so we have
353:58 can see that it is readable so we have the ability here to actually print this
354:01 the ability here to actually print this out and read this file
354:03 out and read this file so how do we do that well let's go ahead
354:06 so how do we do that well let's go ahead and delete these two lines
354:12 and we can just come in here and do month dot read
354:15 month dot read if we do that what happens here let's
354:17 if we do that what happens here let's save it print this out
354:20 save it print this out and you can see that it reads through
354:22 and you can see that it reads through every single iteration January all the
354:25 every single iteration January all the way through December perfect so we just
354:27 way through December perfect so we just read a file and we closed out
354:30 read a file and we closed out working as intended if we wanted to read
354:33 working as intended if we wanted to read this line by line we could we can do
354:36 this line by line we could we can do months.readline like this and if we save
354:39 months.readline like this and if we save that in print
354:41 that in print we will read literally one line if we
354:44 we will read literally one line if we wanted to read a second line we could
354:46 wanted to read a second line we could copy this and we could paste this and
354:48 copy this and we could paste this and save it and come in here and guess what
354:51 save it and come in here and guess what we'll get January and February this time
354:53 we'll get January and February this time so if we want to read this we have to
354:56 so if we want to read this we have to read line by line now if we wanted to
354:59 read line by line now if we wanted to read all the lines at once we could do
355:02 read all the lines at once we could do that
355:03 that in a different way we could do that with
355:04 in a different way we could do that with read lines
355:06 read lines and this will print out an empty array
355:08 and this will print out an empty array or a list here actually and what you'll
355:11 or a list here actually and what you'll see is we get January a new line
355:13 see is we get January a new line February new line March Etc so we put
355:16 February new line March Etc so we put this into a list and now if we try to
355:21 this into a list and now if we try to actually run this again let's actually
355:23 actually run this again let's actually tab over we tried to run this twice look
355:26 tab over we tried to run this twice look what happens
355:28 what happens I'm going to print this and save this
355:35 so we have the first list here and then we have a second list here the second
355:37 we have a second list here the second list is empty
355:39 list is empty well that's because we've actually
355:41 well that's because we've actually already read this so we read through it
355:44 already read this so we read through it here first and then it's empty the next
355:46 here first and then it's empty the next time we try to read it so if we wanted
355:48 time we try to read it so if we wanted to read it again what we need to do is
355:51 to read it again what we need to do is actually use what is called the seek
355:54 actually use what is called the seek method we can come in here and say
355:55 method we can come in here and say months.seek
355:58 months.seek do zero like that to go back to the very
356:01 do zero like that to go back to the very first line
356:03 first line and print out again
356:05 and print out again and now you can see we actually printed
356:07 and now you can see we actually printed this out twice so that works out well
356:11 this out twice so that works out well we also have the ability to put this
356:13 we also have the ability to put this into a for Loop to read through every
356:15 into a for Loop to read through every iteration of the line so if we wanted to
356:18 iteration of the line so if we wanted to do something like
356:20 do something like four month in months we could just print
356:24 four month in months we could just print out month
356:27 out month all right and that should iterate
356:29 all right and that should iterate through everything in here so save that
356:31 through everything in here so save that print this
356:33 print this and you can see that it indeed does
356:36 and you can see that it indeed does print through everything
356:38 print through everything we can also add the dot strip at the end
356:41 we can also add the dot strip at the end of this
356:46 save that print and you can see that we strip out
356:48 print and you can see that we strip out any of the new lines that are in there
356:50 any of the new lines that are in there so you saw we got some spacing in here
356:52 so you saw we got some spacing in here it's a little funky so if we came
356:54 it's a little funky so if we came through and we just added the dot strip
356:56 through and we just added the dot strip that makes our for Loop a little bit
356:57 that makes our for Loop a little bit better so again remember what we're
357:00 better so again remember what we're defining here is whatever we want we can
357:01 defining here is whatever we want we can call this for X in months make this an X
357:04 call this for X in months make this an X and it's the same thing but logically
357:06 and it's the same thing but logically it's just easy to call this month in
357:08 it's just easy to call this month in month and then we can just print those
357:10 month and then we can just print those out so we can iterate through this so so
357:13 out so we can iterate through this so so far up until this point all we've done
357:16 far up until this point all we've done is been able to read a file what if we
357:19 is been able to read a file what if we want to write to a file or append to a
357:21 want to write to a file or append to a file well we can do that as well so if
357:25 file well we can do that as well so if we wanted to
357:27 we wanted to for instance open a file let's open a
357:30 for instance open a file let's open a new file let's do something we haven't
357:31 new file let's do something we haven't created yet let's do days of the week so
357:33 created yet let's do days of the week so let's do open days and if we try to do
357:38 let's do open days and if we try to do this let's change months to days
357:40 this let's change months to days and we're going to change days to close
357:42 and we're going to change days to close and we're just going to leave this open
357:44 and we're just going to leave this open right here so we have our best practice
357:46 right here so we have our best practice now if we try to run this with an open
357:48 now if we try to run this with an open days.txt uh we're not going to be able
357:51 days.txt uh we're not going to be able to do that because currently we're just
357:53 to do that because currently we're just in read mode so we want to be able to
357:56 in read mode so we want to be able to turn over and put ourselves into write
357:58 turn over and put ourselves into write mode in order to do that we can just do
358:01 mode in order to do that we can just do a w if we wanted to check that out we
358:04 a w if we wanted to check that out we could just do print days.mode like we
358:07 could just do print days.mode like we saw before make sure we are actually
358:09 saw before make sure we are actually operating in right mode so if we save
358:12 operating in right mode so if we save this
358:14 this you'll see that we are in right mode so
358:16 you'll see that we are in right mode so we're good to go you could also just
358:18 we're good to go you could also just again delete this save
358:21 again delete this save and print out days apologies you print
358:25 and print out days apologies you print out days save that you'll be able to see
358:27 out days save that you'll be able to see that we are also in write mode so both
358:30 that we are also in write mode so both of these work
358:32 of these work now let's write to a file so we've got
358:35 now let's write to a file so we've got days let's go ahead and
358:37 days let's go ahead and write to that so we can do something
358:40 write to that so we can do something like
358:41 like days oops days dot right
358:45 days oops days dot right and let's say we wanted to put Monday
358:47 and let's say we wanted to put Monday into days save that
358:50 into days save that close it
358:52 close it and if we go ahead and execute that
358:54 and if we go ahead and execute that nothing happens but if we go ahead and
358:57 nothing happens but if we go ahead and cat out days.txt
359:00 cat out days.txt you'll see that Monday has been put into
359:03 you'll see that Monday has been put into days.txt perfect so now what if we
359:07 days.txt perfect so now what if we wanted to continue on with this let's
359:09 wanted to continue on with this let's put Tuesday in there and we're going to
359:12 put Tuesday in there and we're going to need a new line so let's go ahead and do
359:14 need a new line so let's go ahead and do a new line with that and we'll do
359:16 a new line with that and we'll do Tuesday and hopefully when we write this
359:18 Tuesday and hopefully when we write this out we'll see Monday and Tuesday so
359:21 out we'll see Monday and Tuesday so let's save that
359:22 let's save that print this
359:24 print this sorry let's run the script and then
359:26 sorry let's run the script and then print this
359:28 print this and you'll see we have the new line in
359:29 and you'll see we have the new line in there and we have Tuesday but we
359:31 there and we have Tuesday but we actually overwrote it we don't we don't
359:33 actually overwrote it we don't we don't have Monday anymore
359:35 have Monday anymore so what's happening here is we're
359:37 so what's happening here is we're actually writing to a file which is
359:40 actually writing to a file which is overwriting the file we're not appending
359:42 overwriting the file we're not appending to the file so if we wanted to append to
359:44 to the file so if we wanted to append to the file what we need to do is change
359:46 the file what we need to do is change this W to an a
359:48 this W to an a and we can come in here and we can write
359:50 and we can come in here and we can write in Wednesday if we wanted to
359:53 in Wednesday if we wanted to save this
359:55 save this and now let's run this and run that and
359:59 and now let's run this and run that and now you can see we have Tuesday and
360:00 now you can see we have Tuesday and Wednesday so understand the difference
360:02 Wednesday so understand the difference between R being read
360:05 between R being read W being right which overwrites and a
360:09 W being right which overwrites and a being append which allows us to append a
360:11 being append which allows us to append a file instead of overwriting a file
360:13 file instead of overwriting a file so that is it for this lesson I'll go
360:16 so that is it for this lesson I'll go ahead and see you over in the next one
360:19 ahead and see you over in the next one all right let's talk about classes and
360:22 all right let's talk about classes and objects
360:24 objects so python is what is known as an object
360:27 so python is what is known as an object oriented programming language so pretty
360:30 oriented programming language so pretty much everything in Python is an object
360:33 much everything in Python is an object and we can use what is called a class to
360:35 and we can use what is called a class to be what is like an object Constructor
360:38 be what is like an object Constructor and we can use that to help create
360:41 and we can use that to help create objects and this is a little bit easier
360:43 objects and this is a little bit easier to explain once we actually demonstrate
360:46 to explain once we actually demonstrate this so we're going to create a couple
360:48 this so we're going to create a couple of files in this lesson and the first
360:51 of files in this lesson and the first thing that we're going to do is we're
360:53 thing that we're going to do is we're going to do a mouse pad and I am going
360:57 going to do a mouse pad and I am going to create a file called
360:59 to create a file called employees dot pi
361:06 and in this we're going to go ahead and declare class
361:08 declare class I'm going to save this here so let's do
361:12 I'm going to save this here so let's do class employees save it
361:14 class employees save it and we're going to go ahead and hit
361:16 and we're going to go ahead and hit enter and just tab over
361:19 enter and just tab over and we're going to do this
361:22 and we're going to do this Define and two underscores
361:25 Define and two underscores i n i t or init two underscores again
361:29 i n i t or init two underscores again and we're gonna put some parameters
361:31 and we're gonna put some parameters inside of this function and we'll talk
361:33 inside of this function and we'll talk about what the init function is here in
361:35 about what the init function is here in a second let's go ahead and let's think
361:38 a second let's go ahead and let's think about having employees so the first
361:40 about having employees so the first parameter we're going to Define is
361:42 parameter we're going to Define is called self
361:43 called self and then for our employees we might want
361:45 and then for our employees we might want to know the employee's name
361:47 to know the employee's name we might want to know what department
361:49 we might want to know what department they work in
361:51 they work in we might want to know their role in that
361:54 we might want to know their role in that department
361:55 department their salary
361:57 their salary and maybe the years that they've been
362:00 and maybe the years that they've been employed so we'll do years underscore
362:01 employed so we'll do years underscore employed
362:03 employed and just like a function We'll add the
362:06 and just like a function We'll add the colon here at the end
362:08 colon here at the end and we're going to go ahead and tab and
362:11 and we're going to go ahead and tab and then we're going to Define all of this
362:12 then we're going to Define all of this so let's go ahead and say self
362:15 so let's go ahead and say self dot name is equal to name so we're
362:18 dot name is equal to name so we're creating methods here which you'll see
362:21 creating methods here which you'll see us use in just a bit we're going to do
362:23 us use in just a bit we're going to do self.department
362:25 self.department equals Department
362:28 equals Department and you should get the gist at this
362:30 and you should get the gist at this point self.roll is equal to roll
362:33 point self.roll is equal to roll self. salary is equal to salary
362:38 self. salary is equal to salary self
362:40 self dot years employed is equal to years
362:45 dot years employed is equal to years employed
362:51 okay so let's save that so all classes have a function called the init function
362:55 have a function called the init function and this is always executed when the
362:58 and this is always executed when the class is being initiated
363:00 class is being initiated so we're going to use this init function
363:02 so we're going to use this init function to assign values to object properties
363:06 to assign values to object properties so what we're doing here is we're
363:08 so what we're doing here is we're creating these parameters within this
363:10 creating these parameters within this function and we're also building out
363:12 function and we're also building out methods that we can use once we import
363:15 methods that we can use once we import this class so let's go ahead and close
363:18 this class so let's go ahead and close this out and we're going to open up
363:22 this out and we're going to open up another mouse pad and we'll just call
363:25 another mouse pad and we'll just call this something like our employees dot Pi
363:28 this something like our employees dot Pi you can call whatever you want and I'm
363:31 you can call whatever you want and I'm going to go ahead and do my shebang at
363:33 going to go ahead and do my shebang at the top we'll do bin python3
363:36 the top we'll do bin python3 save that and from here I want to
363:40 save that and from here I want to actually import the class that we just
363:43 actually import the class that we just built so what I'm going to do is I'm
363:46 built so what I'm going to do is I'm going to import this and we're going to
363:48 going to import this and we're going to say from employees
363:54 import employees
363:56 employees all right and we can make a couple of
363:59 all right and we can make a couple of employees here so let's set a variable
364:01 employees here so let's set a variable of E1 for employee one and we'll just do
364:04 of E1 for employee one and we'll just do employees
364:06 employees and I'm going to stick with the Bob's
364:07 and I'm going to stick with the Bob's Burgers theme from earlier we'll just
364:09 Burgers theme from earlier we'll just say we've got Bob remember we we're
364:12 say we've got Bob remember we we're declaring Bob's name
364:14 declaring Bob's name his department will say he works in
364:16 his department will say he works in sales
364:17 sales will say that his role within the
364:19 will say that his role within the department is the director of sales
364:24 department is the director of sales and we'll say his salary is a hundred
364:27 and we'll say his salary is a hundred thousand dollars a year
364:29 thousand dollars a year and that he has been employed for 20
364:31 and that he has been employed for 20 years
364:33 years and we'll do another employee
364:37 and we'll do another employee and we'll say that this employee is
364:39 and we'll say that this employee is Linda
364:41 Linda she is an executive
364:49 she is the Chief Information officer or the CIO
364:51 the CIO she makes a hundred and fifty thousand
364:53 she makes a hundred and fifty thousand dollars a year and she has been with the
364:55 dollars a year and she has been with the organization for 10 years
364:58 organization for 10 years so we can do some stuff with this we can
365:00 so we can do some stuff with this we can go and say like print
365:02 go and say like print E1 dot name
365:04 E1 dot name let's save this make sure everything
365:06 let's save this make sure everything works
365:08 works coming here actually let me close and
365:09 coming here actually let me close and reopen this because I forgot my
365:11 reopen this because I forgot my Ampersand on this
365:13 Ampersand on this and we'll come back and now we'll go
365:16 and we'll come back and now we'll go ahead and do python3 our employees and
365:21 ahead and do python3 our employees and you'll see that print e1.name is pulling
365:24 you'll see that print e1.name is pulling down Bob so we're using the name method
365:27 down Bob so we're using the name method that we created with our class so we
365:30 that we created with our class so we Define that within that class so now we
365:33 Define that within that class so now we have the ability to pull down
365:34 have the ability to pull down information based on the class that we
365:36 information based on the class that we built so we can also do something like
365:41 built so we can also do something like print E2 dot roll and we should get that
365:46 print E2 dot roll and we should get that role printed out for us so if we see E2
365:49 role printed out for us so if we see E2 roll we're getting that she is a CIO so
365:54 roll we're getting that she is a CIO so that is accurate statement here let's
365:56 that is accurate statement here let's see if we could open both of these let's
365:58 see if we could open both of these let's open also
366:01 open also employees.pi and we have both of these
366:03 employees.pi and we have both of these here now so it's a little bit easier to
366:04 here now so it's a little bit easier to see we've got our function our init
366:07 see we've got our function our init function here and we have all of our
366:09 function here and we have all of our methods that we've defined now we can
366:12 methods that we've defined now we can build upon this within this class so
366:15 build upon this within this class so let's say if we wanted to make another
366:16 let's say if we wanted to make another function if we wanted to say something
366:18 function if we wanted to say something like Define
366:19 like Define eligible for retirement
366:23 eligible for retirement and we just said self in here as the
366:26 and we just said self in here as the parameter what if we said something like
366:28 parameter what if we said something like if
366:29 if self dot years employed
366:33 self dot years employed is greater than or equal to 20.
366:36 is greater than or equal to 20. then we return true because if the
366:39 then we return true because if the person has worked with us for 20 years
366:41 person has worked with us for 20 years then they are eligible for retirement
366:45 then they are eligible for retirement otherwise if they haven't then they
366:48 otherwise if they haven't then they haven't earned their retirement yet so
366:50 haven't earned their retirement yet so we can look at an employee and see how
366:52 we can look at an employee and see how long they've worked with us and we can
366:54 long they've worked with us and we can save this here and then we can come in
366:56 save this here and then we can come in here we can do something like print
367:00 here we can do something like print and we'll say E1
367:02 and we'll say E1 and we'll ask if they are eligible for
367:06 and we'll ask if they are eligible for retirement
367:09 retirement okay
367:11 okay save this print this out and you'll see
367:14 save this print this out and you'll see that Bob is indeed eligible for
367:17 that Bob is indeed eligible for retirement because he has been with the
367:18 retirement because he has been with the company at least 20 years which is what
367:21 company at least 20 years which is what we put here within the class
367:23 we put here within the class so just know what we're doing is we're
367:25 so just know what we're doing is we're building out our own class and we're
367:27 building out our own class and we're able to Define
367:29 able to Define these functions and these parameters and
367:32 these functions and these parameters and these help us with creating our objects
367:35 these help us with creating our objects that we're using over here so we've got
367:37 that we're using over here so we've got our classes and then we've got our
367:39 our classes and then we've got our objects so this can get really robust
367:42 objects so this can get really robust very quick and we'll build out a project
367:45 very quick and we'll build out a project to look at that here in the next lesson
367:47 to look at that here in the next lesson and that way we can tie this all
367:49 and that way we can tie this all together but this is a very important
367:52 together but this is a very important part of programming and this is very
367:53 part of programming and this is very much a one-on-one class so we're just
367:55 much a one-on-one class so we're just skimming the surface on what this is but
367:57 skimming the surface on what this is but this is actually incredibly useful when
367:59 this is actually incredibly useful when we start building out classes like this
368:01 we start building out classes like this to help with other things that we're
368:03 to help with other things that we're writing and pulling information from so
368:06 writing and pulling information from so that's it for this lesson we're going to
368:08 that's it for this lesson we're going to go ahead and move on to the next one
368:10 go ahead and move on to the next one we have reached the final project in
368:14 we have reached the final project in this course and this is going to tie
368:17 this course and this is going to tie everything together that we have learned
368:19 everything together that we have learned thus far
368:21 thus far so I am a bit of a sneaker head which
368:25 so I am a bit of a sneaker head which means I really like shoes and so what
368:28 means I really like shoes and so what we're going to do is we're going to
368:29 we're going to do is we're going to build a budget app using classes and
368:33 build a budget app using classes and objects and we're going to see what
368:35 objects and we're going to see what shoes we can afford based on how much
368:37 shoes we can afford based on how much money we have
368:38 money we have so we're going to go ahead and start
368:40 so we're going to go ahead and start with the class and we're going to just
368:43 with the class and we're going to just make a new file we'll do mouse pad and
368:46 make a new file we'll do mouse pad and we'll call this shoes I can type shoes
368:49 we'll call this shoes I can type shoes dot pi
368:51 dot pi open that up
368:53 open that up and we'll also open up a new window as
368:57 and we'll also open up a new window as well or just a new tab here and we'll
369:00 well or just a new tab here and we'll write in both of these so uh for this
369:03 write in both of these so uh for this one we're going to go ahead and just
369:04 one we're going to go ahead and just define a class of shoes
369:08 define a class of shoes and I'm going to go ahead and just save
369:10 and I'm going to go ahead and just save that so I see the colors
369:12 that so I see the colors and here we're going to Define our init
369:16 and here we're going to Define our init statement
369:19 statement and we're going to just say self
369:22 and we're going to just say self and then we're going to have a name
369:24 and then we're going to have a name our name of our shoe and the price of
369:27 our name of our shoe and the price of our shoes
369:29 our shoes and within this we're just going to
369:31 and within this we're just going to Define
369:33 Define self.name equals name this should all
369:35 self.name equals name this should all look familiar so far and self dot price
369:39 look familiar so far and self dot price is equal to price
369:41 is equal to price what we're going to do with the price
369:42 what we're going to do with the price because we'll run into an instance where
369:44 because we'll run into an instance where this is going to be taken potentially as
369:46 this is going to be taken potentially as a string we're going to go ahead and
369:48 a string we're going to go ahead and just give this a flow we want to make
369:50 just give this a flow we want to make sure that we are assuming this is going
369:53 sure that we are assuming this is going to be a float of a price here
369:56 to be a float of a price here let's go ahead and Define a few more
369:58 let's go ahead and Define a few more things so I want to define a budget
370:00 things so I want to define a budget check
370:02 check and I want to make sure that we have the
370:04 and I want to make sure that we have the budget here so what we're going to do in
370:07 budget here so what we're going to do in this instance is we're just going to say
370:11 this instance is we're just going to say self and then we'll also add in budget
370:13 self and then we'll also add in budget here
370:15 here and we'll come in here and we'll do a
370:17 and we'll come in here and we'll do a check first we want to make sure that we
370:20 check first we want to make sure that we are given an integer or a float here
370:23 are given an integer or a float here when we are asked for the budget so we
370:26 when we are asked for the budget so we can say something like if not
370:30 can say something like if not is instance and what this means is we're
370:33 is instance and what this means is we're saying if this type is not what we're
370:36 saying if this type is not what we're specifying here then we're going to go
370:39 specifying here then we're going to go ahead and reject this and close out of
370:42 ahead and reject this and close out of the application so the is instance looks
370:44 the application so the is instance looks for our type and returns a True Value
370:46 for our type and returns a True Value but if we say is not true then that's
370:50 but if we say is not true then that's false remember our truth tables and thus
370:53 false remember our truth tables and thus becomes invalid and closes the app so
370:56 becomes invalid and closes the app so what's going to happen is we're going to
370:57 what's going to happen is we're going to say budget
370:59 say budget and we're also going to look whether
371:02 and we're also going to look whether budget is going to be an INT or a float
371:06 budget is going to be an INT or a float and if it is not one of those two things
371:09 and if it is not one of those two things we're going to go ahead and print out
371:11 we're going to go ahead and print out invalid entry
371:14 invalid entry please enter a number something along
371:18 please enter a number something along those lines and then we'll exit the
371:21 those lines and then we'll exit the application
371:22 application so let's say that we have a budget and
371:25 so let's say that we have a budget and we want to also know how much money is
371:27 we want to also know how much money is left over if we buy the shoes so we can
371:30 left over if we buy the shoes so we can define something like change or what
371:33 define something like change or what change is left over and we could say
371:35 change is left over and we could say something like self Budget on this as
371:38 something like self Budget on this as well
371:39 well and we can just return
371:43 and we can just return our budget
371:44 our budget minus ourself dot price
371:48 minus ourself dot price so remember we declared self.price up
371:50 so remember we declared self.price up here now we're calling it we're just
371:52 here now we're calling it we're just saying Hey I want to return the value of
371:54 saying Hey I want to return the value of the budget that we have minus the cost
371:56 the budget that we have minus the cost of the item that we're purchasing
372:02 okay only a couple more things and we'll be done with our class here so we also
372:05 be done with our class here so we also need to purchase it right so let's
372:07 need to purchase it right so let's define buy and we're going to do self
372:10 define buy and we're going to do self budget again
372:18 and here we're going to do a self dot Budget Check
372:31 and what we'll say is if our budget is greater than or equal to self.price
372:35 is greater than or equal to self.price then we're going to print out
372:42 we'll do a F string here and we'll just say U and cop sum and then we'll do
372:46 say U and cop sum and then we'll do self.name
372:49 self.name so the name that we'll provide here this
372:52 so the name that we'll provide here this will all make sense once we tie it all
372:53 will all make sense once we tie it all together
372:55 together okay and then if our budget is equal to
372:59 okay and then if our budget is equal to the self.price then we're gonna just say
373:02 the self.price then we're gonna just say print out
373:04 print out you
373:06 you have exactly enough money for these
373:11 have exactly enough money for these shoes
373:14 shoes otherwise
373:19 we can do else now we could go through this whole thing and and give a
373:20 this whole thing and and give a statement and say well what if we had no
373:22 statement and say well what if we had no money or what if we didn't have enough
373:24 money or what if we didn't have enough money but in this instance we're just
373:26 money but in this instance we're just gonna print out the situation of
373:30 gonna print out the situation of you can
373:33 you can buy these shoes and have we have a
373:37 buy these shoes and have we have a dollar sign here
373:39 dollar sign here we'll say self
373:42 we'll say self dot change
373:44 dot change and we'll give a budget left over
373:46 and we'll give a budget left over so
373:53 left over just like this all right and then when we exit the
373:55 all right and then when we exit the application we can say something like
373:57 application we can say something like exit
373:58 exit and we'll just give a statement thanks
374:01 and we'll just give a statement thanks for using our shoe budget app
374:06 for using our shoe budget app now this might not make any sense yet
374:09 now this might not make any sense yet and that's okay let me make this a
374:10 and that's okay let me make this a little bit bigger
374:13 little bit bigger and so what we're doing here is we're
374:15 and so what we're doing here is we're defining our init and in our init we
374:18 defining our init and in our init we have a name which is going to be the
374:20 have a name which is going to be the name of the shoe
374:21 name of the shoe and price which give me the price of the
374:23 and price which give me the price of the shoe so self.name is equal to name
374:26 shoe so self.name is equal to name self.price is going to be a float
374:28 self.price is going to be a float because we're expecting
374:30 because we're expecting potentially it could be our price of our
374:32 potentially it could be our price of our shoe could be 2.99 or 100.99 it might
374:37 shoe could be 2.99 or 100.99 it might not just be a perfect number so we want
374:39 not just be a perfect number so we want to use a float
374:41 to use a float we have our budget check here we're just
374:43 we have our budget check here we're just checking the is instance we could in
374:45 checking the is instance we could in theory add to this budget check and make
374:47 theory add to this budget check and make sure we have enough funding before we
374:48 sure we have enough funding before we come down and do the purchase would
374:51 come down and do the purchase would probably be the logical way to do this
374:53 probably be the logical way to do this but in this instance we're just using
374:55 but in this instance we're just using really beginner logic and we're just
374:57 really beginner logic and we're just coming through and we're just saying hey
374:58 coming through and we're just saying hey if this instance isn't an integer or a
375:01 if this instance isn't an integer or a float like somebody types in a string
375:03 float like somebody types in a string then we're just going to go ahead and
375:05 then we're just going to go ahead and reject this we we don't want any we have
375:07 reject this we we don't want any we have no interest if this is no integer or
375:09 no interest if this is no integer or float here
375:10 float here then we're going to Define our change so
375:13 then we're going to Define our change so if we have uh money left over like if we
375:17 if we have uh money left over like if we have budget minus the price of the shoe
375:18 have budget minus the price of the shoe then we're going to go ahead and give
375:21 then we're going to go ahead and give some money back
375:23 some money back um and then we're gonna buy the shoe as
375:25 um and then we're gonna buy the shoe as well so we're gonna have our buy option
375:27 well so we're gonna have our buy option as long as our budget is greater than
375:29 as long as our budget is greater than the price of the shoe we can buy that
375:31 the price of the shoe we can buy that shoe
375:32 shoe and if the budget is equal to the price
375:34 and if the budget is equal to the price then we have enough money if it's not
375:36 then we have enough money if it's not then we'll actually have some money left
375:37 then we'll actually have some money left over here
375:39 over here um unless it's the instance of not
375:40 um unless it's the instance of not having enough money and then it'll just
375:42 having enough money and then it'll just exit the application because we haven't
375:44 exit the application because we haven't told it to do anything else and then
375:46 told it to do anything else and then it'll also thank us for using the shoe
375:47 it'll also thank us for using the shoe app so that's part one we have defined
375:51 app so that's part one we have defined the class now could we build this out
375:54 the class now could we build this out all in one thing yes we could just write
375:57 all in one thing yes we could just write a script out for this we could code this
375:59 a script out for this we could code this and make it into one easy script but
376:03 and make it into one easy script but what this will do is allow us
376:04 what this will do is allow us flexibility this is where object
376:06 flexibility this is where object oriented programming comes into play
376:08 oriented programming comes into play because we don't have to continue to
376:10 because we don't have to continue to repeat ourself and what we're following
376:12 repeat ourself and what we're following is what is called the dry approach the
376:15 is what is called the dry approach the don't repeat yourself approach and so
376:19 don't repeat yourself approach and so what we're doing is maintaining
376:21 what we're doing is maintaining everything in a class here and then
376:24 everything in a class here and then we'll call that class and make it very
376:26 we'll call that class and make it very easy on us instead of having one crazy
376:28 easy on us instead of having one crazy long script that is potentially
376:30 long script that is potentially repetitive and a lot more difficult to
376:34 repetitive and a lot more difficult to go through so here we're gonna just
376:37 go through so here we're gonna just open this up and I'm going to call out a
376:40 open this up and I'm going to call out a shebang I'm Ben python3 I'm Gonna Save
376:43 shebang I'm Ben python3 I'm Gonna Save this and I'm going to call this
376:47 this and I'm going to call this uh shoe purchase
376:50 uh shoe purchase dot pi
376:52 dot pi save that
376:55 save that now
376:56 now we're going to import from our class
376:58 we're going to import from our class that we made so from shoes import shoes
377:05 and let's define a few variables so let's say low is equal to
377:08 let's say low is equal to choose and for the low price shoes we're
377:12 choose and for the low price shoes we're just going to say we can buy some and
377:14 just going to say we can buy some and ones and we can buy those for 30 dollars
377:18 ones and we can buy those for 30 dollars uh for medium price shoes maybe we can
377:21 uh for medium price shoes maybe we can purchase some Air Force Ones
377:25 purchase some Air Force Ones and for those maybe they're a hundred
377:28 and for those maybe they're a hundred and twenty dollars
377:30 and twenty dollars and then for the high price shoes maybe
377:33 and then for the high price shoes maybe we're interested in purchasing
377:36 we're interested in purchasing some off-whites
377:42 and those might run us for a hundred dollars
377:44 dollars and from here what we're gonna do is
377:46 and from here what we're gonna do is we're going to do a try statement
377:49 we're going to do a try statement remember we've done a try statement
377:51 remember we've done a try statement before and we're going to say try
377:54 before and we're going to say try and we're going to say shoe budget
378:01 is equal to a float of an input we're going to ask for an
378:03 of an input we're going to ask for an input here so this is all tying together
378:05 input here so this is all tying together we'll say what is your shoe budget
378:10 we'll say what is your shoe budget do a question mark there
378:12 do a question mark there tie this together and then
378:15 tie this together and then we're going to do an exception so if we
378:18 we're going to do an exception so if we have a value error
378:20 have a value error meaning we don't get a number back
378:23 meaning we don't get a number back similar to what we were doing previously
378:25 similar to what we were doing previously if we don't get a number back here we're
378:27 if we don't get a number back here we're going to say please enter a number
378:34 now we can come in here and say
378:37 we can come in here and say for shoes in
378:40 for shoes in and then we can just give this high
378:43 and then we can just give this high medium low like this
378:47 medium low like this we can do a shoes dot by
378:51 we can do a shoes dot by and remember we came out with this by
378:53 and remember we came out with this by Method over in our class here so we're
378:56 Method over in our class here so we're doing a shoes dot by I'm gonna go and
378:59 doing a shoes dot by I'm gonna go and check all this for us and we're going to
379:01 check all this for us and we're going to say
379:02 say to budget
379:04 to budget so we're going to take the input of shoe
379:06 so we're going to take the input of shoe budget what's the value here we'll take
379:08 budget what's the value here we'll take that we'll come in here and we'll see
379:11 that we'll come in here and we'll see what our budget is if it is greater than
379:15 what our budget is if it is greater than or equal to the price of the shoe we're
379:17 or equal to the price of the shoe we're defining our name of the shoe and our
379:20 defining our name of the shoe and our price of the shoe from our parameters
379:22 price of the shoe from our parameters that we defined up here name and price
379:23 that we defined up here name and price so we're saying hey our the name and the
379:27 so we're saying hey our the name and the price so is the price of the shoe
379:30 price so is the price of the shoe is it at least the amount of our budget
379:34 is it at least the amount of our budget and if it is we can buy that and we'll
379:36 and if it is we can buy that and we'll check in the highest order and then go
379:39 check in the highest order and then go in the lowest order if you flip these
379:41 in the lowest order if you flip these and you put in 400 we just keep telling
379:44 and you put in 400 we just keep telling you that you can only buy the low price
379:46 you that you can only buy the low price shoe so you need to make sure it's in
379:47 shoe so you need to make sure it's in the highest to the lowest order in this
379:49 the highest to the lowest order in this this example and so it'll check do we
379:53 this example and so it'll check do we have enough money to buy the 400 pair of
379:55 have enough money to buy the 400 pair of shoes no okay and then do we have enough
379:57 shoes no okay and then do we have enough money to buy the 120 pair of shoes no do
380:00 money to buy the 120 pair of shoes no do we have enough money to buy the 30 pair
380:01 we have enough money to buy the 30 pair of shoes so we'll go through that and
380:03 of shoes so we'll go through that and iterate in this Loop to see what we can
380:06 iterate in this Loop to see what we can or can't buy so let's go ahead and save
380:09 or can't buy so let's go ahead and save this
380:11 this and we'll save shoes.pi and I'm going to
380:14 and we'll save shoes.pi and I'm going to go ahead and run this hopefully I have
380:16 go ahead and run this hopefully I have no typos I will do shoe budget
380:22 no typos I will do shoe budget shoe purchase sorry and run this and I
380:26 shoe purchase sorry and run this and I do have a typo and so if I come back in
380:29 do have a typo and so if I come back in here
380:30 here I forgot to close off my F string so let
380:33 I forgot to close off my F string so let me save that
380:35 me save that now let's try this
380:38 now let's try this what is our shoe budget let's give it a
380:40 what is our shoe budget let's give it a few different options if we said our
380:43 few different options if we said our shoe budget was thirty dollars exactly
380:47 shoe budget was thirty dollars exactly well it's going to say that we can cop
380:49 well it's going to say that we can cop some air some and ones sorry and we have
380:53 some air some and ones sorry and we have exactly enough money for these shoes
380:54 exactly enough money for these shoes thanks for using the shoe app uh what if
380:57 thanks for using the shoe app uh what if we had 31 dollars
380:59 we had 31 dollars well we could still cop some and ones
381:01 well we could still cop some and ones and then we can buy these shoes and have
381:03 and then we can buy these shoes and have one dollar left over all right what if
381:06 one dollar left over all right what if we had 450 dollars
381:09 we had 450 dollars well we can buy the off-whites and we
381:11 well we can buy the off-whites and we can buy those and have fifty dollars
381:13 can buy those and have fifty dollars left over for our budget
381:15 left over for our budget so hopefully this makes sense I know
381:18 so hopefully this makes sense I know this is a lot of information and this
381:20 this is a lot of information and this again is just a one-on-one course so
381:22 again is just a one-on-one course so we're just kind of
381:23 we're just kind of dabbling in the object oriented
381:27 dabbling in the object oriented programming and if you continue on with
381:29 programming and if you continue on with python from here and you start getting
381:30 python from here and you start getting into more complex material then you
381:35 into more complex material then you could build upon what you're learning
381:37 could build upon what you're learning here so
381:38 here so try to think of something that you might
381:40 try to think of something that you might want to script out like this or write
381:43 want to script out like this or write out like this and think of the logic
381:45 out like this and think of the logic behind it I highly recommend going and
381:48 behind it I highly recommend going and doing coding challenges or programming
381:50 doing coding challenges or programming challenges and try to increase the logic
381:54 challenges and try to increase the logic and the ideas behind what you're trying
381:56 and the ideas behind what you're trying to build and that just takes practice
381:59 to build and that just takes practice all this takes practice it's one thing
382:01 all this takes practice it's one thing to watch and follow along with somebody
382:02 to watch and follow along with somebody it's a whole nother game to go out and
382:05 it's a whole nother game to go out and do this yourself so start thinking of
382:07 do this yourself so start thinking of some things that you want to build
382:09 some things that you want to build really use your Google skills look at
382:12 really use your Google skills look at stack Overflow and look at some Googling
382:16 stack Overflow and look at some Googling and some redditing and just try to piece
382:18 and some redditing and just try to piece together the logic that you have in what
382:21 together the logic that you have in what you want to build so highly recommend
382:23 you want to build so highly recommend building upon this this is a great
382:25 building upon this this is a great language learn and very flexible and I
382:28 language learn and very flexible and I hope that you continue on with this
382:38 okay before we get hands on I have to give you a little bit of Death by
382:39 give you a little bit of Death by PowerPoint but it's for good reason
382:41 PowerPoint but it's for good reason so we need to introduce the five stages
382:44 so we need to introduce the five stages of ethical hacking these are the five
382:46 of ethical hacking these are the five stages that you will go through on every
382:49 stages that you will go through on every assessment
382:50 assessment so before we do that let's first make a
382:54 so before we do that let's first make a big note from here on we are moving into
382:56 big note from here on we are moving into the ethical hacking portion of our
382:59 the ethical hacking portion of our course we're going to learn malicious
383:01 course we're going to learn malicious things
383:02 things please only use the information learned
383:04 please only use the information learned in this course for ethical purposes do
383:07 in this course for ethical purposes do not attack your neighbors do not attack
383:09 not attack your neighbors do not attack anybody that you do not have explicit
383:11 anybody that you do not have explicit permission to do so
383:13 permission to do so you can and will get into trouble for
383:15 you can and will get into trouble for doing that so with that out of the way
383:17 doing that so with that out of the way let's talk briefly about the five stages
383:20 let's talk briefly about the five stages of ethical hacking
383:22 of ethical hacking so
383:23 so we start up at the top and we actually
383:26 we start up at the top and we actually start with what is called reconnaissance
383:28 start with what is called reconnaissance the stage is also known as information
383:31 the stage is also known as information gathering and there are two different
383:34 gathering and there are two different types there's active and passive now
383:37 types there's active and passive now passive is saying like going out to
383:40 passive is saying like going out to Google and searching for somebody say
383:42 Google and searching for somebody say you're giving a client and you want to
383:43 you're giving a client and you want to look at their Google you want to look at
383:45 look at their Google you want to look at LinkedIn you might be looking for I
383:47 LinkedIn you might be looking for I don't know a picture of their badge or
383:49 don't know a picture of their badge or an employee's name or maybe an
383:51 an employee's name or maybe an employee's Twitter page
383:53 employee's Twitter page that's all passive you're not actually
383:55 that's all passive you're not actually going out to the company's website and
383:57 going out to the company's website and doing anything active against it now
384:00 doing anything active against it now active reconnaissance kind of falls into
384:02 active reconnaissance kind of falls into place with the second phase which is
384:05 place with the second phase which is scanning an enumeration now that is
384:08 scanning an enumeration now that is active that is where we go out and we
384:10 active that is where we go out and we take tools such as nmap and nessus and
384:13 take tools such as nmap and nessus and nicto and you've never heard of any of
384:15 nicto and you've never heard of any of those that's fine but we take those and
384:17 those that's fine but we take those and we scan actively against a client now
384:21 we scan actively against a client now what we're looking for are open ports
384:23 what we're looking for are open ports vulnerabilities different items and with
384:26 vulnerabilities different items and with what Returns on these results when we do
384:29 what Returns on these results when we do this scanning we also perform what is
384:31 this scanning we also perform what is called enumeration enumeration is just
384:34 called enumeration enumeration is just looking at items and digging into them
384:36 looking at items and digging into them to see if we can find anything of value
384:38 to see if we can find anything of value say that there is a web server running
384:41 say that there is a web server running on Port 80 we see Port 80 is open and
384:45 on Port 80 we see Port 80 is open and it's running something like Apache 1.2
384:47 it's running something like Apache 1.2 which would be really really outdated we
384:49 which would be really really outdated we would go out to Google and we would say
384:51 would go out to Google and we would say Google do you know if Apache 1.2 2 has
384:54 Google do you know if Apache 1.2 2 has any X place for it and we would do
384:56 any X place for it and we would do research that's the enumeration portion
384:58 research that's the enumeration portion of it so once we do our information
385:01 of it so once we do our information gathering we do our scanning enumeration
385:03 gathering we do our scanning enumeration then we move into the gaining access
385:06 then we move into the gaining access portion
385:07 portion this is also known as exploitation we
385:11 this is also known as exploitation we will run an exploit against the client
385:12 will run an exploit against the client or against the vulnerable service or
385:14 or against the vulnerable service or whatever it may be to try to gain access
385:17 whatever it may be to try to gain access into a machine or into a network into an
385:20 into a machine or into a network into an environment Etc once we have that access
385:24 environment Etc once we have that access the process starts to repeat we do
385:27 the process starts to repeat we do scanning and enumeration again and we
385:29 scanning and enumeration again and we also want to maintain that access right
385:32 also want to maintain that access right so if we were to get kicked out okay or
385:36 so if we were to get kicked out okay or a user shuts down their computer how do
385:39 a user shuts down their computer how do we maintain that access so when they
385:40 we maintain that access so when they turn their computer back on we still
385:42 turn their computer back on we still have access to it and then lastly there
385:45 have access to it and then lastly there is the covering tracks you want to
385:47 is the covering tracks you want to delete any logs that you may leave
385:49 delete any logs that you may leave behind you want to delete any kind of
385:52 behind you want to delete any kind of malware that you upload which is more
385:54 malware that you upload which is more important as a pen tester any accounts
385:57 important as a pen tester any accounts that you create for any reason you want
386:00 that you create for any reason you want to delete those as well you really just
386:02 to delete those as well you really just want to clean up it's a good way of
386:04 want to clean up it's a good way of putting it covering tracks is the more
386:06 putting it covering tracks is the more hacker way of putting it but as a
386:07 hacker way of putting it but as a penetration tester you really just want
386:10 penetration tester you really just want to clean up so we're going to go heavily
386:13 to clean up so we're going to go heavily through steps one through three in this
386:16 through steps one through three in this course we'll also cover four and five
386:18 course we'll also cover four and five briefly but the process in methodology
386:22 briefly but the process in methodology never changes regardless if you're doing
386:25 never changes regardless if you're doing network if you're doing web app or if
386:28 network if you're doing web app or if you're doing a different type of
386:29 you're doing a different type of assessment it's all similar in this five
386:32 assessment it's all similar in this five stages of hacking the tools might change
386:35 stages of hacking the tools might change the attack methods might change but the
386:38 the attack methods might change but the overall methodology is always the same
386:41 overall methodology is always the same so that's how we're also going to
386:43 so that's how we're also going to structure this course we're going to go
386:45 structure this course we're going to go in first and we're going to talk about
386:47 in first and we're going to talk about information gathering and reconnaissance
386:49 information gathering and reconnaissance then we're going to move into scanning
386:51 then we're going to move into scanning enumeration and then we'll start with
386:53 enumeration and then we'll start with exploitation and do that repeatedly
386:56 exploitation and do that repeatedly until we get it inside of our heads and
386:58 until we get it inside of our heads and our it feels almost second nature right
387:00 our it feels almost second nature right once we have all that done we'll do some
387:04 once we have all that done we'll do some practice boxes you know give it a go see
387:07 practice boxes you know give it a go see how we do we'll move into the internal
387:10 how we do we'll move into the internal side of things with active directory
387:12 side of things with active directory we'll start working with our web
387:15 we'll start working with our web applications and our wireless and we
387:17 applications and our wireless and we will touch on the maintaining access and
387:19 will touch on the maintaining access and covering tracks but you're going to see
387:21 covering tracks but you're going to see this methodology over and over and you
387:23 this methodology over and over and you might also get this question on an
387:25 might also get this question on an interview you know to describe the five
387:27 interview you know to describe the five stages so it's important to know these
387:29 stages so it's important to know these it's just something that every ethical
387:31 it's just something that every ethical hacker can rattle off pretty quickly so
387:33 hacker can rattle off pretty quickly so have this written down think about it
387:35 have this written down think about it keep your wheels spinning and let's go
387:37 keep your wheels spinning and let's go ahead and move on to our first section
387:39 ahead and move on to our first section which is going to be information gather
387:41 which is going to be information gather ring slash reconnaissance so in some
387:44 ring slash reconnaissance so in some Cool Tools some Google Foo and just what
387:47 Cool Tools some Google Foo and just what kind of information we can actually
387:48 kind of information we can actually gather on a potential client
387:56 so in this section we are going to be talking about information gathering and
387:59 talking about information gathering and all the information gathering we're
388:01 all the information gathering we're going to do in this section is going to
388:03 going to do in this section is going to be passive so I'm calling this passive
388:05 be passive so I'm calling this passive Recon or passive reconnaissance I wanted
388:08 Recon or passive reconnaissance I wanted to give a brief overview of what we're
388:10 to give a brief overview of what we're going to be covering and talk about some
388:13 going to be covering and talk about some high level topics before we get into the
388:15 high level topics before we get into the weeds and really dive into our Target
388:18 weeds and really dive into our Target so let's talk about the different types
388:21 so let's talk about the different types of passive Recon so on the physical or
388:25 of passive Recon so on the physical or social sides physical meaning actually
388:28 social sides physical meaning actually going on site and maybe doing a physical
388:30 going on site and maybe doing a physical engagement or the social engineering
388:33 engagement or the social engineering aspect of maybe doing a phishing
388:35 aspect of maybe doing a phishing assessment or even including in a
388:37 assessment or even including in a physical engagement or a bishing
388:39 physical engagement or a bishing assessment just gathering this
388:41 assessment just gathering this information from the physical social
388:43 information from the physical social aspect is incredibly useful so we have
388:46 aspect is incredibly useful so we have location information so we might utilize
388:49 location information so we might utilize something like satellite images or often
388:53 something like satellite images or often will go on site and do drone
388:55 will go on site and do drone reconnaissance where we fly a drone
388:57 reconnaissance where we fly a drone around and try to gain information and
388:59 around and try to gain information and what we're really after with these
389:01 what we're really after with these images of this drone Recon is we're
389:03 images of this drone Recon is we're trying to find out hey what is the
389:05 trying to find out hey what is the building layout look like are there
389:07 building layout look like are there badge readers are there break areas does
389:11 badge readers are there break areas does security exist do they have somebody
389:12 security exist do they have somebody posted out up front can you just walk
389:15 posted out up front can you just walk right in the door what does their
389:17 right in the door what does their fencing look like are are there areas
389:19 fencing look like are are there areas where they're just leaving the doors
389:21 where they're just leaving the doors propped open where do people go out and
389:24 propped open where do people go out and smoke in these break areas because those
389:25 smoke in these break areas because those are good place to just walk up to
389:28 are good place to just walk up to somebody light up a cigarette even if
389:30 somebody light up a cigarette even if you don't smoke and to start a
389:31 you don't smoke and to start a conversation and then tailgate right in
389:33 conversation and then tailgate right in with them into the building now the
389:36 with them into the building now the other aspect of this is the job
389:38 other aspect of this is the job information so we might be looking for
389:42 information so we might be looking for employees online I might want to know
389:44 employees online I might want to know somebody's name job title phone number
389:46 somebody's name job title phone number who their manager is I try to get a good
389:50 who their manager is I try to get a good idea of what people look like so if I
389:52 idea of what people look like so if I see them on site I have a good idea who
389:54 see them on site I have a good idea who they are I also look for pictures so I
389:57 they are I also look for pictures so I cannot tell you how many times a badge
389:59 cannot tell you how many times a badge photo is posted on LinkedIn or somebody
390:02 photo is posted on LinkedIn or somebody posted on Twitter you can see all the
390:04 posted on Twitter you can see all the memes out there about people posting
390:06 memes out there about people posting their photos at work and it's bad it
390:09 their photos at work and it's bad it happens all the time I see it to this
390:11 happens all the time I see it to this day so we're looking for badge photos
390:13 day so we're looking for badge photos I'm looking for desk photos computer
390:16 I'm looking for desk photos computer photos I had a situation one where
390:19 photos I had a situation one where somebody took a picture of her watching
390:22 somebody took a picture of her watching a game at work she was watching a
390:24 a game at work she was watching a basketball game at work and the
390:26 basketball game at work and the basketball game was on her computer and
390:29 basketball game was on her computer and on her screen there it showed all the
390:32 on her screen there it showed all the different tools that they utilized at
390:33 different tools that they utilized at work she had a work application open in
390:36 work she had a work application open in this photo there was a desk in the
390:39 this photo there was a desk in the background you can see different things
390:40 background you can see different things and it just gives us information and
390:43 and it just gives us information and that's really what we're after what kind
390:45 that's really what we're after what kind of information can We Gather now this
390:47 of information can We Gather now this course is not a course on physical or
390:49 course is not a course on physical or social so I kind of wanted to give a
390:50 social so I kind of wanted to give a high level of what to expect we won't
390:53 high level of what to expect we won't really be doing a whole lot of this in
390:55 really be doing a whole lot of this in this course with this type of
390:57 this course with this type of information gathering but these are the
390:59 information gathering but these are the things that you should be looking for so
391:01 things that you should be looking for so if you are tasked with the physical
391:03 if you are tasked with the physical assessment do go out there and look for
391:06 assessment do go out there and look for satellite images try to get a good feel
391:07 satellite images try to get a good feel of the building layout and also try to
391:10 of the building layout and also try to get a feel for who the employees are who
391:13 get a feel for who the employees are who maybe the it manager is in case you're
391:15 maybe the it manager is in case you're going to say you know I work for it they
391:18 going to say you know I work for it they might ask you who your manager is you
391:20 might ask you who your manager is you might need to know those names and of
391:22 might need to know those names and of course look for pictures if you can find
391:24 course look for pictures if you can find a good badge photo and what that looks
391:26 a good badge photo and what that looks like you can make a fake Badge go on
391:28 like you can make a fake Badge go on site and you'll be way more passable
391:30 site and you'll be way more passable with that badge but sometimes they don't
391:32 with that badge but sometimes they don't even look it can be drawn in crayon so
391:35 even look it can be drawn in crayon so from there let's go ahead and talk about
391:37 from there let's go ahead and talk about what we will be doing a lot of which is
391:39 what we will be doing a lot of which is the web in host
391:41 the web in host so when you get a web or a host
391:43 so when you get a web or a host assessment the first thing you really
391:45 assessment the first thing you really should do is what is called Target
391:47 should do is what is called Target validation so we're going to be
391:49 validation so we're going to be targeting something on bug crowds we're
391:51 targeting something on bug crowds we're not really going to focus on this but
391:53 not really going to focus on this but what we're going to do in the real world
391:55 what we're going to do in the real world is we would validate the Target now
391:58 is we would validate the Target now there are situations where a client will
392:01 there are situations where a client will give you an IP address or a website and
392:03 give you an IP address or a website and they might they might fudge it right
392:04 they might they might fudge it right they might accidentally fat finger it
392:07 they might accidentally fat finger it put uh the wrong number put the wrong
392:09 put uh the wrong number put the wrong letter in the website and then guess
392:11 letter in the website and then guess what you're off attacking somebody
392:12 what you're off attacking somebody else's website and they're if you're a
392:16 else's website and they're if you're a podcast listener there's a good Dark Net
392:17 podcast listener there's a good Dark Net Diaries episode on this if you don't
392:19 Diaries episode on this if you don't listen to darknet Diaries go check it
392:21 listen to darknet Diaries go check it out there's a great episode with a guy
392:24 out there's a great episode with a guy named Rob Fuller AKA mubix and he talks
392:28 named Rob Fuller AKA mubix and he talks about getting the wrong
392:30 about getting the wrong IP address on an assessment and
392:32 IP address on an assessment and attacking the wrong people and actually
392:34 attacking the wrong people and actually gaining access to that machine which is
392:37 gaining access to that machine which is a really really big big screw up on both
392:39 a really really big big screw up on both parts right so you should always
392:41 parts right so you should always validate your targets on top of this
392:44 validate your targets on top of this when we're doing our web and our host on
392:47 when we're doing our web and our host on the website we're going to look for
392:50 the website we're going to look for subdomains and we'll talk more about
392:51 subdomains and we'll talk more about that as we get into it but we can do
392:54 that as we get into it but we can do that with Google we can do that with
392:55 that with Google we can do that with nmap sublister there's so many different
392:58 nmap sublister there's so many different tools that we can use and we'll cover
392:59 tools that we can use and we'll cover some of the tools and how to do it get a
393:01 some of the tools and how to do it get a little deep into that as well especially
393:03 little deep into that as well especially as we get into the website of things
393:05 as we get into the website of things there's fingerprinting we need to know
393:07 there's fingerprinting we need to know what's running on a website or what's
393:09 what's running on a website or what's running on a host what kind of services
393:11 running on a host what kind of services are out there are they running a web
393:13 are out there are they running a web server what's that web server is it IAS
393:15 server what's that web server is it IAS is it Apache what version is it right
393:18 is it Apache what version is it right are they running what ports are open on
393:20 are they running what ports are open on their machines oh they have FTP open
393:22 their machines oh they have FTP open what version of FTP is open so we need
393:24 what version of FTP is open so we need to fingerprint machines and kind of
393:26 to fingerprint machines and kind of understand but on the passive side we're
393:28 understand but on the passive side we're not touching any machine right so we're
393:30 not touching any machine right so we're not going to be doing much scanning
393:32 not going to be doing much scanning against a host we just have to utilize
393:34 against a host we just have to utilize what kind of information might already
393:35 what kind of information might already be out there so if we go out to a
393:37 be out there so if we go out to a website it's on the border of active but
393:41 website it's on the border of active but as long as we're not scanning it in my
393:43 as long as we're not scanning it in my book it's still passive so we'll do we
393:46 book it's still passive so we'll do we will cover some of the passive slash
393:48 will cover some of the passive slash active side in this section and then
393:50 active side in this section and then when we get into scanning we'll get way
393:52 when we get into scanning we'll get way more active with it
393:53 more active with it lastly we're going to hit heavy
393:56 lastly we're going to hit heavy especially in the beginning on data
393:58 especially in the beginning on data breaches data breaches are the most
394:00 breaches data breaches are the most common way when we're doing an external
394:02 common way when we're doing an external assessment that we get into networks
394:04 assessment that we get into networks absolutely by far when we talk about
394:07 absolutely by far when we talk about data breaches we're talking about
394:08 data breaches we're talking about breached incidents from the past that
394:11 breached incidents from the past that have leaked data again these are like
394:14 have leaked data again these are like Home Depot Equifax LinkedIn all kinds of
394:18 Home Depot Equifax LinkedIn all kinds of breaches that are out there that have
394:20 breaches that are out there that have had credentials dumped and then those
394:22 had credentials dumped and then those credentials become available to us
394:24 credentials become available to us eventually and we try to utilize those
394:26 eventually and we try to utilize those to gain access or at least utilize the
394:28 to gain access or at least utilize the usernames to gain access nowadays most
394:31 usernames to gain access nowadays most the time there's not going to be an easy
394:34 the time there's not going to be an easy just scan find something vulnerable and
394:36 just scan find something vulnerable and exploit it on the external side of the
394:39 exploit it on the external side of the house so we're looking for these data
394:41 house so we're looking for these data breaches and this information that we
394:43 breaches and this information that we can gather and this is why information
394:45 can gather and this is why information gathering and then enumeration and
394:47 gathering and then enumeration and scanning most important by far the
394:50 scanning most important by far the better scanning enumeration that you can
394:52 better scanning enumeration that you can do and the better information gather you
394:54 do and the better information gather you can do the better hacker you're going to
394:56 can do the better hacker you're going to be and the better you're going to be at
394:58 be and the better you're going to be at your job so take these first two
395:00 your job so take these first two sections really serious so we're gonna
395:02 sections really serious so we're gonna start in with identifying what our
395:04 start in with identifying what our Target's going to be for this part of
395:07 Target's going to be for this part of the section and then we're going to go
395:09 the section and then we're going to go ahead and start talking about data
395:11 ahead and start talking about data breaches and why they're important and
395:12 breaches and why they're important and go deeper into that and then we'll go
395:15 go deeper into that and then we'll go off some of these tools that you see
395:16 off some of these tools that you see here on this list and really dive into
395:19 here on this list and really dive into those so I will look forward to seeing
395:21 those so I will look forward to seeing you in the next video when we identify
395:23 you in the next video when we identify our Target and get some information
395:25 our Target and get some information gathering started
395:34 all right before we begin doing our reconnaissance we have to
395:36 doing our reconnaissance we have to establish a client to attack so for this
395:40 establish a client to attack so for this course we're going to be utilizing a
395:42 course we're going to be utilizing a client out of bug crowd if you've never
395:45 client out of bug crowd if you've never heard of bug crowd bug crowd is a public
395:47 heard of bug crowd bug crowd is a public bug Bounty program what that means is
395:51 bug Bounty program what that means is there are programs on the website that
395:54 there are programs on the website that will allow you to attack them and if you
395:57 will allow you to attack them and if you find a bug against the program you're
396:00 find a bug against the program you're able to submit it and potentially get
396:02 able to submit it and potentially get money for it so you are able to hack
396:05 money for it so you are able to hack these programs publicly as they are part
396:07 these programs publicly as they are part of this program now the program we're
396:10 of this program now the program we're going to be attacking is Tesla so Tesla
396:13 going to be attacking is Tesla so Tesla is part of bug crowd now please do note
396:17 is part of bug crowd now please do note please double check when you're watching
396:19 please double check when you're watching this course as some time may have passed
396:21 this course as some time may have passed Tesla might no longer be part of this
396:23 Tesla might no longer be part of this bug Bounty program so it's very critical
396:25 bug Bounty program so it's very critical to make sure that you are still within
396:28 to make sure that you are still within scope before you attack if for some
396:31 scope before you attack if for some reason Tesla is no longer in scope just
396:33 reason Tesla is no longer in scope just go ahead and pick a new client and do
396:36 go ahead and pick a new client and do information gathering on them you don't
396:38 information gathering on them you don't have to pick Tesla when we're doing this
396:40 have to pick Tesla when we're doing this you can just do it to follow along with
396:42 you can just do it to follow along with me but you're also welcome to pick any
396:43 me but you're also welcome to pick any program you want so if you go to
396:45 program you want so if you go to bugcrowd.com and we go to programs
396:50 bugcrowd.com and we go to programs I will show you where Tesla exists now
396:53 I will show you where Tesla exists now you can see here that they have all
396:55 you can see here that they have all different types of programs in here and
396:56 different types of programs in here and if I were to scroll down and
396:58 if I were to scroll down and continuously I could find more and more
397:00 continuously I could find more and more and more there are hundreds of programs
397:03 and more there are hundreds of programs involved all kinds of names digital
397:06 involved all kinds of names digital ocean OCTA really big names Pinterest
397:09 ocean OCTA really big names Pinterest altacian
397:11 altacian anything that you can imagine probably
397:14 anything that you can imagine probably has a bug program if it's a reputable
397:16 has a bug program if it's a reputable okay any of the big names most likely
397:18 okay any of the big names most likely have a bug program especially if they're
397:20 have a bug program especially if they're reputable so here you could see what's
397:22 reputable so here you could see what's based on reward what's based on charity
397:24 based on reward what's based on charity and what's based on points only that's
397:26 and what's based on points only that's how the bug bounties are rewarded some
397:28 how the bug bounties are rewarded some of them are not all cash some of them
397:31 of them are not all cash some of them are just for points and for Kudos and
397:33 are just for points and for Kudos and the other ones are for charity I'm going
397:35 the other ones are for charity I'm going to go ahead and just search Tesla and
397:37 to go ahead and just search Tesla and when I do that you can see here that
397:39 when I do that you can see here that Tesla comes up
397:41 Tesla comes up now this is your first lesson into Rules
397:45 now this is your first lesson into Rules of Engagement and we're going to talk
397:46 of Engagement and we're going to talk about Rules of Engagement later but it's
397:49 about Rules of Engagement later but it's super important to read the program
397:51 super important to read the program details that you see here and what we
397:54 details that you see here and what we really need to do is we need to scroll
397:55 really need to do is we need to scroll through and make sure that we stay in
397:58 through and make sure that we stay in Scope when we're doing this so we have a
398:00 Scope when we're doing this so we have a wild card here so this means that any
398:03 wild card here so this means that any subdomain inside of tesla.com is fair
398:06 subdomain inside of tesla.com is fair game tesla.cn Tesla Motors Etc what is
398:10 game tesla.cn Tesla Motors Etc what is more important is that we stay within
398:14 more important is that we stay within this out of scope so we don't want to
398:17 this out of scope so we don't want to attack
398:18 attack shop.eu.testalmotors.com or energy
398:21 shop.eu.testalmotors.com or energy support.tesla.com it says you can report
398:23 support.tesla.com it says you can report vulnerabilities to bug Bounty for this
398:25 vulnerabilities to bug Bounty for this one any domains from Acquisitions such
398:28 one any domains from Acquisitions such as Maxwell so we have to stay within
398:30 as Maxwell so we have to stay within Tesla and there's a few more sites we're
398:33 Tesla and there's a few more sites we're not going to worry too much about that
398:34 not going to worry too much about that when we get into the web app portion of
398:37 when we get into the web app portion of the course we're going to talk about way
398:39 the course we're going to talk about way more detail on the numerating web
398:40 more detail on the numerating web applications and go into that so for now
398:44 applications and go into that so for now what we're going to do is we're just
398:46 what we're going to do is we're just going to focus on information gathering
398:47 going to focus on information gathering what kind of information can We Gather
398:49 what kind of information can We Gather from this client so again I'm setting my
398:51 from this client so again I'm setting my target to Tesla if you pick another
398:53 target to Tesla if you pick another Tesla or another client just make sure
398:56 Tesla or another client just make sure you stay in scope of that client so from
398:59 you stay in scope of that client so from here we're going to move on to our first
399:01 here we're going to move on to our first video and get our information gathering
399:03 video and get our information gathering started
399:13 welcome to the email ocean section we're going to talk about discovering
399:16 we're going to talk about discovering email addresses and this is something
399:19 email addresses and this is something that I do on a weekly basis so I'm going
399:22 that I do on a weekly basis so I'm going to show you the most common tools that I
399:25 to show you the most common tools that I use to actually look up email addresses
399:28 use to actually look up email addresses and try to find people and what you can
399:30 and try to find people and what you can do to kind of verify email addresses so
399:34 do to kind of verify email addresses so I'll show you some of my favorite tools
399:35 I'll show you some of my favorite tools and Concepts and this is something that
399:38 and Concepts and this is something that I do because not only for oh sent and
399:41 I do because not only for oh sent and doing it for investigative type work but
399:43 doing it for investigative type work but think about sales if I'm trying to find
399:47 think about sales if I'm trying to find a lead or I'm trying to find multiple
399:49 a lead or I'm trying to find multiple leads within an organization I have to
399:52 leads within an organization I have to figure out where the emails are who the
399:55 figure out where the emails are who the people I'm trying to email are so maybe
399:57 people I'm trying to email are so maybe I'll Google them and say who is the CSO
400:00 I'll Google them and say who is the CSO or chief information security officer
400:03 or chief information security officer for this company and I might find that
400:05 for this company and I might find that it's Bob Jones and we go look up Bob
400:09 it's Bob Jones and we go look up Bob Jones and we say okay well how do I get
400:11 Jones and we say okay well how do I get Bob Jones's contact information can I
400:14 Bob Jones's contact information can I find it via Google maybe maybe it's out
400:16 find it via Google maybe maybe it's out there in the public but maybe we have to
400:18 there in the public but maybe we have to dig a Little Deeper maybe we have to
400:20 dig a Little Deeper maybe we have to kind of do some guesstimation and see if
400:23 kind of do some guesstimation and see if we can figure it out so that's what
400:24 we can figure it out so that's what we're going to do today is is look at
400:27 we're going to do today is is look at the email addresses formats and try to
400:29 the email addresses formats and try to determine if we can find some emails so
400:32 determine if we can find some emails so let's go ahead and move over to the Kali
400:35 let's go ahead and move over to the Kali Linux machine that I've got
400:37 Linux machine that I've got and the first website is one of my
400:40 and the first website is one of my favorites so hunter.io you just come to
400:43 favorites so hunter.io you just come to hunter.io you get like 50 or 100 free
400:47 hunter.io you get like 50 or 100 free searches a month I don't remember what
400:48 searches a month I don't remember what it is it's it's a fair amount uh you can
400:52 it is it's it's a fair amount uh you can come here and basically just type in a
400:54 come here and basically just type in a company name so like say I want to type
400:55 company name so like say I want to type in TCM security
400:57 in TCM security tcm-sec and you can see TCM security
401:00 tcm-sec and you can see TCM security here we get one result on the email
401:03 here we get one result on the email address so we'll click it and see what
401:05 address so we'll click it and see what happens here
401:06 happens here uh and looks like we have like an info
401:09 uh and looks like we have like an info at
401:09 at tcm-asect.com it tells us hey there's
401:12 tcm-asect.com it tells us hey there's five sources that identify this so we
401:15 five sources that identify this so we see
401:16 see tcm-sec.com there's an about blog so
401:19 tcm-sec.com there's an about blog so this is where they're finding it okay
401:21 this is where they're finding it okay um a better example maybe a something
401:23 um a better example maybe a something that has more users like Tesla Tesla has
401:27 that has more users like Tesla Tesla has 468 users if we come in here and we look
401:31 468 users if we come in here and we look well we can see that they have a pattern
401:34 well we can see that they have a pattern identified here so their pattern they're
401:36 identified here so their pattern they're identifying is first initial
401:38 identifying is first initial last name at tesla.com and that's really
401:42 last name at tesla.com and that's really what we want to see and then we can
401:43 what we want to see and then we can gather email addresses here if we want
401:45 gather email addresses here if we want but say like we knew Bob Jones again
401:49 but say like we knew Bob Jones again going back to that example Bob Jones so
401:51 going back to that example Bob Jones so maybe Bob Jones works at Tesla maybe his
401:54 maybe Bob Jones works at Tesla maybe his email would be B Jones at tesla.com so
401:57 email would be B Jones at tesla.com so it's something to think about now we can
402:00 it's something to think about now we can sign up and get actual information here
402:02 sign up and get actual information here you should be able to sign up with a
402:04 you should be able to sign up with a Gmail account sometimes this does not
402:07 Gmail account sometimes this does not work depending on the country that you
402:09 work depending on the country that you are in so be cognizant you might have to
402:12 are in so be cognizant you might have to use a different email address but I just
402:14 use a different email address but I just tried signing up with a Gmail account
402:16 tried signing up with a Gmail account that I have on here and it worked just
402:18 that I have on here and it worked just fine so I'm going to go ahead and try to
402:20 fine so I'm going to go ahead and try to log in I'm going to sign in with Google
402:22 log in I'm going to sign in with Google with what's already here and just now
402:24 with what's already here and just now I'm logged in so we can go back now and
402:27 I'm logged in so we can go back now and try searching Tesla again
402:30 try searching Tesla again and you'll see that the results actually
402:31 and you'll see that the results actually come back
402:33 come back so we get information here now we get
402:35 so we get information here now we get let me make this a little bit bigger we
402:37 let me make this a little bit bigger we get information as to okay here's the
402:39 get information as to okay here's the vice president this is the vice
402:41 vice president this is the vice president's email address uh project
402:43 president's email address uh project development manager maybe you want to
402:45 development manager maybe you want to talk to somebody in Human Resources so
402:49 talk to somebody in Human Resources so you can click here and go to human
402:50 you can click here and go to human resources and then here are the
402:53 resources and then here are the different Human Resources
402:55 different Human Resources emails that are here so and then the
402:57 emails that are here so and then the sources that they found these email
402:59 sources that they found these email addresses so this isn't a particular
403:01 addresses so this isn't a particular person in HR but it's still Human
403:03 person in HR but it's still Human Resources email addresses so this looks
403:06 Resources email addresses so this looks like it's probably for Hong Kong this is
403:08 like it's probably for Hong Kong this is for Berlin this is gigafactory so they
403:10 for Berlin this is gigafactory so they have different email addresses based on
403:12 have different email addresses based on where they are now if you looked up TCM
403:15 where they are now if you looked up TCM security here you're really not going to
403:16 security here you're really not going to find much on us because we don't have a
403:18 find much on us because we don't have a ton of email addresses out there but I
403:20 ton of email addresses out there but I think that we can find more in other
403:21 think that we can find more in other ways now so we only get so many uses
403:25 ways now so we only get so many uses here we'll just keep thinking about this
403:27 here we'll just keep thinking about this as we move forward so 100.io great great
403:30 as we move forward so 100.io great great resource they have plugins if you want
403:32 resource they have plugins if you want them I I think it's fantastic place to
403:35 them I I think it's fantastic place to look
403:36 look phonebook.cz is the next resource I want
403:38 phonebook.cz is the next resource I want to show you this one is fantastic let's
403:41 to show you this one is fantastic let's start with
403:42 start with tcm-sec.com and see so we're gonna go
403:45 tcm-sec.com and see so we're gonna go tcm-sec.com and we're going to search
403:48 tcm-sec.com and we're going to search email addresses here so they do domains
403:50 email addresses here so they do domains and URLs as well which I think is
403:51 and URLs as well which I think is awesome but let's just search for email
403:53 awesome but let's just search for email address see if anything comes back no no
403:56 address see if anything comes back no no results okay that's okay let's try Tesla
404:03 and see what comes back there okay a lot more
404:05 okay a lot more so we get uh quite a few email addresses
404:09 so we get uh quite a few email addresses we could see Elon Musk all over the
404:10 we could see Elon Musk all over the place we've got Elon Dash musk Elon
404:12 place we've got Elon Dash musk Elon we've got emusks over here and we get a
404:16 we've got emusks over here and we get a ton of emails look at this so what's
404:20 ton of emails look at this so what's nice about this is we can sit here and
404:22 nice about this is we can sit here and try to identify what the possible email
404:26 try to identify what the possible email addresses are so again first initial
404:28 addresses are so again first initial last name looks like it's showing up
404:30 last name looks like it's showing up quite a bit outside of maybe like the
404:33 quite a bit outside of maybe like the Elon musks of the world we're getting a
404:35 Elon musks of the world we're getting a bunch of uh mostly first initial last
404:38 bunch of uh mostly first initial last names in here so I think that's pretty
404:40 names in here so I think that's pretty spot on with this uh the other thing
404:43 spot on with this uh the other thing that we can do is we could utilize this
404:45 that we can do is we could utilize this list say we're we're trying to do
404:47 list say we're we're trying to do something called credential stuffing
404:48 something called credential stuffing which we'll talk about in the next
404:50 which we'll talk about in the next section actually when we talk about
404:51 section actually when we talk about breach credentials uh but say we're
404:54 breach credentials uh but say we're trying to gather a bunch of usernames
404:56 trying to gather a bunch of usernames and test and see if we can log in with
404:58 and test and see if we can log in with those usernames anywhere or maybe
405:00 those usernames anywhere or maybe password spraying not so much uh the
405:03 password spraying not so much uh the credential stuffing but password
405:04 credential stuffing but password spraying where we take all these
405:05 spraying where we take all these usernames and we just throw it at a
405:08 usernames and we just throw it at a login form and say Hey Summer 2020
405:11 login form and say Hey Summer 2020 exclamation point you know see if that
405:13 exclamation point you know see if that logs into any of these accounts and you
405:15 logs into any of these accounts and you would be surprised it happens quite a
405:17 would be surprised it happens quite a bit so you know these are this is
405:20 bit so you know these are this is valuable information even if we don't
405:23 valuable information even if we don't know exactly maybe we're not just
405:24 know exactly maybe we're not just hunting for one email maybe we're
405:26 hunting for one email maybe we're hunting for an entire domain this is a
405:30 hunting for an entire domain this is a great way to get free entire domains
405:32 great way to get free entire domains with a quick copy and paste capability
405:34 with a quick copy and paste capability like we have the Tesla here we can
405:36 like we have the Tesla here we can export the CSV from hunter.io but you
405:39 export the CSV from hunter.io but you only get so many results that you can
405:40 only get so many results that you can export into a CSV here you get a bunch
405:44 export into a CSV here you get a bunch there's no guarantee these are all valid
405:45 there's no guarantee these are all valid but they're still it's still information
405:48 but they're still it's still information information is what we want this is all
405:51 information is what we want this is all we're trying to gather is as much
405:52 we're trying to gather is as much information as possible so these are all
405:54 information as possible so these are all potential email addresses for tesla.com
405:57 potential email addresses for tesla.com I think it's a great great resource
406:00 I think it's a great great resource now we could also use something like uh
406:04 now we could also use something like uh voila no bear now this one you can get
406:07 voila no bear now this one you can get 50 more leads for free I'm not going to
406:09 50 more leads for free I'm not going to show you it's the same kind of deal as
406:11 show you it's the same kind of deal as 100.io they're showing you how to
406:12 100.io they're showing you how to utilize it here basically you can just
406:15 utilize it here basically you can just search for people and see to try to find
406:16 search for people and see to try to find their email addresses there is one I
406:18 their email addresses there is one I want to show you that I do use and I
406:20 want to show you that I do use and I have quite a bit of success with and
406:23 have quite a bit of success with and that is called clearbit and clearbit has
406:26 that is called clearbit and clearbit has to be used in Chrome
406:28 to be used in Chrome so I'm going to bring up this here
406:29 so I'm going to bring up this here clearbit has to be used in Chrome so you
406:32 clearbit has to be used in Chrome so you can download the Chrome extension for
406:34 can download the Chrome extension for Clear bit
406:35 Clear bit and all you have to do is go to Google
406:37 and all you have to do is go to Google let me log in really quick
406:40 let me log in really quick and then I'm going to just select the
406:43 and then I'm going to just select the free account we get so many searches 100
406:45 free account we get so many searches 100 emails a month so basically you're going
406:47 emails a month so basically you're going to search for clearbit connect and you
406:49 to search for clearbit connect and you would just say hey clearbit connect I'll
406:51 would just say hey clearbit connect I'll put a link down below by the way but
406:53 put a link down below by the way but clearbit connect is awesome you'll
406:56 clearbit connect is awesome you'll you'll see why here in a second once I
406:57 you'll see why here in a second once I authorize this
406:59 authorize this okay we're gonna come down here
407:01 okay we're gonna come down here acknowledge probably give out our
407:03 acknowledge probably give out our firstborn and then now we're going to
407:05 firstborn and then now we're going to say hey I want to find emails
407:08 say hey I want to find emails and here's all different kinds of things
407:10 and here's all different kinds of things that we can sit here and search for you
407:12 that we can sit here and search for you can see TCM Securities in here these are
407:14 can see TCM Securities in here these are some searches that I've done these
407:15 some searches that I've done these aren't any clients of mine these are
407:17 aren't any clients of mine these are just searches that I've done in the past
407:18 just searches that I've done in the past maybe looking for information or looking
407:21 maybe looking for information or looking for possible leads or anything so if I
407:25 for possible leads or anything so if I come in here and I say hey I want to
407:27 come in here and I say hey I want to look for TCM security you could type
407:28 look for TCM security you could type that in I'm going to just click on TCM
407:30 that in I'm going to just click on TCM security
407:31 security and look what it discovered that the
407:33 and look what it discovered that the others didn't
407:35 others didn't it discovered me
407:37 it discovered me okay and if I click on me
407:39 okay and if I click on me look it says heat that tcm-sec.com
407:43 look it says heat that tcm-sec.com where where did that come from and then
407:46 where where did that come from and then look it has my LinkedIn right here as
407:48 look it has my LinkedIn right here as well that's amazing that's awesome and
407:50 well that's amazing that's awesome and it says here you can email hate just
407:51 it says here you can email hate just click this button and then it's also got
407:53 click this button and then it's also got rizwan rizwon's on my sales team look
407:56 rizwan rizwon's on my sales team look it's got Riz one at tcm-sec.com what
407:59 it's got Riz one at tcm-sec.com what does that tell you that tells you that
408:00 does that tell you that tells you that we're using a first name basis for our
408:03 we're using a first name basis for our email addresses it's awesome now let's
408:06 email addresses it's awesome now let's come in here and maybe we want to look
408:07 come in here and maybe we want to look at Tesla maybe let's try Tesla one more
408:09 at Tesla maybe let's try Tesla one more time maybe we're looking for the CSO of
408:11 time maybe we're looking for the CSO of Tesla Tesla has a CSO you could come in
408:14 Tesla Tesla has a CSO you could come in here and look like Elon Musk is right
408:16 here and look like Elon Musk is right here obviously CEO but you could come in
408:19 here obviously CEO but you could come in here and maybe go by roll and they have
408:21 here and maybe go by roll and they have different roles in here so CEO let's see
408:24 different roles in here so CEO let's see if we can find any sort of CSO uh I
408:27 if we can find any sort of CSO uh I don't see one but I do see information
408:28 don't see one but I do see information technology so maybe we can find somebody
408:30 technology so maybe we can find somebody the information technology department or
408:32 the information technology department or it Department
408:34 it Department um and then here we go we've got quite a
408:36 um and then here we go we've got quite a few I.T people here's a CIO this could
408:39 few I.T people here's a CIO this could be somebody of interest that we might
408:40 be somebody of interest that we might want to reach out to and we could just
408:42 want to reach out to and we could just scroll through this list and find people
408:43 scroll through this list and find people so say we want to reach out to the CIO
408:45 so say we want to reach out to the CIO just click on this we get first initial
408:49 just click on this we get first initial last name just like we thought we would
408:51 last name just like we thought we would we get this person's LinkedIn page we
408:54 we get this person's LinkedIn page we get their location website this is
408:57 get their location website this is awesome awesome awesome so I typically
409:00 awesome awesome awesome so I typically will start with a Google search if I'm
409:03 will start with a Google search if I'm trying to hunt something down I will
409:05 trying to hunt something down I will start with a Google search I will say
409:07 start with a Google search I will say who is in this role at this company if
409:09 who is in this role at this company if I'm looking for a specific person at a
409:11 I'm looking for a specific person at a company then I will go to phonebook.cz
409:14 company then I will go to phonebook.cz or hunter.io try to identify the the
409:18 or hunter.io try to identify the the formatting of the email and then try to
409:20 formatting of the email and then try to find that person or guesstimate that
409:22 find that person or guesstimate that once we get to that point I try not to
409:25 once we get to that point I try not to burn through these clear bits unless I
409:26 burn through these clear bits unless I need to but clearbit is very good at
409:28 need to but clearbit is very good at identifying this once we get to that
409:30 identifying this once we get to that point we can take this email say like
409:32 point we can take this email say like this um this email or we'll even try a
409:35 this um this email or we'll even try a different email I'll show you a couple
409:36 different email I'll show you a couple but we could take this and we can go try
409:38 but we could take this and we can go try to verify this so there is a website
409:40 to verify this so there is a website called email hippo you can go to
409:45 called email hippo you can go to tools.verifyemailaddress.io and all you
409:47 tools.verifyemailaddress.io and all you have to do is type in an email address
409:49 have to do is type in an email address here sometimes you can get false
409:51 here sometimes you can get false positives if they're good or bad here I
409:54 positives if they're good or bad here I typed in this email address a couple
409:55 typed in this email address a couple times and just got a bad result this is
409:57 times and just got a bad result this is an email address that does not exist now
410:00 an email address that does not exist now let's try an email address that we saw
410:03 let's try an email address that we saw info
410:04 info tcm-sec.com see if it works
410:11 result is okay so it says yeah this email address works so we're verifying
410:13 email address works so we're verifying that this is up so say that you get
410:16 that this is up so say that you get somebody and you see that they have a
410:18 somebody and you see that they have a potential email address you can come
410:19 potential email address you can come here and try to verify it first and see
410:21 here and try to verify it first and see if it works before you go fire off an
410:23 if it works before you go fire off an email uh or don't you don't have to fire
410:25 email uh or don't you don't have to fire off an email you don't have to do
410:27 off an email you don't have to do anything or interact so this is the
410:28 anything or interact so this is the benefit like if you're from a sales
410:30 benefit like if you're from a sales perspective and you're doing osin here
410:31 perspective and you're doing osin here the this is the benefit not having to
410:33 the this is the benefit not having to email get waste your time get it
410:35 email get waste your time get it rejected you can come in here and just
410:37 rejected you can come in here and just validate if you're doing an
410:38 validate if you're doing an investigation you don't want to interact
410:40 investigation you don't want to interact with the person or company that you're
410:42 with the person or company that you're investigating you want to come in here
410:45 investigating you want to come in here and just verify without any interaction
410:48 and just verify without any interaction this is the way to do it same thing with
410:50 this is the way to do it same thing with this website here email
410:52 this website here email checker.net validate email Dash
410:55 checker.net validate email Dash checker.net validate say hey checking
410:58 checker.net validate say hey checking the email I put the same email address
411:00 the email I put the same email address here you can see it says bad we could
411:02 here you can see it says bad we could try again with info at
411:04 try again with info at tcm-sec.com and see if that works and it
411:07 tcm-sec.com and see if that works and it says okay
411:08 says okay so again this is doing a a great job
411:12 so again this is doing a a great job there are possibilities of false
411:14 there are possibilities of false positives there are so many searches
411:16 positives there are so many searches that you can do per month on these I do
411:18 that you can do per month on these I do believe they have apis which is nice if
411:21 believe they have apis which is nice if you want to automate this or script this
411:22 you want to automate this or script this out but I think this is this is
411:25 out but I think this is this is fantastic this is great stuff now there
411:28 fantastic this is great stuff now there are plenty of other ways to verify email
411:30 are plenty of other ways to verify email addresses in the next section we'll talk
411:33 addresses in the next section we'll talk about that even more as we talk about
411:35 about that even more as we talk about breach data because if somebody shows up
411:37 breach data because if somebody shows up in a data breach guess we'll have that
411:40 in a data breach guess we'll have that email address has been used in the past
411:42 email address has been used in the past if you look at something like I have
411:44 if you look at something like I have I've been pwn which I'll talk about in
411:45 I've been pwn which I'll talk about in the next section and they show up guess
411:48 the next section and they show up guess what that person's email address has
411:50 what that person's email address has existed so we're trying to verify if an
411:52 existed so we're trying to verify if an email address exists who that address
411:55 email address exists who that address might belong to Etc now this is more has
411:58 might belong to Etc now this is more has been from a business perspective some of
412:00 been from a business perspective some of this hunting down of emails may be more
412:02 this hunting down of emails may be more difficult to do if you're trying to find
412:04 difficult to do if you're trying to find a specific individual that's where
412:06 a specific individual that's where breach data comes into play and a lot to
412:09 breach data comes into play and a lot to This research and what I'm going to show
412:10 This research and what I'm going to show you in the next section we'll try to
412:11 you in the next section we'll try to hunt down individuals with maybe having
412:13 hunt down individuals with maybe having loose pieces of information like a name
412:16 loose pieces of information like a name or a username or something along those
412:18 or a username or something along those lines breach data can come in handy very
412:20 lines breach data can come in handy very very well so this is kind of scratching
412:22 very well so this is kind of scratching the surface now there's one last thing I
412:25 the surface now there's one last thing I want to show you one last little tip and
412:26 want to show you one last little tip and trick do not underestimate forgot
412:30 trick do not underestimate forgot passwords do not underestimate them
412:33 passwords do not underestimate them let's go to Google for example
412:35 let's go to Google for example right now I am logging in under an
412:37 right now I am logging in under an account that is please don't hack me sir
412:39 account that is please don't hack me sir please so it's please don't hack me sir
412:43 please so it's please don't hack me sir plz I do believe I'm gonna go ahead and
412:46 plz I do believe I'm gonna go ahead and try hitting next on that
412:48 try hitting next on that okay so first of all it said hey welcome
412:52 okay so first of all it said hey welcome hey what does this mean this means that
412:54 hey what does this mean this means that we have a valid account here that's
412:57 we have a valid account here that's great this is validating that this Gmail
412:59 great this is validating that this Gmail account exists
413:01 account exists here's something else we can use this to
413:03 here's something else we can use this to tie to potentially another account or
413:06 tie to potentially another account or help validate say we know that this
413:08 help validate say we know that this email belongs to somebody that's
413:10 email belongs to somebody that's harassing somebody else we don't know
413:13 harassing somebody else we don't know who this person is they're using this
413:14 who this person is they're using this spoofed email but maybe we have a
413:16 spoofed email but maybe we have a hundred maybe we don't maybe we just
413:17 hundred maybe we don't maybe we just want to try to get more data you can
413:19 want to try to get more data you can come to forgot password
413:21 come to forgot password and it's going to say what's the last
413:23 and it's going to say what's the last password remember using I don't know
413:25 password remember using I don't know let's try another way you come down here
413:27 let's try another way you come down here and it says hey let me make this bigger
413:29 and it says hey let me make this bigger Google will send a verification code to
413:32 Google will send a verification code to H
413:33 H and it says look it shows you the rest
413:35 and it says look it shows you the rest of the the digits here and then at TC
413:39 of the the digits here and then at TC here that would give you a pretty good
413:42 here that would give you a pretty good indication if you're tracking who your
413:44 indication if you're tracking who your subject is that this email could tie to
413:46 subject is that this email could tie to somebody else look this is heat
413:47 somebody else look this is heat tcm-sec.com
413:49 tcm-sec.com okay so this email belongs to me this is
413:53 okay so this email belongs to me this is tying back to me now you have another
413:55 tying back to me now you have another Point here so if you knew about this
413:57 Point here so if you knew about this email address and now you have the link
414:00 email address and now you have the link the connection to guarantee that this
414:02 the connection to guarantee that this person this is evidence right here say
414:04 person this is evidence right here say you were doing something which we'll
414:06 you were doing something which we'll learn about again in the next section
414:07 learn about again in the next section where you're looking through breach data
414:09 where you're looking through breach data you find a username that matches this
414:12 you find a username that matches this email address and also matches this
414:13 email address and also matches this email address but people can reuse
414:16 email address but people can reuse usernames there could be multiple people
414:18 usernames there could be multiple people who use the same username so you need to
414:21 who use the same username so you need to verify or some link this would be a
414:23 verify or some link this would be a proof of a link between those a pretty
414:25 proof of a link between those a pretty strong proof if you ask me if you can
414:27 strong proof if you ask me if you can say hey I identified two email addresses
414:29 say hey I identified two email addresses with the same username I did an account
414:31 with the same username I did an account recovery came in here and saw that this
414:34 recovery came in here and saw that this had this same first character and first
414:37 had this same first character and first domain name I think that's a pretty
414:39 domain name I think that's a pretty strong correlation so things to think
414:42 strong correlation so things to think about Wheels to be spinning try to
414:44 about Wheels to be spinning try to identify email addresses in any way
414:46 identify email addresses in any way possible we'll cover this more in depth
414:48 possible we'll cover this more in depth in the next section and I'm really
414:49 in the next section and I'm really excited because password hunting is one
414:51 excited because password hunting is one of my favorite things so let's go ahead
414:53 of my favorite things so let's go ahead and move on to the next section when we
414:55 and move on to the next section when we talk about password osin
415:04 okay so I would like you to go out to github.com
415:06 github.com and then once you're there go ahead and
415:08 and then once you're there go ahead and just do a forward slash H Maverick Adams
415:12 just do a forward slash H Maverick Adams h m a v e r i c k Adams and hit enter
415:19 h m a v e r i c k Adams and hit enter and you can see me and my snazzy photo
415:22 and you can see me and my snazzy photo here but what we're after is I want to
415:25 here but what we're after is I want to show you a tool that I wrote called
415:27 show you a tool that I wrote called breach parse and we're going to walk
415:29 breach parse and we're going to walk through what it does now go ahead and
415:32 through what it does now go ahead and click on breach parts
415:34 click on breach parts and you're going to see a bash script
415:37 and you're going to see a bash script here and a little bit of a description
415:39 here and a little bit of a description so you do not need to download this let
415:42 so you do not need to download this let me preface with what we're doing here
415:44 me preface with what we're doing here this magnet link you're going to need
415:46 this magnet link you're going to need one a torrent some sort of uTorrent or
415:49 one a torrent some sort of uTorrent or BitTorrent and you'll need to download
415:51 BitTorrent and you'll need to download this and it's also something along the
415:53 this and it's also something along the lines of 44 gigabytes extracted it's a
415:57 lines of 44 gigabytes extracted it's a huge file so you don't have to do this
415:59 huge file so you don't have to do this you can just watch and follow along you
416:02 you can just watch and follow along you are more than welcome to install this on
416:04 are more than welcome to install this on your machine I'm going to show you what
416:06 your machine I'm going to show you what it looks like so I'm going to go out to
416:07 it looks like so I'm going to go out to my applications and my files here
416:10 my applications and my files here and then I have put this into my opt
416:13 and then I have put this into my opt folder so if you come into opt here and
416:15 folder so if you come into opt here and I've got breach parse
416:18 I've got breach parse if you come into this breach compilation
416:20 if you come into this breach compilation folder which is what we'll download
416:22 folder which is what we'll download you're going to see that we have data
416:26 you're going to see that we have data here okay so this data has a bunch of
416:29 here okay so this data has a bunch of different data it's got emails starting
416:31 different data it's got emails starting with zero one two three four all these
416:33 with zero one two three four all these different ones what's living inside of
416:36 different ones what's living inside of this
416:37 this is if we can display it
416:40 is if we can display it is emails and passwords now you see
416:43 is emails and passwords now you see these ones have weird symbols inside the
416:45 these ones have weird symbols inside the emails but there's a bunch of emails and
416:48 emails but there's a bunch of emails and passwords in here like somebody at
416:49 passwords in here like somebody at yahoo.com and their password is one two
416:52 yahoo.com and their password is one two three four five six
416:53 three four five six well these passwords are coming from
416:56 well these passwords are coming from credential dumps so we talked about it
416:58 credential dumps so we talked about it earlier about thinking about the you
417:02 earlier about thinking about the you know Equifax or the LinkedIn breach or
417:05 know Equifax or the LinkedIn breach or Home Depot all these big breaches that
417:07 Home Depot all these big breaches that happen
417:08 happen credentials get dumped out and guess
417:10 credentials get dumped out and guess what they show up on the dark web and
417:13 what they show up on the dark web and eventually they show up in these lists
417:15 eventually they show up in these lists so we utilize these lists and we've got
417:18 so we utilize these lists and we've got you click into this just hundreds of
417:21 you click into this just hundreds of files here and again 44 gigabytes so
417:25 files here and again 44 gigabytes so what I did was I built a little tool
417:27 what I did was I built a little tool that can search through this data and
417:29 that can search through this data and pull down names so we can take a quick
417:31 pull down names so we can take a quick look at the tool and what it does but
417:34 look at the tool and what it does but basically what it does is you just put
417:36 basically what it does is you just put in the syntax you search for something
417:39 in the syntax you search for something like at tesla.com and then you specify
417:42 like at tesla.com and then you specify you know tesla.txt
417:44 you know tesla.txt and it's going to search through all of
417:47 and it's going to search through all of these files for at tesla.com if you're
417:49 these files for at tesla.com if you're more interested in the code behind it
417:51 more interested in the code behind it you're more than welcome to read the
417:53 you're more than welcome to read the code in here and see if some of the
417:55 code in here and see if some of the items that we've covered already with
417:57 items that we've covered already with the batch scripting and the python
417:59 the batch scripting and the python scripting kind of ring a bell
418:02 scripting kind of ring a bell so what we're going to do is I'm going
418:04 so what we're going to do is I'm going to come ahead and go into the terminal
418:08 to come ahead and go into the terminal and make it a little bigger
418:10 and make it a little bigger and then I'm just going to change into
418:12 and then I'm just going to change into that op folder breach parse I'm going to
418:14 that op folder breach parse I'm going to run breech parse so reach parse here and
418:19 run breech parse so reach parse here and what we're going to do is I'm just going
418:21 what we're going to do is I'm just going to say
418:22 to say at tesla.com and then Tesla dot text
418:26 at tesla.com and then Tesla dot text and that's going to run so again you do
418:30 and that's going to run so again you do not have to install this this is only
418:32 not have to install this this is only for visual purposes I'm going to show
418:34 for visual purposes I'm going to show you in the next video another way to do
418:36 you in the next video another way to do this so this is going to run through
418:39 this so this is going to run through it's going to take a minute here and
418:41 it's going to take a minute here and it's going to grab everybody's username
418:43 it's going to grab everybody's username and password that says tesla.com and the
418:45 and password that says tesla.com and the username and then it's going to have all
418:48 username and then it's going to have all the passwords and we're going to be able
418:49 the passwords and we're going to be able to decipher things from this so I'm
418:51 to decipher things from this so I'm going to let this run and as soon as
418:53 going to let this run and as soon as it's done I'll come back and we'll talk
418:55 it's done I'll come back and we'll talk about the results
418:56 about the results okay the results are back so this breaks
419:00 okay the results are back so this breaks it down into three files there is a it's
419:05 it down into three files there is a it's cat Tesla there is a master passwords
419:09 cat Tesla there is a master passwords and user so the master has the username
419:12 and user so the master has the username and password and then the users file has
419:14 and password and then the users file has the users passwords has the passwords so
419:17 the users passwords has the passwords so I'm gonna actually G edit the Tesla
419:20 I'm gonna actually G edit the Tesla master dot text
419:22 master dot text and let's take a look at this
419:25 and let's take a look at this so from here we don't have a big list
419:28 so from here we don't have a big list surprisingly for a company the size of
419:31 surprisingly for a company the size of Tesla so what happens is people utilize
419:33 Tesla so what happens is people utilize their work credentials their work emails
419:37 their work credentials their work emails and they log into websites and probably
419:40 and they log into websites and probably shouldn't be using their work emails for
419:42 shouldn't be using their work emails for and we just use it to our advantage so
419:45 and we just use it to our advantage so we're after is we're after not only
419:47 we're after is we're after not only these usernames but we're after these
419:49 these usernames but we're after these passwords as well so we see these
419:51 passwords as well so we see these usernames and we see these passwords and
419:54 usernames and we see these passwords and I like to look for repeat offenders I
419:57 I like to look for repeat offenders I like to look for the syntax as well
420:00 like to look for the syntax as well remember we had first initial last name
420:02 remember we had first initial last name but we see first name dot last name here
420:04 but we see first name dot last name here we see possibly you know just a single
420:08 we see possibly you know just a single name there are different types of things
420:10 name there are different types of things in here so
420:12 in here so uh Nick tesla.com as well so you know
420:15 uh Nick tesla.com as well so you know it's changed up I think nowadays it is
420:18 it's changed up I think nowadays it is first initial last name but maybe in the
420:21 first initial last name but maybe in the past they use first name dot last name
420:23 past they use first name dot last name then move to an easier format or vice
420:26 then move to an easier format or vice versa they started the first initial
420:27 versa they started the first initial last name they got too big then they had
420:29 last name they got too big then they had to do first name dot last name but again
420:32 to do first name dot last name but again what we're after here is potential
420:34 what we're after here is potential repeat offenders so look at this shark
420:37 repeat offenders so look at this shark at tesla.com it got popped twice and the
420:42 at tesla.com it got popped twice and the password is very very very similar so if
420:46 password is very very very similar so if I were to attack tesla.com through a
420:48 I were to attack tesla.com through a login interface I might spray this
420:52 login interface I might spray this username with this password and this
420:54 username with this password and this password that's what we call credential
420:56 password that's what we call credential stuffing because we already know the
420:57 stuffing because we already know the passwords and then I might make some
420:59 passwords and then I might make some modification of capitalized letters and
421:02 modification of capitalized letters and non-capitalized letters with d-a-d-e
421:04 non-capitalized letters with d-a-d-e because 907 and 814 appear to be
421:07 because 907 and 814 appear to be consistent you know so I would alternate
421:10 consistent you know so I would alternate Capitals in non-capitals here in lower
421:13 Capitals in non-capitals here in lower case and just see maybe if something
421:15 case and just see maybe if something sticks so this is something that's
421:17 sticks so this is something that's interesting this user down here one two
421:19 interesting this user down here one two three four five one two three four five
421:20 three four five one two three four five star probably not going to get in with
421:23 star probably not going to get in with that on a company like Tesla but you
421:25 that on a company like Tesla but you never know
421:26 never know but this is what we would do we would
421:27 but this is what we would do we would take the usernames we would throw these
421:29 take the usernames we would throw these passwords at it and that's called
421:30 passwords at it and that's called credential stuffing and then we would
421:32 credential stuffing and then we would take these usernames and all the known
421:34 take these usernames and all the known usernames and we would spray passwords
421:37 usernames and we would spray passwords at them like fall 2019 like we talked
421:39 at them like fall 2019 like we talked about in the last video that's password
421:41 about in the last video that's password spring so this is a important and very
421:44 spring so this is a important and very very critical part of information
421:47 very critical part of information gathering is gathering these usernames
421:49 gathering is gathering these usernames and these credentials right off the bat
421:51 and these credentials right off the bat you want to identify those with your
421:53 you want to identify those with your targets so this is kind of what it looks
421:56 targets so this is kind of what it looks like this is what I do during every
421:58 like this is what I do during every assessment and hopefully that makes
422:01 assessment and hopefully that makes sense and that works into it in the next
422:03 sense and that works into it in the next video we're going to go ahead and just
422:05 video we're going to go ahead and just show another method and start thinking
422:07 show another method and start thinking again about these credentials and how
422:09 again about these credentials and how they can be utilized and then we'll do
422:11 they can be utilized and then we'll do some other information gathering as we
422:12 some other information gathering as we move on and learn some techniques and
422:14 move on and learn some techniques and how we can get information on a client
422:16 how we can get information on a client so I'll see you over in the next video
422:25 okay let's talk about hunting breach credentials and let's get Hands-On now
422:28 credentials and let's get Hands-On now before we get started I know I stressed
422:30 before we get started I know I stressed this in the beginning of the course I'm
422:32 this in the beginning of the course I'm going to stress this again
422:33 going to stress this again what I'm going to show you here could
422:36 what I'm going to show you here could change now I released a course about a
422:39 change now I released a course about a year ago which was on ethical hacking we
422:42 year ago which was on ethical hacking we talked about breach credentials and I
422:44 talked about breach credentials and I utilized a website called we leak info
422:46 utilized a website called we leak info we leak info was then eventually shut
422:49 we leak info was then eventually shut down and I got all kinds of emails
422:51 down and I got all kinds of emails saying hey this is shut down I don't
422:53 saying hey this is shut down I don't know what to do
422:55 know what to do there's more out there okay there's
422:57 there's more out there okay there's always more out there what I'm showing
422:59 always more out there what I'm showing you is the methodology I could show you
423:02 you is the methodology I could show you on a specific website which I'm going to
423:03 on a specific website which I'm going to do that website could go down tomorrow
423:06 do that website could go down tomorrow we never know but what you need to
423:07 we never know but what you need to retain is the thought process and the
423:09 retain is the thought process and the methodology behind what's about to
423:11 methodology behind what's about to happen from there you could take that
423:13 happen from there you could take that and utilize it elsewhere so if a website
423:16 and utilize it elsewhere so if a website does go down you still have the same
423:18 does go down you still have the same thoughts why you're doing it and why
423:19 thoughts why you're doing it and why you're thinking about it so let's go
423:21 you're thinking about it so let's go ahead and move over to a website now so
423:25 ahead and move over to a website now so I want to take you to a website called D
423:27 I want to take you to a website called D hash now this is dhash.com I do not
423:30 hash now this is dhash.com I do not expect you to be able to follow along at
423:33 expect you to be able to follow along at this point because
423:35 this point because this costs money okay it's five bucks
423:38 this costs money okay it's five bucks for a week it's a hundred and fifty
423:40 for a week it's a hundred and fifty dollars for a year this is only a used
423:42 dollars for a year this is only a used to take credit card they only now take
423:44 to take credit card they only now take Bitcoin I do believe or some sort of
423:46 Bitcoin I do believe or some sort of cryptocurrency absolutely worth it in my
423:49 cryptocurrency absolutely worth it in my opinion
423:50 opinion even get a week get a week see if you
423:53 even get a week get a week see if you like it it's amazing there's gonna be
423:55 like it it's amazing there's gonna be tools I show you later on the course
423:56 tools I show you later on the course that will go through and we can do it
423:59 that will go through and we can do it locally like the one I just ran in the
424:01 locally like the one I just ran in the last video I ran breach parts right this
424:03 last video I ran breach parts right this is something that I've put together in
424:05 is something that I've put together in in set up but and it's free but the
424:07 in set up but and it's free but the database isn't maintained it's a slow
424:09 database isn't maintained it's a slow search I don't get the results back as
424:11 search I don't get the results back as instantly and I can't tie it to as many
424:13 instantly and I can't tie it to as many data points as a website like this can I
424:16 data points as a website like this can I think this website's great now let's
424:18 think this website's great now let's talk about what D hash can do now that
424:20 talk about what D hash can do now that I'm logged in
424:22 I'm logged in we have the ability to search by let me
424:25 we have the ability to search by let me make this a little bit bigger we have
424:27 make this a little bit bigger we have the ability to search by email
424:29 the ability to search by email username IP address name address phone
424:33 username IP address name address phone number Vin okay think about this say we
424:37 number Vin okay think about this say we know a email address okay we know an
424:40 know a email address okay we know an email address say it's Bob Bob at
424:43 email address say it's Bob Bob at tesla.com we're not going to search this
424:45 tesla.com we're not going to search this yet we take Bob and we know Bob it has
424:49 yet we take Bob and we know Bob it has an account and we're looking for him we
424:51 an account and we're looking for him we search him Bob shows up and we see Bob
424:54 search him Bob shows up and we see Bob shows up and we see maybe his name like
424:57 shows up and we see maybe his name like Bob Jones or something like that shows
425:00 Bob Jones or something like that shows up maybe something that he's been leaked
425:02 up maybe something that he's been leaked in has his address or maybe there was an
425:04 in has his address or maybe there was an IP address tied to the client you're
425:06 IP address tied to the client you're looking for or the person you're looking
425:07 looking for or the person you're looking for this can all be identified what if
425:11 for this can all be identified what if Bob has a username it's like Bob Bob
425:14 Bob has a username it's like Bob Bob rocks123 okay well we can search that
425:16 rocks123 okay well we can search that username in here and see if that
425:18 username in here and see if that username has repeated itself at all
425:20 username has repeated itself at all which is great we could search by
425:23 which is great we could search by password so say Bob's password was Bob
425:25 password so say Bob's password was Bob rocks123 we could search that password
425:28 rocks123 we could search that password and if it's Unique enough then maybe we
425:31 and if it's Unique enough then maybe we can actually do some Advanced searching
425:34 can actually do some Advanced searching like if we go back to the example from
425:36 like if we go back to the example from last time like this last video we saw
425:39 last time like this last video we saw this 907 d-a-d-e-814
425:43 this 907 d-a-d-e-814 we could put that into a search engine
425:44 we could put that into a search engine and see if that comes back to something
425:47 and see if that comes back to something else maybe that comes back to a user
425:49 else maybe that comes back to a user that is not at a tesla.com but maybe
425:52 that is not at a tesla.com but maybe it's like Bob at gmail.com and then
425:55 it's like Bob at gmail.com and then guess what now we have Bob's personal
425:58 guess what now we have Bob's personal account or now we have Bob tied to
426:00 account or now we have Bob tied to another email account especially if we
426:02 another email account especially if we search by name or something that we can
426:04 search by name or something that we can tie them together we need to start being
426:06 tie them together we need to start being able to relate other accounts to each
426:08 able to relate other accounts to each other we can do that with hashing we
426:10 other we can do that with hashing we could do that with passwords there's a
426:12 could do that with passwords there's a lot of things that we can do and we want
426:14 lot of things that we can do and we want to start tying this together as a real
426:16 to start tying this together as a real world example when I am looking at an
426:18 world example when I am looking at an organization and I'm doing research on
426:20 organization and I'm doing research on on hashing or I'm doing research on
426:22 on hashing or I'm doing research on breach credentials I'm trying to think
426:25 breach credentials I'm trying to think okay first if my client if my client is
426:28 okay first if my client if my client is tesla.com I might come in here and
426:30 tesla.com I might come in here and search at tesla.com and I might come see
426:33 search at tesla.com and I might come see how many results are in here let's see
426:34 how many results are in here let's see what happens
426:35 what happens okay here's George tesla.com George has
426:39 okay here's George tesla.com George has been in a shared data so there's no
426:42 been in a shared data so there's no actual
426:43 actual um any data details here besides a
426:46 um any data details here besides a potential username a name email okay
426:48 potential username a name email okay same thing with safety we'd have to
426:50 same thing with safety we'd have to scroll down and see if we can find
426:51 scroll down and see if we can find something that okay here's Adobe now
426:54 something that okay here's Adobe now Adobe will have a there's actually a bob
426:56 Adobe will have a there's actually a bob and Tesla um Bob at Tesla has a hash
426:59 and Tesla um Bob at Tesla has a hash password here okay so now we could say
427:01 password here okay so now we could say well first of all we can go see if we
427:03 well first of all we can go see if we can figure out what this hash is which
427:05 can figure out what this hash is which we'll talk about in a second we can also
427:07 we'll talk about in a second we can also go and say okay Bob uh does Bob exist
427:11 go and say okay Bob uh does Bob exist anywhere else does this hash exist
427:12 anywhere else does this hash exist anywhere else on this website can we tie
427:15 anywhere else on this website can we tie it to another account that maybe even if
427:17 it to another account that maybe even if we don't crack the password then we can
427:19 we don't crack the password then we can say okay this Bob this ties to Bob
427:22 say okay this Bob this ties to Bob gmail.com so like I would note this down
427:25 gmail.com so like I would note this down and I would take this and copy it so
427:28 and I would take this and copy it so from a real world example I would take
427:30 from a real world example I would take all the data that I see on this website
427:32 all the data that I see on this website I would collect all of the passwords all
427:34 I would collect all of the passwords all of the usernames and everything so like
427:36 of the usernames and everything so like Tesla 9 all this I want to know what the
427:40 Tesla 9 all this I want to know what the passwords are I want to know who the
427:41 passwords are I want to know who the people are I want to know all the data
427:43 people are I want to know all the data because if I could start finding
427:45 because if I could start finding patterns if I could start putting things
427:47 patterns if I could start putting things together maybe I can even relate these
427:49 together maybe I can even relate these back to their personal email accounts
427:51 back to their personal email accounts like we're talking about and then I
427:53 like we're talking about and then I could see password patterns there or
427:55 could see password patterns there or other passwords and just start tying
427:56 other passwords and just start tying this down because my goal is to break
427:59 this down because my goal is to break into an organization if I'm doing a pen
428:01 into an organization if I'm doing a pen test my goal is to break into an
428:02 test my goal is to break into an organization so I'm going to take that
428:04 organization so I'm going to take that data and if I can find other passwords
428:06 data and if I can find other passwords related to a personal account I'm not
428:08 related to a personal account I'm not going to go attempt to break into a
428:10 going to go attempt to break into a personal account but I will take that
428:11 personal account but I will take that data and I will put it together and
428:13 data and I will put it together and maybe try to break into their work email
428:16 maybe try to break into their work email account with those passwords of that
428:17 account with those passwords of that information this can tie to an
428:20 information this can tie to an investigation as well if you're hunting
428:22 investigation as well if you're hunting down an individual you're trying to tie
428:24 down an individual you're trying to tie them to other accounts this is
428:26 them to other accounts this is incredibly useful if you can find their
428:28 incredibly useful if you can find their data in a breached database and have a
428:31 data in a breached database and have a password and that password's unique you
428:33 password and that password's unique you can search it maybe find them somewhere
428:34 can search it maybe find them somewhere else you find and I IP address you find
428:37 else you find and I IP address you find a name there are often IP addresses in
428:40 a name there are often IP addresses in here which we can tie to a location
428:42 here which we can tie to a location possibly and see here's that 9078 or
428:45 possibly and see here's that 9078 or Dade 814 we could take this and maybe
428:48 Dade 814 we could take this and maybe search it and see if it comes back
428:49 search it and see if it comes back anything who knows shark at Tesla shark
428:53 anything who knows shark at Tesla shark at Tesla okay
428:55 at Tesla okay sharkmail.ru look this is a new new
428:58 sharkmail.ru look this is a new new email address
428:59 email address we didn't know about this one before
429:01 we didn't know about this one before and look it does us a favor we search
429:04 and look it does us a favor we search d-a-d-e but here's the capitalize we
429:06 d-a-d-e but here's the capitalize we didn't search for capitalize we're not
429:08 didn't search for capitalize we're not searching specific okay and now we're
429:10 searching specific okay and now we're getting more information look here's one
429:12 getting more information look here's one for Dropbox okay so it tells you where
429:15 for Dropbox okay so it tells you where this is coming from and how you can tie
429:17 this is coming from and how you can tie it in if we can get any sort of name out
429:19 it in if we can get any sort of name out of this
429:21 of this um any sort of anything that would be
429:22 um any sort of anything that would be amazing we can get a person's name or IP
429:25 amazing we can get a person's name or IP address and we could start tying them
429:26 address and we could start tying them down but when you're doing different
429:28 down but when you're doing different searches like this you need to start
429:31 searches like this you need to start almost
429:32 almost um you know like in the investigations
429:33 um you know like in the investigations where they have like the the red yarn
429:36 where they have like the the red yarn and it's going from one pinpoint to
429:39 and it's going from one pinpoint to another you kind of have to zigzag that
429:40 another you kind of have to zigzag that back and forth and really try to tie
429:42 back and forth and really try to tie this down and you'll see that when we
429:44 this down and you'll see that when we get into reporting how you might take
429:46 get into reporting how you might take one individual and really just see like
429:49 one individual and really just see like a password tied to an account tied to
429:51 a password tied to an account tied to this and this was the exact methodology
429:53 this and this was the exact methodology that we took to get to that point
429:55 that we took to get to that point because when you write a report you want
429:57 because when you write a report you want to make sure that I the investigative
429:59 to make sure that I the investigative person or the say you're heading off to
430:01 person or the say you're heading off to the police or whatever you want to make
430:04 the police or whatever you want to make sure that the person that is doing what
430:06 sure that the person that is doing what what you did or they can replicate what
430:08 what you did or they can replicate what you did with ease and there's no no
430:10 you did with ease and there's no no question about it so this is some of the
430:13 question about it so this is some of the the searching that we can do now if we
430:15 the searching that we can do now if we come to dehashed again we can come here
430:17 come to dehashed again we can come here and we can search by email username name
430:21 and we can search by email username name name anything so you can put your name
430:23 name anything so you can put your name in here I mean if you want to search on
430:24 in here I mean if you want to search on here I think it's great you can come
430:26 here I think it's great you can come through here and just search for your
430:28 through here and just search for your name let's go back let's search Tesla
430:31 name let's go back let's search Tesla again I saw a hash in there the Adobe
430:33 again I saw a hash in there the Adobe hashes are kind of interesting they're
430:34 hashes are kind of interesting they're not the easiest to pick up but let's see
430:37 not the easiest to pick up but let's see let's find this Adobe hash
430:39 let's find this Adobe hash so let's say we get a hash like this
430:42 so let's say we get a hash like this we could try to identify what this hash
430:44 we could try to identify what this hash is we can try to crack this hash we can
430:46 is we can try to crack this hash we can see if it's been cracked somewhere else
430:47 see if it's been cracked somewhere else this hash as of right now we have no
430:50 this hash as of right now we have no idea but we know Bob tesla.com we can
430:53 idea but we know Bob tesla.com we can maybe paste this in here first of all
430:55 maybe paste this in here first of all and see if it ties back to anything and
430:57 and see if it ties back to anything and there's 22 results back
431:00 there's 22 results back um you know I would probably be looking
431:02 um you know I would probably be looking for somebody that has this password with
431:06 for somebody that has this password with the name of Bob it's probably not going
431:08 the name of Bob it's probably not going to be like a Brett or a Michael you know
431:12 to be like a Brett or a Michael you know we might want to see if we can find
431:13 we might want to see if we can find another account somewhere else but these
431:15 another account somewhere else but these are all tying down to a hash from Adobe
431:17 are all tying down to a hash from Adobe so depending on how they were hashing
431:18 so depending on how they were hashing this data we might not find anything
431:20 this data we might not find anything else of interest but you can see all the
431:23 else of interest but you can see all the things here all the different
431:24 things here all the different opportunities that are here for us to
431:26 opportunities that are here for us to just do research and tie down
431:28 just do research and tie down information now we can go to a website
431:31 information now we can go to a website called hashes.org
431:34 called hashes.org and if we come here we have the
431:36 and if we come here we have the capability to actually try to search for
431:39 capability to actually try to search for this hash so we could search hashes and
431:41 this hash so we could search hashes and see if we can find it
431:43 see if we can find it so you can come in here and just paste
431:45 so you can come in here and just paste it
431:46 it and again it doesn't do a great job in
431:49 and again it doesn't do a great job in my opinion with the Adobe hashes
431:51 my opinion with the Adobe hashes sometimes they crack but a lot of times
431:53 sometimes they crack but a lot of times it says it can't find them
431:55 it says it can't find them um oops there we go
431:57 um oops there we go let's try hitting a search here
432:00 let's try hitting a search here okay so it says not a valid hash now if
432:02 okay so it says not a valid hash now if you put this into Google as a search
432:07 you put this into Google as a search you can see it didn't come back with
432:08 you can see it didn't come back with anything either so we want to make sure
432:10 anything either so we want to make sure that when we're searching this you know
432:12 that when we're searching this you know we we try all options there is an adobe
432:15 we we try all options there is an adobe database that if you do put in a hash
432:17 database that if you do put in a hash and it does show up there's a GitHub
432:19 and it does show up there's a GitHub Adobe database that will actually show
432:21 Adobe database that will actually show up here so with that being said this is
432:23 up here so with that being said this is kind of what I want you to start
432:24 kind of what I want you to start thinking about when we're hunting down
432:26 thinking about when we're hunting down breach credentials how can I take a
432:28 breach credentials how can I take a person or company that I'm looking into
432:31 person or company that I'm looking into so if you have a company you can just go
432:33 so if you have a company you can just go at company
432:35 at company name.com or dot net or whatever it is
432:37 name.com or dot net or whatever it is search in here see how they show up if
432:40 search in here see how they show up if you have a person maybe a personal email
432:42 you have a person maybe a personal email account if you can find that person if
432:44 account if you can find that person if you know their email account you come in
432:45 you know their email account you come in here and say Bob gmail.com maybe you
432:48 here and say Bob gmail.com maybe you don't know what their their email
432:51 don't know what their their email address is then maybe you come here to
432:53 address is then maybe you come here to the main page you go okay I'm gonna look
432:54 the main page you go okay I'm gonna look for a name I'm going to look for Bob
432:57 for a name I'm going to look for Bob Jones
432:58 Jones and search for that and then you start
433:00 and search for that and then you start taking this and trying to find the
433:02 taking this and trying to find the patterns if you know Bob lives somewhere
433:04 patterns if you know Bob lives somewhere uh maybe you could find an address for
433:06 uh maybe you could find an address for Bob or maybe you know Bob lives in like
433:08 Bob or maybe you know Bob lives in like Arizona you could search Bob Jones and
433:11 Arizona you could search Bob Jones and see if Bob shows up
433:13 see if Bob shows up um and then kind of take it from there
433:14 um and then kind of take it from there and there is some search operators that
433:17 and there is some search operators that you can utilize you can see Bob Jones is
433:19 you can utilize you can see Bob Jones is taking forever you can put this in
433:21 taking forever you can put this in quotations and search it again and kind
433:23 quotations and search it again and kind of narrow down your results here so if
433:25 of narrow down your results here so if we click on this you could see like
433:26 we click on this you could see like here's a name of we got a lot of results
433:29 here's a name of we got a lot of results but here's the name Bob Jones this is a
433:32 but here's the name Bob Jones this is a very common name so
433:34 very common name so um but you could see like if we're
433:35 um but you could see like if we're trying to look this down we can start
433:37 trying to look this down we can start searching and adding operators in here
433:39 searching and adding operators in here and trying to see if we can figure out
433:40 and trying to see if we can figure out to tie a username or something to them
433:43 to tie a username or something to them so again get your wheel spinning don't
433:46 so again get your wheel spinning don't rely on just dehashed but just rely on
433:49 rely on just dehashed but just rely on thinking about this this is the thing
433:51 thinking about this this is the thing you should think about again the hash
433:52 you should think about again the hash could go down tomorrow but if you're
433:54 could go down tomorrow but if you're thinking about it in in the way that the
433:58 thinking about it in in the way that the credentials and the information can be
434:00 credentials and the information can be interwoven remember that red yarn again
434:02 interwoven remember that red yarn again that's really what I want you to take
434:04 that's really what I want you to take away from this so we're going to do
434:06 away from this so we're going to do another video on this I'm going to show
434:07 another video on this I'm going to show you some more I guess tools that are out
434:09 you some more I guess tools that are out there and some other things that you can
434:11 there and some other things that you can do offer alternatives to this and then
434:14 do offer alternatives to this and then we'll wrap up this section so I'll catch
434:16 we'll wrap up this section so I'll catch you over in the next video
434:18 you over in the next video okay we have reached the end of part one
434:20 okay we have reached the end of part one I am again going to link in the
434:22 I am again going to link in the description below the link to part two
434:24 description below the link to part two so go ahead and click on that if you
434:26 so go ahead and click on that if you finish this and we're going to meet you
434:27 finish this and we're going to meet you over in part two of the video