Skip to content

Commit e402843

Browse files
Merge pull request #980 from projectdiscovery/dev
v1.2.1 release prep
2 parents e6663b7 + 523e1e9 commit e402843

File tree

7 files changed

+184
-128
lines changed

7 files changed

+184
-128
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ Interactsh Cli client requires **go1.20+** to install successfully. Run the foll
100100
go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest
101101
```
102102

103+
### Configure PDCP_API_KEY With Interactsh CLI Client
104+
> Get your free api key by signing up at https://cloud.projectdiscovery.io
105+
106+
You can configure your PDCP_API_KEY in two ways:
107+
1. To configure the API key interactively, run the following command:
108+
```sh
109+
./interactsh-client -auth
110+
```
111+
2. If you prefer to pass the API key directly, use the -auth option followed by your API key:
112+
```sh
113+
./interactsh-client -auth=<pdcp-api-key>
114+
````
115+
103116
### Default Run
104117

105118
This will generate a unique payload that can be used for OOB testing with minimal interaction information in the output.

cmd/interactsh-client/main.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
jsoniter "github.com/json-iterator/go"
14+
asnmap "github.com/projectdiscovery/asnmap/libs"
1415
"github.com/projectdiscovery/goflags"
1516
"github.com/projectdiscovery/gologger"
1617
"github.com/projectdiscovery/gologger/levels"
@@ -19,6 +20,8 @@ import (
1920
"github.com/projectdiscovery/interactsh/pkg/options"
2021
"github.com/projectdiscovery/interactsh/pkg/server"
2122
"github.com/projectdiscovery/interactsh/pkg/settings"
23+
"github.com/projectdiscovery/utils/auth/pdcp"
24+
"github.com/projectdiscovery/utils/env"
2225
fileutil "github.com/projectdiscovery/utils/file"
2326
folderutil "github.com/projectdiscovery/utils/folder"
2427
updateutils "github.com/projectdiscovery/utils/update"
@@ -44,6 +47,7 @@ func main() {
4447

4548
flagSet.CreateGroup("config", "config",
4649
flagSet.StringVar(&cliOptions.Config, "config", defaultConfigLocation, "flag configuration file"),
50+
flagSet.DynamicVar(&cliOptions.PdcpAuth, "auth", "true", "configure projectdiscovery cloud (pdcp) api key"),
4751
flagSet.IntVarP(&cliOptions.NumberOfPayloads, "number", "n", 1, "number of interactsh payload to generate"),
4852
flagSet.StringVarP(&cliOptions.Token, "token", "t", "", "authentication token to connect protected interactsh server"),
4953
flagSet.IntVarP(&cliOptions.PollInterval, "poll-interval", "pi", 5, "poll interval in seconds to pull interaction data"),
@@ -86,7 +90,27 @@ func main() {
8690
gologger.Fatal().Msgf("Could not parse options: %s\n", err)
8791
}
8892

89-
options.ShowBanner()
93+
// If user have passed auth flag without key (ex: interactsh-client -auth)
94+
// then we will prompt user to enter the api key, if already set shows user identity and exit
95+
// If user have passed auth flag with key (ex: interactsh-client -auth=<api-key>)
96+
// then we will validate the key and save it to file
97+
if cliOptions.PdcpAuth == "true" {
98+
options.AuthWithPDCP()
99+
} else if len(cliOptions.PdcpAuth) == 36 {
100+
ph := pdcp.PDCPCredHandler{}
101+
if _, err := ph.GetCreds(); err == pdcp.ErrNoCreds {
102+
apiServer := env.GetEnvOrDefault("PDCP_API_SERVER", pdcp.DefaultApiServer)
103+
if validatedCreds, err := ph.ValidateAPIKey(cliOptions.PdcpAuth, apiServer, "interactsh"); err == nil {
104+
options.ShowBanner()
105+
asnmap.PDCPApiKey = validatedCreds.APIKey
106+
if err = ph.SaveCreds(validatedCreds); err != nil {
107+
gologger.Warning().Msgf("Could not save credentials to file: %s\n", err)
108+
}
109+
}
110+
}
111+
} else {
112+
options.ShowBanner()
113+
}
90114

91115
if healthcheck {
92116
cfgFilePath, _ := flagSet.GetConfigFilePath()
@@ -251,7 +275,7 @@ func main() {
251275
}
252276
})
253277
if err != nil {
254-
gologger.Error().Msgf(err.Error())
278+
gologger.Error().Msg(err.Error())
255279
}
256280

257281
c := make(chan os.Signal, 1)

go.mod

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ require (
1414
github.com/mackerelio/go-osstat v0.2.4
1515
github.com/miekg/dns v1.1.56
1616
github.com/pkg/errors v0.9.1
17-
github.com/projectdiscovery/asnmap v1.1.0
18-
github.com/projectdiscovery/goflags v0.1.54
19-
github.com/projectdiscovery/gologger v1.1.12
17+
github.com/projectdiscovery/asnmap v1.1.1
18+
github.com/projectdiscovery/goflags v0.1.64
19+
github.com/projectdiscovery/gologger v1.1.25
2020
github.com/projectdiscovery/ldapserver v1.0.2-0.20240219154113-dcc758ebc0cb
21-
github.com/projectdiscovery/retryabledns v1.0.62
22-
github.com/projectdiscovery/retryablehttp-go v1.0.63
23-
github.com/projectdiscovery/utils v0.1.1
21+
github.com/projectdiscovery/retryabledns v1.0.76
22+
github.com/projectdiscovery/retryablehttp-go v1.0.79
23+
github.com/projectdiscovery/utils v0.2.11
2424
github.com/remeh/sizedwaitgroup v1.0.0
2525
github.com/rs/xid v1.5.0
2626
github.com/stretchr/testify v1.9.0
@@ -40,29 +40,32 @@ require (
4040
github.com/Mzack9999/go-http-digest-auth-client v0.6.1-0.20220414142836-eb8883508809 // indirect
4141
github.com/VividCortex/ewma v1.2.0 // indirect
4242
github.com/akrylysov/pogreb v0.10.1 // indirect
43-
github.com/alecthomas/chroma v0.10.0 // indirect
43+
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
4444
github.com/andybalholm/brotli v1.0.6 // indirect
4545
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
4646
github.com/aymerick/douceur v0.2.0 // indirect
4747
github.com/benbjohnson/clock v1.3.0 // indirect
48-
github.com/charmbracelet/glamour v0.6.0 // indirect
48+
github.com/bits-and-blooms/bitset v1.13.0 // indirect
49+
github.com/charmbracelet/glamour v0.8.0 // indirect
50+
github.com/charmbracelet/lipgloss v0.13.0 // indirect
51+
github.com/charmbracelet/x/ansi v0.3.2 // indirect
4952
github.com/cheggaaa/pb/v3 v3.1.4 // indirect
5053
github.com/cloudflare/circl v1.3.7 // indirect
5154
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
5255
github.com/davecgh/go-spew v1.1.1 // indirect
5356
github.com/dimchansky/utfbom v1.1.1 // indirect
54-
github.com/dlclark/regexp2 v1.8.1 // indirect
57+
github.com/dlclark/regexp2 v1.11.4 // indirect
5558
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
5659
github.com/fatih/color v1.15.0 // indirect
57-
github.com/gaukas/godicttls v0.0.4 // indirect
60+
github.com/gaissmai/bart v0.9.5 // indirect
5861
github.com/go-ole/go-ole v1.2.6 // indirect
5962
github.com/golang/protobuf v1.5.3 // indirect
6063
github.com/golang/snappy v0.0.4 // indirect
6164
github.com/google/go-github/v30 v30.1.0 // indirect
6265
github.com/google/go-querystring v1.1.0 // indirect
6366
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
64-
github.com/gorilla/css v1.0.0 // indirect
65-
github.com/klauspost/compress v1.16.7 // indirect
67+
github.com/gorilla/css v1.0.1 // indirect
68+
github.com/klauspost/compress v1.17.4 // indirect
6669
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
6770
github.com/klauspost/pgzip v1.2.5 // indirect
6871
github.com/kr/pretty v0.3.1 // indirect
@@ -71,30 +74,28 @@ require (
7174
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
7275
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
7376
github.com/mattn/go-colorable v0.1.13 // indirect
74-
github.com/mattn/go-isatty v0.0.19 // indirect
75-
github.com/mattn/go-runewidth v0.0.14 // indirect
77+
github.com/mattn/go-isatty v0.0.20 // indirect
78+
github.com/mattn/go-runewidth v0.0.16 // indirect
7679
github.com/mholt/acmez v1.2.0 // indirect
7780
github.com/mholt/archiver/v3 v3.5.1 // indirect
78-
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
81+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
7982
github.com/minio/selfupdate v0.6.1-0.20230907112617-f11e74f84ca7 // indirect
8083
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8184
github.com/modern-go/reflect2 v1.0.2 // indirect
8285
github.com/muesli/reflow v0.3.0 // indirect
83-
github.com/muesli/termenv v0.15.1 // indirect
86+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
8487
github.com/nwaples/rardecode v1.1.3 // indirect
85-
github.com/olekukonko/tablewriter v0.0.5 // indirect
8688
github.com/pierrec/lz4/v4 v4.1.2 // indirect
8789
github.com/pmezard/go-difflib v1.0.0 // indirect
8890
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
8991
github.com/projectdiscovery/blackrock v0.0.1 // indirect
90-
github.com/projectdiscovery/fastdialer v0.1.1 // indirect
91-
github.com/projectdiscovery/hmap v0.0.45 // indirect
92+
github.com/projectdiscovery/fastdialer v0.2.9 // indirect
93+
github.com/projectdiscovery/hmap v0.0.60 // indirect
9294
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 // indirect
9395
github.com/projectdiscovery/mapcidr v1.1.34 // indirect
94-
github.com/projectdiscovery/networkpolicy v0.0.8 // indirect
95-
github.com/quic-go/quic-go v0.42.0 // indirect
96-
github.com/refraction-networking/utls v1.5.4 // indirect
97-
github.com/rivo/uniseg v0.4.4 // indirect
96+
github.com/projectdiscovery/networkpolicy v0.0.9 // indirect
97+
github.com/refraction-networking/utls v1.6.7 // indirect
98+
github.com/rivo/uniseg v0.4.7 // indirect
9899
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
99100
github.com/shirou/gopsutil/v3 v3.23.7 // indirect
100101
github.com/shoenig/go-m1cpu v0.1.6 // indirect
@@ -111,24 +112,24 @@ require (
111112
github.com/ulikunitz/xz v0.5.11 // indirect
112113
github.com/weppos/publicsuffix-go v0.30.1-0.20230422193905-8fecedd899db // indirect
113114
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
114-
github.com/yl2chen/cidranger v1.0.2 // indirect
115-
github.com/yuin/goldmark v1.5.4 // indirect
116-
github.com/yuin/goldmark-emoji v1.0.1 // indirect
115+
github.com/yuin/goldmark v1.7.4 // indirect
116+
github.com/yuin/goldmark-emoji v1.0.3 // indirect
117117
github.com/yusufpapurcu/wmi v1.2.4 // indirect
118118
github.com/zcalusic/sysinfo v1.0.2 // indirect
119119
github.com/zeebo/blake3 v0.2.3 // indirect
120120
github.com/zmap/rc2 v0.0.0-20190804163417-abaa70531248 // indirect
121121
github.com/zmap/zcrypto v0.0.0-20230422215203-9a665e1e9968 // indirect
122122
go.etcd.io/bbolt v1.3.7 // indirect
123-
golang.org/x/crypto v0.21.0 // indirect
123+
golang.org/x/crypto v0.27.0 // indirect
124124
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
125-
golang.org/x/mod v0.12.0 // indirect
126-
golang.org/x/net v0.23.0 // indirect
125+
golang.org/x/mod v0.17.0 // indirect
126+
golang.org/x/net v0.29.0 // indirect
127127
golang.org/x/oauth2 v0.11.0 // indirect
128-
golang.org/x/sys v0.18.0 // indirect
129-
golang.org/x/term v0.18.0 // indirect
130-
golang.org/x/text v0.14.0 // indirect
131-
golang.org/x/tools v0.13.0 // indirect
128+
golang.org/x/sync v0.8.0 // indirect
129+
golang.org/x/sys v0.25.0 // indirect
130+
golang.org/x/term v0.24.0 // indirect
131+
golang.org/x/text v0.18.0 // indirect
132+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
132133
google.golang.org/appengine v1.6.7 // indirect
133134
google.golang.org/protobuf v1.33.0 // indirect
134135
gopkg.in/djherbis/times.v1 v1.3.0 // indirect

0 commit comments

Comments
 (0)