Skip to content

Commit

Permalink
[feat] v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy0 committed Sep 8, 2022
1 parent f79f690 commit 58a03ec
Show file tree
Hide file tree
Showing 13 changed files with 614 additions and 165 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.2.0
- [feat] 增加dns域传送尝试
- [feat] 尝试内存优化
- [fix] 修复向关闭的 channel 发送数据导致程序异常退出

## v0.1.1
- [feat] 增加 henter、quake

Expand Down
18 changes: 16 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ module github.com/ZhuriLab/Starmap
go 1.17

require (
github.com/caffix/resolve v0.5.4
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08
github.com/corpix/uarand v0.1.1
github.com/google/gopacket v1.1.19
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
github.com/json-iterator/go v1.1.12
github.com/lib/pq v1.10.4
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/miekg/dns v1.1.46
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
github.com/pkg/errors v0.9.1
github.com/projectdiscovery/chaos-client v0.2.0
Expand All @@ -27,11 +29,19 @@ require (
)

require (
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/caffix/queue v0.1.3 // indirect
github.com/caffix/stringset v0.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dgraph-io/badger v1.6.2 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand All @@ -42,8 +52,12 @@ require (
github.com/projectdiscovery/retryabledns v1.0.13-0.20210927160332-db15799e2e4d // indirect
github.com/projectdiscovery/retryablehttp-go v1.0.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
85 changes: 83 additions & 2 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg/active/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Enum(domain string, uniqueMap map[string]resolve.HostEntry, silent bool, fi
return enumMap, wildcardIPs
}

func Verify(uniqueMap map[string]resolve.HostEntry, silent bool, resolvers []string, wildcardIPs map[string]struct{}, maxIPs int) (map[string]resolve.HostEntry, map[string]struct{}) {
func Verify(uniqueMap map[string]resolve.HostEntry, silent bool, resolvers []string, wildcardIPs map[string]struct{}, maxIPs int) (map[string]resolve.HostEntry, map[string]struct{}, []string) {
gologger.Info().Msgf("Start to verify the collected sub domain name results, a total of %d", len(uniqueMap))

opt := &Options{
Expand All @@ -74,9 +74,9 @@ func Verify(uniqueMap map[string]resolve.HostEntry, silent bool, resolvers []str
gologger.Fatal().Msgf("%s", err)
}

AuniqueMap, wildcardIPs := r.RunEnumerationVerify(uniqueMap, ctx)
AuniqueMap, wildcardIPs, unanswers := r.RunEnumerationVerify(ctx)

r.Close()

return AuniqueMap, wildcardIPs
return AuniqueMap, wildcardIPs, unanswers
}
10 changes: 9 additions & 1 deletion pkg/active/recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import (
"context"
"errors"
"fmt"
"github.com/ZhuriLab/Starmap/pkg/util"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
"sync/atomic"
"time"
)

func (r *runner) recvChanel(ctx context.Context) error {
func (r *runner) recvChanel(ctx context.Context, tag bool) error {
defer close(r.recver)
var (
snapshotLen = 65536
timeout = -1 * time.Second
Expand Down Expand Up @@ -90,6 +92,9 @@ func (r *runner) recvChanel(ctx context.Context) error {
if answers.Class == layers.DNSClassIN {
if answers.IP != nil {
ips = append(ips, answers.IP.String())
if util.IsInnerIP(answers.IP.String()) {
r.unanswers = append(r.unanswers, domain)
}
}
}
}
Expand All @@ -116,7 +121,10 @@ func (r *runner) recvChanel(ctx context.Context) error {
ResponseCode: dns.ResponseCode,
}
}
} else if tag {
r.unanswers = append(r.unanswers, domain)
}

}
}
}
Loading

0 comments on commit 58a03ec

Please sign in to comment.