Add Windows/FreeBSD support

The ttyutils package doesn't support Windows or FreeBSD. Ported code from Google's ssh/terminal that supports Windows and added FreeBSD support. Keeping this within logrus avoids an unnecessary dependency on ssh/terminal.