-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yanshiling
committed
Mar 29, 2021
1 parent
00d67d4
commit a606704
Showing
14 changed files
with
2,146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/4dogs-cn/TXPortMap | ||
|
||
go 1.15 |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.