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 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

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Qt+Pyhton实现麒麟V10系统下word文档读写功能

目录 前言1.C调用python1.1 安装Python开发环境1.2 修改Qt工程配置1.3 初始化Python环境1.4 C 调用Python 函数1.5 常用的Python接口 2.python虚拟环境2.1Python虚拟环境简介2.2 virtualenv 安装及使用2.3 在C程序中配置virtualenv 虚拟环境 3.python-docx库的应用4.总结 前言 …

基于YOLOv8模型和PCB电子线路板缺陷目标检测系统(PyTorch+Pyside6+YOLOv8模型)

摘要&#xff1a;基于YOLOv8模型PCB电子线路板缺陷目标检测系统可用于日常生活中检测与定位PCB线路板瑕疵&#xff0c;利用深度学习算法可实现图片、视频、摄像头等方式的目标检测&#xff0c;另外本系统还支持图片、视频等格式的结果可视化与结果导出。本系统采用YOLOv8目标检…

panda3d加载模型复习和python面向对象编程属性学习

运行一个python示例&#xff1b;然后去除一些代码&#xff0c;只剩下加载模型相关&#xff0c;如下&#xff1b; from panda3d.core import loadPrcFileData # Configure the parallax mapping settings (these are just the defaults) loadPrcFileData("", "p…

Vue.js知识点学习的一点笔记

一、虚拟DOM 1、原生JS是命令式编程&#xff0c;当渲染在页面的数据发生一点点变化&#xff0c;需要整个重新渲染一编。vue.js渐进式框架有个虚拟DOM的概念&#xff0c;运用diff算法&#xff0c;比较新旧数据&#xff0c;相同的数据不变不重渲染&#xff0c;不同的部分新数据覆…

python 连接Redis 数据库

pip install redis python代码 import redis# 连接数据库 r redis.Redis(host192.168.56.15, port6379, db0)# 存储数据 #r.set(key, value) r.set(name, zaraNet)# 获取数据 value r.get(name) print(value)# 关闭连接&#xff08;可选&#xff09; r.close()

spring boot 整合mongodb

1、安装依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-mongodb</artifactId></dependency>2、配置数据库连接 spring:data:mongodb:host: localhostport: 27017username: xxxxxxp…

.fargo后缀勒索病毒|勒索病毒解密恢复|fargo勒索病毒解密|勒索病毒解密恢复|数据库恢复

fargo勒索病毒概述&#xff0c;fargo勒索病毒解密恢复及日常防护建议 目录&#xff1a; fargo勒索病毒介绍感染fargo勒索病毒后的表现fargo勒索病毒的感染形式如何恢复.fargo后缀勒索病毒fargo勒索病毒日常防护建议 简介&#xff1a; 河北某有限公司的财务系统&#xff0c;由…

拼多多商品详情API接入站点,实时数据json格式示例

作为国内最大的电商平台之一&#xff0c;拼多多数据采集具有多个维度。 有人需要采集商品信息&#xff0c;包括品类、品牌、产品名、价格、销量等字段&#xff0c;以了解商品销售状况、热门商品属性&#xff0c;进行市场扩大和重要决策&#xff1b; 商品数据&#xff1a;拼…

【数字实验室】时钟切换

大部分开发者使用 BUFGCTRL 或 BUFGMUX进行时钟切换&#xff0c;它们在时钟切换上可以提供无毛刺输出。然而&#xff0c;了解所涉及的原理是有好处的。 当然&#xff0c;无论我们在同步逻辑中使用哪种技术&#xff0c;重要的是要确保在进行时钟切换时输出上没有毛刺。任何故障都…

docker安装Oracle11gR2

文章目录 目录 文章目录 前言 一、前期准备 二、具体配置 2.1 配置oracle容器 2.2 配置navicat连接 总结 前言 使用docker模拟oracle环境 一、前期准备 安装好docker #拉取镜像 docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g #启动 docker run -…

YOLOv5改进系列(22)——替换主干网络之MobileViTv1(一种轻量级的、通用的移动设备 ViT)

【YOLOv5改进系列】前期回顾: YOLOv5改进系列(0)——重要性能指标与训练结果评价及分析 YOLOv5改进系列(1)——添加SE注意力机制

安防监控/视频集中存储/云存储平台EasyCVR v3.3增加首页告警类型

安防监控/视频集中存储/云存储EasyCVR视频汇聚平台&#xff0c;可支持海量视频的轻量化接入与汇聚管理。平台能提供视频存储磁盘阵列、视频监控直播、视频轮播、视频录像、云存储、回放与检索、智能告警、服务器集群、语音对讲、云台控制、电子地图、平台级联、H.265自动转码等…

亚马逊搜索关键词下单怎么操作

亚马逊鲲鹏系统可以根据产品关键词搜索后进行下单购买&#xff0c;多个亚马逊买家号搜索关键词下单可以帮助关键词上首页&#xff0c;具体操作如下&#xff1a; 首先需要先准备好一批能下单的买家账号及代理ip&#xff0c;准备好之后就可以设置需要下单的关键词及asin进行货比…

Navicat 蝉联 2023年度 DBTA 读者选择奖的“最佳数据库管理员解决方案”奖项和 DBTA 100 强名单

近日&#xff0c;Database Trends and Applications (简称 DBTA) 颁发的“读者选择奖”获奖名单新鲜出炉&#xff0c;Navicat 蝉联 2023 年度 DBTA 读者选择奖的“最佳数据库管理员&#xff08;DBA&#xff09;解决方案”奖项和 DBTA 100 强名单&#xff0c;我们感到无比荣幸和…

AutoHotkey:定时删除目录下指定分钟以前的文件,带UI界面

删除指定目录下&#xff0c;所有在某个指定分钟以前的文件&#xff0c;可以用来清理经常生成很多文件的目录&#xff0c;但又需要保留最新的一部分文件 支持拖放目录到界面 能够记忆设置&#xff0c;下次启动后不用重新设置&#xff0c;可以直接开始 应用场景比如&#xff1a…

Python制作爱心并打包成手机端可执行文件

前言 本文是想要将python代码打包成在手机上能执行的文件 尝试了几个库&#xff0c; 有这也那样的限制&#xff0c;最终还是选了BeeWare 环境&#xff1a;python3.7.x 开始 找到打包有相关工具os-android-apk-builder&#xff0c;buildozer&#xff0c;cx_Freeze&#xff…

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

uniapp 顶部头部样式

<u-navbartitle"商城":safeAreaInsetTop"true"><view slot"left"><image src"/static/logo.png" mode"" class"u-w-50 u-h-50"></image></view></u-navbar>

深入了解 Java 中 Files 类的常用方法及抽象类的 final 修饰

文章目录 Files 类常用方法抽象类的 final 修饰 &#x1f389;欢迎来到Java学习路线专栏~深入了解 Java 中 Files 类的常用方法及抽象类的 final 修饰 ☆* o(≧▽≦)o *☆嗨~我是IT陈寒&#x1f379;✨博客主页&#xff1a;IT陈寒的博客&#x1f388;该系列文章专栏&#xff1a…

JetBrains IDE远程开发功能可供GitHub用户使用

JetBrains与GitHub去年已达成合作&#xff0c;提供GitHub Codespaces 与 JetBrains Gateway 之间的集成。 GitHub Codespaces允许用户创建安全、可配置、专属的云端开发环境&#xff0c;此集成意味着您可以通过JetBrains Gateway使用在 GitHub Codespaces 中运行喜欢的IDE进行…