diff --git a/tcp_syni.nim b/tcp_syni.nim index c4f4fc4..e3c48db 100644 --- a/tcp_syni.nim +++ b/tcp_syni.nim @@ -254,7 +254,7 @@ proc doAccept(puncher: TcpSyniPuncher, srcIp: IpAddress, sock.close() proc injectSynPackets(attempt: AcceptAttempt) {.async.} = - let rawFd = setupTcpInjectingSocket() + let injectFd = setupTcpInjectingSocket() for dstPort in attempt.dstPorts: let synOut = IpPacket(protocol: tcp, ipAddrSrc: attempt.srcIp, ipAddrDst: attempt.dstIp, ipTTL: 2, @@ -262,7 +262,7 @@ proc injectSynPackets(attempt: AcceptAttempt) {.async.} = tcpSeqNumber: rand(uint32), tcpAckNumber: 0, tcpFlags: {SYN}, tcpWindowSize: 1452 * 10) echo &"[{synOut.ipAddrSrc}:{synOut.tcpPortSrc} -> {synOut.ipAddrDst}:{synOut.tcpPortDst}, SEQ {synOut.tcpSeqNumber}] injecting outgoing SYN" - await rawFd.injectTcpPacket(synOut) + await injectFd.injectTcpPacket(synOut) for seqNum in attempt.seqNums: let synIn = IpPacket(protocol: tcp, ipAddrSrc: attempt.dstIp, ipAddrDst: attempt.srcIp, ipTTL: 64, @@ -271,8 +271,8 @@ proc injectSynPackets(attempt: AcceptAttempt) {.async.} = tcpSeqNumber: seqNum, tcpAckNumber: 0, tcpFlags: {SYN}, tcpWindowSize: 1452 * 10) echo &"[{synIn.ipAddrSrc}:{synIn.tcpPortSrc} -> {synIn.ipAddrDst}:{synIn.tcpPortDst}, SEQ {synIn.tcpSeqNumber}] injecting incoming SYN" - await rawFd.injectTcpPacket(synIn) - closeSocket(rawFd) + await injectFd.injectTcpPacket(synIn) + closeSocket(injectFd) proc accept*(puncher: TcpSyniPuncher, srcPort: Port, dstIp: IpAddress, dstPorts: seq[Port],