Skip to content

Commit

Permalink
Add OS detection for logging. Windows < 10 doesn't support ANSI escap…
Browse files Browse the repository at this point in the history
…e codes
  • Loading branch information
Etienne Stalmans committed May 11, 2017
1 parent b373fc2 commit 6f72d3e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

Ruler is a tool that allows you to interact with Exchange servers remotely, through either the MAPI/HTTP or RPC/HTTP protocol. The main aim is abuse the client-side Outlook features and gain a shell remotely.

The full low-down on how Ruler was implemented and some background regarding MAPI can be found in our blog posts: [Ruler release], [Pass the Hash with Ruler], [Outlook forms and shells].
The full low-down on how Ruler was implemented and some background regarding MAPI can be found in our blog posts:
* [Ruler release]
* [Pass the Hash with Ruler]
* [Outlook forms and shells].

For a demo of it in action: [Ruler on YouTube]

Expand Down
34 changes: 24 additions & 10 deletions utils/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package utils
import (
"io"
"log"
"runtime"
)

var (
Expand All @@ -22,15 +23,28 @@ func Init(
infoHandle io.Writer,
warningHandle io.Writer,
errorHandle io.Writer) {
if runtime.GOOS == "windows" {
Trace = log.New(traceHandle, "[*] ", 0)
Info = log.New(infoHandle, "[+] ", 0)
Clear = log.New(infoHandle, " ", 0)
Debug = log.New(warningHandle, " ", 0)
Fail = log.New(infoHandle, "[x] ", 0)
Question = log.New(infoHandle, "[?] ", 0)
Warning = log.New(warningHandle,
"[WARNING] ", 0)
Error = log.New(errorHandle,
"ERROR: ", log.Ldate|log.Ltime)

Trace = log.New(traceHandle, "\033[33m[*] \033[0m", 0)
Info = log.New(infoHandle, "\033[32m[+] \033[0m", 0)
Clear = log.New(infoHandle, " ", 0)
Debug = log.New(warningHandle, " ", 0)
Fail = log.New(infoHandle, "\033[91m[x] \033[0m", 0)
Question = log.New(infoHandle, "\033[91m[?] \033[0m", 0)
Warning = log.New(warningHandle,
"\033[91m[WARNING] \033[0m", 0)
Error = log.New(errorHandle,
"\033[31mERROR\033[0m: ", log.Ldate|log.Ltime)
} else {
Trace = log.New(traceHandle, "\033[33m[*] \033[0m", 0)
Info = log.New(infoHandle, "\033[32m[+] \033[0m", 0)
Clear = log.New(infoHandle, " ", 0)
Debug = log.New(warningHandle, " ", 0)
Fail = log.New(infoHandle, "\033[91m[x] \033[0m", 0)
Question = log.New(infoHandle, "\033[91m[?] \033[0m", 0)
Warning = log.New(warningHandle,
"\033[91m[WARNING] \033[0m", 0)
Error = log.New(errorHandle,
"\033[31mERROR\033[0m: ", log.Ldate|log.Ltime)
}
}

0 comments on commit 6f72d3e

Please sign in to comment.