zoukankan
html css js c++ java
用ASP.Net获取客户端网卡的MAC
using
System.Text.RegularExpressions;
using
System.Diagnostics;
public
class
test
{
public
test
{}
public
static
string
GetCustomerMac(
string
IP)
//
para IP is the client's IP
{
string
dirResults
=
""
;
ProcessStartInfo psi
=
new
ProcessStartInfo();
Process proc
=
new
Process();
psi.FileName
=
"
nbtstat
"
;
psi.RedirectStandardInput
=
false
;
psi.RedirectStandardOutput
=
true
;
psi.Arguments
=
"
-A
"
+
IP;
psi.UseShellExecute
=
false
;
proc
=
Process.Start(psi);
dirResults
=
proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
dirResults
=
dirResults.Replace(
"
\r
"
,
""
).Replace(
"
\n
"
,
""
).Replace(
"
\t
"
,
""
);
Regex reg
=
new
Regex(
"
Mac[ ]{0,}Address[ ]{0,}=[ ]{0,}(?<key>((.)*?)) __MAC
"
,RegexOptions.IgnoreCase
|
RegexOptions.Compiled);
Match mc
=
reg.Match(dirResults
+
"
__MAC
"
);
if
(mc.Success)
{
return
mc.Groups[
"
key
"
].Value;
}
else
{
reg
=
new
Regex(
"
Host not found
"
,RegexOptions.IgnoreCase
|
RegexOptions.Compiled);
mc
=
reg.Match(dirResults);
if
(mc.Success)
{
return
"
Host not found!
"
;
}
else
{
return
""
;
}
}
}
}
查看全文
相关阅读:
youtube-VisualSfM and MeshLab workflow video-meshlab part integration
testing_lab1
homework2-st
homework1-spm
homework1-st
just one last blog
week 10
week 9
week 8
课后题7
原文地址:https://www.cnblogs.com/studio313/p/229631.html
最新文章
Spring源码研究--下载-编译-导入eclipse-验证
像素(PX)转其它长度单位(mm、cm...)
http中的Content-Type
关于application/x-www-form-urlencoded等字符编码的解释说明
multipart/form-data boundary 说明
win7 升级Power Shell到4.0
.net Cache 需要注意的地方
SQL 字段修改
Powser Design 16.5 导入Mysql数据库的bug
Druid中配置双数据库
热门文章
ActiveMq Windows 配置优化
Eclipse使用Maven创建Web时错误:Could not resolve archetype
更新VS2017会出现“请更新 Visual Studio 安装程序 再继续” 提示
ipv6过审函数
logging模块
re
xml模块
configParser模块
json模块
shelve模块
Copyright © 2011-2022 走看看