zoukankan      html  css  js  c++  java
  • nbtstat a ip 获取MAC地址等

            //nbtstat -a ip 获取MAC地址等
            public static string cmdNbtstat(string macIp2)
            {
                string hostname2 = "               ";
                string domain2 = "               ";
                string username2 = "               ";
                string mac2 = "               ";

                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.FileName = "nbtstat";
                process.StartInfo.Arguments = "-a "+macIp2;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.RedirectStandardOutput = true;

                process.Start();

                string output = process.StandardOutput.ReadToEnd();
                int hostname2Length = output.IndexOf("<00>  UNIQUE");
                int domain2Length = output.IndexOf("<00>  GROUP");
                int username2Length = output.LastIndexOf("<03>  UNIQUE");
                int mac2Length = output.IndexOf("MAC Address = ");

                if (hostname2Length > 0)
                {
                    hostname2 = output.Substring(hostname2Length - 15, 15);
                }

                if (domain2Length > 0)
                {
                    domain2 = output.Substring(domain2Length - 15, 15);
                }

                if (username2Length > 0)
                {
                    username2 = output.Substring(username2Length - 15, 15);
                }

                if(mac2Length>0)
                {
                    mac2 = output.Substring(mac2Length+14, 17);
                }
                process.WaitForExit();
                return hostname2 + domain2 + username2 + mac2.Replace("-", ":").Trim();
            }

  • 相关阅读:
    GZDBHelper C#.NET开源的数据库访问组件
    判断页面是否是静态页面
    Web应用程序dll获取当前程序集路径问题
    webAPI 上传文件
    解决.Net Core3.0 修改cshtml代码之后必须重新生成才可以看到效果
    .net core使用LESS
    test
    JS实现线程锁(Promise),NodeJS并发锁处理
    参考护照编码实现算法JS生成带字母有序编码
    centos7防火墙开放端口与关闭防火墙
  • 原文地址:https://www.cnblogs.com/mossan/p/749846.html
Copyright © 2011-2022 走看看