I am trying to implement a receiving side of the TCP protocol via scapy.
I have node A who sends some random json file over TCP to node B, and I am trying to write the receiving side of TCP using scapy for node B. I am sniffing packets in scapy and trying to ACK incoming packets from node B.
I have figured out how to set correct ACK and SEQ numbers for the ACK packets I construct, but I'm struggling with creating correct Timestamp TCP options. I have read in RFC-1323 that Timestamp contains TSval and TSecr. I set TSecr by copying the TSval from the incoming packet, but from what I understand, I need to set TSval to be the current time of the system. I'm not sure how to get the time correctly. I tried doing the following in python
import time
TSval = int(time.time())
But it doesn't give me the correct value because the value of TSecr is something like 3130283869 whereas the above snippet gives me something like 1539307653 (almost 2x smaller). It's not clear to me what kind of time is represented by Tsecr and TSval. Is it epoch time? Is it something else?