1
00:00:00,840 --> 00:00:01,770
Welcome back everybody.

2
00:00:02,430 --> 00:00:08,490
So for now we haven't really done anything yet but we did import our port scanner and now we're ready

3
00:00:08,490 --> 00:00:11,080
to start coding the main part of the program.

4
00:00:11,130 --> 00:00:16,680
So let's go to the vulnerability scanner right here right click on it click on the new and click on

5
00:00:16,680 --> 00:00:17,510
python file.

6
00:00:17,520 --> 00:00:20,420
So all of this stuff we already learned we know how to do it.

7
00:00:20,610 --> 00:00:23,290
And let's create a program which will be called Wolf.

8
00:00:23,310 --> 00:00:24,560
Can that be why.

9
00:00:25,200 --> 00:00:29,310
Now first thing that we want to do is of course to import our port scanner

10
00:00:32,340 --> 00:00:37,890
which make sure that it is in the same directory that is important and that is actually going to be

11
00:00:37,890 --> 00:00:42,570
the only library that we are going to need since these two libraries which are going to be the socket

12
00:00:42,570 --> 00:00:49,230
library and the IP why library are already imported inside of this port scanner program.

13
00:00:49,230 --> 00:00:49,900
All right.

14
00:00:49,980 --> 00:00:55,500
Now you might notice once again that this IP Y is actually red underlined which means that this library

15
00:00:55,500 --> 00:00:58,680
does not exist inside of this virtual environment.

16
00:00:58,680 --> 00:01:01,360
And we already talked about this before.

17
00:01:01,440 --> 00:01:06,270
You need to actually Page 3 install it inside of this virtual environment so let's do that right away

18
00:01:06,720 --> 00:01:08,850
using our terminal.

19
00:01:08,850 --> 00:01:17,440
Make sure that you're using terminal inside of the PI term and simply just type 3 install IP y.

20
00:01:18,250 --> 00:01:20,040
It will install a library for you.

21
00:01:20,170 --> 00:01:24,860
And as soon as it is finished you should no longer have this red underlined.

22
00:01:24,890 --> 00:01:25,500
All right.

23
00:01:25,600 --> 00:01:26,370
So let's see

24
00:01:29,270 --> 00:01:29,920
here it is.

25
00:01:29,960 --> 00:01:31,010
It is gone now.

26
00:01:31,100 --> 00:01:34,770
And now we have all of the libraries needed to complete our project.

27
00:01:34,910 --> 00:01:38,070
All right so let's go back to our main part of the program.

28
00:01:38,210 --> 00:01:43,160
We imported our port scanner and now let's think about all of the things that we need in order to complete

29
00:01:43,160 --> 00:01:43,910
this project.

30
00:01:43,910 --> 00:01:48,320
So first of all of course we need the target and we are going to scan.

31
00:01:48,320 --> 00:01:54,860
So we want to prompt the user of this program for the targets IP address so let's call it targets IP

32
00:01:54,980 --> 00:02:00,930
equals input and we're going to actually ask the user for the input of this.

33
00:02:01,310 --> 00:02:05,870
So let's type it like this and then we can add a star sign.

34
00:02:05,870 --> 00:02:07,450
Enter target.

35
00:02:07,490 --> 00:02:12,930
Scan for vulnerable open ports.

36
00:02:13,480 --> 00:02:13,900
OK.

37
00:02:14,390 --> 00:02:16,840
So this will be the target's IP.

38
00:02:16,850 --> 00:02:21,760
Once again we also want to make sure that this can be both IP address and the actual domain name.

39
00:02:21,830 --> 00:02:27,400
But we don't need to worry about that as that part of the code is already located inside of our ports

40
00:02:27,400 --> 00:02:29,140
Canada that we import it.

41
00:02:29,180 --> 00:02:31,400
So no need to code it once again.

42
00:02:31,790 --> 00:02:38,180
Let us go to the next line and also let's ask for user for the number of ports that they want to scan.

43
00:02:38,210 --> 00:02:41,570
Now we didn't use it in our port scanner so why not use it.

44
00:02:41,570 --> 00:02:42,140
Right here.

45
00:02:42,290 --> 00:02:47,160
Let's say they want to scan 100 ports and a different user wants to scan 200 ports.

46
00:02:47,180 --> 00:02:49,840
Let's add that as an available option as well.

47
00:02:49,850 --> 00:03:01,640
So port number will be equal to the input and in the second line we prompt the user for the amount of

48
00:03:01,640 --> 00:03:11,880
ports you want to scan and let's also notify them inside of the brackets that five hundred will mean

49
00:03:12,240 --> 00:03:14,650
the first 500 ports.

50
00:03:14,770 --> 00:03:15,120
OK.

51
00:03:15,660 --> 00:03:19,940
So in case they get confused they know what they need to specify.

52
00:03:19,950 --> 00:03:20,370
All right.

53
00:03:20,370 --> 00:03:25,740
Now another important thing that we need to do about this line is we need to make sure that this port

54
00:03:25,740 --> 00:03:28,120
number is an integer value.

55
00:03:28,170 --> 00:03:33,660
For example if the user specifies number 100 hundred it will be stored inside of this port number but

56
00:03:33,720 --> 00:03:37,050
it will be stored as a string and not as an integer.

57
00:03:37,050 --> 00:03:44,490
Therefore we need to wrap this entire part inside of an integer function and this integer function simply

58
00:03:44,490 --> 00:03:49,520
just converts whatever is inside of the brackets into an integer value.

59
00:03:49,530 --> 00:03:55,920
Keep in mind that you will get an error in case the actual user of this program specifies a string for

60
00:03:55,920 --> 00:04:02,280
example they type the word tree while that word will not get converted to an integer because that is

61
00:04:02,280 --> 00:04:02,930
not possible.

62
00:04:02,940 --> 00:04:09,540
Therefore this will only work if the user specifies the actual number which should be the case as we

63
00:04:09,540 --> 00:04:10,980
are indeed asking for a number.

64
00:04:10,980 --> 00:04:13,530
Therefore we want to convert it to integer.

65
00:04:13,560 --> 00:04:16,350
So our program can continue executing.

66
00:04:16,350 --> 00:04:16,680
All right.

67
00:04:16,680 --> 00:04:21,690
So now that we got these things out of the way there is a third and last thing that we need to ask the

68
00:04:21,690 --> 00:04:27,510
user before we actually start fronting the main part of the program and that is going to be the actual

69
00:04:27,510 --> 00:04:31,110
file from which we are going to read vulnerable softwares.

70
00:04:31,110 --> 00:04:36,240
So for this program to run we need to file as I mentioned at the beginning of this section we need a

71
00:04:36,240 --> 00:04:41,890
file that is going to store vulnerable software names that then we are going to compare with the software

72
00:04:41,890 --> 00:04:43,710
is running on open ports.

73
00:04:43,740 --> 00:04:52,590
So we're going to call that for example Val underscore file and it will be equal to the input

74
00:04:57,450 --> 00:04:58,210
loops.

75
00:04:58,470 --> 00:05:10,380
Let's add the double quotes so to the input and then we prompt the user enter path to the file with

76
00:05:10,470 --> 00:05:11,100
vulnerable

77
00:05:13,700 --> 00:05:14,770
softwares.

78
00:05:15,920 --> 00:05:16,310
OK.

79
00:05:16,410 --> 00:05:21,760
So now that we've finished everything these are three things that we need in order to run this program.

80
00:05:22,050 --> 00:05:24,660
Let's print also the new line character.

81
00:05:24,660 --> 00:05:30,500
So right after this we can have a little bit better view.

82
00:05:30,660 --> 00:05:34,230
And now we want to use the port scanner onto our program.

83
00:05:34,230 --> 00:05:34,690
All right.

84
00:05:34,710 --> 00:05:42,780
So we're simply just going to call the function port scanner dot scan onto the target's IP.

85
00:05:44,550 --> 00:05:45,140
OK.

86
00:05:45,150 --> 00:05:50,910
Now if you think about this a little bit you will notice that this will not actually work.

87
00:05:50,910 --> 00:05:52,350
Now why this will not work.

88
00:05:52,350 --> 00:05:59,040
Well there are a few problems with our ports scanner not with the port scanner itself but with the way

89
00:05:59,070 --> 00:06:03,930
that we imported it and that we are going to use it inside the vulnerable our ability scanner.

90
00:06:03,930 --> 00:06:06,780
So first of all we got a problem with this port.

91
00:06:06,820 --> 00:06:08,970
No variable.

92
00:06:08,970 --> 00:06:14,840
We cannot really paste it into obvious can function as ours can function only takes one parameter.

93
00:06:14,850 --> 00:06:20,730
So that is the first problem as we don't really have a way to actually tell the port scanner that we

94
00:06:20,730 --> 00:06:23,210
want to use this exact amount of ports.

95
00:06:23,220 --> 00:06:27,350
So that is the part that we also need to edit inside of a report scanner.

96
00:06:27,360 --> 00:06:33,830
Now another thing that we want to do is want to convert this entire actual port scanner into a class.

97
00:06:34,140 --> 00:06:37,610
And we also want to get rid of some of the functions that we need.

98
00:06:37,950 --> 00:06:43,880
And also we want to get rid of this part of the program says there is a lot to do with this port scanner.

99
00:06:43,890 --> 00:06:45,960
We're going to leave that for the next material.

100
00:06:45,990 --> 00:06:51,060
So in the next story we're going to cover this port scanner and convert it to the best possible way

101
00:06:51,060 --> 00:06:53,970
for us to use it inside of our own vulnerability scanner.

102
00:06:53,970 --> 00:06:55,980
And then we're going to continue from there.

103
00:06:55,980 --> 00:06:56,310
All right.

104
00:06:56,310 --> 00:07:02,280
So for now we simply just prompted the user for the needed things and in the next video we're going

105
00:07:02,280 --> 00:07:09,060
to cover the port scanner and how we can convert it the best way possible see there and take care by.
