gor工具http流量复制、流量回放,生产运维生气

这篇具有很好参考价值的文章主要介绍了gor工具http流量复制、流量回放,生产运维生气。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

 gor是一款流量复制回放工具,gor工具的官网:https://goreplay.org/

1、对某个端口的http流量进行打印

./gor --input-raw :8000 --output-stdout

gor工具http流量复制、流量回放,生产运维生气,网络,http,网络协议,网络,流量复制,流量回放,HTTP静态服务器

 2、对流量实时转发,把81端口流量转发到192.168.3.221:80端口

./gor --input-raw :81--output-http="http://192.168.3.221:80"

3、把抓取到的流量以文件的形式存储到磁盘上

./gor --input-raw :8000 --output-file=requests.gor

4、对抓取到的流量进行回放

#流量回放到192.168.3.221:80
./gor --input-file requests.gor --output-http="http://192.168.3.221:80"
#流量回放打印到屏幕上
./gor --input-file requests.gor --output-stdout

5、快速开一个静态服务器

./gor file-server :8000

6、gor的运行参数如下:文章来源地址https://www.toymoban.com/news/detail-657894.html

Gor is a simple http traffic replication tool written in Go. Its main goal is to replay traffic from production servers to staging and dev environments.
Project page: https://github.com/buger/gor
Author: <Leonid Bugaev> leonsbox@gmail.com
Current Version: v1.3.0

  -copy-buffer-size value
        Set the buffer size for an individual request (default 5MB)
  -cpuprofile string
        write cpu profile to file
  -exit-after duration
        exit after specified duration
  -http-allow-header value
        A regexp to match a specific header against. Requests with non-matching headers will be dropped:
                 gor --input-raw :8080 --output-http staging.com --http-allow-header api-version:^v1
  -http-allow-method value
        Whitelist of HTTP methods to replay. Anything else will be dropped:
                gor --input-raw :8080 --output-http staging.com --http-allow-method GET --http-allow-method OPTIONS
  -http-allow-url value
        A regexp to match requests against. Filter get matched against full url with domain. Anything else will be dropped:
                 gor --input-raw :8080 --output-http staging.com --http-allow-url ^www.
  -http-basic-auth-filter value
        A regexp to match the decoded basic auth string against. Requests with non-matching headers will be dropped:
                 gor --input-raw :8080 --output-http staging.com --http-basic-auth-filter "^customer[0-9].*"
  -http-disallow-header value
        A regexp to match a specific header against. Requests with matching headers will be dropped:
                 gor --input-raw :8080 --output-http staging.com --http-disallow-header "User-Agent: Replayed by Gor"
  -http-disallow-url value
        A regexp to match requests against. Filter get matched against full url with domain. Anything else will be forwarded:
                 gor --input-raw :8080 --output-http staging.com --http-disallow-url ^www.
  -http-header-limiter value
        Takes a fraction of requests, consistently taking or rejecting a request based on the FNV32-1A hash of a specific header:
                 gor --input-raw :8080 --output-http staging.com --http-header-limiter user-id:25%
  -http-original-host
        Normally gor replaces the Host http header with the host supplied with --output-http.  This option disables that behavior, preserving the original Host header.
  -http-param-limiter value
        Takes a fraction of requests, consistently taking or rejecting a request based on the FNV32-1A hash of a specific GET param:
                 gor --input-raw :8080 --output-http staging.com --http-param-limiter user_id:25%
  -http-pprof :8181
        Enable profiling. Starts  http server on specified port, exposing special /debug/pprof endpoint. Example: :8181
  -http-rewrite-header value
        Rewrite the request header based on a mapping:
                gor --input-raw :8080 --output-http staging.com --http-rewrite-header Host: (.*).example.com,$1.beta.example.com
  -http-rewrite-url value
        Rewrite the request url based on a mapping:
                gor --input-raw :8080 --output-http staging.com --http-rewrite-url /v1/user/([^\/]+)/ping:/v2/user/$1/ping
  -http-set-header value
        Inject additional headers to http request:
                gor --input-raw :8080 --output-http staging.com --http-set-header 'User-Agent: Gor'
  -http-set-param value
        Set request url param, if param already exists it will be overwritten:
                gor --input-raw :8080 --output-http staging.com --http-set-param api_key=1
  -input-dummy value
        Used for testing outputs. Emits 'Get /' request every 1s
  -input-file value
        Read requests from file: 
                gor --input-file ./requests.gor --output-http staging.com
  -input-file-dry-run
        Simulate reading from the data source without replaying it. You will get information about expected replay time, number of found records etc.
  -input-file-loop
        Loop input files, useful for performance testing.
  -input-file-max-wait duration
        Set the maximum time between requests. Can help in situations when you have too long periods between request, and you want to skip them. Example: --input-raw-max-wait 1s
  -input-file-read-depth int
        GoReplay tries to read and cache multiple records, in advance. In parallel it also perform sorting of requests, if they came out of order. Since it needs hold this buffer in memory, bigger values can cause worse performance (default 100)
  -input-kafka-host string
        Send request and response stats to Kafka:
                gor --output-stdout --input-kafka-host '192.168.0.1:9092,192.168.0.2:9092'
  -input-kafka-json-format
        If turned on, it will assume that messages coming in JSON format rather than  GoReplay text format.
  -input-kafka-topic string
        Send request and response stats to Kafka:
                gor --output-stdout --input-kafka-topic 'kafka-log'
  -input-raw value
        Capture traffic from given port (use RAW sockets and require *sudo* access):
                # Capture traffic from 8080 port
                gor --input-raw :8080 --output-http staging.com
  -input-raw-allow-incomplete
        If turned on Gor will record HTTP messages with missing packets
  -input-raw-bpf-filter string
        BPF filter to write custom expressions. Can be useful in case of non standard network interfaces like tunneling or SPAN port. Example: --input-raw-bpf-filter 'dst port 80'
  -input-raw-buffer-size value
        Controls size of the OS buffer which holds packets until they dispatched. Default value depends by system: in Linux around 2MB. If you see big package drop, increase this value.
  -input-raw-buffer-timeout duration
        set the pcap timeout. for immediate mode don't set this flag
  -input-raw-engine libpcap
        Intercept traffic using libpcap (default), `raw_socket` or `pcap_file`
  -input-raw-expire duration
        How much it should wait for the last TCP packet, till consider that TCP message complete. (default 2s)
  -input-raw-monitor
        enable RF monitor mode
  -input-raw-override-snaplen
        Override the capture snaplen to be 64k. Required for some Virtualized environments
  -input-raw-promisc
        enable promiscuous mode
  -input-raw-protocol value
        Specify application protocol of intercepted traffic. Possible values: http, binary
  -input-raw-realip-header string
        If not blank, injects header with given name and real IP value to the request payload. Usually this header should be named: X-Real-IP
  -input-raw-stats
        enable stats generator on raw TCP messages
  -input-raw-timestamp-type string
        Possible values: PCAP_TSTAMP_HOST, PCAP_TSTAMP_HOST_LOWPREC, PCAP_TSTAMP_HOST_HIPREC, PCAP_TSTAMP_ADAPTER, PCAP_TSTAMP_ADAPTER_UNSYNCED. This values not supported on all systems, GoReplay will tell you available values of you put wrong one.
  -input-raw-track-response
        If turned on Gor will track responses in addition to requests, and they will be available to middleware and file output.
  -input-tcp value
        Used for internal communication between Gor instances. Example: 
                # Receive requests from other Gor instances on 28020 port, and redirect output to staging
                gor --input-tcp :28020 --output-http staging.com
  -input-tcp-certificate string
        Path to PEM encoded certificate file. Used when TLS turned on.
  -input-tcp-certificate-key string
        Path to PEM encoded certificate key file. Used when TLS turned on.
  -input-tcp-secure
        Turn on TLS security. Do not forget to specify certificate and key files.
  -kafka-tls-ca-cert string
        CA certificate for Kafka TLS Config:
                gor  --input-raw :3000 --output-kafka-host '192.168.0.1:9092' --output-kafka-topic 'topic' --kafka-tls-ca-cert cacert.cer.pem --kafka-tls-client-cert client.cer.pem --kafka-tls-client-key client.key.pem
  -kafka-tls-client-cert string
        Client certificate for Kafka TLS Config (mandatory with to kafka-tls-ca-cert and kafka-tls-client-key)
  -kafka-tls-client-key string
        Client Key for Kafka TLS Config (mandatory with to kafka-tls-client-cert and kafka-tls-client-key)
  -memprofile string
        write memory profile to this file
  -middleware string
        Used for modifying traffic using external command
  -output-binary value
        Forwards incoming binary payloads to given address.
                # Redirect all incoming requests to staging.com address 
                gor --input-raw :80 --input-raw-protocol binary --output-binary staging.com:80
  -output-binary-debug
        Enables binary debug output.
  -output-binary-timeout duration
        Specify HTTP request/response timeout. By default 5s. Example: --output-binary-timeout 30s
  -output-binary-track-response
        If turned on, Binary output responses will be set to all outputs like stdout, file and etc.
  -output-binary-workers int
        Gor uses dynamic worker scaling by default.  Enter a number to run a set number of workers.
  -output-file value
        Write incoming requests to file: 
                gor --input-raw :80 --output-file ./requests.gor
  -output-file-append
        The flushed chunk is appended to existence file or not. 
  -output-file-buffer string
        The path for temporary storing current buffer: 
                gor --input-raw :80 --output-file s3://mybucket/logs/%Y-%m-%d.gz --output-file-buffer /mnt/logs (default "/tmp")
  -output-file-flush-interval duration
        Interval for forcing buffer flush to the file, default: 1s. (default 1s)
  -output-file-max-size-limit value
        Max size of output file, Default: 1TB
  -output-file-queue-limit int
        The length of the chunk queue. Default: 256 (default 256)
  -output-file-size-limit value
        Size of each chunk. Default: 32mb
  -output-http value
        Forwards incoming requests to given http address.
                # Redirect all incoming requests to staging.com address 
                gor --input-raw :80 --output-http http://staging.com
  -output-http-elasticsearch string
        Send request and response stats to ElasticSearch:
                gor --input-raw :8080 --output-http staging.com --output-http-elasticsearch 'es_host:api_port/index_name'
  -output-http-queue-len int
        Number of requests that can be queued for output, if all workers are busy. default = 1000 (default 1000)
  -output-http-redirects int
        Enable how often redirects should be followed.
  -output-http-response-buffer value
        HTTP response buffer size, all data after this size will be discarded.
  -output-http-skip-verify
        Don't verify hostname on TLS secure connection.
  -output-http-stats
        Report http output queue stats to console every N milliseconds. See output-http-stats-ms
  -output-http-stats-ms int
        Report http output queue stats to console every N milliseconds. default: 5000 (default 5000)
  -output-http-timeout duration
        Specify HTTP request/response timeout. By default 5s. Example: --output-http-timeout 30s (default 5s)
  -output-http-track-response
        If turned on, HTTP output responses will be set to all outputs like stdout, file and etc.
  -output-http-worker-timeout duration
        Duration to rollback idle workers. (default 2s)
  -output-http-workers int
        Gor uses dynamic worker scaling. Enter a number to set a maximum number of workers. default = 0 = unlimited.
  -output-http-workers-min int
        Gor uses dynamic worker scaling. Enter a number to set a minimum number of workers. default = 1.
  -output-kafka-host string
        Read request and response stats from Kafka:
                gor --input-raw :8080 --output-kafka-host '192.168.0.1:9092,192.168.0.2:9092'
  -output-kafka-json-format
        If turned on, it will serialize messages from GoReplay text format to JSON.
  -output-kafka-topic string
        Read request and response stats from Kafka:
                gor --input-raw :8080 --output-kafka-topic 'kafka-log'
  -output-null
        Used for testing inputs. Drops all requests.
  -output-stdout
        Used for testing inputs. Just prints to console data coming from inputs.
  -output-tcp value
        Used for internal communication between Gor instances. Example: 
                # Listen for requests on 80 port and forward them to other Gor instance on 28020 port
                gor --input-raw :80 --output-tcp replay.local:28020
  -output-tcp-response-buffer value
        TCP response buffer size, all data after this size will be discarded.
  -output-tcp-secure
        Use TLS secure connection. --input-file on another end should have TLS turned on as well.
  -output-tcp-skip-verify
        Don't verify hostname on TLS secure connection.
  -output-tcp-stats
        Report TCP output queue stats to console every 5 seconds.
  -output-tcp-sticky
        Use Sticky connection. Request/Response with same ID will be sent to the same connection.
  -output-tcp-workers int
        Number of parallel tcp connections, default is 10 (default 10)
  -prettify-http
        If enabled, will automatically decode requests and responses with: Content-Encoding: gzip and Transfer-Encoding: chunked. Useful for debugging, in conjunction with --output-stdout
  -recognize-tcp-sessions
        [PRO] If turned on http output will create separate worker for each TCP session. Splitting output will session based as well.
  -split-output true
        By default each output gets same traffic. If set to true it splits traffic equally among all outputs.
  -stats
        Turn on queue stats output
  -verbose int
        set the level of verbosity, if greater than zero then it will turn on debug output

到了这里,关于gor工具http流量复制、流量回放,生产运维生气的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 先进API生产力工具eqable HTTP,一站式开发调试工具推荐

    Reqable是什么? Regable = Fiddler/Charles + Postman Reqable是HTTP一站式开发+调试国产化解决方案,拥有更便捷的体验,更先进的协议,更高效的性能和更精致的界面。 Reqable是一款跨平台的专业HTTP开发和调试工具,在全平台支持HTTP1、HTTP2和HTTP3(QUIC)协议,简单易用、功能先进、性能高效

    2024年02月11日
    浏览(53)
  • python3-API流量回放/锲约测试/自动化测试

    简介 http工具集,通过代理获取到API的请求与响应信息,将这些请求信息进行流量回放/锲约测试或快速生成用例, 亦可通过人工进行修改参数化提取、变量引用、断言等形成API自动化测试用例等! 你以为只是流量回放吗?错~走去瞧瞧v2版本! 看官~请记得给个 star 呗? 项目地址

    2024年02月04日
    浏览(32)
  • 【网络工程】网络流量分析工具 Wireshark

    Wireshark (前身 Ethereal):它是一个强大的网络封包分析软件工具 ! 此工具使用WinPCAP作为接口,直接与网卡进行数据报文交换。主要用来捕获截取网络数据包的,并自动解析数据包为用户显示数据包详细信息,供用户对数据包进行分析。 下载及安装: 点击这里 1.打开网址,进入

    2024年02月13日
    浏览(39)
  • Windows网络流量监控工具整理

    NetSpeedMonitor【国外】是Windows任务栏的轻量级网络监视工具栏。 只能监测实时网速和总流量。 只能运行在 Windows XP,Windows Server 2003,Windows Vista或Windows 7的计算机上。 监控TCP / UDP端点的连接表和带有简短流量概述 地址:https://web.archive.org/web/20140614061956/http://www.floriangilles.com:

    2024年02月05日
    浏览(55)
  • 免费开源使用的几款红黑网络流量工具,自动化的多功能网络侦查工具、超级关键词URL采集工具、Burpsuite被动扫描流量转发插件

    免费开源使用的几款红黑网络流量工具,自动化的多功能网络侦查工具、超级URL采集工具、Burpsuite被动扫描流量转发插件。 #################### 免责声明:工具本身并无好坏,希望大家以遵守《网络安全法》相关法律为前提来使用该工具,支持研究学习,切勿用于非法犯罪

    2024年02月12日
    浏览(39)
  • 网络安全应急响应工具之-流量安全取证NetworkMiner

    在前面的一些文章中,用了很多的章节介绍流量分析和捕获工具wireshark。Wireshark是一款通用的网络协议分析工具,非常强大,关于wireshark的更多介绍,请关注专栏,wireshark从入门到精通。本文将介绍一个专注于网络流量取证的工具NetworkMiner,其视角和wireshark是不同的。 Netwo

    2024年02月03日
    浏览(48)
  • Jtti:CentOS 7安装网络流量实时监控工具iftop的方法

    要在CentOS 7上安装网络流量实时监控工具iftop,您可以按照以下步骤操作: 打开终端:在CentOS 7上,打开终端以执行命令。 安装EPEL存储库:iftop通常包含在EPEL(Extra Packages for Enterprise Linux)存储库中。如果您还没有安装EPEL存储库,请使用以下命令安装: sudo yum install epel-rele

    2024年02月09日
    浏览(33)
  • 网络流量分析详解(包含OSI七层模型、TCP协议及Wireshark工具用法)

    这个系列讲的是整个网络流量分析流程,其中包含TCP协议、HTTP协议详解和Wireshark、Tcpdump的详细用法,现在只完成了其中一部分内容,每周更新,感兴趣的可以持续关注一下~ 内容比较杂,直接用 Ctrl+F 找自己需要的就可以 ​ 网络流量分析(NTA)可以描述为检查网络流量以表征所

    2023年04月12日
    浏览(90)
  • Qt编写监控实时显示和取流回放工具(回放支持切换进度)

    现在各个监控大厂做的设备,基本上都会支持通过rtsp直接取流显示,而且做的比较好的还支持通过rtsp回放取流,基本上都会约定一个字符串的规则,每个厂家都是不一样的规则,比如回放对应的rtsp地址还要带上时间范围,回放肯定要指定一个开始时间和结束时间。这里需要

    2024年02月10日
    浏览(50)
  • 读写分离的手段——主从复制,解决读流量大大高于写流量的问题

    假设说有这么一种业务场景,读流量显著高于写流量,你要怎么优化呢。因为写是要加锁的,可能就会阻塞你读请求。而且其实读多写少的场景还很多见,比如电商平台,用户浏览n多个商品才会买一个。 大部分人的思路可能是建个缓存来帮助 MySQL 抗住大部分的查询请求。但

    2024年01月20日
    浏览(28)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包