Skip to content

Commit

Permalink
Refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
topscoder committed Jun 2, 2023
1 parent 37e108e commit b9c84d3
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 232 deletions.
136 changes: 31 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<h1 align="center">
<b>AnalyticsRelationships</b>
<br>
</h1>
# AnalyticsRelationships

<p align="center">
<a href="https://golang.org/dl/#stable">
<img src="https://img.shields.io/badge/go-1.16-blue.svg?style=flat-square&logo=go">
Expand All @@ -12,136 +10,64 @@
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html">
<img src="https://img.shields.io/badge/license-GNU-green.svg?style=square&logo=gnu">
<a href="https://twitter.com/JosueEncinar">
<img src="https://img.shields.io/badge/author-@JosueEncinar-orange.svg?style=square&logo=twitter">
<img src="https://img.shields.io/badge/author-@JosueEncinar-orange.svg?style=square&logo=twitter">&nbsp;
<a href="https://twitter.com/topscoder">
<img src="https://img.shields.io/badge/author-@topscoder-orange.svg?style=square&logo=twitter">
</a>
</p>


<p align="center">
This script try to get related domains / subdomains by looking at Google Analytics IDs from a URL. First search for ID of Google Analytics in the webpage and then request to <b>builtwith</b> and <b>hackertarget</b> with the ID.
</p>
<br/>
<hr/>

**Note**: It does not work with all websites. It is searched by the following expressions:

```
-> "www\.googletagmanager\.com/ns\.html\?id=[A-Z0-9\-]+"
-> GTM-[A-Z0-9]+
-> "UA-\d+-\d+"
```

## Available versions:

* [Python](Python)
* [GO](.)
This script tries to get related domains and/or subdomains by looking at Google Analytics IDs from a URL. First search for ID of Google Analytics in the webpage and then request to <b>builtwith</b> and <b>hackertarget</b> with the ID.</p>

## Installation:
<p align="center">
<b>Note: This is a fork of the original project at github.com/Josue87/AnalyticsRelationships</b>
</p>

Installation according to language.
<hr/>

### Python
**Note**: It does not work with all websites. It is searched by the following expressions:

```
> git clone https://github.com/Josue87/AnalyticsRelationships.git
> cd AnalyticsRelationships/Python
> sudo pip3 install -r requirements.txt
```
* `*"www\.googletagmanager\.com/ns\.html\?id=[A-Z0-9\-]+"`
* `GTM-[A-Z0-9]+`
* `*"UA-\d+-\d+"`

### GO
## Installation

```
> git clone https://github.com/Josue87/AnalyticsRelationships.git
> cd AnalyticsRelationships/
> go build -ldflags "-s -w"
```
Install Golang, then run:

### Docker
```
> git clone https://github.com/Josue87/AnalyticsRelationships.git
> cd AnalyticsRelationships
> docker build -t analyticsrelationships:latest .
```
`go install -v github.com/topscoder/analyticsrelationships@latest`

## Usage

Usage according to language

### Python

```
> python3 analyticsrelationships.py -u https://www.example.com
```

Or redirect output to a file (banner or information messages are sent to the error output):

```
python3 analyticsrelationships.py -u https://www.example.com > /tmp/example.txt
```


### GO

```
> ./analyticsrelationships --url https://www.example.com
```

Or redirect output to a file (banner or information messages are sent to the error output):

```
> ./analyticsrelationships --url https://www.example.com > /tmp/example.txt
```

You can also pass a file as input

```
> cat file.txt | ./analyticsrelationships
```

Or a single URL
This tool can be used in different ways:

1. Pass a single URL using the `-url` flag:
```
> echo https://www.example.com | ./analyticsrelationships
analyticsrelationships -url https://www.example.com
```

### Docker

Only Python Version.
2. You can also pass URL's as input via STDIN

```
> docker run -it analyticsrelationships:latest https://www.example.com
cat urls.txt | analyticsrelationships
```

Or redirect output to a file (banner or information messages are sent to the error output):
3. Or a single URL via STDIN

```
> docker run -it analyticsrelationships:latest https://www.example.com > /tmp/example.txt
echo https://www.example.com | analyticsrelationships
```
## Examples

### Python

Output redirection to file /tmp/example.txt:

![image](https://user-images.githubusercontent.com/16885065/118681597-fdf27180-b7ff-11eb-9b4d-c6738d1bc5ff.png)

Without redirection:

![image](https://user-images.githubusercontent.com/16885065/118681802-28442f00-b800-11eb-8a95-8b0de24ec691.png)

### GO

Without redirection:

![image](https://user-images.githubusercontent.com/16885065/118682807-0e571c00-b801-11eb-8da2-d9e3d3c1d555.png)

Working with file redirection works just like in Python.
## Options

An example with a file:
- `-url`: URL of the website to scan the Analytics code from
- `-silent`: Don't print shizzle. Only what matters.

![image](https://user-images.githubusercontent.com/16885065/123318287-57506d80-d52f-11eb-89d8-cf0a3f8ab4ee.png)
## Contributing

Contributions are welcome! If you find a bug or want to suggest a new feature, please open an issue or submit a pull request.

# Disclaimer!
## License

This is a PoC. The author is not responsible for any illegitimate use.
AnalyticsRelationships is released under the GNU license.
Loading

0 comments on commit b9c84d3

Please sign in to comment.