예제 #1
0
파일: osver.py 프로젝트: 0x24bin/winexe-1
def os_version(name):
    info = srvsvc.netservergetinfo("\\\\%s" % name, 101)
    return platform_type(info)
예제 #2
0
파일: osver.py 프로젝트: 0x24bin/winexe-1
def platform_type(info101):
    """Determine the operating system type from a SRV_INFO_101."""

    if info101['major_version'] == 4 and info101['minor_version'] == 0:
        return PLATFORM_NT4

    if info101['major_version'] == 5 and info101['minor_version'] == 0:
        return PLATFORM_NT5

    return PLATFORM_UNKNOWN

def is_domain_controller(info101):
    """Return true if the server_type field from a  SRV_INFO_101
    indicates a domain controller."""
    return info101['server_type'] & srvsvc.SV_TYPE_DOMAIN_CTRL

def os_version(name):
    info = srvsvc.netservergetinfo("\\\\%s" % name, 101)
    return platform_type(info)

if __name__ == "__main__":
    import sys
    if len(sys.argv) != 2:
        print "Usage: osver.py server"
        sys.exit(0)
    info = srvsvc.netservergetinfo("\\\\%s" % sys.argv[1], 101)
    print "platform type = %d" % platform_type(info)
    if is_domain_controller(info):
        print "%s is a domain controller" % sys.argv[1]
예제 #3
0
파일: osver.py 프로젝트: 23171580/padavan
def os_version(name):
    info = srvsvc.netservergetinfo("\\\\%s" % name, 101)
    return platform_type(info)
예제 #4
0
파일: osver.py 프로젝트: 23171580/padavan
    if info101['major_version'] == 4 and info101['minor_version'] == 0:
        return PLATFORM_NT4

    if info101['major_version'] == 5 and info101['minor_version'] == 0:
        return PLATFORM_NT5

    return PLATFORM_UNKNOWN


def is_domain_controller(info101):
    """Return true if the server_type field from a  SRV_INFO_101
    indicates a domain controller."""
    return info101['server_type'] & srvsvc.SV_TYPE_DOMAIN_CTRL


def os_version(name):
    info = srvsvc.netservergetinfo("\\\\%s" % name, 101)
    return platform_type(info)


if __name__ == "__main__":
    import sys
    if len(sys.argv) != 2:
        print "Usage: osver.py server"
        sys.exit(0)
    info = srvsvc.netservergetinfo("\\\\%s" % sys.argv[1], 101)
    print "platform type = %d" % platform_type(info)
    if is_domain_controller(info):
        print "%s is a domain controller" % sys.argv[1]
예제 #5
0
파일: osver.py 프로젝트: runt18/samba
def os_version(name):
    info = srvsvc.netservergetinfo("\\\\{0!s}".format(name), 101)
    return platform_type(info)
예제 #6
0
파일: osver.py 프로젝트: runt18/samba
def platform_type(info101):
    """Determine the operating system type from a SRV_INFO_101."""

    if info101['major_version'] == 4 and info101['minor_version'] == 0:
        return PLATFORM_NT4

    if info101['major_version'] == 5 and info101['minor_version'] == 0:
        return PLATFORM_NT5

    return PLATFORM_UNKNOWN

def is_domain_controller(info101):
    """Return true if the server_type field from a  SRV_INFO_101
    indicates a domain controller."""
    return info101['server_type'] & srvsvc.SV_TYPE_DOMAIN_CTRL

def os_version(name):
    info = srvsvc.netservergetinfo("\\\\{0!s}".format(name), 101)
    return platform_type(info)

if __name__ == "__main__":
    import sys
    if len(sys.argv) != 2:
        print "Usage: osver.py server"
        sys.exit(0)
    info = srvsvc.netservergetinfo("\\\\{0!s}".format(sys.argv[1]), 101)
    print "platform type = {0:d}".format(platform_type(info))
    if is_domain_controller(info):
        print "{0!s} is a domain controller".format(sys.argv[1])