Skip to content

Commit

Permalink
update versions 1
Browse files Browse the repository at this point in the history
  • Loading branch information
yanshiling committed Mar 29, 2021
1 parent 00d67d4 commit a606704
Show file tree
Hide file tree
Showing 14 changed files with 2,146 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
release
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

echo "build macos x64 TxPortMap..."

CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o release/TxPortMap_macos_x64 cmd/TxPortMap/TxPortMap.go
echo "build windows x64 TxPortMap..."
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o release/TxPortMap_windows_x64.exe cmd/TxPortMap/TxPortMap.go
echo "build linux x64 TxPortMap..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o release/TxPortMap_linux_x64 cmd/TxPortMap/TxPortMap.go

49 changes: 49 additions & 0 deletions cmd/TxPortMap/TxPortMap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package main

import (
"flag"
"fmt"
"github.com/4dogs-cn/TXPortMap/pkg/common"
"os"
)

func init() {
flag.Parse()

// fmt.Println("threadnum: ", common.NumThreads)

if common.NumThreads < 1 || common.NumThreads > 2000 {
fmt.Println("number of goroutine must between 1 and 2000")
os.Exit(-1)
}
}

// 建议扫描top100或者top1000端口时使用顺序扫描,其它情况使用随机扫描
func main() {

// trace追踪文件生产,调试时打开注释即可
/*
f1, err := os.Create("scan.trace")
if err != nil {
log.Fatal(err)
}
trace.Start(f1)
defer trace.Stop()
*/
//common.ArgsPrint()
engine := common.CreateEngine()

// 命令行参数错误
if err := engine.Parser(); err != nil {
fmt.Println(err)
os.Exit(1)
}

// common.ArgsPrint()
//engine.Wg.Add(engine.WorkerCount)
//go engine.Scheduler()
engine.Run()

// 等待扫描任务完成
engine.Wg.Wait()
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/4dogs-cn/TXPortMap

go 1.15
184 changes: 184 additions & 0 deletions pkg/common/constant.go

Large diffs are not rendered by default.

Loading

0 comments on commit a606704

Please sign in to comment.