初级会员
  • 第 3012 位会员
  • CodyGuo
  • guoxiao219@126.com
  • 2015-06-15 20:23:50

最近分享的资源

    暂无

最近发布的项目

    暂无

最近的评论

  • nmap -O 10.10.2.1 Starting Nmap 7.01 ( https://nmap.org ) at 2016-12-23 09:12 CST Nmap scan report for 10.10.2.1 Host is up (0.00057s latency). Not shown: 990 filtered ports PORT STATE SERVICE 22/tcp closed ssh 53/tcp closed domain 80/tcp closed http 443/tcp closed https 1723/tcp open pptp 3306/tcp closed mysql 3690/tcp closed svn 8080/tcp open http-proxy 8888/tcp closed sun-answerbook 9100/tcp closed jetdirect MAC Address: 00:90:7F:84:50:94 (WatchGuard Technologies) Aggressive OS guesses: Linux 2.6.32 (97%), IPFire 2.11 firewall (Linux 2.6.32) (93%), Linux 2.6.35 (90%), IGEL UD3 thin client (Linux 2.6) (90%), DD-WRT v24-sp1 (Linux 2.4) (90%), Linux 2.6.32 - 2.6.35 (90%), Linux 3.8 (89%), Kyocera CopyStar CS-2560 printer (88%), QNAP NAS Firmware 3.8.3 (Linux 3.X) (88%), Linux 3.11 - 4.1 (88%) No exact OS matches for host (test conditions non-ideal). Network Distance: 1 hop OS detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 11.12 seconds
  • walk.MsgBox(nil, "hi", "hello codyguo!", walk.MsgBoxIconInformation)
  • github.com/nsf/gocode
  • nmap or netbios
  • 我也写了一段试试看,发现可以用findstr,但是不能用find,原因还没找到。 ``` package main import ( "fmt" "log" "os" "os/exec" "runtime" "strings" ) const ( winPre = "cmd /c " LinuxPre = "bash /c " ) func main() { cmd := `echo "hello world. A" | findstr "h" | findstr "l" | findstr "o"` result, err := RunCmd(cmd) if err != nil { log.Fatal(err) } fmt.Println(string(result)) // readPipe() } func RunCmd(cmd string) (result []byte, err error) { cmdPip := strings.Split(cmd, "|") if len(cmdPip) < 2 { return run(cmd).Output() } return runPipe(cmdPip) } func run(cmd string) *exec.Cmd { if strings.Contains(cmd, "findstr") || !strings.Contains(cmd, "find") { cmd = strings.Replace(cmd, `"`, "", -1) cmd = strings.TrimSpace(cmd) } cmdList := strings.Split(cmd, " ") return exec.Command(cmdList[0], cmdList[1:]...) } // 不支持windows的find命令,原因未知 func runPipe(pip []string) (result []byte, err error) { var cmds []*exec.Cmd switch runtime.GOOS { case "windows": cmds = append(cmds, run(winPre+pip[0])) case "linux": cmds = append(cmds, run(LinuxPre+pip[0])) default: return nil, fmt.Errorf("Not supported by the system. %v", runtime.GOOS) } for i := 1; i < len(pip); i++ { cmds = append(cmds, run(pip[i])) cmds[i].Stdin, err = cmds[i-1].StdoutPipe() if err != nil { return nil, err } } end := len(cmds) - 1 // cmds[end].Stdout = os.Stdout stdout, _ := cmds[end].StdoutPipe() for i := end; i > 0; i-- { cmds[i].Start() } cmds[0].Run() buf := make([]byte, 512) n, _ := stdout.Read(buf) err = cmds[end].Wait() return buf[:n], err } func readPipe() { var err error cmd1 := exec.Command("cmd", "/c", `echo hello world.`) cmd2 := exec.Command("find", "/i", `"he"`) cmd2.Stdin, err = cmd1.StdoutPipe() if err != nil { log.Fatal(err) } cmd2.Stdout = os.Stdout cmd2.Stderr = os.Stderr cmd2.Start() cmd1.Run() err = cmd2.Wait() fmt.Println(err) } ```