1 00:00:00,009 --> 00:00:00,449 All right. 2 00:00:00,460 --> 00:00:05,670 So let's write our very first piece of code related to cybersecurity and this one 3 00:00:05,920 --> 00:00:11,220 will check to see if a user and a password is actually valid or not. 4 00:00:11,550 --> 00:00:16,139 You're more than welcome to try writing the code on your own. If not, 5 00:00:16,340 --> 00:00:18,350 let me show you how you will do this. 6 00:00:18,360 --> 00:00:21,149 So the first thing we need to do is we need to indicate 7 00:00:21,510 --> 00:00:24,559 what the password is. So 8 00:00:24,790 --> 00:00:26,510 I'm going to call 9 00:00:27,219 --> 00:00:29,620 the variable in here is stored 10 00:00:29,790 --> 00:00:31,639 underscore password. 11 00:00:32,580 --> 00:00:36,520 Ok. And let's provide a value for the password. 12 00:00:36,689 --> 00:00:40,810 I'm gonna go with something very, very, very, very generic. 13 00:00:41,069 --> 00:00:42,819 Uh let's say password, 14 00:00:43,029 --> 00:00:47,009 uh 123. Ok. So this is going to be the actual password. 15 00:00:47,069 --> 00:00:49,830 By the way, I'm not sure if I've mentioned this before. But 16 00:00:50,259 --> 00:00:51,279 in Python, 17 00:00:51,639 --> 00:00:55,159 if you wanted to add like a comment or a hint 18 00:00:55,779 --> 00:01:01,750 in your code, you can do so by using the hashtag symbol and then type in your comment. 19 00:01:01,759 --> 00:01:02,560 Ok. So 20 00:01:02,689 --> 00:01:06,150 maybe I've mentioned this before. If not. Well, there you go. 21 00:01:06,349 --> 00:01:07,269 Ok, so 22 00:01:07,459 --> 00:01:11,360 start password. Here it is going to be password 123. So now 23 00:01:11,510 --> 00:01:13,910 we need to ask the user 24 00:01:14,589 --> 00:01:16,349 to provide the password. 25 00:01:16,550 --> 00:01:18,720 And then once they provide the password, 26 00:01:18,730 --> 00:01:22,349 we can then run an el statement that will check to see 27 00:01:22,360 --> 00:01:25,949 if the password they've typed in is actually correct or not. 28 00:01:25,959 --> 00:01:32,370 If it's correct, we can say access granted. If not, we'll say access denied. So 29 00:01:33,379 --> 00:01:36,620 the first thing I'm gonna do right now is I'm going to get 30 00:01:37,279 --> 00:01:43,819 the user input. So let me just add my comment and say, get user input as the first step. 31 00:01:43,830 --> 00:01:44,180 So 32 00:01:44,650 --> 00:01:47,260 what we'll do right now is we can call 33 00:01:47,559 --> 00:01:49,800 the user input, we can call it the NT 34 00:01:50,610 --> 00:01:52,080 password. 35 00:01:52,250 --> 00:01:52,819 OK. 36 00:01:53,069 --> 00:01:56,580 This will be the variable that will store the input. So 37 00:01:57,239 --> 00:02:00,919 right there, I like the suggestion that Python has given us. So 38 00:02:01,069 --> 00:02:04,419 it simply says enter the password equals imputes and then 39 00:02:04,610 --> 00:02:08,139 we're going to ask the user to provide their password. 40 00:02:08,470 --> 00:02:10,460 So the next image to do right now 41 00:02:11,190 --> 00:02:12,339 is to see 42 00:02:12,529 --> 00:02:14,210 if whether or not 43 00:02:14,669 --> 00:02:17,729 the passwords actually match. OK? We wanna make sure 44 00:02:17,880 --> 00:02:20,449 that whatever they type in here is going to match 45 00:02:20,649 --> 00:02:24,520 the password that we have stored. And by the way, 46 00:02:25,679 --> 00:02:27,720 it's kind of amazing how I don't know if you, 47 00:02:27,729 --> 00:02:30,399 if you see the exact same thing on your own screen. 48 00:02:30,850 --> 00:02:36,059 But Python is literally just writing the entire code for me and I promise you, 49 00:02:36,070 --> 00:02:38,160 this is the very first time 50 00:02:38,270 --> 00:02:40,740 I'm actually writing this code on 51 00:02:40,899 --> 00:02:43,339 replete. I promise you, I haven't written this code before. 52 00:02:43,889 --> 00:02:48,679 It's amazing how it's so smart, it's so intelligent. It knows exactly 53 00:02:48,960 --> 00:02:53,000 what I want to type and that's exactly what I want to do. 54 00:02:53,410 --> 00:02:55,460 I wanna say. Ok, if 55 00:02:55,880 --> 00:02:57,699 the end of the password 56 00:02:57,860 --> 00:03:01,860 is equal to the start password, what are we gonna do? 57 00:03:02,000 --> 00:03:04,539 We are going to print. 58 00:03:05,330 --> 00:03:06,789 Ok. And then in brackets, 59 00:03:07,600 --> 00:03:09,740 string access 60 00:03:10,210 --> 00:03:11,220 granted. 61 00:03:11,850 --> 00:03:12,580 Right. 62 00:03:13,880 --> 00:03:13,889 Oh, 63 00:03:14,300 --> 00:03:16,940 sorry about that. 64 00:03:19,490 --> 00:03:20,710 What are we gonna print? 65 00:03:21,759 --> 00:03:23,179 We are going to print 66 00:03:25,220 --> 00:03:27,550 brackets codes, 67 00:03:28,860 --> 00:03:31,199 access denied 68 00:03:32,740 --> 00:03:33,839 and nowadays 69 00:03:35,410 --> 00:03:37,710 and maybe remove the extra code right there. 70 00:03:39,949 --> 00:03:40,809 And there you go. 71 00:03:41,210 --> 00:03:44,210 That is our code right there. 72 00:03:44,419 --> 00:03:49,449 Very simple, very straightforward. Let us try it. So I'm going to run 73 00:03:50,139 --> 00:03:54,110 and now I'm going to ask for the password. Let's try. 74 00:03:54,639 --> 00:03:59,270 Uh James 123 did not work. No access denied. 75 00:03:59,770 --> 00:04:00,190 Uh 76 00:04:00,949 --> 00:04:04,960 Well, it did not work. Let's run the program once one more time. 77 00:04:05,220 --> 00:04:07,679 Let's not try password 78 00:04:09,309 --> 00:04:09,960 uh 79 00:04:10,649 --> 00:04:12,610 passwor 80 00:04:12,979 --> 00:04:14,300 123 81 00:04:14,419 --> 00:04:15,389 press enter 82 00:04:15,520 --> 00:04:19,230 and there you go. Yay access has been granted. So 83 00:04:19,529 --> 00:04:22,739 our code actually works properly. And 84 00:04:23,079 --> 00:04:25,739 of course, this is just a very simple block of code. 85 00:04:25,750 --> 00:04:27,630 It's not the entire program itself, 86 00:04:27,640 --> 00:04:29,510 but this is the very first step towards 87 00:04:29,519 --> 00:04:34,880 creating a more comprehensive uh password checker tool. 88 00:04:34,890 --> 00:04:37,970 Thank you for watching the video. I will see you in the next class.