1
0
mirror of https://github.com/schollz/croc.git synced 2024-12-25 14:54:30 +03:00

suppress logging messages when ctl+c interrupting

update readme
This commit is contained in:
Zack Scholl 2018-10-11 06:39:17 -07:00
parent f9b79ed371
commit af11143cba
3 changed files with 10 additions and 3 deletions

View File

@ -15,7 +15,7 @@
## Overview
*croc* uses "code phrases" to securely transfer files. A code phrase is a combination of three random words which the sender shares with the recipient. The code phrase is used by the sender and recipient for password authenticated key exchange ([PAKE](https://github.com/schollz/pake)) to validate parties and generate a secure session key for end-to-end encryption. Since a code phrase can only be used once between two parties, an attacker only has a 1 in 16,777,216 chance to guess the right code phrase to steal the file, any attacker with the wrong code phrase will fail the PAKE and the sender will be notified. Only two people with the right code phrase will be able to computers transfer encrypted data through a relay.
*croc* uses "code phrases" to securely transfer files. A code phrase is a combination of three random words (mnemonicoded 4 bytes) which the sender shares with the recipient. The code phrase is used by the sender and recipient for password authenticated key exchange ([PAKE](https://github.com/schollz/pake)) to validate parties and generate a secure session key for end-to-end encryption. Since a code phrase can only be used once between two parties, an attacker has a chance of less than 1 in *4 billion* to guess the right code phrase to steal the file. Any attacker with the wrong code phrase will fail the PAKE and the sender will be notified. Only two people with the right code phrase will be able to computers transfer encrypted data through a relay.
The actual data transfer is accomplished using a relay, either using raw TCP sockets or websockets. If both computers are on the LAN network then *croc* will use a local relay, otherwise a public relay is used. All the data going through the relay is encrypted using the PAKE-generated session key, so the relay can't spy on information passing through it. The data is transferred in blocks, where each block is compressed and encrypted, and the recipient keeps track of blocks received so that it can resume the transfer if interrupted.

View File

@ -72,10 +72,14 @@ func Init(debug bool) (c *Croc) {
debugLevel = "debug"
c.Debug = true
}
SetDebugLevel(debugLevel)
return
}
func SetDebugLevel(debugLevel string) {
logger.SetLogLevel(debugLevel)
sender.DebugLevel = debugLevel
recipient.DebugLevel = debugLevel
relay.DebugLevel = debugLevel
zipper.DebugLevel = debugLevel
return
}

View File

@ -135,7 +135,7 @@ func (c *Croc) sendReceive(address, websocketPort string, tcpPorts []string, fna
return fmt.Errorf("codephrase is too short")
}
// allow interrupts
// allow interrupts from Ctl+C
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
@ -171,6 +171,9 @@ func (c *Croc) sendReceive(address, websocketPort string, tcpPorts []string, fna
case <-done:
return nil
case <-interrupt:
if !c.Debug {
SetDebugLevel("critical")
}
log.Debug("interrupt")
err = sock.WriteMessage(websocket.TextMessage, []byte("interrupt"))
if err != nil {