1
00:00:00,480 --> 00:00:04,320
-: How do we communicate with a website?

2
00:00:04,320 --> 00:00:06,060
Most of you probably know this already,

3
00:00:06,060 --> 00:00:08,490
but I will mention it in this video

4
00:00:08,490 --> 00:00:11,490
just so we can get a quick refresher.

5
00:00:11,490 --> 00:00:13,380
We explained all of these attacks

6
00:00:13,380 --> 00:00:14,490
in the previous video,

7
00:00:14,490 --> 00:00:16,830
but it's important we know the basics

8
00:00:16,830 --> 00:00:18,240
behind communication,

9
00:00:18,240 --> 00:00:20,463
between a client and our website.

10
00:00:21,420 --> 00:00:23,070
So we send requests

11
00:00:23,070 --> 00:00:25,050
and receive pages back,

12
00:00:25,050 --> 00:00:27,750
with the help of HTTP requests

13
00:00:27,750 --> 00:00:29,883
and HTTP responses.

14
00:00:30,840 --> 00:00:34,380
HTTP request is something that we send to the website

15
00:00:34,380 --> 00:00:38,220
once we want to get a certain webpage from that website,

16
00:00:38,220 --> 00:00:40,950
and HTTP response is a response

17
00:00:40,950 --> 00:00:44,550
from the website telling us that either it found the page

18
00:00:44,550 --> 00:00:47,820
that we were looking for or it didn't.

19
00:00:47,820 --> 00:00:51,450
HTTP response also contains an HTML code

20
00:00:51,450 --> 00:00:53,940
of the web page that we requested.

21
00:00:53,940 --> 00:00:57,360
Now, this would be a basic explanation of the process,

22
00:00:57,360 --> 00:00:58,860
but let us also take a look

23
00:00:58,860 --> 00:01:00,870
at how an HTTP request

24
00:01:00,870 --> 00:01:04,050
and a HTTP response look like.

25
00:01:04,050 --> 00:01:08,100
So, if we take a look at this image right here,

26
00:01:08,100 --> 00:01:10,020
in the red letters, we can see

27
00:01:10,020 --> 00:01:13,200
HTTP request to some webpage.

28
00:01:13,200 --> 00:01:18,200
While in the blue letters, we see an HTTP response.

29
00:01:18,330 --> 00:01:21,540
Let us focus first on HTTP request.

30
00:01:21,540 --> 00:01:24,510
So some of the known fields from the HTTP request

31
00:01:24,510 --> 00:01:27,360
would be ones you see in the image.

32
00:01:27,360 --> 00:01:29,190
We got hosts

33
00:01:29,190 --> 00:01:31,800
and that field defines the website domain,

34
00:01:31,800 --> 00:01:33,900
that you're searching for.

35
00:01:33,900 --> 00:01:36,810
Sometimes this field can also have a port number,

36
00:01:36,810 --> 00:01:37,770
due to web servers,

37
00:01:37,770 --> 00:01:41,040
sometimes hosting more than one website.

38
00:01:41,040 --> 00:01:43,500
Besides that, we also got the user agent field,

39
00:01:43,500 --> 00:01:45,240
and this field is used

40
00:01:45,240 --> 00:01:47,490
by server to identify the client

41
00:01:47,490 --> 00:01:50,400
that is connecting to the server.

42
00:01:50,400 --> 00:01:52,350
By identifying I mean,

43
00:01:52,350 --> 00:01:55,020
it'll usually identify the web browser,

44
00:01:55,020 --> 00:01:56,583
that the client is using.

45
00:01:57,630 --> 00:02:00,420
HTTP request can also have cookies,

46
00:02:00,420 --> 00:02:02,610
which we can't see here in this picture,

47
00:02:02,610 --> 00:02:05,310
but what cookies are our values exchanged

48
00:02:05,310 --> 00:02:07,560
between a client and a server

49
00:02:07,560 --> 00:02:09,389
that are used for holding data,

50
00:02:09,389 --> 00:02:12,573
and information about a certain session that the user has.

51
00:02:13,590 --> 00:02:16,920
Sometimes an HTTP request can also have

52
00:02:16,920 --> 00:02:18,600
authorization parameter,

53
00:02:18,600 --> 00:02:21,480
which is used to check for the identity.

54
00:02:21,480 --> 00:02:24,240
With this parameter, usernames and passwords

55
00:02:24,240 --> 00:02:25,980
are sent to the website.

56
00:02:25,980 --> 00:02:28,980
On the other hand, we got an HTTP response,

57
00:02:28,980 --> 00:02:32,400
which also has some special fields of its own.

58
00:02:32,400 --> 00:02:36,210
First thing we see, is the status code.

59
00:02:36,210 --> 00:02:39,270
Now, a field called status code doesn't exist,

60
00:02:39,270 --> 00:02:42,540
but the value will be stored in the first line

61
00:02:42,540 --> 00:02:44,100
of the response.

62
00:02:44,100 --> 00:02:47,580
Most of you encountered at some point a 404 error

63
00:02:47,580 --> 00:02:50,340
once you try to search for a certain web page,

64
00:02:50,340 --> 00:02:54,000
a 404, in this case, is a status code.

65
00:02:54,000 --> 00:02:55,080
In this picture,

66
00:02:55,080 --> 00:02:57,270
we can see a status code of 200,

67
00:02:57,270 --> 00:02:59,880
which indicates that the page exists

68
00:02:59,880 --> 00:03:02,580
and that we loaded it successfully.

69
00:03:02,580 --> 00:03:06,090
Besides this, we got set cookie field,

70
00:03:06,090 --> 00:03:08,400
and this field, if defined,

71
00:03:08,400 --> 00:03:12,030
will establish values of cookies to the client.

72
00:03:12,030 --> 00:03:15,570
This value server can use later to identify the client,

73
00:03:15,570 --> 00:03:17,703
and to also store client's data.

74
00:03:18,630 --> 00:03:21,060
We also got field called cache control,

75
00:03:21,060 --> 00:03:23,850
and this field is used if the content

76
00:03:23,850 --> 00:03:25,590
of the response should get stored

77
00:03:25,590 --> 00:03:28,473
inside the browser of the client, or not.

78
00:03:29,340 --> 00:03:31,830
And we also got content length,

79
00:03:31,830 --> 00:03:35,223
that will tell us size of the response in bytes.

80
00:03:36,330 --> 00:03:37,830
Below all of these fields,

81
00:03:37,830 --> 00:03:40,320
we can see HTML tags opening,

82
00:03:40,320 --> 00:03:41,670
and down there,

83
00:03:41,670 --> 00:03:43,530
is the web page that we requested

84
00:03:43,530 --> 00:03:45,360
from this website.

85
00:03:45,360 --> 00:03:48,450
It sends us the webpage code that will then

86
00:03:48,450 --> 00:03:50,580
get rendered inside of our browser,

87
00:03:50,580 --> 00:03:52,740
and it'll show us the web page.

88
00:03:52,740 --> 00:03:54,870
Simple as that.

89
00:03:54,870 --> 00:03:55,703
Great.

90
00:03:55,703 --> 00:03:58,230
Now that we refreshed our memory about this,

91
00:03:58,230 --> 00:04:01,290
let us finally start attacking websites.

92
00:04:01,290 --> 00:04:02,590
See you in the next video.

