Visual Basic Forum

Visual Basic Forum
für VB6 und VB.NET Programmierer
 
RegistrierenRegistrieren  LoginLogin
Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Source Codes
Autor
Nachricht
clx_
Tutorial Leser
Tutorial Leser

Anmeldedatum: 16.01.2008
Beiträge: 25

[Anti Leak v1] MAC-Addresse
Verfasst am: 16.02.2008, 18:49

Hier erkläre ich eben eine Anti-Leak Methode mit der MAC-Addresse.

Code:
Option Explicit

' alle benötigten API-Deklarationen
Private Declare Function Netbios Lib "netapi32.dll" _
  (pncb As NCB) As Byte

Private Declare Sub CopyMemory Lib "kernel32" _
  Alias "RtlMoveMemory" ( _
  hpvDest As Any, _
  ByVal hpvSource As Long, _
  ByVal cbCopy As Long)

Private Declare Function GetProcessHeap Lib "kernel32" () As Long

Private Declare Function HeapAlloc Lib "kernel32" ( _
  ByVal hHeap As Long, _
  ByVal dwFlags As Long, _
  ByVal dwBytes As Long) As Long

Private Declare Function HeapFree Lib "kernel32" ( _
  ByVal hHeap As Long, _
  ByVal dwFlags As Long, _
  lpMem As Any) As Long

Private Const NCBASTAT = &H33
Private Const NCBNAMSZ = 16
Private Const NCBRESET = &H32
Private Const HEAP_ZERO_MEMORY = &H8
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
   
Private Type NCB
  ncb_command As Byte
  ncb_retcode As Byte
  ncb_lsn As Byte
  ncb_num As Byte
  ncb_buffer As Long
  ncb_length As Integer
  ncb_callname As String * NCBNAMSZ
  ncb_name As String * NCBNAMSZ
  ncb_rto As Byte
  ncb_sto As Byte
  ncb_post As Long
  ncb_lana_num As Byte
  ncb_cmd_cplt As Byte
  ncb_reserve(9) As Byte ' Reserved, must be 0
  ncb_event As Long
End Type

Private Type ADAPTER_STATUS
  adapter_address(5) As Byte
  rev_major As Byte
  reserved0 As Byte
  adapter_type As Byte
  rev_minor As Byte
  duration As Integer
  frmr_recv As Integer
  frmr_xmit As Integer
  iframe_recv_err As Integer
  xmit_aborts As Integer
  xmit_success As Long
  recv_success As Long
  iframe_xmit_err As Integer
  recv_buff_unavail As Integer
  t1_timeouts As Integer
  ti_timeouts As Integer
  Reserved1 As Long
  free_ncbs As Integer
  max_cfg_ncbs As Integer
  max_ncbs As Integer
  xmit_buf_unavail As Integer
  max_dgram_size As Integer
  pending_sess As Integer
  max_cfg_sess As Integer
  max_sess As Integer
  max_sess_pkt_size As Integer
  name_count As Integer
End Type

Private Type NAME_BUFFER
  name  As String * NCBNAMSZ
  name_num As Integer
  name_flags As Integer
End Type

Private Type ASTAT
  adapt As ADAPTER_STATUS
  NameBuff(30) As NAME_BUFFER
End Type

' MAC-Adresse der Netzwerk-Karte ermitteln
Public Function MAC_Address() As String
  Dim strucNCB As NCB
  Dim strucASTAT As ASTAT
  Dim bResult As Byte
  Dim lResult As Long
  Dim sAddress As String
  Dim sBuffer As String
  Dim i As Integer

  With strucNCB
    ' Struktur füllen
    .ncb_command = NCBRESET
    bResult = Netbios(strucNCB)
    .ncb_command = NCBASTAT
    .ncb_lana_num = 0
    .ncb_callname = "*               "
    .ncb_length = Len(strucASTAT)
   
    ' Heap-Speicher reservieren
    lResult = HeapAlloc(GetProcessHeap(), _
      HEAP_GENERATE_EXCEPTIONS Or _
      HEAP_ZERO_MEMORY, .ncb_length)

    If lResult <> 0 Then
      .ncb_buffer = lResult
      bResult = Netbios(strucNCB)
      CopyMemory strucASTAT, .ncb_buffer, Len(strucASTAT)

      ' MAC-Adresse
      For i = 0 To 5
        sBuffer = Hex$(strucASTAT.adapt.adapter_address(i))
        sAddress = sAddress & IIf(Len(sBuffer) = 2, _
          sBuffer, "0" & sBuffer) & " "
      Next i

      ' Heap-Speicher wieder freigeben
      HeapFree GetProcessHeap(), 0, lResult
    End If

    If Len(sAddress) Then
      ' MAC-Adresse existiert
      MAC_Address = Trim$(sAddress)
    Else
      ' keine MAC-Adresse vorhanden
      MAC_Address = "nicht verfügbar"
    End If
  End With
End Function


Das kommt in die MainForm rein.
Und das schreibt ihr darunter.

Code:
Private Sub Form_Load()
Label1.Caption = MAC_Address 'Hiermit wird die MAC-Addresse in einem Label angezeigt, um eure Hardware ID herauszufinden.
If Not MAC_Address = "00 00 00 00 00 00" Then ' MAC-Addresse reinschreiben in die " ".
MsgBox "Wrong Hardware ID", vbOKOnly, "Error!"
Unload Me
End If
End Sub


Dann wird das Programm automatisch mit einer MsgBox beendet.

Viel Spaß & Glück,
euer cLxx*
 
ZiG_
Überflieger
Überflieger

Anmeldedatum: 07.03.2007
Beiträge: 1248


Verfasst am: 16.02.2008, 19:16

Wenn man nur die MAC Adresse nimmt, bringt das garnichts.
Gibt genug Programme womit man die MAC einfach ändern kann.
Wer nicht auf seine Weise denkt, denkt überhaupt nicht. (Oscar Wilde)
 
clx_
Tutorial Leser
Tutorial Leser

Anmeldedatum: 16.01.2008
Beiträge: 25


Verfasst am: 16.02.2008, 19:23

Ist doch halt nur eine Art ^^
 
marcel1994_
Coder
Coder

Anmeldedatum: 08.02.2008
Beiträge: 202


Verfasst am: 17.02.2008, 01:11

Danke, versuche gerade das in meinen builde reinzubauen, jedoch verstehe ich folgende zeile nicht richtig:

Code:
If Not MAC_Address = "00 00 00 00 00 00" Then ' MAC-Addresse reinschreiben in die " ".


ich verstehe ncith warum da die MAC adresse 00 00 00 00 00 00 stehen muss, ich habs mit meiner versucht (von meiner netzwerkkarte) und es ging nicht ^^
 
clx_
Tutorial Leser
Tutorial Leser

Anmeldedatum: 16.01.2008
Beiträge: 25


Verfasst am: 17.02.2008, 02:30


Add mich ICQ ich gucks mir mal an ^^
ICQ: 64752605
 
Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Source Codes

Tags: ermitteln, antileak, hardware, private

 
 Verwandte Themen   Aufrufe   Letzter Beitrag 
Keine neuen Beiträge [suche] Tuturials winsock & daten senden 981 09.06.2011, 13:19
Keine neuen Beiträge [Video] *.dll & *.ocx Installer 2604 06.03.2008, 21:19
Keine neuen Beiträge ListView speichern & laden 1328 05.08.2008, 13:32
Keine neuen Beiträge Registry & Co Fragen 1201 03.05.2007, 10:57
Keine neuen Beiträge Listbox speichern & laden 2260 22.03.2007, 21:25
 


[ Time: 0.2145s ][ Queries: 92 (0.1374s) ][ GZIP on - Debug on ]