2007年9月8日
[DllImport("Ws2_32.dll")]
public static extern Int32 inet_addr(string ip);
[DllImport("Iphlpapi.dll")]
public static extern uint SendARP([In]Int32 dest, [In]Int32 soc, ref Int64 mac, [In, Out]ref Int32 len);
private static string mac;
private static Int64 macinfo;
public static string GetMac(string deIP)
{
Int32 des = inet_addr(deIP);
macinfo = new Int64();
Int32 len = 6;
SendARP(des, 0, ref macinfo, ref len);
mac = macinfo.ToString("x4");
StringBuilder sb = new StringBuilder();
string s;
int i = 0;
if (mac != "0000" && mac.Length == 12)
{
while (i < 12)
{
s = mac.Substring(10 - i, 2);
sb.Append(s.ToUpper());
if (i != 10)
sb.Append("-");
i += 2;
}
mac = sb.ToString();
}
else
{
mac = "Error!";
}
return mac;
}
posted @
2007-09-08 08:59 Realvan 阅读(849) |
评论 (0) |
编辑 收藏
2007年7月17日
wmic /node:"[full machine name]" /USER:"[domain]\[username]"
PATH win32_terminalservicesetting WHERE (__Class!="") CALL SetAllowTSConnections 1
posted @
2007-07-17 17:28 Realvan 阅读(1066) |
评论 (0) |
编辑 收藏