gadhash: Google Analytics Domain Hash Calculator
Calculates Google Analytics domain hash given domain(s).
When analyzing Google Analytics cookies, you will see an Urchin Tracking Module A (UTMA) value (utma=) in the URL. The part for comparison is only the number before the first dot ("."). For instance, in "utma=173272373.nnnnn...", the domain hash is 173272373 ("google.com", where n is any arbitrary number).
Enter only the domain (without the protocol, i.e. don't include "
http://") so that the domain hash will be calculated correctly. A hash value of 0 indicates an error.
This is a C++ CLI related to the Windows GUI C# version I wrote previously.
gadhash has a single
main.cpp file that contains all of the application code. As such, you can build the application using any compiler you are comfortable with that has C++11 support. CMake has been used to remain compiler-independent.
The following Boost 1.61.0 libraries are required dependencies for
See the Boost documentation for getting started on *nix. (there is also instructions for Windows but note that
gadhash intentionally targets Linux platforms—I also wrote a Windows GUI version, though, FYI).
Install CMake 3.8 or higher (if you don't already have it). This is a fairly new version so it may not be available in some package repositories. I recommend downloading it from cmake.org and following their installation instructions.
Once you have CMake installed, you can generate a Makefile for your platform by invoking
cmake and providing the path to the
CMakeLists.txt file at the root of this repository. For example:
This will generate a Makefile which you can then use to build the software:
This should result in a compiled binary being created for your system. You can also run
make install if you choose to after this.
Alternatively, you can just run
cmake --build [/path/to/CMakeLists.txt] and it should build regardless of the build system on your platform (especially useful if it doesn't support
gadhash expects a file (or
stdin) containing a list of domains separated by newlines (
\r—be sure to use UNIX/LF line endings).
gadhash [OPTION(s)] [FILE(s)] Options: -h [ --help ] get usage help -v [ --version ] display version -d [ --delimiter ] arg (=,) specify output delimiter string (comma/CSV by default; can be multiple characters) -f [ --file ] arg file(s) containing list of domains (one per line); gadhash reads stdin if no file(s) specified or a hyphen ('-') is given
If no options or file names are specified, gadhash will read from
std::string and assumes UTF-8 (POSIX)—I made no attempt to deal with wide characters (neither
wchar_t) nor alternate line endings (CR, i.e.
\r) to support Windows. I only intended for this to work on Linux. That said, feel free to fork this code and make it support whatever you want it to! Keep in mind I already wrote a Windows GUI version of this tool (if there is interest, I can make that one support file input containing a list of domains, too).
"Rainbow tables" of hashed domains have been made available using
gadhash to compute the Google Analytics (GA) domain hashes. This will enable interested parties to query a domain hash to find the corresponding domain.
I welcome contributions. Contact me at firstname.lastname@example.org, create an issue, and/or fork this code and create a pull request.
License, Disclaimers, etc.
Copyright © 2017 Dan O'Day (email@example.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This project uses the
Boost libraries for CLI argument parsing and memory-mapping files. Boost is distributed under the Boost Software License, Version 1.0 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
The hash function is based on a StackOverflow answer posted by user Nico Westerdale to this question posted by user Alex Wayne (the answer is written in C#). StackOverflow user contributions are licensed under cc by-sa 3.0 with attribution required.