In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about the introduction and usage of the HTTP protocol in the Web penetration test conducted by Python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
HTTP protocol
HTTP, the full name of Hypertext transfer Protocol, is a protocol designed to communicate between client and server. In the network world, HTTP belongs to the seventh layer of the OSI model-the application layer, and also belongs to the fourth layer of the TCP/IP model-the application layer.
About what is the OSI model and what is the TCP/IP model, in short, it is a network architecture of the computer network world, which is used to define the function of the principle of computer network and its various parts of communication.
The following figure is a simple example of the OSI model and the TCP/IP model:
OSI model and TCP/IP model
The OSI model is not one-to-one corresponding to the TCP/IP model, but the idea and structure are generally similar.
In the TCP/IP model, the network interface layer is the network interface of our various network devices (routers, switches, computers, etc.) and the physical links between the interfaces (network cables, fiber optics, etc.); the internetwork layer is the addressing and routing between network devices, which determines the path of communication between the two devices, and the IP address acts in this layer. The next transport layer is to hook up and establish contact after determining the route between the devices through IP. The main protocol of this layer is that TCP and UDP,TCP are connection-oriented transport protocols (classic three-way handshake). Under the confirmation of both sides, the two will establish a network connection, while UDP is a connectionless transmission protocol, which does not need confirmation by the receiver and belongs to unreliable transmission. Finally, there is the application layer, which defines many advanced transport protocols, such as HTTP involved in our web crawler, DNS, FTP and so on. Many network applications are developed based on this layer of network protocols.
Each layer of TCP/IP and its common protocols
Our web crawler involves the upper three layers, such as the http involved in obtaining the HTML, the IP involved in using the proxy IP, and the TCP/UDP used to establish a communication connection.
Next, we use wireshark to grab packets that open a web page. By grabbing packets of network data, we can clearly sort out the relationship between the various layers of TCP/IP.
As you can see from the figure, we sent a HTTP request to a remote server, and the captured packet showed that the HTTP request we sent was transmitted in an Frame frame.
Our request field data is packaged in the HTTP request, the HTTP request is packaged in the TCP request, and the TCP request is then packaged through IP and finally transmitted through the Frame frame. This completes the process of requesting a web page.
How the HTTP protocol works
HTTP is used to realize the communication between the client and the server, mainly relying on requests and responses to complete a job.
The client sends the request and the server responds to the request. In an HTTP connection, it is always the client that sends the request and the server that responds. Moreover, in HTTP, only the client sends the request and the server can respond, otherwise the server cannot actively respond to the client.
The embodiment of the real world is that the web server will not return a HTML page to us for no reason, we have to type or click on a URL, the web page will appear on the browser.
Request and response of HTP
Protocol version of HTTP
There are two versions of the HTTP protocol:
HTTP/1.0
HTTP/1.1
Http1.0 is the foundation of http protocol, while http1.1 adds and improves the functions of http1.0.
The port on which HTTP is running
By default, the HTTP protocol runs on port 80 on the server side.
HTTPS
HTTP protocol uses plaintext for transmission and communication, which is very insecure for some secret communications and is easy to be stolen.
So HTTPS came into being.
HTTPS uses SSL or TLS to encrypt HTTP messages and runs on port 443
Message structure of HTTP
Usually an HTTP message includes a request message sent by the client to the server and a response message sent by the server to the client. Both types of messages consist of a starting line, one or more header fields, a blank line indicating the end of the header field, and an optional message body.
Where the request message:
Starting line: consists of three parts: the request method, the URL of the request, and the version of the HTTP protocol used
Header domain: various request headers (detailed below)
Message body: general GET requests have no message body
Message structure of HTTP request
Response message:
Starting line: consists of three parts: the protocol version of the response, the response status code and the description of the response status code
Head domain: all kinds of response heads
Message body: the body that responds to the request, such as a HTML page, a file, a picture, etc.
Message structure of HTTP response
Second, the method of HTTP
According to the definition of the HTTP standard, there are eight request methods for HTTP:
GET: requests the specified resource and returns the resource entity.
POST: submit data to the specified resource and process the request (operations such as uploading a file or submitting a form).
HEAD: similar to the GET method, the specified resource is requested, but the resource entity is not returned.
PUT: request to update the specified resource.
DELETE: request to delete the specified resource.
OPTIONS: returns the request method supported by the server for the specified resource.
TRACE: echo requests received by the server, mainly for testing or diagnosis.
The CONNECT:HTTP/1.1 protocol is reserved for proxy servers that can change connections to pipelines.
Where:
The methods defined in HTTP/1.0 are: get, post, head
The methods defined in HTTP/1.1 are: options, put, delete, trace, connect, etc.
After reading the above, do you have any further understanding of the introduction and usage of the HTTP protocol in Python's Web penetration testing? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.