Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsandeep committed May 19, 2023
2 parents 475e9cf + 5405d57 commit 2dddf7f
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 171 deletions.
4 changes: 2 additions & 2 deletions .github/docker/client/Dockerfile
@@ -1,13 +1,13 @@
# Base
FROM golang:1.20.3-alpine AS builder
FROM golang:1.20.4-alpine AS builder
RUN apk add --no-cache git build-base gcc musl-dev
WORKDIR /app
COPY . /app
RUN go mod download
RUN go build ./cmd/interactsh-client

# Release
FROM alpine:3.17.3
FROM alpine:3.18.0
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates
COPY --from=builder /app/interactsh-client /usr/local/bin/
Expand Down
4 changes: 2 additions & 2 deletions .github/docker/server/Dockerfile
@@ -1,5 +1,5 @@
# Base
FROM golang:1.20.3-alpine AS builder
FROM golang:1.20.4-alpine AS builder
RUN apk add --no-cache git build-base gcc musl-dev
WORKDIR /app
COPY . /app
Expand All @@ -8,7 +8,7 @@ RUN go build ./cmd/interactsh-server


# Release
FROM alpine:3.17.3
FROM alpine:3.18.0
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates python3 libffi curl \
&& apk add --no-cache --virtual .build-deps python3-dev py3-pip py3-wheel libffi-dev build-base \
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-test.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -40,4 +40,8 @@ jobs:

- name: Race Condition Tests
run: go build -race ./...
working-directory: .
working-directory: .

- name: Example Code Tests
run: go build .
working-directory: examples/
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yml
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.20.x
- name: Run golangci-lint
uses: golangci/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-binary.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: 1.20.x
- name: "Create release on GitHub"
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
41 changes: 2 additions & 39 deletions README.md
Expand Up @@ -92,7 +92,7 @@ DEBUG:

## Interactsh CLI Client

Interactsh Cli client requires **go1.17+** to install successfully. Run the following command to get the repo -
Interactsh Cli client requires **go1.20+** to install successfully. Run the following command to get the repo -

```sh
go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest
Expand Down Expand Up @@ -787,44 +787,7 @@ On default settings, the daemon listens on the following ports:

### Use as library

The below example uses interactsh client library to get external interactions for a generated URL by making a http request to the URL.

```go
package main

import (
"fmt"
"net/http"
"time"

"github.com/projectdiscovery/interactsh/pkg/client"
"github.com/projectdiscovery/interactsh/pkg/server"
)

func main() {
client, err := client.New(client.DefaultOptions)
if err != nil {
panic(err)
}
defer client.Close()

client.StartPolling(time.Duration(1*time.Second), func(interaction *server.Interaction) {
fmt.Printf("Got Interaction: %v => %v\n", interaction.Protocol, interaction.FullId)
})
defer client.StopPolling()

URL := client.URL()

resp, err := http.Get("https://" + URL)
if err != nil {
panic(err)
}
resp.Body.Close()

fmt.Printf("Got URL: %v => %v\n", URL, resp)
time.Sleep(5 * time.Second)
}
```
The [examples](examples/) uses interactsh client library to get external interactions for a generated URL by making a http request to the URL.

### Nuclei - OAST

Expand Down
6 changes: 5 additions & 1 deletion cmd/interactsh-client/main.go
Expand Up @@ -50,6 +50,7 @@ func main() {
flagSet.IntVarP(&cliOptions.CorrelationIdLength, "correlation-id-length", "cidl", settings.CorrelationIdLengthDefault, "length of the correlation id preamble"),
flagSet.IntVarP(&cliOptions.CorrelationIdNonceLength, "correlation-id-nonce-length", "cidn", settings.CorrelationIdNonceLengthDefault, "length of the correlation id nonce"),
flagSet.StringVarP(&cliOptions.SessionFile, "session-file", "sf", "", "store/read from session file"),
flagSet.DurationVarP(&cliOptions.KeepAliveInterval, "keep-alive-interval", "kai", time.Minute, "keep alive interval"),
)

flagSet.CreateGroup("filter", "Filter",
Expand Down Expand Up @@ -158,7 +159,7 @@ func main() {
}
}

_ = client.StartPolling(time.Duration(cliOptions.PollInterval)*time.Second, func(interaction *server.Interaction) {
err = client.StartPolling(time.Duration(cliOptions.PollInterval)*time.Second, func(interaction *server.Interaction) {
if matcher != nil && !matcher.match(interaction.FullId) {
return
}
Expand Down Expand Up @@ -237,6 +238,9 @@ func main() {
}
}
})
if err != nil {
gologger.Error().Msgf(err.Error())
}

c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
Expand Down
2 changes: 2 additions & 0 deletions deploy/deploy.yaml
Expand Up @@ -74,6 +74,8 @@
name: "{{ container_name }}"
image: "{{ container_image }}"
command: "{{ container_command }}"
memory: "4g"
memory_swap: "-1"
network_mode: host
restart: true
restart_policy: "unless-stopped"
Expand Down
34 changes: 34 additions & 0 deletions examples/client.go
@@ -0,0 +1,34 @@
package main

import (
"fmt"
"net/http"
"time"

"github.com/projectdiscovery/interactsh/pkg/client"
"github.com/projectdiscovery/interactsh/pkg/server"
)

func main() {
client, err := client.New(client.DefaultOptions)
if err != nil {
panic(err)
}
defer client.Close()

client.StartPolling(time.Duration(1*time.Second), func(interaction *server.Interaction) {
fmt.Printf("Got Interaction: %v => %v\n", interaction.Protocol, interaction.FullId)
})
defer client.StopPolling()

URL := client.URL()

resp, err := http.Get("https://" + URL)
if err != nil {
panic(err)
}
resp.Body.Close()

fmt.Printf("Got URL: %v => %v\n", URL, resp)
time.Sleep(1 * time.Second)
}
25 changes: 12 additions & 13 deletions go.mod
@@ -1,6 +1,6 @@
module github.com/projectdiscovery/interactsh

go 1.19
go 1.20

require (
git.mills.io/prologic/smtpd v0.0.0-20210710122116-a525b76c287a
Expand All @@ -11,20 +11,19 @@ require (
github.com/goburrow/cache v0.1.4
github.com/google/uuid v1.3.0
github.com/json-iterator/go v1.1.12
github.com/karlseguin/ccache/v2 v2.0.8
github.com/libdns/libdns v0.2.1
github.com/mackerelio/go-osstat v0.2.4
github.com/miekg/dns v1.1.53
github.com/miekg/dns v1.1.54
github.com/pkg/errors v0.9.1
github.com/projectdiscovery/asnmap v1.0.3
github.com/projectdiscovery/asnmap v1.0.4
github.com/projectdiscovery/goflags v0.1.8
github.com/projectdiscovery/gologger v1.1.8
github.com/projectdiscovery/retryabledns v1.0.23
github.com/projectdiscovery/retryablehttp-go v1.0.15
github.com/projectdiscovery/utils v0.0.25
github.com/projectdiscovery/gologger v1.1.10
github.com/projectdiscovery/retryabledns v1.0.24
github.com/projectdiscovery/retryablehttp-go v1.0.16
github.com/projectdiscovery/utils v0.0.32
github.com/remeh/sizedwaitgroup v1.0.0
github.com/rs/xid v1.5.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.3
github.com/syndtr/goleveldb v1.0.0
go.uber.org/multierr v1.11.0
go.uber.org/ratelimit v0.2.0
Expand Down Expand Up @@ -74,7 +73,7 @@ require (
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/projectdiscovery/blackrock v0.0.0-20221025011524-9e4efe804fb4 // indirect
github.com/projectdiscovery/blackrock v0.0.1 // indirect
github.com/projectdiscovery/mapcidr v1.1.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
Expand All @@ -86,9 +85,9 @@ require (
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down

0 comments on commit 2dddf7f

Please sign in to comment.