testing - 使用 Peach Fuzzer 模糊 TCP 数据包

标签 testing networking tcp fuzzing fuzz-testing

我有两个应用程序,Sender.exe 和 Receiver.exe。我必须对发送方与接收方之间发送的 tcp 数据包进行模糊测试。

我是 Peach Fuzzer 的初学者。您能否提供一个示例(Peach Pit)来说明如何对 TCP 数据包进行模糊测试。我无法在互联网上找到样本。

最佳答案

给定的代码可能会对您有所帮助。此 xml PIT 代码将使用请求 header 向本地主机发送 GET 请求

GET https://localhost HTTP/1.1
HOST : http://localhost
content-length: {some value depend ur body}

{body}

只需将此 xml 放入文件,然后 ./peach -1 --debug pathtofile/file.xml

<?xml version="1.0" encoding="utf-8"?>
<Peach xmlns="http://peachfuzzer.com/2012/Peach" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://peachfuzzer.com/2012/Peach /peach/peach.xsd">
<DataModel name="Headermodel">
    <String name="Header" /> 
    <String value=": "/> 
    <String name="Value" /> 
    <String value="\r\n" /> 
</DataModel>


<DataModel name="HttpRequest">
 <!-- The HTTP reqest line: GET http://foo.coi HTTP/l.O -->
    <Block name= "RequestLine"> 
        <String name="Method"/>
        <String value=" "/> 
        <String name="RequestUri"/> 
        <String value=" "/>
        <String name="HttpVersion"/>
        <String value="\r\n"/> 
    </Block> 

    <Block name="HeaderHost" ref="Headermodel"> 
        <String name="Header" value="Host" /> 
    </Block> 

    <Block name="HeaderContentLength" ref="Headermodel"> 
        <String name="Header" value="Content-Length" /> 
        <!-- <String name="Header" value="Content-Length" />  -->
        <String name="Value"> 
            <Relation type="size" of="httpBody.content"/> 
        </String> 
    </Block> 

    <!-- <String value="\r\n"/>  -->

    <Block name="httpBody"> 
        <String name="content" value="length is 12" /> 
    </Block> 
</DataModel>


 <Data name="HttpGet" > 
    <Field name="RequestLine.Method" value="GET"/>
    <Field name="RequestLine.RequestUri" value="http://localhost" />
    <Field name="RequestLine.HttpVersion" value="HTTP/1.1"/>
    <Field name="HeaderHost.Value" value="http://localhost"/>
    <Field name="httpBody.content" value="\r\nfuzz"/>
 </Data> 

 <Data name="HttpOptions" ref="HttpGet"> 
    <Field name="RequestLine.Method" value="OPTIONS"/> 
    <Field name="RequestLine.RequestUri" value="*" /> 
    <Field name="HeaderHost.Value" value="" /> 
 </Data> 

 <StateModel name="State1" initialState="Initial"> 
    <State name="Initial">
        <Action type="output">
            <DataModel ref="HttpRequest"/>
            <Data ref="HttpGet"/> 
        </Action> 
    </State> 
</StateModel> 

<StateModel name="State2" initialState="Initial"> 
    <State name="Initial"> 
        <Action type="output"> 
            <DataModel ref="HttpRequest" /> 
            <Data ref="HttpOptions" />
        </Action> 
    </State> 
</StateModel>

<Test name="Default">
        <StateModel ref="State1"/>

        <Publisher class="TcpClient">
                <Param name="Host" value="localhost" />
                <Param name="Port" value="80" />
        </Publisher>
        <Logger class="File">
            <Param name="Path" value="logs"/>
        </Logger>
</Test>

关于testing - 使用 Peach Fuzzer 模糊 TCP 数据包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31041926/

相关文章:

python - Django 1.8 中的登录测试用例失败

django - 如何测试具有 transaction.atomic(using=myDb) 的 Django View ?

testing - 在 TestCafe 中切换到 iframe 上下文后找不到元素

algorithm - 不清楚 Nagle 的算法

perl - 我如何在 Perl 中进行单元测试?

networking - 在elasticsearch实例上开启open GCE防火墙进行外部连接

java - 将 UDP 与 NIO 一起使用有什么意义?

java - 如何在 Java 上同时支持 IPv4 和 IPv6

c - 如何在linux内核中丢弃tcp数据包但一次又一次地收不到?

Linux TCP 接受无 SYN|ACK