NativeUtil.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:JAVA- 作者:
/** 获取网卡序列号 */
public static final String getDUID() {
    String address = "";
    String command = "cmd.exe /c ipconfig /all";
    try {
        Process p = Runtime.getRuntime().exec(command);
        BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line;
        while ((line = br.readLine()) != null) {
            if (line.indexOf("DUID") > 0) {
                int index = line.indexOf(":");
                index += 2;
                address = line.substring(index);
                break;
            }
        }
        br.close();
    } catch (IOException e) {
    }
    return address;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号