https://github.com/kyagara/hagelslag-go
HTTP, Minecraft and Veloren server scanner written in Go.
https://github.com/kyagara/hagelslag-go
golang http minecraft mongodb multithreading scanner veloren
Last synced: about 1 year ago
JSON representation
HTTP, Minecraft and Veloren server scanner written in Go.
- Host: GitHub
- URL: https://github.com/kyagara/hagelslag-go
- Owner: Kyagara
- License: apache-2.0
- Created: 2024-11-02T17:22:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-16T19:51:03.000Z (over 1 year ago)
- Last Synced: 2025-03-01T23:09:50.041Z (about 1 year ago)
- Topics: golang, http, minecraft, mongodb, multithreading, scanner, veloren
- Language: Go
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hagelslag
cool scanner <(= w =)>
## Why
Starting as a C [project](https://github.com/Kyagara/hagelslag), I felt like doing a go version of it.
The `hagelslag` name came from a friend, well, eating a [Hagelslag](https://en.wikipedia.org/wiki/Hagelslag).
## How
`hagelslag` works by generating all possible IPv4 addresses, checking if they are [reserved](https://en.wikipedia.org/wiki/Reserved_IP_addresses) or not and sending them to workers.
Each worker will wait for addresses coming from a channel, spawn a go routine for each address then start the process of connecting, scanning and saving (when successful).
### CLI
```bash
-ip
IP address to start from, without port
-scanner
Scanner to use (default: http)
-port
Override the scanners port
-uri
MongoDB URI (default: mongodb://localhost:27017)
-only-connect
Skip scanning, connect and save if successful (default: false)
-rate
Limit of connections, be careful with this value (default: 1000)
```
### Scanning
If not set to `OnlyConnect`, the scanner will do the following:
- `http`: send a `GET` request.
- `minecraft`: send a handshake, status request packet.
- `veloren`: send a init packet, server info packet.
Current behaviour is to read until the response reaches the limit of 15Mb or EOF is encountered.
### Saving
Data will be inserted in the mongodb `hagelslag` database inside the `` collection and will follow the structure:
> mongodb has a limit of 16Mb for a document, if a response exceeds 15Mb, the json/html that will be saved _will_ be malformed, validate the data before using it.
> `data` field can be a string (for html or malformed response) or a json object.
```json
{
"_id": "
",
"latency": 0,
"data": ""
}
```
## TODO/Ideas
- Maybe an interface for both DialTCP and DialUDP.
- Improve logging.
- At high rates, DB connection errors out, maybe using bulk write can solve this.
- Maybe add bedrocks servers to the Minecraft scanner.
- Remove this weird virus that keeps adding Frieren in the code.