test
This commit is contained in:
BIN
helloworld
Executable file
BIN
helloworld
Executable file
Binary file not shown.
7
helloworld.go
Normal file
7
helloworld.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello world")
|
||||
}
|
||||
35
main.go
Normal file
35
main.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
func scanPort(host string, port int, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
address := fmt.Sprintf("%s:%d", host, port)
|
||||
conn, err := net.DialTimeout("tcp", address, 500*time.Millisecond)
|
||||
if err == nil {
|
||||
fmt.Printf("[OPEN] %s\n", address)
|
||||
conn.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
host := "134.185.113.169" // 스캔할 IP 주소
|
||||
startPort := 1
|
||||
endPort := 1024
|
||||
|
||||
for port := startPort; port <= endPort; port++ {
|
||||
wg.Add(1)
|
||||
go scanPort(host, port, &wg)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
fmt.Println("✅ 스캔 완료.")
|
||||
}
|
||||
Reference in New Issue
Block a user