Right now there are more than 300,000 htm files (and a small number of html files). A considerable portion of these files have been defaced with malware. It is found that the source files of these defaced html and htm files have the URL mm.aa88567.cn in the last line.
Now, we need to find those defaced web pages (whose last line contains the string "mm.aa88567.cn"), and then delete their last line.
Tools to be used: commonly used tools in Windows, or external tools: perl, sed,... (those with a volume size not exceeding 1M are all acceptable).
Now we need to find the tool with the fastest processing speed and its solution (code)
sed (40K version 4.0.7) download: http://upload.cn-dos.net/img/1813.rar
perl (369K version 5.005_03) download: http://upload.cn-dos.net/img/1814.rar
The following is the bat code for generating test files:
[ Last edited by plp626 on 2010-3-4 at 23:00 ]
Now, we need to find those defaced web pages (whose last line contains the string "mm.aa88567.cn"), and then delete their last line.
Tools to be used: commonly used tools in Windows, or external tools: perl, sed,... (those with a volume size not exceeding 1M are all acceptable).
Now we need to find the tool with the fastest processing speed and its solution (code)
sed (40K version 4.0.7) download: http://upload.cn-dos.net/img/1813.rar
perl (369K version 5.005_03) download: http://upload.cn-dos.net/img/1814.rar
The following is the bat code for generating test files:
@echo off&setlocal enabledelayedexpansion
md test&cd test
echo Generating test files...
for /l %%a in (1 1 2000)do (
(echo ^<html^>
echo ...!random!...
echo ^<... http://mm.aa88567.cn/ ... ^>
)>!random!!time:~-2!!random!.htm
)
for /l %%a in (1 1 3000)do (
(echo ^<html^>
echo ...!random!...
echo dfddfd
)>!random!!time:~-2!!random!!time:~-2!.html
)
set ff=!random!
md %ff%
for /l %%a in (1 1 2000)do (
(echo ^<html^>
echo ...!random!...
echo ^<... http://mm.aa88567.cn/ ... ^>
)>%ff%\!random!!time:~-2!!random!.htm
)
for /l %%a in (1 1 3000)do (
(echo ^<html^>
echo ...!random!...
echo dfddfd
)>%ff%\!random!!time:~-2!!random!!time:~-2!.html
)[ Last edited by plp626 on 2010-3-4 at 23:00 ]

