from scapy.all import *
import sys
import re


def showSEQs(src,pktno):
	prevSEQ = 0
	for x in range(0,pktno):
		i=IP()
		i.dst=src
		t=TCP()
		t.dport = 513
		t.flags = "S"
		ans = sr1(i/t, verbose=0)
		print "[+] Received SEQ %d" % ans[TCP].seq
		if (x != 0) :
			print "[+] Difference between consecutive SEQ: %d" % (ans[TCP].seq - prevSEQ)
		prevSEQ = ans[TCP].seq

src = "172.16.10.1"
print "[*] Showing SEQ numbers for %s" % src
pktno = 15
showSEQs(src,pktno)
