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

news2025/1/29 14:08:00

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

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

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

 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的运行参数如下:

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/894402.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

自适应混沌蜣螂优化算法及其MALTAB实现

本文改进主要参考&#xff1a; S. Li and J. Li, “Chaotic dung beetle optimization algorithm based on adaptive t-Distribution,” 2023 IEEE 3rd International Conference on Information Technology, Big Data and Artificial Intelligence (ICIBA), Chongqing, China…

滑块验证2

滑块示例 介绍 滑块图片地址接口获取,两张(滑块图和背景缺口图)验证通过校验为接口校验,需要一个uuid和位移拼接成校验地址uuid能通过接口获取,位移需计算得到缺口位移计算 需将两张图片区分保存,然后通过特定工具包计算出位移 所需包 opencv-python 部分代码 def _t…

陪诊小程序|服务到家就医陪伴更不可少

随着科技的不断发展和医疗服务的日益完善&#xff0c;陪诊小程序成为了当下为炙手可热的医疗软件之一。无论是患者还是医护人员&#xff0c;陪诊小程序都为他们提供了全新的就医体验和便捷的服务。下面让我们一同探索一下陪诊小程序的软件开发功能。 一、陪诊小程序功能&#x…

2018年3月全国计算机等级考试真题(语言二级C)

2018年3月全国计算机等级考试真题&#xff08;语言二级C&#xff09; 第1题 设有定义&#xff1a;char s[81]&#xff1b;int i0&#xff1b;以下不能将一行带有空格的字符串正确读入的语句或语句组是 A. while((s[i]getchar())!\n);s[i]\0; B. scanf("%s",s); C.…

数组累加器-reduce、reduceRight

数组累加器-reduce 一、基本语法1.reduce2.reduceRight 二、具体使用1.reduce2.reduceRight 三、使用场景1.数组求和2.数组求积3.计算数组中每个元素出现的次数 一、基本语法 1.reduce reduce() &#xff1a;对数组中的每个元素按序执行一个提供的 reducer 函数&#xff0c;每…

高效使用ChatGPT之ChatGPT客户端

ChatGPT客户端&#xff0c;支持Mac, Windows, and Linux 下载地址见文章结尾 软件截图 Windows: Mac&#xff1a; 说明 chatgpt桌面版&#xff0c;相比于网页版的chatgpt&#xff0c;最大的特色是支持历史聊天对话记录导出&#xff0c;且支持三种格式&#xff1a;PNG、PDF、…

i.MX6ULL开发板无法进入NFS挂载文件系统的解决办法

问题 使用NFS网络挂载文件系统后卡住无法进入系统。 解决办法 此处不详细讲述NFS安装流程 查看板卡挂载在/home/etc/rc.init下的自启动程序 进入到../../home/etc目录下&#xff0c;查看rc.init文件&#xff0c;首先从第一行排查&#xff0c;查看/home/etc/netcfg文件代码内容&…

AI版 PS AI beta 25.0的完整包

介绍&#xff1a; PS AI beta 25.0的完整包&#xff0c;还有一个神经网络滤镜&#xff0c;以及简体中文补丁。 离线完整包&#xff0c;直接安装就可以用&#xff0c;不需要国外注册登录&#xff0c;不需要国外网络做图&#xff0c;支持中文生成。安装文件目录&#xff1a; 3.安…

FinalShell SSH工具安装教程及编辑窗口修改背景颜色,自定义背景图片,修改字体,修改快捷键(详细图文教程)

FinalShell 在 Windows 上提供了一个方便、安全、功能完备的远程管理工具。它的中文支持和自定义功能让其适合国内 Linux 系统管理者使用。与 Xshell 等软件相比&#xff0c;FinalShell 更注重功能实用性。 目录 FinalShellFinalShell的安装教程FinalShell 的一些主要功能和特点…

破局!低代码直击智慧园区建设痛点!

从捷码官网获取的捷码产品体验账号&#xff0c;用浏览器打开下列地址即可&#xff08;推荐电脑端哈&#xff09;&#xff0c;需要自取&#xff1a; http://dev.gemcoder.com/front/development/index.html#/officialLogin?jmcmVnaXN0ZXI9dHJ1ZQ%3D%3D 随着大数据、物联网、云计…

open suse 15.5(任意版本) 使用阿里云的repo

一、shell suse 的包管理工具叫 zypper. zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/15.5/repo/oss/ openSUSE-15.5-Oss zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/15.5/repo/non-oss/ openSUSE-15.5-Non-Oss …

CS5523 MIPI/DSI转EDP信号转换芯片|pin√pin替代龙迅LT8911方案

ASL新推出CS5523是一款MIPI DSI输入、DP/e DP输出转换芯片。MIPI DSI最多支持4个通道&#xff0c;每个通道的最大运行速度为1.5Gps。对于DP 1.2输出&#xff0c;它由4个数据通道组成&#xff0c;支持1.62Gbps和2.7Gbps的链路速率。它支持2560的最高分辨率*144060Hz.它只能使用单…

pdf怎么合并在一起?这几个合并方法了解一下

pdf怎么合并在一起&#xff1f;在日常工作、学习和生活中&#xff0c;我们常常会遇到需要将多个PDF文件合并成一个文件的情况。比如&#xff0c;在学术论文写作中&#xff0c;我们可能需要将多篇论文合并成一个文件进行打印和提交。在工作中&#xff0c;我们可能需要将多个报告…

2023年上半年软件设计师下午真题及答案解析

试题一(15分) 随着农业领域科学种植的发展&#xff0c;需要对农业基地及农事进行信息化管理&#xff0c;为租户和农户等人员提供种植相关服务&#xff0c;现欲开发农事管理服务平台&#xff0c;其主要功能是&#xff1a; (1)人员管理&#xff1a;平台管理员管理租户&#xff…

msvcp120.dll丢失的解决方法?哪种解决方法比较常用?

msvcp140.dll是Microsoft Visual C Redistributable的一部分&#xff0c;它是Windows操作系统中的一个动态链接库文件。这个文件包含了许多C标准库函数的实现&#xff0c;对于一些依赖C标准库的应用程序来说&#xff0c;msvcp140.dll是非常重要的。msvcp140.dll的主要用途是提供…

python编程中有哪些方便的调试方法

大家好&#xff0c;给大家分享一下一个有趣的事情&#xff0c;很多人还不知道这一点。下面详细解释一下。现在让我们来看看&#xff01; 对于每个程序开发者来说&#xff0c;调试几乎是必备技能。常用Pycharm编辑器里的方法有Print大法、log大法&#xff0c;但缺少类似Matlab的…

2024浙大MBA/MEM/MPA四个月冲刺备考策略

近期收到很多考生的咨询&#xff1a;距离联考就仅剩四个多月的时间&#xff0c;这个管理类联考的难度如何&#xff1f;主要考些什么内容&#xff1f;现在才开始备考还有希望上岸浙大吗&#xff1f;是不是要等到明年在开始备考比较合适&#xff1f;那么今天在这里小立老师就跟大…

《凤凰架构》第二章——访问远程服务

前言 这章挺难的&#xff0c;感觉离我比较远&#xff0c;不太好懂&#xff0c;简单记录吧。 这章主要讲访问远程服务&#xff0c;主要对比了RPC和REST的区别&#xff0c;可以结合知乎上的文章《既然有 HTTP 请求&#xff0c;为什么还要用 RPC 调用&#xff1f;》 这篇文章进行…

电脑提示丢失(或找不到)msvcp120.dll解决办法

msvcp140.dll是Microsoft Visual C Redistributable的一部分&#xff0c;它是Windows操作系统中的一个动态链接库文件。这个文件包含了许多C标准库函数的实现&#xff0c;对于一些依赖C标准库的应用程序来说&#xff0c;msvcp140.dll是非常重要的。msvcp140.dll的主要用途是提供…

学计算机只能是赛博打灰人?转嵌入式你就已经稳了!

最近有很多大一新生问我&#xff0c;自己不小心被录到计算机专业了&#xff0c;是不是以后最好就只能大厂996&#xff0c;做赛博打灰人&#xff0c;然后三十五岁直接被优化呢&#xff1f; 我说&#xff0c;你这种人正是嵌入式最需要的人&#xff0c;进入嵌入式行业不仅天然具有…