Blog

Building Gor (Go Replay) on Windows

Gor, or Go Replay, is a great tool to replicate traffic from a production system to a test environment. The tool itself comes prebuilt for OSX and Linux however it lacks a Windows build as there aren’t any free CI tools providing a Windows environment. With that in mind, let’s go over the steps to build this great tool on Windows.

Gor is built using the Go Programming Language. Go compiles code to a native binary for your operating system and uses GNU tools to compile so we have to assemble some parts to get this all working. There are nuances in building Windows binaries, especially around a i386/i686 (32-bit) versus amd64 (x86_64 64-bit), so for this build we will focus around using 32-bit versions of tools. Listed below are all the components you need to get Gor built along with the specific versions I tested with.

First install mingw. You can follow the mingw getting started document for details but the basics are as follows. MinGW should be installed to C:MinGW. You will want to set an environment variable to point to C:MinGWbin. You can do this in your current session by running:

set PATH=%PATH%;C:MinGWbin

Next using mingw-get you will install gcc. If the command doesn’t work, ensure that the c:MinGWbin is on the path.

mingw-get install gcc

Go ahead and install WinPcap and enable the service. Once you have that installed you will want to extract the developer pack and copy everything in the Include directory to c:MinGWinclude and copy from Lib the files libpacket.a libwpcap.a Packet.lib wpcap.lib to C:MinGWlib (excluding the files from x64). This will ensure that you have the necessary headers and files to build Gor’s raw TCO listener.

Finally, to get everything working together, install Go from the msi using defaults (check go install docs for more details). Ensure go works from the command line and then setup your workspace environment as follows. You may want to setup the GOPATH as a Windows user environment variable.

mkdir %HOMEPATH%workset GOPATH=%HOMEPATH%work

Run the Git installer and make sure git works from the command line.

We are in the homestretch. The steps now are very similar to the gor compilation page.

cd %GOPATH%go get github.com/buger/gorcd src/github.com/buger/gorgo build -ldflags="-extldflags "-static""""

After that