1
00:00:00,780 --> 00:00:06,600
Hello everybody and welcome to our first project where we are going to quote our own port scanner using

2
00:00:06,600 --> 00:00:08,160
Python 3.

3
00:00:08,280 --> 00:00:12,720
So in the previous section we introduced herself to clinics were installed by charm.

4
00:00:12,810 --> 00:00:17,420
And now we are ready to start writing our code before we start.

5
00:00:17,580 --> 00:00:20,900
Let's first explain what is the purpose of a port scanner.

6
00:00:20,970 --> 00:00:25,090
What it will do and how are we going to create it.

7
00:00:25,090 --> 00:00:31,090
Well first of all our port scanner is a program that allows you to scan target machine and discover

8
00:00:31,180 --> 00:00:34,770
whether it has some open or closed ports.

9
00:00:34,870 --> 00:00:39,900
For example we all know that the port 80 is used in order to serve HDP.

10
00:00:39,970 --> 00:00:46,740
And in order to serve a website page How would you actually discover whether port data is open without

11
00:00:46,740 --> 00:00:48,610
visiting that page.

12
00:00:48,630 --> 00:00:55,170
Well using our port scanner we can see whether we can connect to that port data or whether we cannot

13
00:00:55,260 --> 00:00:56,430
if we can't connect.

14
00:00:56,430 --> 00:01:00,590
That means that the port is open and it is most likely hosting up a page there.

15
00:01:00,630 --> 00:01:04,200
And if we cannot connect that means that the port is closed.

16
00:01:04,200 --> 00:01:05,910
Simple as that.

17
00:01:05,910 --> 00:01:10,800
So that will be the base line and the base part of our program.

18
00:01:10,820 --> 00:01:17,830
Now let's open a new project and to do that we can go right here on file and then new project here we

19
00:01:17,830 --> 00:01:24,940
can call it port scanner click on Create it will ask you whether we want to open the new project in

20
00:01:24,940 --> 00:01:26,770
this window or in another window.

21
00:01:27,070 --> 00:01:30,740
I will simply just select this window right here.

22
00:01:30,820 --> 00:01:36,270
It will create the virtual environment for this project and then we can start coding.

23
00:01:36,430 --> 00:01:45,650
Now here it is the port scanner we will click on new and then python file and we will call it port scanner.

24
00:01:45,650 --> 00:01:46,440
Don't be white.

25
00:01:47,030 --> 00:01:47,780
OK.

26
00:01:48,310 --> 00:01:50,530
Byte file we created it.

27
00:01:50,530 --> 00:01:58,640
Let me just enlarge a little bit more the font size so once again to the editor font and right here

28
00:01:58,670 --> 00:01:59,600
let's go.

29
00:01:59,600 --> 00:02:03,740
Twenty four apply and now we are ready to go.

30
00:02:03,740 --> 00:02:07,930
Now for this project we're going to meet two different Python libraries.

31
00:02:07,940 --> 00:02:10,730
We're going to need to import the socket library.

32
00:02:11,900 --> 00:02:18,430
And we're also going to need to import a library called IP y.

33
00:02:18,500 --> 00:02:24,600
And we're going to port it like this from IP y import IP.

34
00:02:25,470 --> 00:02:33,070
Now right the way you might notice that the IP y and IP are both red underlined.

35
00:02:33,090 --> 00:02:39,980
This means that the PI charm cannot recognize this library and cannot find it so before we actually

36
00:02:39,980 --> 00:02:43,790
start using it we need to download it first.

37
00:02:43,790 --> 00:02:46,220
Now there are a few ways you can actually download it.

38
00:02:46,220 --> 00:02:53,720
You can download it using a regular terminal which we are going to do as a first try right here so I

39
00:02:53,720 --> 00:02:58,930
will just put it like this so we can see everything.

40
00:02:59,110 --> 00:03:05,840
Now in order to install a desired library using the terminal you have to use a command called bip 3

41
00:03:05,940 --> 00:03:12,340
install now pick three is a part of Python 3 and it is used to actually install Python free libraries

42
00:03:12,640 --> 00:03:16,150
that are missing and that you need in order to run your program.

43
00:03:16,810 --> 00:03:17,310
OK.

44
00:03:17,500 --> 00:03:23,320
Now if you're using a new clinics you most likely won't have three installed and in order to install

45
00:03:23,320 --> 00:03:31,420
it you simply just typed and installed Python three dash Pip press your enter and it will install it

46
00:03:31,510 --> 00:03:32,310
for you.

47
00:03:32,380 --> 00:03:36,690
For me it has already been installed so we can continue right away.

48
00:03:36,760 --> 00:03:42,490
Let me clear the screen and large this a little bit just in case you cannot see what I am typing.

49
00:03:44,020 --> 00:03:49,980
And let's get the library that we're missing so be three installed IP white.

50
00:03:50,140 --> 00:03:51,100
Press your enter

51
00:03:55,200 --> 00:03:59,280
and it will say requirement already set this flight.

52
00:03:59,290 --> 00:04:05,130
Now this might seem confusing because two minutes ago I just told you that we are missing this library

53
00:04:05,130 --> 00:04:07,000
that we cannot find it.

54
00:04:07,260 --> 00:04:12,600
And here inside of a terminal it says that the requirement has already been satisfied and that we already

55
00:04:12,600 --> 00:04:14,710
have this library at this location.

56
00:04:15,840 --> 00:04:21,450
Well that is another part of the pie charm that you need to understand by charm simply creates a virtual

57
00:04:21,450 --> 00:04:24,600
environment every time you create a new project.

58
00:04:24,600 --> 00:04:30,480
That means that the library that you have installed inside of your clinics doesn't necessarily have

59
00:04:30,480 --> 00:04:33,430
to be installed inside of your pie chart program.

60
00:04:33,450 --> 00:04:39,420
Therefore this IP why library has not been installed inside of this virtual environment.

61
00:04:39,420 --> 00:04:40,770
So where can we install it.

62
00:04:40,950 --> 00:04:48,150
Well you can go here on terminal and you will see right away that before the route Kelly and then the

63
00:04:48,240 --> 00:04:54,520
actual directory we have this V and V inside the brackets which stands for virtual environment.

64
00:04:54,540 --> 00:05:01,620
So right here if we type the same command which is people installed and then IP Why press your enter

65
00:05:02,490 --> 00:05:07,650
you can see that right now it is successfully downloading it and it has downloaded it inside of our

66
00:05:07,650 --> 00:05:10,000
virtual environment right now.

67
00:05:10,080 --> 00:05:15,240
If we lower this go right here you can see that this is no longer red underlined.

68
00:05:15,240 --> 00:05:18,660
And now we have both of our libraries ready to use.

69
00:05:18,660 --> 00:05:23,790
So I just wanted to show you that because it is really important and we will be switching between libraries

70
00:05:23,790 --> 00:05:25,390
throughout the entire course.

71
00:05:25,410 --> 00:05:29,280
So it is important for you to understand the meaning of a virtual environment.

72
00:05:29,280 --> 00:05:34,620
Therefore once you next time try to install a desired library that is missing from Pine charm don't

73
00:05:34,620 --> 00:05:37,050
use calendar next terminal like this.

74
00:05:37,050 --> 00:05:41,820
You simply just go down here and inside of this PI term project you can install the desired library

75
00:05:42,030 --> 00:05:44,370
inside of the virtual environment.

76
00:05:44,370 --> 00:05:49,700
So now the port important the design libraries in the next video we can start finally coding our ports

77
00:05:49,710 --> 00:05:52,080
can see you there by.
