From 98c5c259f24915ada6fa10f00425d49e0d078c40 Mon Sep 17 00:00:00 2001 From: "Autumn.home" Date: Fri, 14 Jun 2024 22:03:21 +0800 Subject: [PATCH] update --- .github/workflows.bak/main.yml | 68 --------------------------------- .github/workflows/main.yml | 70 ++++++++++++++++++++++++++++++++++ pkg/system/config.go | 7 ++-- 3 files changed, 73 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows.bak/main.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows.bak/main.yml b/.github/workflows.bak/main.yml deleted file mode 100644 index c9e708ae..00000000 --- a/.github/workflows.bak/main.yml +++ /dev/null @@ -1,68 +0,0 @@ -#name: Download Tools -# -#on: -# push: -# branches: -# - main -# -#jobs: -# build: -# runs-on: ubuntu-latest -# -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 -# -# - name: Mkdir Tools -# run: | -# if [ ! -d "tools/linux" ]; then -# mkdir -p tools/linux -# fi -# if [ ! -d "tools/darwin" ]; then -# mkdir -p tools/darwin -# fi -# if [ ! -d "tools/win" ]; then -# mkdir -p tools/win -# fi -# - name: Update Ksubdomain -# run: | -# wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-v1.9.5-linux.tar -# tar xvf KSubdomain-v1.9.5-linux.tar -# rm -rf KSubdomain-v1.9.5-linux.tar -# mv ksubdomain tools/linux/ksubdomain -# -# wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-v1.9.5-darwin.tar -# tar xvf KSubdomain-v1.9.5-darwin.tar -# rm -rf KSubdomain-v1.9.5-darwin.tar -# mv ksubdomain tools/darwin/ksubdomain -# -# wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-windows.tar -# tar xvf KSubdomain-windows.tar -# rm -rf KSubdomain-windows.tar -# mv ksubdomain.exe tools/win/ksubdomain.exe -# -# - name: Update rad -# run: | -# wget https://github.com/chaitin/rad/releases/download/1.0/rad_linux_amd64.zip -# unzip rad_linux_amd64.zip -# rm -rf rad_linux_amd64.zip -# mv rad_linux_amd64 tools/linux/rad -# -# -# wget https://github.com/chaitin/rad/releases/download/1.0/rad_darwin_amd64.zip -# unzip rad_darwin_amd64.zip -# rm -rf rad_darwin_amd64.zip -# mv rad_darwin_amd64 tools/darwin/rad -# -# wget https://github.com/chaitin/rad/releases/download/1.0/rad_windows_amd64.zip -# unzip rad_windows_amd64.zip -# rm -rf rad_windows_amd64.zip -# mv rad_windows_amd64.exe tools/win/rad.exe -# - name: Commit and Push changes -# run: | -# echo $(date +'%Y%m%d') > date.txt -# git add . -# git config --local user.email "action@github.com" -# git config --local user.name "GitHub Action" -# git commit -am "$(date +'%Y%m%d')" -# git push -v --progress diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..89f10798 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +name: Download Tools + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + + - name: Mkdir Tools + run: | + if [ ! -d "tools/linux" ]; then + mkdir -p tools/linux + fi + if [ ! -d "tools/darwin" ]; then + mkdir -p tools/darwin + fi + if [ ! -d "tools/win" ]; then + mkdir -p tools/win + fi + - name: Update Ksubdomain + run: | + wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-v1.9.5-linux.tar + tar xvf KSubdomain-v1.9.5-linux.tar + rm -rf KSubdomain-v1.9.5-linux.tar + mv ksubdomain tools/linux/ksubdomain + + wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-v1.9.5-darwin.tar + tar xvf KSubdomain-v1.9.5-darwin.tar + rm -rf KSubdomain-v1.9.5-darwin.tar + mv ksubdomain tools/darwin/ksubdomain + + wget https://github.com/boy-hack/ksubdomain/releases/download/v1.9.5/KSubdomain-windows.tar + tar xvf KSubdomain-windows.tar + rm -rf KSubdomain-windows.tar + mv ksubdomain.exe tools/win/ksubdomain.exe + + - name: Update rad + run: | + wget https://github.com/chaitin/rad/releases/download/1.0/rad_linux_amd64.zip + unzip rad_linux_amd64.zip + rm -rf rad_linux_amd64.zip + mv rad_linux_amd64 tools/linux/rad + + + wget https://github.com/chaitin/rad/releases/download/1.0/rad_darwin_amd64.zip + unzip rad_darwin_amd64.zip + rm -rf rad_darwin_amd64.zip + mv rad_darwin_amd64 tools/darwin/rad + + wget https://github.com/chaitin/rad/releases/download/1.0/rad_windows_amd64.zip + unzip rad_windows_amd64.zip + rm -rf rad_windows_amd64.zip + mv rad_windows_amd64.exe tools/win/rad.exe + - name: Commit and Push changes + run: | + echo $(date +'%Y%m%d') > date.txt + git add . + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "$(date +'%Y%m%d')" + git push -v --progress diff --git a/pkg/system/config.go b/pkg/system/config.go index 25721f65..972ee832 100644 --- a/pkg/system/config.go +++ b/pkg/system/config.go @@ -93,15 +93,14 @@ func SetUp() bool { SensRegChan = make(chan struct{}, 50) CrawlerThreadNow = 0 VERSION = "1.2" - UpdateUrl = "https://raw.githubusercontent.com/Autumn-27/ScopeSentry/main/tools/" + UpdateUrl = "https://update.scope-sentry.top" PocList = make(map[string]types.PocData) dbFlag := InitDb() if !dbFlag { return dbFlag } LogInit(AppConfig.System.Debug) - - UpdateInit() + go UpdateInit() flagCheck := checkCrawler() if !flagCheck { return false @@ -383,7 +382,7 @@ func UpdateInit() { return } if resp["code"].(float64) != 200 { - SlogError(fmt.Sprintf("Update Init Error: %s", resp["message"])) + SlogDebugLocal(fmt.Sprintf("Update Init Error: %s", resp["message"])) } } func WriteYamlConfigToFile(path string, content interface{}) error {