IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

 Kayıt ol  Topluluk
Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 21 Temmuz 2008, 19:25   #1
Çevrimiçi
Yardımcı Admin
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Uzaktan MAC adresi bulmak




PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
 'Projeye eklenmesi gerekenler:
2 adet textbox ve 1 adet buton

Option Explicit

Private Const NO_ERROR 0

Private Declare Function inet_addr Lib "wsock32.dll" _
  
(ByVal s As String) As Long

Private Declare Function SendARP Lib "iphlpapi.dll" _
  
(ByVal DestIP As Long_
   ByVal SrcIP 
As Long_
   pMacAddr 
As Long_
   PhyAddrLen 
As Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" _
   Alias 
"RtlMoveMemory" _
  
(dst As Any_
   src 
As Any_
   ByVal bcount 
As Long)
   


Private 
Sub Form_Load()

   
Text1.Text "192.168.1.101"
   
Text2.Text ""
   
Command1.Caption "Get Remote Mac Address"
   
End Sub


Private Sub Command1_Click()

   
Dim sRemoteMacAddress As String
   
   
If Len(Text1.Text) > 0 Then
   
      
If GetRemoteMACAddress(Text1.TextsRemoteMacAddressThen
         Text2
.Text sRemoteMacAddress
      
Else
         
Text2.Text "(SendARP call failed)"
      
End If
     
   
End If

End Sub


Private Function GetRemoteMACAddress(ByVal sRemoteIP As String_
                                     sRemoteMacAddress 
As String) As Boolean

   Dim dwRemoteIP 
As Long
   Dim pMacAddr 
As Long
   Dim bpMacAddr
() As Byte
   Dim PhyAddrLen 
As Long
   Dim cnt 
As Long
   Dim tmp 
As String
   
  
'convert the string IP into
  '
an unsigned long value containing
  
'a suitable binary representation
  '
of the Internet address given
   dwRemoteIP 
inet_addr(sRemoteIP)
   
   If 
dwRemoteIP <> 0 Then
   
     
'set PhyAddrLen to 6
      PhyAddrLen = 6
   
     '
retrieve the remote MAC address
      
If SendARP(dwRemoteIP0&, pMacAddrPhyAddrLen) = NO_ERROR Then
     
         
If pMacAddr <> And PhyAddrLen <> 0 Then
     
           
'returned value is a long pointer
           '
to the mac addressso copy data
           
'to a byte array
            ReDim bpMacAddr(0 To PhyAddrLen - 1)
            CopyMemory bpMacAddr(0), pMacAddr, ByVal PhyAddrLen
         
           '
loop through array to build string
            
For cnt 0 To PhyAddrLen 1
               
               
If bpMacAddr(cnt) = 0 Then
                  tmp 
tmp "00-"
               
Else
                  
tmp tmp Hex$(bpMacAddr(cnt)) & "-"
               
End If
         
            
Next
           
           
'remove the trailing dash
           '
added above and return True
            
If Len(tmp) > 0 Then
               sRemoteMacAddress 
Left$(tmpLen(tmp) - 1)
               
GetRemoteMACAddress True
            End 
If

            Exit Function
         
         Else
            
GetRemoteMACAddress False
         End 
If
           
      Else
         
GetRemoteMACAddress False
      End 
If  'SendARP
     
   Else
      GetRemoteMACAddress = False
   End If  '
dwRemoteIP
     
End 
Function 

Alıntıdır..

__________________
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet
Cevapla

Etiketler
adresi, bulmak, mac, uzaktan


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Uzaktan Uzaktan - Nurullah Genç Sevda Şairler ve Şiirleri 0 10 Ağustos 2012 23:15
Uzaktan Yönetim Sunay Ağ, Network ve Networking 0 04 Mayıs 2010 16:03