Created
July 8, 2014 03:01
-
-
Save joshrendek/a64c073b610e35623b23 to your computer and use it in GitHub Desktop.
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
func HandleShellRequest(channel ssh.Channel, in <-chan *ssh.Request) { | |
for req := range in { | |
ok := true | |
logfile.Println("[request " + req.Type + "]: " + string(req.Payload)) | |
switch req.Type { | |
case "shell": | |
logfile.Println("[shell]") | |
case "exec": | |
if string(req.Payload) == "uname" { | |
logfile.Println("[[[" + string(req.Payload) + "]]]") | |
channel.Write([]byte("\n\rLinux\n\r")) | |
} | |
channel.Close() | |
} | |
req.Reply(ok, nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment