https://github.com/0x4f53/textsubs
A simple Golang library to extract subdomains from any piece of text.
https://github.com/0x4f53/textsubs
attack-surface-management attacksurface cybersecurity golang golang-library golang-package infosec pentesting subdomain-enumeration subdomain-finder
Last synced: 8 months ago
JSON representation
A simple Golang library to extract subdomains from any piece of text.
- Host: GitHub
- URL: https://github.com/0x4f53/textsubs
- Owner: 0x4f53
- License: gpl-3.0
- Created: 2024-08-04T23:40:03.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-03T20:04:25.000Z (over 1 year ago)
- Last Synced: 2025-04-03T11:05:50.837Z (about 1 year ago)
- Topics: attack-surface-management, attacksurface, cybersecurity, golang, golang-library, golang-package, infosec, pentesting, subdomain-enumeration, subdomain-finder
- Language: Go
- Homepage: https://pkg.go.dev/github.com/0x4f53/textsubs
- Size: 58.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/0x4f53/textsubs)
# textsubs
A simple Golang library to extract subdomains and domains from text (*not URLs!)
### Usage
1. Import this package in your go program
```
go get github.com/0x4f53/textsubs
```
2. Use it in code as usual
```
...
subdomains := SubdomainsOnly(string(data), true)
for index, sub := subdomains {
// Rest of the code
}
...
```
### Documentation
Visit https://pkg.go.dev/github.com/0x4f53/textsubs to read about the functions and their descriptions
### Working
This package uses [publicsuffix2](https://github.com/weppos/publicsuffix-go), basic regex matching and a few if-else statements to determine if a string containing dots
is a subdomain or not. Please note that certain strings like "readme.md" will be marked as valid subdomains due to
_.md_ being a valid TLD.
---
Copyright (c) 2024 Owais Shaikh
Licensed under [GNU GPL 3.0](LICENSE)