GithubHelp home page GithubHelp logo

ustb_network_course_design's Introduction

使用Jpcap发送ARP以及ICMP请求

一、实验过程

这里写图片描述

  1. 首先获取本地的网卡以及IP信息
  2. 输入当前网关的地址,在这个拓扑图中也就是172.17.5.1
  3. 程序封装ARP请求,向网关发送ARP请求
  4. 抓取ARP相应的包,过滤之后获得网关的MAC地址
  5. 输入要PING的目的IP,即172.16.5.7
  6. 抓取ICMP相应的包,过滤之后输出ECHO和REPLY的包

PS:特别注意

在ARP的发送的包中: 源IP和源MAC地址是自己本地的IP(172.17.5.6)和MAC地址 目的IP是网关的IP(172.17.5.1),目的MAC地址是全F(表示广播,此时并不知道目的MAC地址)

在ICMP的发送的包中: 源IP和源MAC地址是自己本地的IP(172.17.5.6)和MAC地址 目的IP是PC2的IP(172.16.5.7),目的MAC地址是网关的MAC(也就是之前ARP获得的MAC地址)

之所以目的MAC地址是网关的MAC地址,而不是PC2的MAC地址。 是因为所有的数据包只需要交给路由器负责分组转发即可。 本身并不需要知道另一个网段的IP和MAC的映射关系。 但是,一些路由器会有ARP代理的功能,简单来说就是如果有这项功能的话,目的MAC地址写PC2的MAC地址也会成功的发送出去。

二、项目结构

这里写图片描述

Packet包: 下面所有的Packet来源于Jpcap的源码,是各个报文的字段的属性,在这个项目中并没有用到

Util包: 下面是将byte[]转化为int方便输出的工具类

ARP: 程序的入口,运行Main函数即可运行

JpcapPacket: demo程序,用于检测环境是否搭配好

ARPAttackTest、ARPCheatAttack: 用于测试ARP攻击

三、运行

  1. 搭建开发环境:如何搭建开发环境
  2. 运行ARP中的Main函数

ustb_network_course_design's People

Contributors

wchstrife avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.