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

 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 valueSet the buffer size for an individual request (default 5MB)-cpuprofile stringwrite cpu profile to file-exit-after durationexit after specified duration-http-allow-header valueA 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 valueWhitelist 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 valueA 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 valueA 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 valueA 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 valueA 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 valueTakes 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-hostNormally 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 valueTakes 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 :8181Enable profiling. Starts  http server on specified port, exposing special /debug/pprof endpoint. Example: :8181-http-rewrite-header valueRewrite 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 valueRewrite 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 valueInject additional headers to http request:gor --input-raw :8080 --output-http staging.com --http-set-header 'User-Agent: Gor'-http-set-param valueSet 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 valueUsed for testing outputs. Emits 'Get /' request every 1s-input-file valueRead requests from file: gor --input-file ./requests.gor --output-http staging.com-input-file-dry-runSimulate reading from the data source without replaying it. You will get information about expected replay time, number of found records etc.-input-file-loopLoop input files, useful for performance testing.-input-file-max-wait durationSet 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 intGoReplay 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 stringSend 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-formatIf turned on, it will assume that messages coming in JSON format rather than  GoReplay text format.-input-kafka-topic stringSend request and response stats to Kafka:gor --output-stdout --input-kafka-topic 'kafka-log'-input-raw valueCapture traffic from given port (use RAW sockets and require *sudo* access):# Capture traffic from 8080 portgor --input-raw :8080 --output-http staging.com-input-raw-allow-incompleteIf turned on Gor will record HTTP messages with missing packets-input-raw-bpf-filter stringBPF 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 valueControls 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 durationset the pcap timeout. for immediate mode don't set this flag-input-raw-engine libpcapIntercept traffic using libpcap (default), `raw_socket` or `pcap_file`-input-raw-expire durationHow much it should wait for the last TCP packet, till consider that TCP message complete. (default 2s)-input-raw-monitorenable RF monitor mode-input-raw-override-snaplenOverride the capture snaplen to be 64k. Required for some Virtualized environments-input-raw-promiscenable promiscuous mode-input-raw-protocol valueSpecify application protocol of intercepted traffic. Possible values: http, binary-input-raw-realip-header stringIf 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-statsenable stats generator on raw TCP messages-input-raw-timestamp-type stringPossible 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-responseIf turned on Gor will track responses in addition to requests, and they will be available to middleware and file output.-input-tcp valueUsed for internal communication between Gor instances. Example: # Receive requests from other Gor instances on 28020 port, and redirect output to staginggor --input-tcp :28020 --output-http staging.com-input-tcp-certificate stringPath to PEM encoded certificate file. Used when TLS turned on.-input-tcp-certificate-key stringPath to PEM encoded certificate key file. Used when TLS turned on.-input-tcp-secureTurn on TLS security. Do not forget to specify certificate and key files.-kafka-tls-ca-cert stringCA 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 stringClient certificate for Kafka TLS Config (mandatory with to kafka-tls-ca-cert and kafka-tls-client-key)-kafka-tls-client-key stringClient Key for Kafka TLS Config (mandatory with to kafka-tls-client-cert and kafka-tls-client-key)-memprofile stringwrite memory profile to this file-middleware stringUsed for modifying traffic using external command-output-binary valueForwards 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-debugEnables binary debug output.-output-binary-timeout durationSpecify HTTP request/response timeout. By default 5s. Example: --output-binary-timeout 30s-output-binary-track-responseIf turned on, Binary output responses will be set to all outputs like stdout, file and etc.-output-binary-workers intGor uses dynamic worker scaling by default.  Enter a number to run a set number of workers.-output-file valueWrite incoming requests to file: gor --input-raw :80 --output-file ./requests.gor-output-file-appendThe flushed chunk is appended to existence file or not. -output-file-buffer stringThe 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 durationInterval for forcing buffer flush to the file, default: 1s. (default 1s)-output-file-max-size-limit valueMax size of output file, Default: 1TB-output-file-queue-limit intThe length of the chunk queue. Default: 256 (default 256)-output-file-size-limit valueSize of each chunk. Default: 32mb-output-http valueForwards 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 stringSend 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 intNumber of requests that can be queued for output, if all workers are busy. default = 1000 (default 1000)-output-http-redirects intEnable how often redirects should be followed.-output-http-response-buffer valueHTTP response buffer size, all data after this size will be discarded.-output-http-skip-verifyDon't verify hostname on TLS secure connection.-output-http-statsReport http output queue stats to console every N milliseconds. See output-http-stats-ms-output-http-stats-ms intReport http output queue stats to console every N milliseconds. default: 5000 (default 5000)-output-http-timeout durationSpecify HTTP request/response timeout. By default 5s. Example: --output-http-timeout 30s (default 5s)-output-http-track-responseIf turned on, HTTP output responses will be set to all outputs like stdout, file and etc.-output-http-worker-timeout durationDuration to rollback idle workers. (default 2s)-output-http-workers intGor uses dynamic worker scaling. Enter a number to set a maximum number of workers. default = 0 = unlimited.-output-http-workers-min intGor uses dynamic worker scaling. Enter a number to set a minimum number of workers. default = 1.-output-kafka-host stringRead 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-formatIf turned on, it will serialize messages from GoReplay text format to JSON.-output-kafka-topic stringRead request and response stats from Kafka:gor --input-raw :8080 --output-kafka-topic 'kafka-log'-output-nullUsed for testing inputs. Drops all requests.-output-stdoutUsed for testing inputs. Just prints to console data coming from inputs.-output-tcp valueUsed for internal communication between Gor instances. Example: # Listen for requests on 80 port and forward them to other Gor instance on 28020 portgor --input-raw :80 --output-tcp replay.local:28020-output-tcp-response-buffer valueTCP response buffer size, all data after this size will be discarded.-output-tcp-secureUse TLS secure connection. --input-file on another end should have TLS turned on as well.-output-tcp-skip-verifyDon't verify hostname on TLS secure connection.-output-tcp-statsReport TCP output queue stats to console every 5 seconds.-output-tcp-stickyUse Sticky connection. Request/Response with same ID will be sent to the same connection.-output-tcp-workers intNumber of parallel tcp connections, default is 10 (default 10)-prettify-httpIf 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 trueBy default each output gets same traffic. If set to true it splits traffic equally among all outputs.-statsTurn on queue stats output-verbose intset the level of verbosity, if greater than zero then it will turn on debug output

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

学C的第三十四天【程序环境和预处理】

相关代码gitee自取&#xff1a; C语言学习日记: 加油努力 (gitee.com) 接上期&#xff1a; 学C的第三十三天【C语言文件操作】_高高的胖子的博客-CSDN博客 1 . 程序的翻译环境和执行环境 在ANSI C(C语言标准)的任何一种实现中&#xff0c;存在两个不同的环境。 &#xff0…

如何取消订阅IEEE membership的email

最近小虎开了一个IEEE Student Member&#xff0c;邮箱都快被IEEE给爆箱了。所以想办法取消订阅其邮件&#xff0c;但是保留其member身份。 方法 在profile界面选择communication preferences and policies, Uncheck所有communications&#xff0c;选择I only want to recei…

Java之接口

作者简介&#xff1a; zoro-1&#xff0c;目前大一&#xff0c;正在学习Java&#xff0c;数据结构等 作者主页&#xff1a; zoro-1的主页 欢迎大家点赞 &#x1f44d; 收藏 ⭐ 加关注哦&#xff01;&#x1f496;&#x1f496; Java之接口 接口的概念语法规则接口特性接口使用案…

DTC 19服务学习2

紧跟上篇 0x04 reportDTCSnapshotRecordByDTCNumber 通过DTC和快照序列来获取DTC快照记录。 适用以下假设&#xff1a; — 服务器支持存储给定 DTC 的两个 DTCSnapshot 记录的能力。 — 此示例假定是上一个示例的延续。 — 假设服务器请求服务器存储的 DTC 编号 123456 的两个…

攻防世界-backup

原题 解题思路 备份文件后缀大多是bak、git、svn、swp等&#xff0c;尝试index.php.bak就有文件下载了:

1、攻防世界第一天

1、网站目录下会有一个robots.txt文件&#xff0c;规定爬虫可以/不可以爬取的网站。 2、URL编码细则&#xff1a;URL栏中字符若出现非ASCII字符&#xff0c;则对其进行URL编码&#xff0c;浏览器将该请求发给服务端&#xff1b;服务端会可能会先对收到的url进行解码&#xff0…

【HBZ分享】java中的BitSet 与 Redis中的BitMap 与 布隆过滤器

BitMap的存储原理 bitMap他会标识出某个整数是否存在&#xff0c;存在即为1&#xff0c;不存在对应位即为0bitMap是存储int类型的&#xff0c;int 4byte&#xff0c; 1byte 8bit&#xff0c;因此bitMap数组中的每个下标可以标识出32个数字是否存在bitMap相当于一个个小格子&…

解决方案:如何在 Amazon EMR Serverless 上执行纯 SQL 文件?

《大数据平台架构与原型实现&#xff1a;数据中台建设实战》一书由博主历时三年精心创作&#xff0c;现已通过知名IT图书品牌电子工业出版社博文视点出版发行&#xff0c;点击《重磅推荐&#xff1a;建大数据平台太难了&#xff01;给我发个工程原型吧&#xff01;》了解图书详…

IP 地址监控工具

地址监控实用程序是一套 IP 工具&#xff0c;包括 IP 地址监控工具、流氓检测工具和 MAC 地址解析器&#xff0c;用于日常监控和管理 DNS 名称、IP和 MAC 地址。地址监控工具用于 IP监控&#xff0c;用于管理 DNS 名称、网络的 IP 和 MAC 地址&#xff0c;并跟踪 IP 地址。 IP…

uniapp配置添加阿里巴巴图标icon流程步骤

文章目录 下载复制文件到项目文件夹里项目配置目录结构显示图标 下载 阿里巴巴icon官网 https://www.iconfont.cn/ 复制文件到项目文件夹里 项目配置目录结构 显示图标

智能监控系统的守护者:人工智能行为识别技术的崛起与发展

人工智能助力监控系统&#xff1a;行为识别在安全监控中的应用与挑战 摘要&#xff1a; 随着人工智能技术的快速发展&#xff0c;行为识别在监控系统中的应用逐渐成为安全监控领域的重要工具。本文将详细探讨人工智能行为识别技术在监控系统中的应用&#xff0c;以及在实际应用…

JVM中分代回收机制

为什么要分为新生代和老年代&#xff1f; 分为新生代&#xff08;Young Generation&#xff09;和老年代&#xff08;Old Generation&#xff09;是为了更有效地管理和优化内存的使用。 新生代主要存放生命周期较短的对象&#xff0c;例如方法的局部变量、临时变量等。由于这…

数据结构-二叉树

在学习二叉树之前.必须先要掌握一些树的重要概念: 结点的度:一个结点含有的子树个数称为该结点的度.树的度:一棵树中,所有节点度的最大值称为树的度.叶子结点:度为0的结点称为叶子节点.(也叫终端结点)双亲结点:若一个结点含有子结点,则这个结点称为其子结点的双亲结点(也叫父节…

Egg.js构建一个stream流式接口服务

经常需要用到 stream 流式接口服务,比如&#xff1a;大文件下载、日志实时输出等等。本文将介绍如何使用Egg.js构建一个 stream 流式接口服务。 一、准备工作 目录结构&#xff1a; app//controllerindex.jstest.txttest.shindex.js 控制器test.txt 测试文件&#xff0c;最好…

申请部署阿里云SSL免费证书

使用宝塔自动创建的证书有时候会报NET::ERR_CERT_COMMON_NAME_INVALID&#xff0c;并且每次只能三个月&#xff0c;需要点击续期非常麻烦&#xff0c;容易遗忘。 阿里云免费SSL证书 前往阿里云管理控制台【数字证书管理服务】【SSL证书】&#xff0c;每年20个额度&#xff0c;一…

17.HPA和rancher

文章目录 HPA部署 metrics-server部署HPA Rancher部署Rancherrancher添加集群仪表盘创建 namespace仪表盘创建 Deployments仪表盘创建 service 总结 HPA HPA&#xff08;Horizontal Pod Autoscaling&#xff09;Pod 水平自动伸缩&#xff0c;Kubernetes 有一个 HPA 的资源&…

docker+haror

docker 2013年诞生&#xff0c;推荐单容器只运行一个程序或进程&#xff0c;形成一个分布式的应用模型。 总结下来就是&#xff1a;docker带来启动流程更快&#xff0c;运行效率较高、资源损耗较小&#xff0c;属于轻量级的服务。 docker的安装 推荐的一键化安装的脚本&#…

STM8遇坑[EEPROM读取debug不正常release正常][ STVP下载成功单运行不成功][定时器消抖莫名其妙的跑不通流程]

EEPROM读取debug不正常release正常 这个超级无语,研究和半天,突然发现调到release就正常了,表现为写入看起来正常读取不正常,这个无语了,不想研究了 STVP下载不能够成功运行 本文摘录于&#xff1a;https://blog.csdn.net/qlexcel/article/details/71270780只是做学习备份之…

Python面向对象植物大战僵尸

先来一波效果图 来看看如何设计游戏架构 import sysimport pygameclass BaseSprite(pygame.sprite.Sprite):def __init__(self, name):super().__init__()self.image pygame.image.load(name)self.rect self.image.get_rect()class AnimateSprite(BaseSprite):def __init__(…

Vue 2 处理边界情况

访问元素和组件 通过Vue 2 组件基础一文的学习&#xff0c;我们知道组件之间可以通过传递props或事件来进行通信。 但在一些情况下&#xff0c;我们使用下面的方法将更有用。 1.访问根实例 根实例可通过this.$root获取。 我们在所有子组件中都可以像上面那样访问根实例&…