14th Day-linux Command and basic knowledge combat

Source: Internet
Author: User

This section goes on to summarize the previous day's content:

5. Find all the files in the current directory and replace the www.etianetian.org string in the file with the www.oldboy.cc

The first step: simulate the attack process:

[Email protected]:~/ett/test$LS # create several test filesTest.log Test.Tar. GZ test.txt[email protected]:~/ett/test$Find./-type F |Xargs sed-I.'1 I www.etiantian.org '  # traverse the current directory, insert test content in 1 rows per file [email protected]:~/ett/test$CatTest.log # View execution results, already inserted successfully www.etiantian.orgHello!enddrink tea[email protected]:~/ett/test$Cattest.txtwww.etiantian.orgHello!enddrink tea[email protected]:~/ett/test$CatTest.Tar. GZ www.etiantian.org?? UV??????4]?? Om? O?'? [???; C3?? \?? w#?? R8?'?]? $? G?? H>?1.??? Xi%x?9???                      5?? X?x????? R? Q?? J??? EiA???? N???*[email protected]?l????,??!?? W?]???    X??????????;?? ?
([Email protected]:~/ett/test$

Step Two: Replace the test statement

[Email protected]:~/ett/test$Find./-type F |Xargs sed-I. 's/www.etiantian.org/www.oldboy.cc/g'[email protected]:~/ett/test$CatTest.log # Check to see that the successful Www.oldboy has been replaced .ccHello!enddrink tea[email protected]:~/ett/test$Cattest.txt Www.oldboy.ccHello!enddrink tea[email protected]:~/ett/test$CatTest.Tar. GZ Www.oldboy.cc?? UV??????4]?? Om? O?'? [???; C3?? \?? w#?? R8?'?]? $? G?? H>?1.??? Xi%x?9???                      5?? X?x????? R? Q?? J??? EiA???? N???*[email protected]?l????,??!?? W?]???    X??????????;?? ?
([Email protected]:~/ett/test$

Idea: Find all the files in the current directory through the Find command, and invoke the SED command with the-exec parameter to complete the replacement
Old boy teacher at the time of the processing process:
1, Hinves personnel confirmed the problem, and detailed confirmation of the situation.
2, the formulation of processing solutions, first backup data, and then execute the command batch modification back.
3, write the solution instructions, written to their operations.
4, ask the processing results, and inform the detailed review log, to find out the source of the problem occurred.
5, to provide solutions to solve the problem.

14th Day-linux Command and basic knowledge combat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.