cleverness (mostly) confirmed. exploiting bugs in cmd.exe for fun and pretty printing ftw i guess?
This commit is contained in:
parent
7598e2bf6f
commit
b2109646f3
@ -18,26 +18,12 @@ except ImportError:
|
|||||||
class color(object):
|
class color(object):
|
||||||
# Windows doesn't support ANSI color escapes like sh does.
|
# Windows doesn't support ANSI color escapes like sh does.
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
# "You should be using subprocess!" yeah yeah yeah, I know, shut up.
|
# Gorram it, Windows.
|
||||||
# I already have OS imported and this is a quick hack.
|
# https://bugs.python.org/issue29059
|
||||||
BLACK = os.system('color 0')
|
# https://bugs.python.org/issue30075
|
||||||
BLUE = os.system('color 1')
|
# https://github.com/Microsoft/WSL/issues/1173
|
||||||
GREEN = os.system('color 2')
|
import subprocess
|
||||||
DARKCYAN = os.system('color 3') # "Aqua" text
|
subprocess.call('', shell=True)
|
||||||
RED = os.system('color 4')
|
|
||||||
PURPLE = os.system('color 5')
|
|
||||||
YELLOW = os.system('color 6')
|
|
||||||
END = os.system('color 7') # "White" text
|
|
||||||
GRAY = os.system('color 8')
|
|
||||||
CYAN = os.system('color 9') # "Light Blue" text
|
|
||||||
LTGREEN = os.system('color A') # "Light Green" text
|
|
||||||
LTAQUA = os.system('color B') # "Light Aqua" text
|
|
||||||
LTRED = os.system('color C') # "Light Red" text
|
|
||||||
LTPURPLE = os.system('color D') # "Light Purple" text
|
|
||||||
LTYELLOW = os.system('color E') # "Light Yellow" text
|
|
||||||
BOLD = os.system('color F') # "Bright White" text
|
|
||||||
UNDERLINE = None
|
|
||||||
else:
|
|
||||||
PURPLE = '\033[95m'
|
PURPLE = '\033[95m'
|
||||||
CYAN = '\033[96m'
|
CYAN = '\033[96m'
|
||||||
DARKCYAN = '\033[36m'
|
DARKCYAN = '\033[36m'
|
||||||
@ -200,10 +186,8 @@ def parseArgs():
|
|||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
_cfgpath = 'PLIST:~/Library/Preferences/net.sourceforge.mumble.Mumble.plist'
|
_cfgpath = 'PLIST:~/Library/Preferences/net.sourceforge.mumble.Mumble.plist'
|
||||||
# ALL versions of windows, even Win10, on x86. Even 64-bit. I know.
|
# ALL versions of windows, even Win10, on x86. Even 64-bit. I know.
|
||||||
elif sys.platform == 'win32':
|
# And Cygwin, which currently doesn't even suppport registry reading (see blobGetter()).
|
||||||
_cfgpath = r'REG:HKEY_CURRENT_USER\Software\Mumble\Mumble\net\certificate'
|
elif sys.platform in ('win32', 'cygwin'):
|
||||||
# Some people are sensible.
|
|
||||||
if sys.platform == 'cygwin':
|
|
||||||
_cfgpath = r'REG:HKEY_CURRENT_USER\Software\Mumble\Mumble\net\certificate'
|
_cfgpath = r'REG:HKEY_CURRENT_USER\Software\Mumble\Mumble\net\certificate'
|
||||||
elif (sys.platform == 'linux') or (re.match('.*bsd.*', sys.platform)): # duh
|
elif (sys.platform == 'linux') or (re.match('.*bsd.*', sys.platform)): # duh
|
||||||
_cfgpath = 'INI:~/.config/Mumble/Mumble.conf'
|
_cfgpath = 'INI:~/.config/Mumble/Mumble.conf'
|
||||||
@ -240,6 +224,9 @@ def parseArgs():
|
|||||||
'{0}INI{1}'.format(color.BOLD, color.END),
|
'{0}INI{1}'.format(color.BOLD, color.END),
|
||||||
'{0}REG{1}'.format(color.BOLD, color.END),
|
'{0}REG{1}'.format(color.BOLD, color.END),
|
||||||
'{0}{1}{2}'.format(color.BOLD, _defcrt, color.END)))
|
'{0}{1}{2}'.format(color.BOLD, _defcrt, color.END)))
|
||||||
|
# this ^ currently prints "0m" at the end of the help message,
|
||||||
|
# all the way on the left on Windows.
|
||||||
|
# Why? Who knows; Microsoft is a mystery even to themselves.
|
||||||
return(args)
|
return(args)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -247,8 +234,9 @@ def main():
|
|||||||
cert = Hasher(args)
|
cert = Hasher(args)
|
||||||
cert.importCert()
|
cert.importCert()
|
||||||
h = cert.hashCert()
|
h = cert.hashCert()
|
||||||
print('\n\t\033[1mYour certificate\'s public hash is: \033[94m{0}\033[0m'.format(h))
|
print(('\n\t{0}Your certificate\'s public hash is: ' +
|
||||||
print('\n\t\033[1mPlease provide this to the Mumble server administrator that has requested it.\033[0m\n')
|
'{1}{2}{3}\n\n\t{0}Please provide this to the Mumble server administrator ' +
|
||||||
|
'that has requested it.{3}').format(color.BOLD, color.BLUE, h, color.END))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user