急!!!我要写一个扫描器,毕业答辩好混过去,已经能够扫描某一网段哪些主机开了哪些端口,老师还让加功能,要求能够获得某一主机的操作系统类型,求各位高手救急,点拨点拨,该如何实现?小弟是生手,请讲仔细些,有源代码就更好了。

解决方案 »

  1.   

    OSVERSIONINFO
    The OSVERSIONINFO data structure contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and descriptive text about the operating system. This structure is used with the GetVersionEx function.typedef struct _OSVERSIONINFO{ 
        DWORD dwOSVersionInfoSize; 
        DWORD dwMajorVersion; 
        DWORD dwMinorVersion; 
        DWORD dwBuildNumber; 
        DWORD dwPlatformId; 
        TCHAR szCSDVersion[ 128 ]; 
    } OSVERSIONINFO; 
     
    Members
    dwOSVersionInfoSize 
    Specifies the size, in bytes, of this data structure. Set this member to sizeof(OSVERSIONINFO) before calling the GetVersionEx function. 
    dwMajorVersion 
    Identifies the major version number of the operating system. For example, for Windows NT version 3.51, the major version number is 3; and for Windows NT version 4.0, the major version number is 4. 
    dwMinorVersion 
    Identifies the minor version number of the operating system. For example, for Windows NT version 3.51, the minor version number is 51; and for Windows NT version 4.0, the minor version number is 0. 
    dwBuildNumber 
    Windows NT: Identifies the build number of the operating system. 
    Windows 95: Identifies the build number of the operating system in the low-order word. The high-order word contains the major and minor version numbers. dwPlatformId 
    Identifies the operating system platform. This member can be one of the following values: Value Platform 
    VER_PLATFORM_WIN32s Win32s on Windows 3.1.  
    VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95 or Windows 98. 
    For Windows 95, dwMinorVersion is zero. For Windows 98, dwMinorVersion is greater than zero. 
     
    VER_PLATFORM_WIN32_NT Win32 on Windows NT. 
      
    szCSDVersion 
    Windows NT: Contains a null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty. 
    Windows 95: Contains a null-terminated string that provides arbitrary additional information about the operating system. 
      

  2.   

    好像有个扫描器叫nmap的, 用的finger来做的,有个操作系统指纹库。不过太复杂了,你直接根据开的端口来判断吧,比如说什么137,139的,其他都不开,一般都是98,等等之类的。
      

  3.   

    楼上的文章好吓人!!
    判断操作系统类型,用下面的代码可以了:
    OSVERSIONINFO osvi;
    CString winver,os;
             osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx (&osvi);
    switch(osvi.dwPlatformId)
    {
    case 0:
    os = "Windows 3.x";
    break;
    case 1:
    os = "Windows 95/98/Me";
    break;
    case 2:
    os = "Windows NT/2000";
    break;
    }
      

  4.   

    GetVersion是获取本机的windows系统版本。看楼主的意思,好像是要判断被扫描机器的OS类型。这不止是windows版本的问题了,还可能是Linux, unix等系统。
      

  5.   

    正好看到SNMP协议,可以取MIB库中的 System组的SysDescr(1.3.6.1.2.1.1.3.0)
    看其Software里的值就是了.
      

  6.   

    http://www.huihoo.com/vm/jvm_system.html
      

  7.   

    http://www.tongyi.net/article/20000905/20000905632.shtml
      

  8.   

    halk(夜风) :你说得对,就是要求所扫描主机的操作系统类型。
    sevencat(七猫) :能给小弟讲仔细些吗?感激!
    请大家再多支持,谢谢!
      

  9.   

    halk(夜风) ( ) 信誉:99 讲得很详细了。