-
Notifications
You must be signed in to change notification settings - Fork 29
Getting Started
To start working with Gor, you need to have a web server running on your machine and terminal to run commands. If you are just poking around, you can quickly start the server by calling python -m SimpleHTTPServer 8000
, this will start simple file server of the current directory on port 8000
.
Download the latest Gor binary from https://github.com/buger/gor/releases (we provide precompiled binaries for Linux x64 and Mac OS), or you can compile by yourself Compilation.
Once the archive is downloaded and uncompressed, you run Gor from the current directory, or you may want to copy binary to your PATH (for Linux and Mac OS it can be /usr/local/bin
).
Now run this command in terminal: sudo ./gor --input-raw :8000 --output-dummy=""
This command says to listen for all network activity happening on port 8000 and log it to stdout.
If you are familiar with tcpdump
, we going to implement similar functionality.
You may notice that it will ask for the password: to analyze network Gor need permissions which available only to root users. However, it is possible to configure Gor [beign run for non-root users](Running as a non-root user).
Make a few requests by opening http://localhost:8000
in your browser, or just by calling curl in terminal curl http://localhost:8000
. You should see that Gor
outputs all the HTTP requests and responses right to terminal window where it is running.
Gor is not a proxy; you do not need to put 3-rd party tool to your critical path. Instead Gor just silently analyzes the traffic of your application and do not affect it anyhow.
Now it's time to replay your original traffic to another environment. Let's start same file web server but on a different port: python -m SimpleHTTPServer 8001
.
Instead of --output-dummy
we will use --output-http
and provide URL of second server: sudo ./gor --input-raw :8000 --output-http="http://localhost:8001"
Make few requests to first server. You should see them replicated to the second one, voila!
Sometimes it's not possible to replay requests in real time; Gor allows you save requests to the file and replay them later.
First use --output-file
to save them: sudo ./gor --input-raw :8000 --output-file=requests.gor
. This will create new file and continiously write all captured requests to it.
Let's re-run Gor, and run again but now it will replay requests from file: ./gor --input-file requests.gor --output-http="http://localhost:8001"
. You should see all the recorded requests coming to the second server, and they will be replayed in the same order and with exactly same timing as they were recorded.
Next: The Basics