Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow update #108

Merged
merged 3 commits into from Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build-test.yml
@@ -1,7 +1,10 @@
name: 🔨 Build Test

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


Expand All @@ -13,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19

- name: Check out code
uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -3,6 +3,9 @@ name: 🚨 CodeQL Analysis
on:
workflow_dispatch:
pull_request:
paths:
- '**.go'
- '**.mod'
branches:
- dev

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/dockerhub-push.yml
@@ -1,8 +1,10 @@
name: 🌥 Docker Push

on:
release:
types: [published]
workflow_run:
workflows: ["🎉 Release Binary"]
types:
- completed
workflow_dispatch:

jobs:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint-test.yml
@@ -1,7 +1,10 @@
name: 🙏🏻 Lint Test

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

jobs:
Expand All @@ -12,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
- name: Checkout code
uses: actions/checkout@v3
- name: Run golangci-lint
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release-binary.yml
@@ -1,6 +1,7 @@
name: 🎉 Release Binary

on:
create:
push:
tags:
- v*
workflow_dispatch:
Expand All @@ -12,7 +13,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
- name: "Check out code"
uses: actions/checkout@v3
with:
Expand All @@ -21,6 +22,9 @@ jobs:
uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
DISCORD_WEBHOOK_ID: "${{ secrets.DISCORD_WEBHOOK_ID }}"
DISCORD_WEBHOOK_TOKEN: "${{ secrets.DISCORD_WEBHOOK_TOKEN }}"
with:
args: "release --rm-dist"
version: latest
Expand Down
28 changes: 21 additions & 7 deletions .goreleaser.yml
@@ -1,3 +1,7 @@
before:
hooks:
- go mod tidy

builds:
- binary: simplehttpserver
main: cmd/simplehttpserver/simplehttpserver.go
Expand All @@ -12,10 +16,20 @@ builds:
- arm64

archives:
- id: tgz
format: tar.gz
replacements:
darwin: macOS
format_overrides:
- goos: windows
format: zip
- format: zip
replacements:
darwin: macOS

checksum:
algorithm: sha256

announce:
slack:
enabled: true
channel: '#release'
username: GoReleaser
message_template: 'New Release: {{ .ProjectName }} {{ .Tag }} is published! Check it out at {{ .ReleaseURL }}'

discord:
enabled: true
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -65,6 +65,7 @@ This will display help for the tool. Here are all the switches it supports.
| `-cert` | HTTPS/TLS certificate (self generated if not specified) | `simplehttpserver -cert cert.pem` |
| `-key` | HTTPS/TLS certificate private key | `simplehttpserver -key cert.key` |
| `-domain` | Domain name to use for the self-generated certificate | `simplehttpserver -domain projectdiscovery.io` |
| `-cors` | Enable cross-origin resource sharing (CORS) | `simplehttpserver -cors` |
| `-basic-auth` | Basic auth (username:password) | `simplehttpserver -basic-auth user:password` |
| `-realm` | Basic auth message | `simplehttpserver -realm "insert the credentials"` |
| `-version` | Show version | `simplehttpserver -version` |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
@@ -1,6 +1,6 @@
module github.com/projectdiscovery/simplehttpserver

go 1.17
go 1.19

require (
github.com/fsnotify/fsnotify v1.6.0
Expand Down
7 changes: 2 additions & 5 deletions internal/runner/banner.go
Expand Up @@ -8,17 +8,14 @@ const banner = `
\__ \/ / __ -__ \/ __ \/ / _ \/ /_/ / / / / / / /_/ / ___/ _ \/ ___/ | / / _ \/ ___/
___/ / / / / / / / /_/ / / __/ __ / / / / / / ____(__ ) __/ / | |/ / __/ /
/____/_/_/ /_/ /_/ .___/_/\___/_/ /_/ /_/ /_/ /_/ /____/\___/_/ |___/\___/_/
/_/ - v0.0.5
/_/ - v0.0.6
`

// Version is the current version
const Version = `0.0.5`
const Version = `0.0.6`

// showBanner is used to show the banner to the user
func showBanner() {
gologger.Print().Msgf("%s\n", banner)
gologger.Print().Msgf("\t\tprojectdiscovery.io\n\n")

gologger.Print().Msgf("Use with caution. You are responsible for your actions\n")
gologger.Print().Msgf("Developers assume no liability and are not responsible for any misuse or damage.\n")
}
6 changes: 3 additions & 3 deletions pkg/httpserver/uploadlayer.go
Expand Up @@ -2,7 +2,7 @@ package httpserver

import (
"errors"
"io/ioutil"
"io"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -55,7 +55,7 @@ func (t *HTTPServer) uploadlayer(handler http.Handler) http.Handler {
r.Body = http.MaxBytesReader(w, r.Body, maxFileSize)
}

data, err = ioutil.ReadAll(r.Body)
data, err = io.ReadAll(r.Body)
if err != nil {
gologger.Print().Msgf("%s\n", err)
w.WriteHeader(http.StatusInternalServerError)
Expand Down Expand Up @@ -95,5 +95,5 @@ func handleUpload(base, file string, data []byte) error {
return errors.New("invalid path")
}

return ioutil.WriteFile(trustedPath, data, 0655)
return os.WriteFile(trustedPath, data, 0655)
}
4 changes: 2 additions & 2 deletions pkg/tcpserver/tcpserver.go
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"crypto/tls"
"errors"
"io/ioutil"
"os"
"net"
"sync"
"time"
Expand Down Expand Up @@ -146,7 +146,7 @@ func (t *TCPServer) Close() error {
// LoadTemplate from yaml
func (t *TCPServer) LoadTemplate(templatePath string) error {
var config RulesConfiguration
yamlFile, err := ioutil.ReadFile(templatePath)
yamlFile, err := os.ReadFile(templatePath)
if err != nil {
return err
}
Expand Down