Python java.lang.System.getProperty() Examples

The following are 30 code examples of java.lang.System.getProperty(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module java.lang.System , or try the search function .
Example #1
Source File: _sslcerts.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
def _extract_certs_from_keystore_file(f, password):
    keystore = KeyStore.getInstance(KeyStore.getDefaultType())
    if password is None:
        password = System.getProperty('javax.net.ssl.trustStorePassword')
        if password is None:  # default java keystore password is changeit
            password = 'changeit'
    elif not isinstance(password, str):
        password = []

    keystore.load(BufferedInputStream(f), password)
    certs = []

    alias_iter = keystore.aliases()
    while alias_iter.hasMoreElements():
        alias = alias_iter.nextElement()
        certs.append(keystore.getCertificate(alias))

    return certs 
Example #2
Source File: Utils.py    From 802.11ah-ns3 with GNU General Public License v2.0 6 votes vote down vote up
def unversioned_sys_platform():
	s=sys.platform
	if s.startswith('java'):
		from java.lang import System
		s=System.getProperty('os.name')
		if s=='Mac OS X':
			return'darwin'
		elif s.startswith('Windows '):
			return'win32'
		elif s=='OS/2':
			return'os2'
		elif s=='HP-UX':
			return'hp-ux'
		elif s in('SunOS','Solaris'):
			return'sunos'
		else:s=s.lower()
	if s=='powerpc':
		return'darwin'
	if s=='win32'or s=='os2':
		return s
	return re.split('\d+$',s)[0] 
Example #3
Source File: Utils.py    From royal-chaos with MIT License 6 votes vote down vote up
def unversioned_sys_platform():
	s=sys.platform
	if s.startswith('java'):
		from java.lang import System
		s=System.getProperty('os.name')
		if s=='Mac OS X':
			return'darwin'
		elif s.startswith('Windows '):
			return'win32'
		elif s=='OS/2':
			return'os2'
		elif s=='HP-UX':
			return'hp-ux'
		elif s in('SunOS','Solaris'):
			return'sunos'
		else:s=s.lower()
	if s=='powerpc':
		return'darwin'
	if s=='win32'or s=='os2':
		return s
	if s=='cli'and os.name=='nt':
		return'win32'
	return re.split('\d+$',s)[0] 
Example #4
Source File: _sslcerts.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
def _extract_certs_from_keystore_file(f, password):
    keystore = KeyStore.getInstance(KeyStore.getDefaultType())
    if password is None:
        password = System.getProperty('javax.net.ssl.trustStorePassword')
        if password is None:  # default java keystore password is changeit
            password = 'changeit'
    elif not isinstance(password, str):
        password = []

    keystore.load(BufferedInputStream(f), password)
    certs = []

    alias_iter = keystore.aliases()
    while alias_iter.hasMoreElements():
        alias = alias_iter.nextElement()
        certs.append(keystore.getCertificate(alias))

    return certs 
Example #5
Source File: ssl.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def get_default_verify_paths():
    """Return paths to default cafile and capath.
    """
    cafile, capath = None, None
    default_cert_dir_env = os.environ.get('SSL_CERT_DIR', None)
    default_cert_file_env = os.environ.get('SSL_CERT_FILE', None)

    java_cert_file = System.getProperty('javax.net.ssl.trustStore')

    if java_cert_file is not None and os.path.isfile(java_cert_file):
        cafile = java_cert_file
    else:
        if default_cert_dir_env is not None:
            capath = default_cert_dir_env if os.path.isdir(default_cert_dir_env) else None
        if default_cert_file_env is not None:
            cafile = default_cert_file_env if os.path.isfile(default_cert_file_env) else None

        if cafile is None:
            # http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
            java_home = System.getProperty('java.home')
            for _path in ('lib/security/jssecacerts', 'lib/security/cacerts'):
                java_cert_file = os.path.join(java_home, _path)
                if os.path.isfile(java_cert_file):
                    cafile = java_cert_file
                    capath = os.path.dirname(cafile)

    return DefaultVerifyPaths(cafile if os.path.isfile(cafile) else None,
                              capath if capath and os.path.isdir(capath) else None,
                              'SSL_CERT_FILE', default_cert_file_env,
                              'SSL_CERT_DIR', default_cert_dir_env) 
Example #6
Source File: javapath.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def gethome():
    return System.getProperty("user.home")


# normpath() from Python 1.5.2, with Java appropriate generalizations

# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
# It should be understood that this may change the meaning of the path
# if it contains symbolic links! 
Example #7
Source File: javapath.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def getuser():
    return System.getProperty("user.name") 
Example #8
Source File: javapath.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def gethome():
    return System.getProperty("user.home")


# normpath() from Python 1.5.2, with Java appropriate generalizations

# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
# It should be understood that this may change the meaning of the path
# if it contains symbolic links! 
Example #9
Source File: platform.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return newString(value)
    except AttributeError:
        return default 
Example #10
Source File: ssl.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def get_default_verify_paths():
    """Return paths to default cafile and capath.
    """
    cafile, capath = None, None
    default_cert_dir_env = os.environ.get('SSL_CERT_DIR', None)
    default_cert_file_env = os.environ.get('SSL_CERT_FILE', None)

    java_cert_file = System.getProperty('javax.net.ssl.trustStore')

    if java_cert_file is not None and os.path.isfile(java_cert_file):
        cafile = java_cert_file
    else:
        if default_cert_dir_env is not None:
            capath = default_cert_dir_env if os.path.isdir(default_cert_dir_env) else None
        if default_cert_file_env is not None:
            cafile = default_cert_file_env if os.path.isfile(default_cert_file_env) else None

        if cafile is None:
            # http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
            java_home = System.getProperty('java.home')
            for _path in ('lib/security/jssecacerts', 'lib/security/cacerts'):
                java_cert_file = os.path.join(java_home, _path)
                if os.path.isfile(java_cert_file):
                    cafile = java_cert_file
                    capath = os.path.dirname(cafile)

    return DefaultVerifyPaths(cafile if os.path.isfile(cafile) else None,
                              capath if capath and os.path.isdir(capath) else None,
                              'SSL_CERT_FILE', default_cert_file_env,
                              'SSL_CERT_DIR', default_cert_dir_env) 
Example #11
Source File: runner.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def value(self, value):
        def repl(sub):
            from java.lang import System
            return System.getProperty(sub.group(1), sub.group(1))
        value = self.re_var.sub(repl, value)
        return value 
Example #12
Source File: platform.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #13
Source File: platform.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #14
Source File: platform.py    From unity-python with MIT License 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #15
Source File: platform.py    From android_universal with MIT License 5 votes vote down vote up
def _java_getprop(name, default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #16
Source File: platform.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #17
Source File: javapath.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def getuser():
    return System.getProperty("user.name") 
Example #18
Source File: javapath.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def gethome():
    return System.getProperty("user.home")


# normpath() from Python 1.5.2, with Java appropriate generalizations

# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
# It should be understood that this may change the meaning of the path
# if it contains symbolic links! 
Example #19
Source File: platform.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return newString(value)
    except AttributeError:
        return default 
Example #20
Source File: ssl.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def get_default_verify_paths():
    """Return paths to default cafile and capath.
    """
    cafile, capath = None, None
    default_cert_dir_env = os.environ.get('SSL_CERT_DIR', None)
    default_cert_file_env = os.environ.get('SSL_CERT_FILE', None)

    java_cert_file = System.getProperty('javax.net.ssl.trustStore')

    if java_cert_file is not None and os.path.isfile(java_cert_file):
        cafile = java_cert_file
    else:
        if default_cert_dir_env is not None:
            capath = default_cert_dir_env if os.path.isdir(default_cert_dir_env) else None
        if default_cert_file_env is not None:
            cafile = default_cert_file_env if os.path.isfile(default_cert_file_env) else None

        if cafile is None:
            # http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
            java_home = System.getProperty('java.home')
            for _path in ('lib/security/jssecacerts', 'lib/security/cacerts'):
                java_cert_file = os.path.join(java_home, _path)
                if os.path.isfile(java_cert_file):
                    cafile = java_cert_file
                    capath = os.path.dirname(cafile)

    return DefaultVerifyPaths(cafile if os.path.isfile(cafile) else None,
                              capath if capath and os.path.isdir(capath) else None,
                              'SSL_CERT_FILE', default_cert_file_env,
                              'SSL_CERT_DIR', default_cert_dir_env) 
Example #21
Source File: javapath.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def getuser():
    return System.getProperty("user.name") 
Example #22
Source File: javapath.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def gethome():
    return System.getProperty("user.home")


# normpath() from Python 1.5.2, with Java appropriate generalizations

# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
# It should be understood that this may change the meaning of the path
# if it contains symbolic links! 
Example #23
Source File: platform.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return newString(value)
    except AttributeError:
        return default 
Example #24
Source File: ssl.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def get_default_verify_paths():
    """Return paths to default cafile and capath.
    """
    cafile, capath = None, None
    default_cert_dir_env = os.environ.get('SSL_CERT_DIR', None)
    default_cert_file_env = os.environ.get('SSL_CERT_FILE', None)

    java_cert_file = System.getProperty('javax.net.ssl.trustStore')

    if java_cert_file is not None and os.path.isfile(java_cert_file):
        cafile = java_cert_file
    else:
        if default_cert_dir_env is not None:
            capath = default_cert_dir_env if os.path.isdir(default_cert_dir_env) else None
        if default_cert_file_env is not None:
            cafile = default_cert_file_env if os.path.isfile(default_cert_file_env) else None

        if cafile is None:
            # http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
            java_home = System.getProperty('java.home')
            for _path in ('lib/security/jssecacerts', 'lib/security/cacerts'):
                java_cert_file = os.path.join(java_home, _path)
                if os.path.isfile(java_cert_file):
                    cafile = java_cert_file
                    capath = os.path.dirname(cafile)

    return DefaultVerifyPaths(cafile if os.path.isfile(cafile) else None,
                              capath if capath and os.path.isdir(capath) else None,
                              'SSL_CERT_FILE', default_cert_file_env,
                              'SSL_CERT_DIR', default_cert_dir_env) 
Example #25
Source File: runner.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def value(self, value):
        def repl(sub):
            from java.lang import System
            return System.getProperty(sub.group(1), sub.group(1))
        value = self.re_var.sub(repl, value)
        return value 
Example #26
Source File: platform.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #27
Source File: platform.py    From meddle with MIT License 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #28
Source File: platform.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #29
Source File: platform.py    From BinderFilter with MIT License 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
Example #30
Source File: platform.py    From Computable with MIT License 5 votes vote down vote up
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default