def main(dst, ttl):
    iface, src, _ = networking.get_route(dst)
    if ROOT_USER_ID == os.geteuid():
        sniffer = networking.create_sniffer(iface, src, dst)
        probe = DnsWrongAnswerProbe(src, SPORT, dst, DPORT, int(ttl), sniffer)
        sniffer.start_sniffing()
        probe.poke()
        time.sleep(2)
        sniffer.stop_sniffing()
        report = probe.peek()
    else:
        probe = DnsWrongAnswerProbe(src, SPORT, dst, DPORT, int(ttl), sniffer=None)
        probe.poke()
        time.sleep(2)
        report = probe.peek()
        report.pop('ROUTER_IP')
    report.pop('PACKETS')
    print(report)
def main(dst, sport, ttl):
    iface, src, _ = networking.get_route(dst)
    if ROOT_USER_ID == os.geteuid():
        sniffer = networking.create_sniffer(iface, src, dst)
        probe = UdpPacketDropProbe(src, int(sport), dst, 53, int(ttl), sniffer)
        sniffer.start_sniffing()
        probe.poke()
        time.sleep(2)
        sniffer.stop_sniffing()
        report = probe.peek()
    else:
        probe = UdpPacketDropProbe(src, int(sport), dst, 53, int(ttl), sniffer=None)
        probe.poke()
        time.sleep(2)
        report = probe.peek()
    packets = report.pop('PACKETS')
    print(report)
    for mark, packet in packets:
        formatted_packet = packet.sprintf('%.time% %IP.src% -> %IP.dst% %TCP.flags%')
        print('[%s] %s' % (mark, formatted_packet))
Exemple #3
0
def main(dst, ttl, offending_payload_type='HTTP'):
    iface, src, _ = networking.get_route(dst)
    dport = HTTP_DPORT if 'HTTP' == offending_payload_type else DNS_DPORT
    if ROOT_USER_ID == os.geteuid():
        sniffer = networking.create_sniffer(iface, src, dst)
        probe = TcpRstProbe(src, SPORT, dst, dport, int(ttl), sniffer,
            offending_payload_type=offending_payload_type)
        sniffer.start_sniffing()
        probe.poke()
        time.sleep(2)
        sniffer.stop_sniffing()
        report = probe.peek()
    else:
        probe = TcpRstProbe(src, SPORT, dst, dport, int(ttl), sniffer=None,
            offending_payload_type=offending_payload_type)
        probe.poke()
        time.sleep(2)
        report = probe.peek()
    packets = report.pop('PACKETS')
    print(report)
    for mark, packet in packets:
        formatted_packet = packet.sprintf('%.time% %IP.src% -> %IP.dst% %TCP.flags%')
        print('[%s] %s' % (mark, formatted_packet))