From e745141b512761921e777ac107a22d3ac54172c5 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Sun, 23 Aug 2020 15:17:19 +0200 Subject: [PATCH] have to resend ACK, not SYN+ACK --- tcp_syni.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcp_syni.nim b/tcp_syni.nim index f3be199..4e51ac8 100644 --- a/tcp_syni.nim +++ b/tcp_syni.nim @@ -80,7 +80,7 @@ proc captureSeqNumbers(puncher: TcpSyniPuncher, rawFd: AsyncFD, break await cb(seqNums) -proc captureAndResendSynAck(puncher: TcpSyniPuncher, rawFd: AsyncFD) {.async.} = +proc captureAndResendAck(puncher: TcpSyniPuncher, rawFd: AsyncFD) {.async.} = while true: let packet = await rawFd.recv(4000) if packet == "": @@ -90,7 +90,7 @@ proc captureAndResendSynAck(puncher: TcpSyniPuncher, rawFd: AsyncFD) {.async.} = parsed.ipAddrSrc == puncher.srcIp and parsed.tcpPortSrc.int == puncher.srcPort.int and parsed.ipAddrDst == puncher.dstIp and - parsed.tcpFlags == {SYN, ACK}: + parsed.tcpFlags == {ACK}: for port in puncher.dstPorts: if parsed.tcpPortDst.int == port.int: let ipPacket = IpPacket(protocol: tcp, @@ -158,9 +158,9 @@ proc connect*(puncher: TcpSyniPuncher, progressCb: PunchProgressCb): Future[AsyncSocket] {.async.} = let iface = fromIpAddress(puncher.srcIp) let captureSeqFd = setupEthernetCapturingSocket(iface) - let captureSynAckFd = setupEthernetCapturingSocket(iface) + let captureAckFd = setupEthernetCapturingSocket(iface) asyncCheck puncher.captureSeqNumbers(captureSeqFd, progressCb) - asyncCheck puncher.captureAndResendSynAck(captureSynAckFd) + asyncCheck puncher.captureAndResendAck(captureAckFd) await puncher.addFirewallRules() try: result = await puncher.connectParallel()