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.mzph.cn/news/45737.shtml

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

相关文章

第一百三十一天学习记录:数据结构与算法基础:栈和队列(下)(王卓教学视频)

队列的表示和操作的实现 循环顺序队列是一种使用数组来实现的队列结构&#xff0c;其中头指针和尾指针表示队列的头部和尾部位置。 当队列为空时&#xff0c;头指针和尾指针都指向同一个位置&#xff0c;即数组的第一个位置。这是因为在空队列中&#xff0c;没有任何元素可以作…

【算法刷题之数组篇(1)】

目录 1.leetcode-59. 螺旋矩阵 II&#xff08;题2.题3相当于二分变形&#xff09;2.leetcode-33. 搜索旋转排序数组3.leetcode-81. 搜索旋转排序数组 II(与题目2对比理解)&#xff08;题4和题5都是排序双指针&#xff09;4.leetcode-15. 三数之和5.leetcode-18. 四数之和6.leet…

系统卡死问题分析

CPU模式 CPU Frequency Scaling (CPUFREQ) Introduction CPU频率调节设备驱动程序的功能。该驱动程序允许在运行过程中更改CPU的时钟频率。一旦CPU频率被更改,必要的电源供应电压也会根据设备树脚本(DTS)中定义的电压值进行变化。通过降低时钟速度,这种方法可以减少功耗…

第2步---MySQL卸载和图形化工具展示

第2步---MySQL卸载和图形化工具展示 1.MySQL的卸载 2.MySQL的图形化工具 2.1常见的图形化工具 SQLyog&#xff1a;简单。SQLyog首页、文档和下载 - MySQL 客户端工具 - OSCHINA - 中文开源技术交流社区 Mysql Workbench &#xff1a;MySQL :: MySQL Workbench DataGrip&…

PHP-MD5注入

0x00 前言 有些零散的知识未曾关注过&#xff0c;偶然捡起反而更加欢喜。 0x01 md5 注入绕过 md5函数有两个参数&#xff0c;第一个参数是要进行md5的值&#xff0c;第二个值默认为false&#xff0c;如果为true则返回16位原始二进制格式的字符串。意思就是会将md5后的结果当…

什么是BEM命名规范?为什么要使用BEM命名规范?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ BEM命名规范⭐ 为什么使用BEM命名规范&#xff1f;⭐ 写在最后 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 记得点击上方或者右侧链接订阅本专栏哦 几何带你启航前端之旅 欢迎来到前端入门之旅&#xff01;这个专栏是为…

市面上那里有稳定L2股票行情数据接口?

随着市场的发展和技术的进步&#xff0c;level2股票行情数据接口已经成为股票交易软件的标准配置之一。虽然这些券商软件的功能在很大程度上相似&#xff0c;但它们仍然有自己的特点和优势。 例如&#xff1a;通过股票交易所以其专业的研究报告和丰富的信息服务而受到广泛关注&…

登陆接口的的Filter过滤

目录 一、概述 二、基本操作 三、登陆检查接口 一、概述 什么是Filter&#xff1f; Filter表示过滤器&#xff0c;是 JavaWeb三大组件(Servlet、Filter、Listener)之一。 过滤器可以把对资源的请求拦截下来&#xff0c;从而实现一些特殊的功能 使用了过滤器之后&#xff0…

2、手写模拟Spring底层原理

创建BeanDefinition bean定义 设置BeanDefinition 的类信息&#xff0c;作用域信息 创建beanDefinitionMap scope为原型&#xff1a; scope为单例&#xff1a; 总结&#xff1a; 扫描ComponentScan注解上的包扫描路径&#xff0c;将Component注解修饰的类&#xff0c;生成Bea…

实现简单的element-table的拖拽效果

第一步&#xff0c;先随便创建element表格 <el-table ref"dragTable" :data"tableData" style"width: 100%" border fit highlight-current-row><el-table-column label"日期" width"180"><template slot-sc…

基于Spring Boot的机场VIP客户管理系统的设计与实现(Java+spring boot+MySQL)

获取源码或者论文请私信博主 演示视频&#xff1a; 基于Spring Boot的机场VIP客户管理系统的设计与实现&#xff08;Javaspring bootMySQL&#xff09; 使用技术&#xff1a; 前端&#xff1a;html css javascript jQuery ajax thymeleaf 微信小程序 后端&#xff1a;Java s…

6G 特点及表现

6G R&D Vision: Requirements and Candidate Technologies 5G已经提出来了大移动带宽&#xff0c;低时延和大规模机器互联&#xff0c;在这个基础上&#xff0c;6G加上了高可靠性&#xff0c;高定位精度和高智能化。 6G的主要候选技术&#xff0c;包括(子) THz 通信&#x…

微服务-Nacos(配置管理)

配置更改热更新 在Nacos中添加配置信息&#xff1a; 在弹出表单中填写配置信息&#xff1a; 配置获取的步骤如下&#xff1a; 1.引入Nacos的配置管理客户端依赖&#xff08;A、B服务&#xff09;&#xff1a; <!--nacos的配置管理依赖--><dependency><groupId&…

【仿写tomcat】五、响应静态资源(访问html页面)、路由支持以及多线程改进

访问html页面 如果我们想访问html页面其实就是将本地的html文件以流的方式响应给前端即可&#xff0c;下面我们对HttpResponseServlet这个类做一些改造 package com.tomcatServer.domain;import com.tomcatServer.utils.ScanUtil;import java.io.IOException; import java.io…

Facebook AI mBART:巴别塔的硅解

2018年&#xff0c;谷歌发布了BERT&#xff08;来自transformers的双向编码器表示&#xff09;&#xff0c;这是一种预训练的语言模型&#xff0c;在一系列自然语言处理&#xff08;NLP&#xff09;任务中对SOTA结果进行评分&#xff0c;并彻底改变了研究领域。类似的基于变压器…

Tomcat 一次请求的生命周期

在使用 Tomcat 的时候&#xff0c;我们只需要在 Servlet 实现类中写我们的业务逻辑代码即可&#xff0c;不需要管 Socket 连接、协议处理要怎么实现&#xff0c;因为这部分作为不经常变动的部分&#xff0c;被封装到了 Tomcat 中&#xff0c;程序员只需要引入 Tomcat 中即可&am…

免费开源服务器资源监控系统grafana+prometheus+node_exporter

有项目做测试的时候需要查询服务器资源利用情况&#xff0c;自己又没写相应的模块&#xff0c;此时就需要一套好用的资源监控系统&#xff0c;&#xff0c;咨询了运维人员给推荐了一套&#xff0c;装完后真的很好用。 就是grafanaprometheusnode_exporter&#xff08;linux&am…

三、Kafka生产者

目录 3.1 生产者消息发送流程3.1.1 发送原理 3.2 异步发送 API3.3 同步发送数据3.4 生产者分区3.4.1 kafka分区的好处3.4.2 生产者发送消息的分区策略3.4.3 自定义分区器 3.5 生产者如何提高吞吐量3.6 数据可靠性 3.1 生产者消息发送流程 3.1.1 发送原理 3.2 异步发送 API 3…

30.Netty源码服务端启动主要流程

highlight: arduino-light 服务端启动主要流程 •创建 selector •创建 server socket channel •初始化 server socket channel •给 server socket channel 从 boss group 中选择一个 NioEventLoop •将 server socket channel 注册到选择的 NioEventLoop 的 selector •…

Ubuntu20.04安装Nvidia显卡驱动教程

1、禁用nouveau 1、创建文件&#xff0c;如果没有下载vim编辑器&#xff0c;将vim换成gedit即可 $ sudo vim /etc/modprobe.d/blacklist-nouveau.conf 2、在文件中插入以下内容&#xff0c;将nouveau加入黑名单&#xff0c;默认不开启 blacklist nouveau options nouveau m…