zoukankan      html  css  js  c++  java
  • sendip工具详解

    sendip是linux下的命令行发包工具。

    结构

    sendip 网络层 上一层 数据 hostname

    格式

    sendip [-v] [-d data] [-h] [-f datafile] [-p module] [module options] hostname
    • hostname是目的主机,即此数据包的第一个路由目标,可使用网址和 ip。hostname 字段可以和 -id 的值不同,此时该数据包在主机发出后的第一个路由目标是 hostname 字段指示的地址,但该数据的的目的 ip 地址为 -id 的值。
    • -d 要携带的数据。
    • -f 从文件中读取要携带的数据。
    • -p 指定发送报文的类型,选项就是帮助提示中的ipv4 ipv6 icmp tcp udp bgp rip ntp的8种类型,注意各个协议之间的搭配使用,例如ntp是用udp传输,而rip是用tcp传输。这个参数可以复用来更加精确的确定一个报文的类型和各个字段,例如:-p ipv4 –p tcp –p rip是可以一起用的。该参数必须配置。
    • -v 打印整个发出的数据包。

    相应-p的用法可以用-h查询,如

    sendip -p ipv6 -h
    sendip -p ipv6 -6s 2001:db1::2000 -p icmp -h

    另外,报文的源IP不必是网卡上存在的IP,可以根据个人需求任意构造。

    例子

    sendip -p ipv6 -6s 2001:db1::2000 -p icmp -ct 1 -cd 3 -d 0xcafecafe 2001:db1:3:4:add1:4e2f:a095:2811
    # 从2001:db1::2000地址发送icmpv6 type=1 code=3的报文至2001:db1:3:4:add1:4e2f:a095:2811
    # 注意data,即-d部分,不宜太短,比如只写0xcafe就抓不到包
    sendip -p ipv6 -6s 2001:db1::2000 -p udp -ud 11111 -d 0xcafecafe 2001:db1:3:4:add1:4e2f:a095:2811
    # 从2001:db1::2000地址发送ipv6 udp dstport=11111的报文至2001:db1:3:4:add1:4e2f:a095:2811
  • 相关阅读:
    0841. Keys and Rooms (M)
    0478. Generate Random Point in a Circle (M)
    0714. Best Time to Buy and Sell Stock with Transaction Fee (M)
    0535. Encode and Decode TinyURL (M)
    1721. Swapping Nodes in a Linked List (M)
    0823. Binary Trees With Factors (M)
    1461. Check If a String Contains All Binary Codes of Size K (M)
    0623. Add One Row to Tree (M)
    1332. Remove Palindromic Subsequences (E)
    0706. Design HashMap (E)
  • 原文地址:https://www.cnblogs.com/lldxz/p/11738702.html
Copyright © 2011-2022 走看看