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