Skip to content

Commit 70e672f

Browse files
authored
Merge pull request #21 from HuntDownProject/release/v1.0.3
Release/v1.0.3
2 parents 7bd3ccf + 4e20e3e commit 70e672f

File tree

12 files changed

+432
-325
lines changed

12 files changed

+432
-325
lines changed

.github/workflows/auto-pr.yml

Whitespace-only changes.

.github/workflows/build-test.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7-
- dev
7+
- develop
88
pull_request:
99
branches:
1010
- main
11-
- dev
11+
- develop
1212
- feature*
1313
paths:
1414
- '**.go'
@@ -38,12 +38,6 @@ jobs:
3838
run: go test ./...
3939
working-directory: .
4040

41-
#- name: Integration Tests
42-
# env:
43-
# GH_ACTION: true
44-
# run: bash run.sh
45-
# working-directory: integration_tests/
46-
4741
- name: Install
4842
run: go install
4943
working-directory: cmd/hednsextractor/

cmd/hednsextractor/hednsextractor.go

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"strconv"
77

88
"github.com/HuntDownProject/hednsextractor/utils"
9-
"github.com/projectdiscovery/goflags"
109
"github.com/projectdiscovery/gologger"
11-
"github.com/projectdiscovery/gologger/levels"
1210
)
1311

1412
var (
@@ -17,72 +15,35 @@ var (
1715

1816
func main() {
1917

18+
// Parse the stdin
2019
utils.ParseStdin()
2120

22-
flagSet := goflags.NewFlagSet()
23-
flagSet.Marshal = true
24-
flagSet.SetDescription("HEDnsExtractor - A suite for hunting suspicious targets, expose domains and phishing discovery!")
25-
flagSet.BoolVar(&utils.OptionCmd.Onlydomains, "only-domains", false, "show only domains")
26-
flagSet.BoolVar(&utils.OptionCmd.Onlynetworks, "only-networks", false, "show only networks")
27-
flagSet.StringVar(&utils.OptionCmd.Workflow, "workflow", "", "Workflow config")
28-
flagSet.StringVar(&utils.OptionCmd.Target, "target", "", "IP Address or Network to query")
29-
flagSet.BoolVar(&utils.OptionCmd.Silent, "silent", false, "show silent output")
30-
flagSet.BoolVar(&utils.OptionCmd.Verbose, "verbose", false, "show verbose output")
31-
32-
flagSet.CreateGroup("configuration", "Configuration",
33-
flagSet.StringVar(&utils.OptionCmd.Config, "config", utils.DefaultConfigLocation, "flag config file"),
34-
)
35-
36-
flagSet.CreateGroup("config", "Virustotal",
37-
flagSet.BoolVar(&utils.OptionCmd.Vtscore, "vt", false, "show Virustotal score"),
38-
flagSet.StringVar(&utils.OptionCmd.VtApiKey, "vt-api-key", "", "Virustotal API Key"),
39-
flagSet.StringVar(&utils.OptionCmd.VtscoreValue, "vt-score", "0", "Minimum Virustotal score to show"),
40-
)
41-
42-
if err := flagSet.Parse(); err != nil {
43-
gologger.Fatal().Msgf("Could not parse flags: %s\n", err)
44-
}
45-
46-
if utils.OptionCmd.Verbose {
47-
gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose)
48-
} else if utils.OptionCmd.Silent {
49-
gologger.DefaultLogger.SetMaxLevel(levels.LevelSilent)
50-
} else {
51-
gologger.DefaultLogger.SetMaxLevel(levels.LevelInfo)
52-
}
53-
54-
if utils.OptionCmd.Vtscore && utils.OptionCmd.VtApiKey == "" {
55-
gologger.Fatal().Msgf("A Virustotal API Key is needed in config file: %s\n", utils.DefaultConfigLocation)
56-
}
21+
// Load parameters from command line and configuration file
22+
utils.LoadParameters()
5723

5824
// Show Banner
5925
utils.ShowBanner()
6026

61-
// read the targets from yaml
62-
var c utils.Conf
27+
// read the Workflow from yaml
28+
var workflow utils.Workflow
6329
if utils.OptionCmd.Workflow != "" {
64-
c.GetConf(utils.OptionCmd.Workflow)
30+
workflow.GetConf(utils.OptionCmd.Workflow)
6531

66-
for i := range c.Domains {
67-
utils.IdentifyTarget(c.Domains[i])
32+
for i := range workflow.Domains {
33+
utils.IdentifyTarget(workflow.Domains[i])
6834
}
6935

70-
for i := range c.Ipaddrs {
71-
utils.IdentifyTarget(c.Ipaddrs[i])
36+
for i := range workflow.Ipaddrs {
37+
utils.IdentifyTarget(workflow.Ipaddrs[i])
7238
}
7339

74-
for i := range c.Networks {
75-
utils.IdentifyTarget(c.Networks[i])
40+
for i := range workflow.Networks {
41+
utils.IdentifyTarget(workflow.Networks[i])
7642
}
7743
}
7844

79-
// Look into target parameter to grab the IPv4s and Networks
80-
if utils.OptionCmd.Target != "" {
81-
gologger.Verbose().Msgf("Identifying networks for %s", utils.OptionCmd.Target)
82-
utils.IdentifyTarget(utils.OptionCmd.Target)
83-
}
84-
85-
utils.RunCrawler()
45+
hurricane := utils.Hurricane{}
46+
hurricane.RunCrawler()
8647

8748
if utils.OptionCmd.Vtscore && !utils.OptionCmd.Silent {
8849
gologger.Info().Msgf("Filtering with Virustotal with a mininum score %s", utils.OptionCmd.VtscoreValue)
@@ -92,8 +53,8 @@ func main() {
9253
var bMatchedPTR = false
9354
var bMatchedDomain = false
9455

95-
if c.Regex != "" {
96-
var re = regexp.MustCompile(c.Regex)
56+
if workflow.Regex != "" {
57+
var re = regexp.MustCompile(workflow.Regex)
9758
bMatchedDomain = re.MatchString(result.Domain)
9859
bMatchedPTR = re.MatchString(result.PTR)
9960
} else {
@@ -106,7 +67,8 @@ func main() {
10667
}
10768

10869
if utils.OptionCmd.Vtscore {
109-
result.VtScore = utils.GetVtReport(result.Domain)
70+
virustotal := utils.Virustotal{}
71+
result.VtScore = virustotal.GetVtReport(result.Domain)
11072
if score, err := strconv.ParseUint(utils.OptionCmd.VtscoreValue, 10, 64); err == nil {
11173
if result.VtScore < score {
11274
continue

go.mod

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,57 @@ module github.com/HuntDownProject/hednsextractor
33
go 1.21
44

55
require (
6-
github.com/PuerkitoBio/goquery v1.8.1
7-
github.com/projectdiscovery/goflags v0.1.32
6+
github.com/PuerkitoBio/goquery v1.9.1
7+
github.com/projectdiscovery/goflags v0.1.46
88
github.com/projectdiscovery/gologger v1.1.12
9-
github.com/projectdiscovery/retryablehttp-go v1.0.22
10-
github.com/projectdiscovery/utils v0.0.68
11-
github.com/tidwall/gjson v1.17.0
9+
github.com/projectdiscovery/retryablehttp-go v1.0.54
10+
github.com/projectdiscovery/utils v0.0.87
11+
github.com/tidwall/gjson v1.17.1
1212
gopkg.in/yaml.v2 v2.4.0
1313
)
1414

1515
require (
16+
github.com/Mzack9999/gcache v0.0.0-20230410081825-519e28eab057 // indirect
1617
github.com/Mzack9999/go-http-digest-auth-client v0.6.1-0.20220414142836-eb8883508809 // indirect
1718
github.com/akrylysov/pogreb v0.10.2 // indirect
18-
github.com/andybalholm/brotli v1.0.6 // indirect
19+
github.com/andybalholm/brotli v1.1.0 // indirect
1920
github.com/andybalholm/cascadia v1.3.2 // indirect
2021
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
2122
github.com/aymerick/douceur v0.2.0 // indirect
23+
github.com/chzyer/readline v1.5.1 // indirect
24+
github.com/cloudflare/circl v1.3.7 // indirect
2225
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
2326
github.com/dimchansky/utfbom v1.1.1 // indirect
27+
github.com/docker/go-units v0.5.0 // indirect
2428
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
25-
github.com/gaukas/godicttls v0.0.3 // indirect
29+
github.com/go-logr/logr v1.4.1 // indirect
30+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
2631
github.com/golang/snappy v0.0.4 // indirect
32+
github.com/google/go-cmp v0.6.0 // indirect
33+
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f // indirect
2734
github.com/gorilla/css v1.0.1 // indirect
35+
github.com/ianlancetaylor/demangle v0.0.0-20240312041847-bd984b5ce465 // indirect
2836
github.com/json-iterator/go v1.1.12 // indirect
29-
github.com/klauspost/compress v1.17.4 // indirect
37+
github.com/klauspost/compress v1.17.7 // indirect
3038
github.com/klauspost/pgzip v1.2.6 // indirect
3139
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
3240
github.com/mholt/archiver/v3 v3.5.1 // indirect
3341
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
34-
github.com/miekg/dns v1.1.57 // indirect
42+
github.com/miekg/dns v1.1.58 // indirect
3543
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3644
github.com/modern-go/reflect2 v1.0.2 // indirect
3745
github.com/nwaples/rardecode v1.1.3 // indirect
38-
github.com/onsi/gomega v1.22.1 // indirect
39-
github.com/pierrec/lz4/v4 v4.1.19 // indirect
46+
github.com/onsi/ginkgo/v2 v2.17.1 // indirect
47+
github.com/onsi/gomega v1.32.0 // indirect
48+
github.com/pierrec/lz4/v4 v4.1.21 // indirect
4049
github.com/pkg/errors v0.9.1 // indirect
4150
github.com/projectdiscovery/blackrock v0.0.1 // indirect
42-
github.com/projectdiscovery/fastdialer v0.0.35 // indirect
43-
github.com/projectdiscovery/hmap v0.0.30 // indirect
44-
github.com/projectdiscovery/networkpolicy v0.0.6 // indirect
45-
github.com/projectdiscovery/retryabledns v1.0.47 // indirect
46-
github.com/refraction-networking/utls v1.3.3 // indirect
51+
github.com/projectdiscovery/fastdialer v0.0.65 // indirect
52+
github.com/projectdiscovery/hmap v0.0.41 // indirect
53+
github.com/projectdiscovery/networkpolicy v0.0.8 // indirect
54+
github.com/projectdiscovery/retryabledns v1.0.58 // indirect
55+
github.com/quic-go/quic-go v0.42.0 // indirect
56+
github.com/refraction-networking/utls v1.6.3 // indirect
4757
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
4858
github.com/syndtr/goleveldb v1.0.0 // indirect
4959
github.com/tidwall/btree v1.7.0 // indirect
@@ -53,22 +63,23 @@ require (
5363
github.com/tidwall/pretty v1.2.1 // indirect
5464
github.com/tidwall/rtred v0.1.2 // indirect
5565
github.com/tidwall/tinyqueue v0.1.1 // indirect
56-
github.com/ulikunitz/xz v0.5.11 // indirect
66+
github.com/ulikunitz/xz v0.5.12 // indirect
5767
github.com/ulule/deepcopier v0.0.0-20200430083143-45decc6639b6 // indirect
58-
github.com/weppos/publicsuffix-go v0.30.2-0.20230730094716-a20f9abcc222 // indirect
68+
github.com/weppos/publicsuffix-go v0.30.2 // indirect
5969
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
6070
github.com/yl2chen/cidranger v1.0.2 // indirect
6171
github.com/zmap/rc2 v0.0.0-20190804163417-abaa70531248 // indirect
6272
github.com/zmap/zcrypto v0.0.0-20231219022726-a1f61fb1661c // indirect
63-
go.etcd.io/bbolt v1.3.8 // indirect
73+
go.etcd.io/bbolt v1.3.9 // indirect
74+
go.uber.org/mock v0.4.0 // indirect
6475
go.uber.org/multierr v1.11.0 // indirect
65-
golang.org/x/crypto v0.17.0 // indirect
66-
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 // indirect
67-
golang.org/x/mod v0.14.0 // indirect
68-
golang.org/x/net v0.19.0 // indirect
69-
golang.org/x/sys v0.15.0 // indirect
76+
golang.org/x/crypto v0.21.0 // indirect
77+
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
78+
golang.org/x/mod v0.16.0 // indirect
79+
golang.org/x/net v0.23.0 // indirect
80+
golang.org/x/sys v0.18.0 // indirect
7081
golang.org/x/text v0.14.0 // indirect
71-
golang.org/x/tools v0.16.1 // indirect
82+
golang.org/x/tools v0.19.0 // indirect
7283
gopkg.in/djherbis/times.v1 v1.3.0 // indirect
7384
gopkg.in/yaml.v3 v3.0.1 // indirect
7485
)

0 commit comments

Comments
 (0)