Delete 'Test_Cases/Test_Case2.py'
This commit is contained in:
parent
95cc7844d2
commit
adfd481671
@ -1,32 +0,0 @@
|
||||
import socket
|
||||
|
||||
# Sending a SYN packet
|
||||
|
||||
def init_socket():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
|
||||
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
|
||||
return s
|
||||
|
||||
def send_raw_packet():
|
||||
ip_header = b'\x45\x00\x00\x28' # Version, IHL, Type of Service | Total Length
|
||||
ip_header += b'\x00\x00\x00\x00' # Identification | Flags, Fragment Offset
|
||||
ip_header += b'\x28\x06\xa6\xec' # TTL = 40s, Protocol = 6 for TCP | Header Checksum
|
||||
ip_header += b'\xc0\xa8\x0a\x14' # Source Address: 192.168.10.20
|
||||
ip_header += b'\xc0\xa8\x0a\x0a' # Destination Address: 192.168.10.10
|
||||
|
||||
tcp_header = b'\x04\xD2\x11\x5C' # Source Port | Destination Port
|
||||
tcp_header += b'\x00\x00\x00\x00' # Sequence Number
|
||||
tcp_header += b'\x00\x00\x00\x00' # Acknowledgement Number
|
||||
tcp_header += b'\x50\x02\x00\x00' # Data Offset, Reserved, Flags | Window Size
|
||||
tcp_header += b'\xe6\x32\x00\x00' # Checksum | Urgent Pointer
|
||||
|
||||
packet = ip_header + tcp_header
|
||||
return packet
|
||||
|
||||
if __name__=="__main__":
|
||||
dst_IP = '192.168.10.10'
|
||||
|
||||
s = init_socket()
|
||||
|
||||
packet = send_raw_packet()
|
||||
s.sendto(packet, (dst_IP, 0))
|
Loading…
x
Reference in New Issue
Block a user