تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] جلب الايبي و ماك اديس لراوتر
#2
PHP كود :
private void button1_Click(object senderEventArgs e) {
    
System.Text.StringBuilder sb = new System.Text.StringBuilder();
    
sb.AppendLine("MAC Address: " getMacAddress());
    
sb.AppendLine("Local IP Address: " getLocalIPAddress());
    
sb.AppendLine("Public IP Address: " getPublicIPAddress());

    
MessageBox.Show(sb.ToString());
}

public 
object getMacAddress() {
    
string result "";
    try {
        
System.Net.NetworkInformation.NetworkInterface[] nics =
            
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
        
result System.Text.RegularExpressions.
            
Regex.Replace(nics[0].GetPhysicalAddress().ToString(), "..(?=.)""$&:");
    } catch { }
    return 
result;
}

public 
object getPublicIPAddress() {
    
string result "";
    try {
        
result = new System.Net.WebClient().DownloadString("http://icanhazip.com/").Trim();
    } catch { }
    return 
result;
}

public 
string getLocalIPAddress() {
    
string result "";
    try {
        
result System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();
    } catch { }
    return 
result;

الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: جلب الايبي و ماك اديس لراوتر - بواسطة amgad525 - 15-12-16, 06:00 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم