Lanckw
Lanckw

Reputation: 21

How to send a SYN packet and not sending the ACK response?

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("HOST", PORT))

This code surely send a SYN packet to HOST, but does it complete the three-way handshake? Does it send the ACK packet to HOST?

If not, how can I make socket not sending the ACK packet?

That's because I'm trying to study the syn flood flaws and how this attack works. So SYN packets are sent but no ACK packets response are sent.

Upvotes: 0

Views: 3359

Answers (1)

J_H
J_H

Reputation: 20450

The .connect() call is asking the kernel to setup a usable socket with the standard 3-way handshake:

  1. SYN →
  2. ← SYN+ACK
  3. ACK →

To send packets, without creating a usable socket, call hping3 instead:

$ sudo hping3 -i u1 -S -p 80 192.168.1.1

Upvotes: 1

Related Questions