mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Moved client chaff config up so it works for non-interactive (-x) invocations.
This commit is contained in:
parent
a1f4e0342a
commit
dfeb0d709e
1 changed files with 10 additions and 3 deletions
|
@ -143,6 +143,11 @@ func main() {
|
||||||
cmdStr = strings.Trim(string(cmdStdin), "\r\n")
|
cmdStr = strings.Trim(string(cmdStdin), "\r\n")
|
||||||
} else {
|
} else {
|
||||||
op = []byte{'c'}
|
op = []byte{'c'}
|
||||||
|
// non-interactive cmds may complete quickly, so chaff earlier/faster
|
||||||
|
// to help ensure there's some cover to the brief traffic.
|
||||||
|
// (ignoring cmdline values)
|
||||||
|
chaffFreqMin = 2
|
||||||
|
chaffFreqMax = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(authCookie) == 0 {
|
if len(authCookie) == 0 {
|
||||||
|
@ -173,6 +178,10 @@ func main() {
|
||||||
_, err = conn.Write(rec.cmd)
|
_, err = conn.Write(rec.cmd)
|
||||||
_, err = conn.Write(rec.authCookie)
|
_, err = conn.Write(rec.authCookie)
|
||||||
|
|
||||||
|
// Set up chaffing to server
|
||||||
|
conn.Chaff(chaffFreqMin, chaffFreqMax, chaffBytesMax) // enable client->server chaffing
|
||||||
|
conn.EnableChaff()
|
||||||
|
|
||||||
//client reader (from server) goroutine
|
//client reader (from server) goroutine
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -235,8 +244,6 @@ func main() {
|
||||||
// Copy() expects EOF so this will
|
// Copy() expects EOF so this will
|
||||||
// exit with outerr == nil
|
// exit with outerr == nil
|
||||||
//!_, outerr := io.Copy(conn, os.Stdin)
|
//!_, outerr := io.Copy(conn, os.Stdin)
|
||||||
conn.Chaff(chaffFreqMin, chaffFreqMax, chaffBytesMax) // enable client->server chaffing
|
|
||||||
conn.EnableChaff()
|
|
||||||
_, outerr := func(conn *hkexsh.Conn, r io.Reader) (w int64, e error) {
|
_, outerr := func(conn *hkexsh.Conn, r io.Reader) (w int64, e error) {
|
||||||
return io.Copy(conn, r)
|
return io.Copy(conn, r)
|
||||||
}(conn, os.Stdin)
|
}(conn, os.Stdin)
|
||||||
|
|
Loading…
Reference in a new issue