当前位置: 首页 > news >正文

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

相关文章:

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

gor是一款流量复制回放工具&#xff0c;gor工具的官网&#xff1a;https://goreplay.org/ 1、对某个端口的http流量进行打印 ./gor --input-raw :8000 --output-stdout 2、对流量实时转发&#xff0c;把81端口流量转发到192.168.3.221:80端口 ./gor --input-raw :81--output-ht…...

设计模式之单例设计模式

单例设计模式 2.1 孤独的太阳盘古开天&#xff0c;造日月星辰。2.2 饿汉造日2.3 懒汉的队伍2.4 大道至简 读《秒懂设计模式总结》 单例模式(Singleton)是一种非常简单且容易理解的设计模式。顾名思义&#xff0c;单例即单一的实例&#xff0c;确切地讲就是指在某个系统中只存在…...

Java自学到什么程度就可以去找工作了?

引言 Java作为一门广泛应用于软件开发领域的编程语言&#xff0c;对于初学者来说&#xff0c;了解到什么程度才能开始寻找实习和入职机会是一个常见的问题。 本文将从实习和入职这两个方面&#xff0c;分点详细介绍Java学习到什么程度才能够开始进入职场。并在文章末尾给大家安…...

三、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…...

【SA8295P 源码分析】19 - QNX Host NFS 文件系统配置

【SA8295P 源码分析】19 - QNX Host NFS 文件系统配置 一、NFS Server二、NFS Client三、NFS 相关的文件及目录四、将文件放入QNX 文件系统中五、编译下载验证系列文章汇总见:《【SA8295P 源码分析】00 - 系列文章链接汇总》 本文链接:《【SA8295P 源码分析】19 - QNX Host N…...

JRE、JDK、JVM及JIT之间有什么不同?_java基础知识总结

当涉及Java编程和执行时&#xff0c;以下术语具有不同的含义&#xff1a; 1.JRE (Java Runtime Environment) JRE是Java运行时环境的缩写。它是一个包含用于在计算机上运行Java应用程序所需的组件集合。JRE包括了以下几个主要部分&#xff1a; Java虚拟机(JVM)&#xff1a;用…...

sqlite3数据库的实现

sqlite3代码实现数据库的插入、删除、修改、退出功能 #include <head.h> #include <sqlite3.h> #include <unistd.h> int do_insert(sqlite3 *db); int do_delete(sqlite3 *db); int do_update(sqlite3 *db);int main(int argc, const char *argv[]) {sqlit…...

c#设计模式-结构型模式 之 桥接模式

前言 桥接模式是一种设计模式&#xff0c;它将抽象与实现分离&#xff0c;使它们可以独立变化。这种模式涉及到一个接口作为桥梁&#xff0c;使实体类的功能独立于接口实现类。这两种类型的类可以结构化改变而互不影响。 桥接模式的主要目的是通过将实现和抽象分离&#xff0c;…...

【Vue-Router】导航守卫

前置守卫 main.ts import { createApp } from vue import App from ./App.vue import {router} from ./router // import 引入 import ElementPlus from element-plus import element-plus/dist/index.css const app createApp(App) app.use(router) // use 注入 ElementPlu…...

07无监督学习——降维

1.降维的概述 维数灾难(Curse of Dimensionality):通常是指在涉及到向量的计算的问题中&#xff0c;随着维数的增加&#xff0c;计算量呈指数倍增长的一种现象。 1.1什么是降维&#xff1f; 1.降维(Dimensionality Reduction)是将训练数据中的样本(实例)从高维空间转换到低维…...

系列七、IOC操作bean管理(xml自动装配)

一、概述 自动装配是根据指定规则&#xff08;属性名称或者属性类型&#xff09;&#xff0c;Spring自动将匹配的属性值进行注入。 二、分类 xml自动装配分为按照属性名称自动装配&#xff08;byName&#xff09;和按照属性类型自动装配&#xff08;byType&#xff09;。 2.1…...

01- vdom 和模板编译源码

组件渲染的过程 template --> ast --> render --> vDom --> 真实的Dom --> 页面 Runtime-Compiler和Runtime-Only的区别 - 简书 编译步骤 模板编译是Vue中比较核心的一部分。关于 Vue 编译原理这块的整体逻辑主要分三个部分&#xff0c;也可以说是分三步&am…...

C++入门知识点——解决C语言不足

&#x1f636;‍&#x1f32b;️Take your time ! &#x1f636;‍&#x1f32b;️ &#x1f4a5;个人主页&#xff1a;&#x1f525;&#x1f525;&#x1f525;大魔王&#x1f525;&#x1f525;&#x1f525; &#x1f4a5;代码仓库&#xff1a;&#x1f525;&#x1f525;魔…...

探秘分布式大数据:融合专业洞见,燃起趣味火花,启迪玄幻思维

文章目录 一 数据导论二 大数据的诞生三 大数据概论3.1 大数据的5V特征3.2 大数据的工作核心 四 大数据软件生态4.1 数据存储软件4.2 数据计算软件4.3 数据传输软件 五 Apache Hadoop概述5.1 Apache Hadoop框架5.2 Hadoop的功能5.3 Hadoop的发展5.4 Hadoop发行版本 一 数据导论…...

什么是 SPI,和API有什么区别?

面试回答 Java 中区分 API 和 SPI&#xff0c;通俗的讲&#xff1a;API 和 SPI 都是相对的概念&#xff0c;他们的差别只在语义上&#xff0c;API 直接被应用开发人员使用&#xff0c;SPI 被框架扩展人员使用。 API Application Programming Interface 大多数情况下&#xff…...

python3 安装clickhouse_sqlalchemy(greenlet) 失败

环境信息&#xff1a; centos7操作系统&#xff0c;python3.8 执行pip3 install clickhouse_sqlalchemy或者pip3 install greenlet报以下报错&#xff1a; Command "/opt/python3.6.10-customized/bin/python3.6 -u -c "import setuptools, tokenize;file/tmp/pip-in…...

五款拿来就能用的炫酷表白代码

「作者主页」&#xff1a;士别三日wyx 「作者简介」&#xff1a;CSDN top100、阿里云博客专家、华为云享专家、网络安全领域优质创作者 「推荐专栏」&#xff1a;小白零基础《Python入门到精通》 五款炫酷表白代码 1、无限弹窗表白2、做我女朋友好吗&#xff0c;不同意就关机3、…...

Springboot 封装整活 Mybatis 动态查询条件SQL自动组装拼接

前言 ps&#xff1a;最近在参与3100保卫战&#xff0c;战况很激烈&#xff0c;刚刚打完仗&#xff0c;来更新一下之前写了一半的博客。 该篇针对日常写查询的时候&#xff0c;那些动态条件sql 做个简单的封装&#xff0c;自动生成&#xff08;抛砖引玉&#xff0c;搞个小玩具&a…...

宝塔部署Java+Vue前后端分离项目经验总结

前言 之前部署服务器都是在Linux环境下自己一点一点安装软件&#xff0c;听说用宝塔傻瓜式部署更快&#xff0c;这次浅浅尝试了一把。 确实简单&#xff01; 1、 买服务器 咋买服务器略&#xff0c;记得服务器装系统就装 Cent OS 7系列即可&#xff0c;我装的7.6。 2、创建…...

【公告】停止更新

CSDN 博客的限制太多了。阅读体验也非常差。后续将不再 CSDN 上更新。 逐步迁移到掘金和个人博客。 欢迎关注 掘金&#xff1a;0xforee 个人博客&#xff1a;0xforee’s blog...

剑指offer20_链表中环的入口节点

链表中环的入口节点 给定一个链表&#xff0c;若其中包含环&#xff0c;则输出环的入口节点。 若其中不包含环&#xff0c;则输出null。 数据范围 节点 val 值取值范围 [ 1 , 1000 ] [1,1000] [1,1000]。 节点 val 值各不相同。 链表长度 [ 0 , 500 ] [0,500] [0,500]。 …...

将对透视变换后的图像使用Otsu进行阈值化,来分离黑色和白色像素。这句话中的Otsu是什么意思?

Otsu 是一种自动阈值化方法&#xff0c;用于将图像分割为前景和背景。它通过最小化图像的类内方差或等价地最大化类间方差来选择最佳阈值。这种方法特别适用于图像的二值化处理&#xff0c;能够自动确定一个阈值&#xff0c;将图像中的像素分为黑色和白色两类。 Otsu 方法的原…...

学习STC51单片机31(芯片为STC89C52RCRC)OLED显示屏1

每日一言 生活的美好&#xff0c;总是藏在那些你咬牙坚持的日子里。 硬件&#xff1a;OLED 以后要用到OLED的时候找到这个文件 OLED的设备地址 SSD1306"SSD" 是品牌缩写&#xff0c;"1306" 是产品编号。 驱动 OLED 屏幕的 IIC 总线数据传输格式 示意图 …...

CMake控制VS2022项目文件分组

我们可以通过 CMake 控制源文件的组织结构,使它们在 VS 解决方案资源管理器中以“组”(Filter)的形式进行分类展示。 🎯 目标 通过 CMake 脚本将 .cpp、.h 等源文件分组显示在 Visual Studio 2022 的解决方案资源管理器中。 ✅ 支持的方法汇总(共4种) 方法描述是否推荐…...

【Java学习笔记】BigInteger 和 BigDecimal 类

BigInteger 和 BigDecimal 类 二者共有的常见方法 方法功能add加subtract减multiply乘divide除 注意点&#xff1a;传参类型必须是类对象 一、BigInteger 1. 作用&#xff1a;适合保存比较大的整型数 2. 使用说明 创建BigInteger对象 传入字符串 3. 代码示例 import j…...

HashMap中的put方法执行流程(流程图)

1 put操作整体流程 HashMap 的 put 操作是其最核心的功能之一。在 JDK 1.8 及以后版本中&#xff0c;其主要逻辑封装在 putVal 这个内部方法中。整个过程大致如下&#xff1a; 初始判断与哈希计算&#xff1a; 首先&#xff0c;putVal 方法会检查当前的 table&#xff08;也就…...

SiFli 52把Imagie图片,Font字体资源放在指定位置,编译成指定img.bin和font.bin的问题

分区配置 (ptab.json) img 属性介绍&#xff1a; img 属性指定分区存放的 image 名称&#xff0c;指定的 image 名称必须是当前工程生成的 binary 。 如果 binary 有多个文件&#xff0c;则以 proj_name:binary_name 格式指定文件名&#xff0c; proj_name 为工程 名&…...

DAY 45 超大力王爱学Python

来自超大力王的友情提示&#xff1a;在用tensordoard的时候一定一定要用绝对位置&#xff0c;例如&#xff1a;tensorboard --logdir"D:\代码\archive (1)\runs\cifar10_mlp_experiment_2" 不然读取不了数据 知识点回顾&#xff1a; tensorboard的发展历史和原理tens…...

手动给中文分词和 直接用神经网络RNN做有什么区别

手动分词和基于神经网络&#xff08;如 RNN&#xff09;的自动分词在原理、实现方式和效果上有显著差异&#xff0c;以下是核心对比&#xff1a; 1. 实现原理对比 对比维度手动分词&#xff08;规则 / 词典驱动&#xff09;神经网络 RNN 分词&#xff08;数据驱动&#xff09…...

Easy Excel

Easy Excel 一、依赖引入二、基本使用1. 定义实体类&#xff08;导入/导出共用&#xff09;2. 写 Excel3. 读 Excel 三、常用注解说明&#xff08;完整列表&#xff09;四、进阶&#xff1a;自定义转换器&#xff08;Converter&#xff09; 其它自定义转换器没生效 Easy Excel在…...