mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Proto login accounting via utmp(x) and lastlog
This commit is contained in:
parent
6698861c15
commit
ac28e5ef7a
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"blitter.com/go/go_login"
|
||||||
hkexsh "blitter.com/go/hkexsh"
|
hkexsh "blitter.com/go/hkexsh"
|
||||||
"blitter.com/go/hkexsh/spinsult"
|
"blitter.com/go/hkexsh/spinsult"
|
||||||
"github.com/kr/pty"
|
"github.com/kr/pty"
|
||||||
|
@ -137,7 +138,7 @@ func runShellAs(who string, cmd string, interactive bool, conn hkexsh.Conn, chaf
|
||||||
if chaffing {
|
if chaffing {
|
||||||
conn.EnableChaff()
|
conn.EnableChaff()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ..and the pty to stdout.
|
// ..and the pty to stdout.
|
||||||
_, _ = io.Copy(conn, ptmx)
|
_, _ = io.Copy(conn, ptmx)
|
||||||
|
|
||||||
|
@ -289,6 +290,9 @@ func main() {
|
||||||
log.Println("[Command complete]")
|
log.Println("[Command complete]")
|
||||||
} else if rec.op[0] == 's' {
|
} else if rec.op[0] == 's' {
|
||||||
log.Println("[Running shell]")
|
log.Println("[Running shell]")
|
||||||
|
utmpx := go_login.Put_utmp(string(rec.who), string("todo.example.org"))
|
||||||
|
defer func() { go_login.Unput_utmp(utmpx) }()
|
||||||
|
go_login.Put_lastlog_entry("hkexsh", string(rec.who), string("todo.example.org"))
|
||||||
runShellAs(string(rec.who), string(rec.cmd), true, conn, chaffEnabled)
|
runShellAs(string(rec.who), string(rec.cmd), true, conn, chaffEnabled)
|
||||||
// Returned hopefully via an EOF or exit/logout;
|
// Returned hopefully via an EOF or exit/logout;
|
||||||
// Clear current op so user can enter next, or EOF
|
// Clear current op so user can enter next, or EOF
|
||||||
|
|
Loading…
Reference in a new issue