Fmt'ing some log outputs...

shw-merge
xSmurf 7 years ago
parent 7c657b9f53
commit bfa28d89da

@ -45,7 +45,7 @@ func (p *prompter) prompt(policy *Policy) {
return return
} }
p.policyMap[policy.sandbox+"|"+policy.path] = policy p.policyMap[policy.sandbox+"|"+policy.path] = policy
fmt.Println("Saving policy key:" + policy.sandbox + "|" + policy.path) log.Debugf("Saving policy key:" + policy.sandbox + "|" + policy.path)
p.policyQueue = append(p.policyQueue, policy) p.policyQueue = append(p.policyQueue, policy)
p.cond.Signal() p.cond.Signal()
} }
@ -99,7 +99,7 @@ func (p *prompter) processNextPacket() bool {
} }
if pc.getPrompting() { if pc.getPrompting() {
fmt.Println("Skipping over already prompted connection") log.Debugf("Skipping over already prompted connection")
promptLock.Unlock() promptLock.Unlock()
continue continue
} }
@ -245,7 +245,7 @@ func (p *prompter) nextConnection() (pendingConnection, bool) {
p.removePolicy(policy) p.removePolicy(policy)
} else { } else {
if pc == nil && !qempty { if pc == nil && !qempty {
fmt.Println("FIX ME: I NEED TO SLEEP ON A WAKEABLE CONDITION PROPERLY!!") log.Errorf("FIX ME: I NEED TO SLEEP ON A WAKEABLE CONDITION PROPERLY!!")
time.Sleep(time.Millisecond * 300) time.Sleep(time.Millisecond * 300)
} }
return pc, qempty return pc, qempty
@ -258,7 +258,7 @@ func (p *prompter) removePolicy(policy *Policy) {
if DoMultiPrompt { if DoMultiPrompt {
if len(p.policyQueue) == 0 { if len(p.policyQueue) == 0 {
fmt.Println("Skipping over zero length policy queue") log.Debugf("Skipping over zero length policy queue")
newQueue = make([]*Policy, 0, 0) newQueue = make([]*Policy, 0, 0)
} }
} }

@ -141,7 +141,7 @@ func (s *socksChain) start() {
var err error var err error
s.listener, err = net.Listen(s.cfg.ListenSocksNet, s.cfg.ListenSocksAddr) s.listener, err = net.Listen(s.cfg.ListenSocksNet, s.cfg.ListenSocksAddr)
if err != nil { if err != nil {
log.Errorf("ERR/socks: Failed to listen on the socks address: %v", err) log.Errorf("SOCKS: Failed to listen on the socks address: %v", err)
os.Exit(1) os.Exit(1)
} }
@ -157,7 +157,7 @@ func (s *socksChain) socksAcceptLoop() error {
conn, err := s.listener.Accept() conn, err := s.listener.Accept()
if err != nil { if err != nil {
if e, ok := err.(net.Error); ok && !e.Temporary() { if e, ok := err.(net.Error); ok && !e.Temporary() {
log.Infof("ERR/socks: Failed to Accept(): %v", err) log.Errorf("SOCKS: Failed to Accept(): %v", err)
return err return err
} }
continue continue
@ -171,12 +171,12 @@ func (c *socksChainSession) sessionWorker() {
defer c.clientConn.Close() defer c.clientConn.Close()
clientAddr := c.clientConn.RemoteAddr() clientAddr := c.clientConn.RemoteAddr()
log.Infof("INFO/socks: New connection from: %v", clientAddr) log.Debugf("SOCKS: New connection from: %v", clientAddr)
// Do the SOCKS handshake with the client, and read the command. // Do the SOCKS handshake with the client, and read the command.
var err error var err error
if c.req, err = Handshake(c.clientConn); err != nil { if c.req, err = Handshake(c.clientConn); err != nil {
log.Infof("ERR/socks: Failed SOCKS5 handshake: %v", err) log.Errorf("SOCKS: Failed SOCKS5 handshake: %v", err)
return return
} }
@ -206,7 +206,7 @@ func (c *socksChainSession) sessionWorker() {
c.handleConnect(tls) c.handleConnect(tls)
default: default:
// Should *NEVER* happen, validated as part of handshake. // Should *NEVER* happen, validated as part of handshake.
log.Infof("BUG/socks: Unsupported SOCKS command: 0x%02x", c.req.Cmd) log.Warningf("SOCKS: Unsupported SOCKS command: 0x%02x", c.req.Cmd)
c.req.Reply(ReplyCommandNotSupported) c.req.Reply(ReplyCommandNotSupported)
} }
} }
@ -389,7 +389,7 @@ func (c *socksChainSession) handleConnect(tls bool) {
if c.optData != nil { if c.optData != nil {
if _, err = c.upstreamConn.Write(c.optData); err != nil { if _, err = c.upstreamConn.Write(c.optData); err != nil {
log.Infof("ERR/socks: Failed writing OptData: %v", err) log.Errorf("SOCKS: Failed writing OptData: %v", err)
return return
} }
c.optData = nil c.optData = nil
@ -398,7 +398,7 @@ func (c *socksChainSession) handleConnect(tls bool) {
// A upstream connection has been established, push data back and forth // A upstream connection has been established, push data back and forth
// till the session is done. // till the session is done.
c.forwardTraffic(tls) c.forwardTraffic(tls)
log.Infof("INFO/socks: Closed SOCKS connection from: %v", c.clientConn.RemoteAddr()) log.Debugf("SOCKS: Closed SOCKS connection from: %v", c.clientConn.RemoteAddr())
} }
func (c *socksChainSession) forwardTraffic(tls bool) { func (c *socksChainSession) forwardTraffic(tls bool) {

Loading…
Cancel
Save