2020-12-05 Third Weekly Report

Third weekly report

—————————————————————————————————————
Caiji came to share what he learned again this week, What I have learned this week is some introductory knowledge, most of which need to be remembered. I combine the content on the Internet and in the book and then combine my own ideas. I think it should be like if you are just getting started. . This post also involves the content of the previous post. The whole article is full of text, please read it patiently. If there are errors or better explanations, please feel free to put forward in the comment area.
This time there is a small algorithm based on HTML and HTTP protocol and Linux foundation.

1.
HTML basics What is HTML?

HTML is a language used to describe web pages.
HTML refers to Hypertext Markup Language.
HTML is not a programming language, but a markup language. A
markup language is a set of markup tags.
HTML uses markup tags to describe web pages.

What are HTML tags?

HTML tags usually exist in pairs, such as <b> and </b>. The expression is <tag>content<tag>
. The first tag in the tag pair is the start tag, and the second tag is the end tag. Also called open and closed tags.

What are HTML elements?

In fact, HTML elements and HTML tags have the same meaning. Strictly speaking, the element contains a start tag and an end tag.
For example, <p>hello,world</p> This is an HTML tag.

web browser

Web browsers (like Google, edge, IE) are used to read HTML files and display them in the form of web pages through the browser.
The browser will not display HTML tags. However, you can use tags to decide how to display the HTML content to the user. <body>content</body>, only the content can be displayed on the web page.

Analysis of the most basic HTML files (I commented here is useless<!–…—>)


<!DOCTYPE html> //Declaration is an HTML 5 type file|It is conducive to the correct display of the webpage in the browser

<html>//The root element, like #include <stdio.h>
<head> in C language, this tag contains the file meta information, which is the information that defines the document
<meta charset=“ut f-8” > //Used to display Chinese content, must not be lost! ! ! Otherwise, there will be garbled characters
<!– to ensure smooth Chinese output–>

<title>document title</title>//the name of the HTML file
< /head>
<body>
<h 1>My first HTML page</ h 1>
<p>My first paragraph. </ p>
</body>
</html>//End tag

The following is an explanation of some sentences.
Represents comments (equivalent to // in C language)
<! DOCTYP E> Represents the type of document
<meta> Represents the meta information of HTML documents (equivalent to hidden information of the file)
<i frame>, Define an inline frame (refers to <i frame>content</i frame> can display multiple pages in a browser window)

What is XSS?

XSS (the most common web application security loophole) uses the loopholes left during web page development to inject malicious instruction codes through a certain method, when the user loads and executes the malicious web page program created by the attacker. The
related statements should be remembered as follows :
<script> defines the client-side script
<i mg src=>, which specifies the URL of the displayed image (link address with network location) (just like you open a network picture, you can copy its link, which is equivalent to URL)
<body background =>, specify the URL of the document background image
<body onload=> event attribute of the body tag
<input on focus=autofocu s>, event attribute of the form form
<button onclick=> keystroke event attribute (that is, when the user operates an element For example, a certain event triggered when a button or text box starts a JAVA script action)
<link herf=>define external resource link
<object data> define the URL of the object data

HTML encoding
Because some special characters cannot be expressed in HTML programs, use HTML encoding to realize the representation of special characters
"——"
&a pos——'
& ——&
&It ——<
> ——>
In addition, any character can be used Use its decimal or hexadecimal
ASCLL for HTML encoding ?"——"
'——'
&#x 22——"
&#x 27——'

2. HTTP protocol basis

HTTP is used to define the process of exchanging data between a web browser and a web server, and the HTTP protocol is used to define the communication format between the client and the web server. HTTP defines how information is formatted, how it is transmitted, and the responses taken by servers and browsers under various commands.

Basic characteristics of HTTP protocol
1. Based on request and response The
client initiates a request to the http server, and the server responds to the request, back and forth.
2. No connection
No connection refers to no connection at the application layer, limiting each connection to only process a request, which means that the client initiates a request, the server responds, and the connection is terminated. Free up resources. Long-term links will cause most of the network resources to be idle and cause waste.
3. Stateless
means that the http protocol has no memory function. After each request is completed, it will not save the last data.
Advantages: Each response is faster.
Disadvantages: If the next requested data is associated with the previous one, you have to Performing a total data transmission may cause a large amount of data to be transmitted each time.
4. Simple and fast The
protocol is simple, one round and one end makes the scale of the http server program small, so that the communication speed is fast.
5. The flexible
http protocol allows the transmission of any type of data, which simplifies the design of the HTTP server and can accept a large number of highly concurrent requests. The HTTP protocol always sends requests from the client and the server sends back responses.

HTTP request message The
request message is divided into four parts: request line, request header information, blank line and request body.

Request line
http request line consists of three fields: request method field, url field and http protocol version field. They are separated by spaces. For example: POST http://job.xjtu.edu.cn/companyLogin.do HTTP/1.1

Request method:

instruction effect
GET Request the resource of the URL
POST Perform an operation and request the new data attached after the URL resource
head Get resource response message header
put Request the server to store a resource
delete Request the server to delete a resource
trace Request the server to send back the received information
.options Query the supported options of the server

url field: the
most common url format
protocol://[user[:password]@]hostname[:post]/[path]/file[?param=value]
protocol separator user information domain name port path resource file parameter key parameter Values
like /?: These characters have been understood by url as a special meaning, so these characters cannot appear randomly. If you want to escape special characters, you must escape the special characters first. The rules for escaping are as follows: convert the grandfather who needs to catch the horse to hexadecimal and then from right to left, take 4 as (less than 4 digits are processed directly, and every two digits are used as one digit, and% is encoded in the form of %XY. )

The url is divided into the following parts; example: http://user:[email protected]:80/dir/index/htm?uid=1#chi
1. Protocol part The protocol part of the above url is "http: "This means that the web page uses the HTTP protocol followed by the "//" as the separator
2. We have seen less information on the authentication section. This is an optional part and will appear in an anonymous form. Part of it with @ as the end character, such as user
3. The domain name part is related to which server you obtain resources from. For example, the
port set by the above www.example 4. Port service can generally be omitted. jb:80
5. The relative path of the resource accessed by the path under the server, not an absolute path, usually in the form of /XXX/XXX such as /dir/indexhtm
6. The parameter part is from? The part between # is the parameter part, also called the search part] query part. The parameter allows multiple parameters to exist, but use & as a separator such as uid=1 above.
7. Fragment part: The essential difference between this part and the form information after the above? Is that this part of the content will not be passed to the server. Generally used for anchors of pages. That is, our common website generally has a back to the top button at the bottom right, which is generally implemented by it. As above chi1

Request header: The request header adds some additional information to the request message. It consists of "name/value" pairs, each line is one pair, and the name is separated by a colon.
Common request headers:
Host: The server address that accepts the request, It can also be a domain name.
Use-Agent: the browser’s identification mark.
Connection: Specify connection-related attributes, such as Connection: Keep-Alive
Accept-Charset: Notify the server of the encoding format that can be sent
Accept-Encoding: Notify the server of the data that can be sent Compressed format
Accept-Language: the language that can be sent to the notification server
Referer: Referer: Referer: www.xxser.com/login.php, which means that the user came to this page from login.php.
cookie: cookie is a very important request header, it is a piece of text, often used to indicate the identity of the requester
Range: can request part of the content of the entity, multi-threaded download will definitely use this please header
x-forward-for: namely xxf, It represents the IP of the requester, which can be multiple, separated by a comma.
Accept: Used to specify which MIME type information the client accepts, such as: Accept: text/html, indicating that the client wants to accept HTML text information

There is a blank line after the request header, which indicates the end of the request header and must not be omitted

Blank line: used to distinguish request header information and request body

Request body

Optional part, such as GET request, there is no request body, if the request method is dead POST, usually put here is the data to be submitted; for example, you want to use the POST method to submit a form, where the data in the user field is "admin ", the password field is 123456, then the request data here is user=admin&password=123456, use & to connect each field.

Response message: consists of three parts: response line, response header, and response body

Response line


There are five categories of common status codes by HTTP protocol version, status code, and message .

Status code type meaning
1XX The message prompt indicates that the message was successfully accepted.
2XX Success, the server successfully processed the request
3XX Redirect, tell the client that what you are looking for is not in my possession, and let the client find someone else
4XX Client error status code
5XX An error occurred on the server side

Common status codes

status code meaning
200 Successful client request is the most common state.
302 Redirect.
404 The requested resource does not exist and is the most common state
400 The client's request is caused by a syntax error and cannot be understood by the server.
401 The client's request is not authorized
403 The server receives the request, but refuses to provide service to the client
500 Server internal error is the most common state
503 The server is currently unable to process the client's request and may return to normal after a period of time.

Response header: The response header is used to express the basic information of the server and the description of the data. The server can inform the client how to process the data through the description of the data.
Common response headers are as follows
: Allow: Which request methods are supported by the server
Content-Enconding: Document Encoding method.
contene-Type: indicates what MIME type the following document belongs to. Servlet defaults to text/plain, but it usually needs to be explicitly specified as text/html. Since Content-Type is often set, HttpServletResponse provides a dedicated method setContentType.
DAte: The current GMT time. For example, Date:Mon,31Dec200104:25:57GMT
Expires: tells the browser how long to cache the returned resource, -1 and 0 means no cache.
Last-Modified: The last modification time of the document.
Location: This header is used with the 302 status code to redirect the recipient to a new URL address. Prompt customers where to get resources
REfresh: tell the browser to refresh the browser regularly
Server: the server tells you the type of browser server through this header
Set-Cookie: view the cookie information associated with the settings and the page
Transfer-encoding: tell the browser
WWW-Authenticate , the transmission format of the server data, tells the client what type of authorization information should be provided in the Authorization header? This header is required in the response containing the 401 status line. The
Content-Length entity header is used to specify the length of the entity body, expressed in decimal numbers stored in bytes.

Response body: The response body is the message body of the response. If the hot pot is pure data, it returns pure data. If the request is an HTML page, then the returned HTML code is the
HTTP
version.

version effect
HTTP 0.9 This version only allows the GET method, which is typically stateless, without protocol headers and status codes, and supports plain text
HTTP 1.0 Added HEAD and POST methods, supporting long connections, caching and identity authentication
HTTP 1.1 Added Keep-alive mechanism and PipeLining pipeline, and added OPTIONS, PUT, DELETE, TRACE, CONNECT methods
HTTP 2.0 Added multiplexing, header compression, reset at any time and other functions

3. Algorithm
quick sort

4.Linux basics

Common Linux commands:
1. Common commands to switch the machine
shutdown-h now: shut down immediately
shutdown-r now: restart the computer
now reboot: restart the computer now
su -: switch user;
passwd: modify user password
logout: user logout
ls: display Target list
cd[path]: used to switch the working directory
pwd: display the user’s current working directory as an absolute path
man[command]: view Linux help information
apropos[whatever]: search for the keyword
echo[string] in the database file : Print a line of text
cat[file]: connect the file and print it to the output device
less[file]: allow the user to browse the contents of the text file forward or backward
mv[file1][file2]: used to rename the file directory , Or move files from one directory to another
cp[file1] [file2]: move files from one directory to another
rm[file]: used to delete one or more files
ps: used to report the current system The process status
top: view the overall operation of the system in real time
kill: kill a process
ifconfig: view or set the network device
ping: view whether the host on the network is working
netstat: display network link, routing table and network interface information
nc (netcat): establish tcp and udp connections and monitor
touch[file]: create a new empty file
mkdir [dir]: create a directory,
chmod: change the permissions of a file or directory
chown: the owner of the file to be changed
nano/vim/Emacs/: the text compiler of the character terminal
exit to exit the shell
2. The shortcut command
tab=complete
ctrl+l -: clear the screen
ctrl+c terminate the current process
ctrl+z pause the room Use'fg' in the previous process to continue
ctrl+d Delete the character at the cursor
ctrl+a Move to the
beginning of the command line ctrl+e Move to the end of the command line
ctrl+b Move the word backward (to the left)
ctrl+f Move the word forward (to the right)
ctrl+shift+c copy
ctrl+shift+v and paste
3. Variable
var=value Assign value var, var, to variable var
v a r , {var} Take the value of the variable'cmd
',$(cmd) to replace the standard
output'string'. The non-replaceable character
"string" can replace the character

Analyze a simple linux program
$ var = "test";//Make assignments
$ echo $var//Print out the contents of var
test
$ echo'This is a $var';//Print out "This is a var" but Because the character is in the'', so the var inside is "But because the character is in the ``, so the inside isV A R & lt " but is due to a word character in' ' Intheorderin thesurfaceof thevar No Substitution
This var IS $ A
$ echo "This IS Avar"; / / print out var "; // print outvar";/ / Playing print out var, because the character is replaced in the "" in
This is a test

$ echo date;//Print out time
14:40:07 CST, Monday, November 06, 2017
$ $(bash)

$ echo $0
/bin/bash
$ $($0)

Important directories:
/bin, /sbin: link to /usr/bin, store some core binary files of Linux, the instructions can be run on the shell /boot
/boot: programs used when the operating system starts
/dev: include All the external devices used in the Linux system. But it is just equivalent to a port to access these devices.
/ect/: stores various configuration files and subdirectories used in system management.
/etc/rc.d: stores scripts used when Linux is started and shut down.
/home: common permanent home directory
/lib, /lib64: link to /usr/lib, store the dynamic link shared library required by the system and software
/mnt: this directory allows users to temporarily mount other file systems
/proc : The virtual directory is the mapping of the system's memory. You can directly access the directory to obtain system information
/root: the home directory of the system administrator
/srv: store some data that needs to be extracted after the service is started
/sys: equivalent to a folder with subfolders (yes)
/tmp: public The temporary files are used to store the directory
/usr: equivalent to the user center
/usr/src: the storage directory of the kernel source code
/var: store the service log information

Guess you like

Origin blog.csdn.net/m0_52699073/article/details/110715909