Skip to content

Commit

Permalink
Merge pull request #491 from projectdiscovery/dev
Browse files Browse the repository at this point in the history
interactsh v1.1.1
  • Loading branch information
ehsandeep committed Mar 11, 2023
2 parents 933a8c1 + 996cc9d commit 14231ab
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 102 deletions.
13 changes: 8 additions & 5 deletions .github/docker/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Build
FROM golang:1.20.0-alpine AS build-env
RUN apk add build-base
RUN go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest
# Base
FROM golang:1.20.1-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.2
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates
COPY --from=build-env /go/bin/interactsh-client /usr/local/bin/interactsh-client
COPY --from=builder /app/interactsh-client /usr/local/bin/

ENTRYPOINT ["interactsh-client"]
21 changes: 14 additions & 7 deletions .github/docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# Build
FROM golang:1.20.0-alpine AS build-env
RUN apk add build-base
RUN go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-server@latest
# Base
FROM golang:1.20.1-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-server


# Release
FROM alpine:3.17.2
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates python3 py3-pip build-base curl \
&& python3 -m pip install impacket
&& 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 \
&& python3 -m pip install impacket \
&& python3 -m pip cache purge \
&& apk del .build-deps
RUN curl -o /usr/local/bin/smb_server.py https://raw.githubusercontent.com/projectdiscovery/interactsh/main/cmd/interactsh-server/smb_server.py
WORKDIR "/usr/local/bin"
COPY --from=build-env /go/bin/interactsh-server /usr/local/bin/interactsh-server
COPY --from=builder /app/interactsh-server /usr/local/bin/

ENTRYPOINT ["interactsh-server"]
5 changes: 4 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: 🔨 Build Test

on:
pull_request:
paths:
- '**.go'
- '**.mod'
workflow_dispatch:

jobs:
Expand All @@ -10,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest-16-cores, windows-latest-8-cores, macOS-latest]
steps:
- name: Set up Go
uses: actions/setup-go@v3
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ on:
pull_request:
branches:
- dev
paths:
- '**.go'
- '**.mod'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
permissions:
actions: read
contents: read
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dockerhub-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:

- name: Checkout
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Get Github tag
id: meta
run: |
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/interactsh/releases/latest" | jq -r .tag_name)"
curl --silent "https://api.github.com/repos/projectdiscovery/interactsh/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -39,4 +39,4 @@ jobs:
file: .github/docker/client/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: projectdiscovery/interactsh-client:latest,projectdiscovery/interactsh-client:${{ steps.meta.outputs.tag }}
tags: projectdiscovery/interactsh-client:latest,projectdiscovery/interactsh-client:${{ steps.meta.outputs.TAG }}
6 changes: 3 additions & 3 deletions .github/workflows/dockerhub-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:

- name: Checkout
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Get Github tag
id: meta
run: |
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/interactsh/releases/latest" | jq -r .tag_name)"
curl --silent "https://api.github.com/repos/projectdiscovery/interactsh/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -39,4 +39,4 @@ jobs:
file: .github/docker/server/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: projectdiscovery/interactsh-server:latest,projectdiscovery/interactsh-server:${{ steps.meta.outputs.tag }}
tags: projectdiscovery/interactsh-server:latest,projectdiscovery/interactsh-server:${{ steps.meta.outputs.TAG }}
5 changes: 4 additions & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ name: 🙏🏻 Lint Test

on:
pull_request:
paths:
- '**.go'
- '**.mod'
workflow_dispatch:

jobs:
lint:
name: Lint Test
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
release:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: "Check out code"
uses: actions/checkout@v3
Expand Down
12 changes: 9 additions & 3 deletions cmd/interactsh-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package main

import (
"bytes"
jsonpkg "encoding/json"
"fmt"
"os"
"os/signal"
"path/filepath"
"regexp"
"time"

jsoniter "github.com/json-iterator/go"
"github.com/projectdiscovery/goflags"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
Expand Down Expand Up @@ -57,6 +57,7 @@ func main() {
flagSet.BoolVar(&cliOptions.DNSOnly, "dns-only", false, "display only dns interaction in CLI output"),
flagSet.BoolVar(&cliOptions.HTTPOnly, "http-only", false, "display only http interaction in CLI output"),
flagSet.BoolVar(&cliOptions.SmtpOnly, "smtp-only", false, "display only smtp interactions in CLI output"),
flagSet.BoolVar(&cliOptions.Asn, "asn", false, " include asn information of remote ip in json output"),
)

flagSet.CreateGroup("output", "Output",
Expand All @@ -77,7 +78,7 @@ func main() {
options.ShowBanner()

if healthcheck {
cfgFilePath, _ := goflags.GetConfigFilePath()
cfgFilePath, _ := flagSet.GetConfigFilePath()
gologger.Print().Msgf("%s\n", runner.DoHealthCheck(cfgFilePath))
os.Exit(0)
}
Expand Down Expand Up @@ -147,6 +148,11 @@ func main() {
if filter != nil && filter.match(interaction.FullId) {
return
}

if cliOptions.Asn {
_ = client.TryGetAsnInfo(interaction)
}

if !cliOptions.JSON {
builder := &bytes.Buffer{}

Expand Down Expand Up @@ -201,7 +207,7 @@ func main() {
}
}
} else {
b, err := jsonpkg.Marshal(interaction)
b, err := jsoniter.Marshal(interaction)
if err != nil {
gologger.Error().Msgf("Could not marshal json output: %s\n", err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion cmd/interactsh-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
options.ShowBanner()

if healthcheck {
cfgFilePath, _ := goflags.GetConfigFilePath()
cfgFilePath, _ := flagSet.GetConfigFilePath()
gologger.Print().Msgf("%s\n", runner.DoHealthCheck(cfgFilePath))
os.Exit(0)
}
Expand Down
27 changes: 14 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ require (
github.com/karlseguin/ccache/v2 v2.0.8
github.com/libdns/libdns v0.2.1
github.com/mackerelio/go-osstat v0.2.3
github.com/miekg/dns v1.1.50
github.com/miekg/dns v1.1.51
github.com/pkg/errors v0.9.1
github.com/projectdiscovery/goflags v0.0.10-0.20220827133735-3ff03268251a
github.com/projectdiscovery/asnmap v1.0.1
github.com/projectdiscovery/goflags v0.1.8
github.com/projectdiscovery/gologger v1.1.8
github.com/projectdiscovery/retryabledns v1.0.21
github.com/projectdiscovery/retryablehttp-go v1.0.11
github.com/projectdiscovery/utils v0.0.9
github.com/projectdiscovery/retryablehttp-go v1.0.12
github.com/projectdiscovery/utils v0.0.14
github.com/remeh/sizedwaitgroup v1.0.0
github.com/rs/xid v1.4.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.2
github.com/syndtr/goleveldb v1.0.0
go.uber.org/multierr v1.9.0
go.uber.org/multierr v1.10.0
go.uber.org/ratelimit v0.2.0
go.uber.org/zap v1.24.0
goftp.io/server/v2 v2.0.0
Expand All @@ -40,7 +41,7 @@ require (
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
Expand All @@ -53,19 +54,19 @@ require (
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/projectdiscovery/fileutil v0.0.3 // indirect
github.com/projectdiscovery/stringsutil v0.0.2 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
github.com/projectdiscovery/blackrock v0.0.0-20221025011524-9e4efe804fb4 // indirect
github.com/projectdiscovery/mapcidr v1.1.0 // indirect
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/exp v0.0.0-20230108222341-4b8118a2686a // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/tools v0.5.0 // indirect
gopkg.in/djherbis/times.v1 v1.3.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

0 comments on commit 14231ab

Please sign in to comment.