简体   繁体   English

如何在Robot框架中使用Scapy库?

[英]How to use Scapy library in Robot framework?

I am using Robot framework (RFW) to test protocol testing stuff. 我正在使用机器人框架(RFW)来测试协议测试内容。 I need to send Protocol (BGP, OSPF, DNS, DHCPv6, STP, SIP etc) traffic to my device under test. 我需要将协议(BGP,OSPF,DNS,DHCPv6,STP,SIP等)流量发送到被测设备。

I have analyzed "Rammbock Library", but I think it's not fulfilling my requirements. 我已经分析了“ Rammbock库”,但是我认为它不能满足我的要求。 I am familiar with Scapy to send protocol traffic. 我熟悉Scapy发送协议流量。 So I am planning to use Scapy library in RFW. 因此,我计划在RFW中使用Scapy库。

I got following links: 我得到以下链接:

But I am not getting idea on how to use this in RFW. 但是我不知道如何在RFW中使用它。 I mean the keywords. 我的意思是关键字。

Anybody have idea on following questions. 任何人都对以下问题有想法。

  1. How to build a packet in this library? 如何在此库中构建数据包?

  2. How to view the packet? 如何查看数据包?

  3. How to send that packet? 如何发送该数据包?

RF has keyword in BuiltIn to call a method of a object. RF在BuiltIn中具有关键字来调用对象的方法。

for example - scapy object have show() or show2() method to display a frame. 例如-scapy对象具有show()或show2()方法来显示框架。

""" contents of s.py (as a library) """
from scapy.all import *
def make_ether_icmp_pkt():
    return Ether()/ICMP()


#------------ test --------------------
*** Settings ***
Library  s.py  WITH NAME  S

*** Test Cases ***
simple
  ${P}=  S.make_ether_icmp_pkt
  call method  ${P}  show
  Log  ${P.type}

1, 3: scapy itself can do it - for RF keyword you need to convert scapy module as a RF library, and loaded as a remote library if you use scapy in remote machine. 1,3:scapy本身可以做到-对于RF关键字,您需要将scapy模块转换为RF库,如果在远程计算机中使用scapy,则需要将其作为远程库加载。

  1. protocol decode you can use tshark - command-line tool of wireshark, to decode captured packets in .pcap file. 协议解码,您可以使用Wireshark的tshark-命令行工具对.pcap文件中捕获的数据包进行解码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM