lundi 18 juillet 2016

building a get packet with scapy

I am trying to create an http get packet and I have a problem, the server does not return an answer.

def make_GET(url):
    ip_address = find_ip(url)
    if not ip_address:
        return False
    syn = IP(dst=ip_address) / TCP(dport=80, flags='S')
    syn_ack = sr1(syn, timeout=2)
    if not syn_ack:
        return False
    get_str = 'GET / HTTP/1.1rnHost: '+url+'rnrn'
    request = IP(dst=ip_address) / TCP(dport=80, sport=syn_ack[TCP].dport,
             seq=syn_ack[TCP].ack, ack=syn_ack[TCP].seq + 1, flags='A') / get_str
    request.show()
    reply = sr(request, timeout=2)
    if not reply:
        return False

Aucun commentaire:

Enregistrer un commentaire