<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mac Adresse eines Clienten ermitteln. ( Winsock )]]></title><description><![CDATA[<p>Hi, also ich möchte in meinem WinSock Server die Mac Adresse ermitteln,<br />
leider ist mir bei meiner Suche nichts unter die finger gekommen was für mich speziell verwendbar wäre... Mein Ziel ist es einfach eine Art Mac-Adressen Ban einzubauen um dieses alt bekannte Router Neustarten zu verhinder... Ich weiß das das auch keine Perfekte lösung ist jedoch ist sie schwerer zu umgehen ( Die Wege sind nicht so bekannt )..</p>
<p>Kann mir da von euch einer vielleicht weiterhelfen, bitte?</p>
<p>Edit: Mir ist aufgefallen das es etwas unglücklich verfasst war, ich möchte natürlich in meinem Winsock server die Mac adressen der Clienten ermitteln nicht meine eigene.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/221428/mac-adresse-eines-clienten-ermitteln-winsock</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 21:32:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/221428.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Aug 2008 23:03:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Mon, 01 Sep 2008 23:13:04 GMT]]></title><description><![CDATA[<p>Hi, also ich möchte in meinem WinSock Server die Mac Adresse ermitteln,<br />
leider ist mir bei meiner Suche nichts unter die finger gekommen was für mich speziell verwendbar wäre... Mein Ziel ist es einfach eine Art Mac-Adressen Ban einzubauen um dieses alt bekannte Router Neustarten zu verhinder... Ich weiß das das auch keine Perfekte lösung ist jedoch ist sie schwerer zu umgehen ( Die Wege sind nicht so bekannt )..</p>
<p>Kann mir da von euch einer vielleicht weiterhelfen, bitte?</p>
<p>Edit: Mir ist aufgefallen das es etwas unglücklich verfasst war, ich möchte natürlich in meinem Winsock server die Mac adressen der Clienten ermitteln nicht meine eigene.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1573299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1573299</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Mon, 01 Sep 2008 23:13:04 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Mon, 01 Sep 2008 05:29:48 GMT]]></title><description><![CDATA[<p>bump</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1574434</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1574434</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Mon, 01 Sep 2008 05:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Mon, 01 Sep 2008 07:42:10 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;snmp.h&gt;
#include &lt;conio.h&gt;
#include &lt;stdio.h&gt;

typedef BOOL(WINAPI * pSnmpExtensionInit) (
        IN DWORD dwTimeZeroReference,
        OUT HANDLE * hPollForTrapEvent,
        OUT AsnObjectIdentifier * supportedView);

typedef BOOL(WINAPI * pSnmpExtensionTrap) (
        OUT AsnObjectIdentifier * enterprise,
        OUT AsnInteger * genericTrap,
        OUT AsnInteger * specificTrap,
        OUT AsnTimeticks * timeStamp,
        OUT RFC1157VarBindList * variableBindings);

typedef BOOL(WINAPI * pSnmpExtensionQuery) (
        IN BYTE requestType,
        IN OUT RFC1157VarBindList * variableBindings,
        OUT AsnInteger * errorStatus,
        OUT AsnInteger * errorIndex);

typedef BOOL(WINAPI * pSnmpExtensionInitEx) (
        OUT AsnObjectIdentifier * supportedView);

void main()
{
    WSADATA WinsockData;
    if (WSAStartup(MAKEWORD(2, 0), &amp;WinsockData) != 0) {
        fprintf(stderr, &quot;This program requires Winsock 2.x!\n&quot;);
        return;
    }

    HINSTANCE m_hInst;
    pSnmpExtensionInit m_Init;
    pSnmpExtensionInitEx m_InitEx;
    pSnmpExtensionQuery m_Query;
    pSnmpExtensionTrap m_Trap;
    HANDLE PollForTrapEvent;
    AsnObjectIdentifier SupportedView;
    UINT OID_ifEntryType[] = {
        1, 3, 6, 1, 2, 1, 2, 2, 1, 3
    };
    UINT OID_ifEntryNum[] = {
        1, 3, 6, 1, 2, 1, 2, 1
    };
    UINT OID_ipMACEntAddr[] = {
        1, 3, 6, 1, 2, 1, 2, 2, 1, 6
    };                          //, 1 ,6 };
    AsnObjectIdentifier MIB_ifMACEntAddr =
        { sizeof(OID_ipMACEntAddr) / sizeof(UINT), OID_ipMACEntAddr };
    AsnObjectIdentifier MIB_ifEntryType = {
        sizeof(OID_ifEntryType) / sizeof(UINT), OID_ifEntryType
    };
    AsnObjectIdentifier MIB_ifEntryNum = {
        sizeof(OID_ifEntryNum) / sizeof(UINT), OID_ifEntryNum
    };
    RFC1157VarBindList varBindList;
    RFC1157VarBind varBind[2];
    AsnInteger errorStatus;
    AsnInteger errorIndex;
    AsnObjectIdentifier MIB_NULL = {
        0, 0
    };
    int ret;
    int dtmp;
    int i = 0, j = 0;
    BOOL found = FALSE;
    char TempEthernet[13];
    m_Init = NULL;
    m_InitEx = NULL;
    m_Query = NULL;
    m_Trap = NULL;

    /* Load the SNMP dll and get the addresses of the functions
       necessary */
    m_hInst = LoadLibrary(&quot;inetmib1.dll&quot;);
    if (m_hInst &lt; (HINSTANCE) HINSTANCE_ERROR) {
        m_hInst = NULL;
        return;
    }
    m_Init =
        (pSnmpExtensionInit) GetProcAddress(m_hInst, &quot;SnmpExtensionInit&quot;);
    m_InitEx =
        (pSnmpExtensionInitEx) GetProcAddress(m_hInst,
                                              &quot;SnmpExtensionInitEx&quot;);
    m_Query =
        (pSnmpExtensionQuery) GetProcAddress(m_hInst,
                                             &quot;SnmpExtensionQuery&quot;);
    m_Trap =
        (pSnmpExtensionTrap) GetProcAddress(m_hInst, &quot;SnmpExtensionTrap&quot;);
    m_Init(GetTickCount(), &amp;PollForTrapEvent, &amp;SupportedView);

    /* Initialize the variable list to be retrieved by m_Query */
    varBindList.list = varBind;
    varBind[0].name = MIB_NULL;
    varBind[1].name = MIB_NULL;

    /* Copy in the OID to find the number of entries in the
       Inteface table */
    varBindList.len = 1;        /* Only retrieving one item */
    SNMP_oidcpy(&amp;varBind[0].name, &amp;MIB_ifEntryNum);
    ret =
        m_Query(ASN_RFC1157_GETNEXTREQUEST, &amp;varBindList, &amp;errorStatus,
                &amp;errorIndex);
    printf(&quot;# of adapters in this system : %i\n&quot;,
           varBind[0].value.asnValue.number); varBindList.len = 2;

    /* Copy in the OID of ifType, the type of interface */
    SNMP_oidcpy(&amp;varBind[0].name, &amp;MIB_ifEntryType);

    /* Copy in the OID of ifPhysAddress, the address */
    SNMP_oidcpy(&amp;varBind[1].name, &amp;MIB_ifMACEntAddr);

    do {

        /* Submit the query.  Responses will be loaded into varBindList.
           We can expect this call to succeed a # of times corresponding
           to the # of adapters reported to be in the system */
        ret =
            m_Query(ASN_RFC1157_GETNEXTREQUEST, &amp;varBindList, &amp;errorStatus,
                    &amp;errorIndex); if (!ret) ret = 1;

        else
            /* Confirm that the proper type has been returned */
            ret =
                SNMP_oidncmp(&amp;varBind[0].name, &amp;MIB_ifEntryType,
                             MIB_ifEntryType.idLength); if (!ret) {
            j++;
            dtmp = varBind[0].value.asnValue.number;
            printf(&quot;Interface #%i type : %i\n&quot;, j, dtmp);

            /* Type 6 describes ethernet interfaces */
            if (dtmp == 6) {

                /* Confirm that we have an address here */
                ret =
                    SNMP_oidncmp(&amp;varBind[1].name, &amp;MIB_ifMACEntAddr,
                                 MIB_ifMACEntAddr.idLength);
                if ((!ret)
                    &amp;&amp; (varBind[1].value.asnValue.address.stream != NULL)) {
                    if (
                        (varBind[1].value.asnValue.address.stream[0] ==
                         0x44)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[1] ==
                            0x45)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[2] ==
                            0x53)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[3] ==
                            0x54)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[4] ==
                            0x00)) {

                        /* Ignore all dial-up networking adapters */
                        printf(&quot;Interface #%i is a DUN adapter\n&quot;, j);
                        continue;
                    }
                    if (
                        (varBind[1].value.asnValue.address.stream[0] ==
                         0x00)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[1] ==
                            0x00)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[2] ==
                            0x00)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[3] ==
                            0x00)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[4] ==
                            0x00)
                        &amp;&amp; (varBind[1].value.asnValue.address.stream[5] ==
                            0x00)) {

                        /* Ignore NULL addresses returned by other network
                           interfaces */
                        printf(&quot;Interface #%i is a NULL address\n&quot;, j);
                        continue;
                    }
                    sprintf(TempEthernet, &quot;%02x%02x%02x%02x%02x%02x&quot;,
                            varBind[1].value.asnValue.address.stream[0],
                            varBind[1].value.asnValue.address.stream[1],
                            varBind[1].value.asnValue.address.stream[2],
                            varBind[1].value.asnValue.address.stream[3],
                            varBind[1].value.asnValue.address.stream[4],
                            varBind[1].value.asnValue.address.stream[5]);
                    printf(&quot;MAC Address of interface #%i: %s\n&quot;, j,
                           TempEthernet);}
            }
        }
    } while (!ret);         /* Stop only on an error.  An error will occur
                               when we go exhaust the list of interfaces to
                               be examined */
    getch();

    /* Free the bindings */
    SNMP_FreeVarBind(&amp;varBind[0]);
    SNMP_FreeVarBind(&amp;varBind[1]);
}
</code></pre>
<p><a href="http://tangentsoft.net/wskfaq/examples/getmac-snmp.html" rel="nofollow">http://tangentsoft.net/wskfaq/examples/getmac-snmp.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1574466</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1574466</guid><dc:creator><![CDATA[asdca]]></dc:creator><pubDate>Mon, 01 Sep 2008 07:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Mon, 01 Sep 2008 23:12:05 GMT]]></title><description><![CDATA[<p>Hum, gut das ist eine Methode die mac adressen seiner eigenen netzwerkadapter zu bekommen. Aber ich möchte ja die meiner verbundenen Clienten ermitteln...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575075</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575075</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Mon, 01 Sep 2008 23:12:05 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Tue, 02 Sep 2008 06:07:40 GMT]]></title><description><![CDATA[<p>Die Funktion heisst SendARP(..).<br />
<a href="http://msdn.microsoft.com/en-us/library/aa366358.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa366358.aspx</a></p>
<p>Die Auflösung von IP zu MAC via ARP geht aber nur im eigenen Subnetz.</p>
<p>Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575120</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575120</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Tue, 02 Sep 2008 06:07:40 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Tue, 02 Sep 2008 06:27:22 GMT]]></title><description><![CDATA[<p>Du kannst ja die oben gennante Methode auf dem Client anwenden und dann via Socket dir die MAC-Adresse zu schicken lassen... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575127</guid><dc:creator><![CDATA[mRXXo]]></dc:creator><pubDate>Tue, 02 Sep 2008 06:27:22 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Wed, 03 Sep 2008 00:54:18 GMT]]></title><description><![CDATA[<p>Warum nur im Subnet?<br />
und wenn ich jetzt einen unveränderlichen und total offenen Server habe, gibt es da möglichkeiten?<br />
Außerdem wenn ich mir die adresse schiken lasse gibt es ja die möglichkeit das sich jemand z.B. mit WPE reinhängt und einfach ne falsche sendet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575632</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Wed, 03 Sep 2008 00:54:18 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Wed, 03 Sep 2008 05:44:30 GMT]]></title><description><![CDATA[<blockquote>
<p>Warum nur im Subnet?</p>
</blockquote>
<p>Guck wie ARP funktioniert und für was es ist, dann findest Du die Erklärung.<br />
Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575648</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Wed, 03 Sep 2008 05:44:30 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Wed, 03 Sep 2008 08:02:22 GMT]]></title><description><![CDATA[<p>Schurke schrieb:</p>
<blockquote>
<p>die möglichkeit das jemand einfach ne falsche sendet.</p>
</blockquote>
<p>die gibts immer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575711</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575711</guid><dc:creator><![CDATA[asdca]]></dc:creator><pubDate>Wed, 03 Sep 2008 08:02:22 GMT</pubDate></item><item><title><![CDATA[Reply to Mac Adresse eines Clienten ermitteln. ( Winsock ) on Wed, 03 Sep 2008 08:47:17 GMT]]></title><description><![CDATA[<p>dann verschlüssle deine nachrichten!</p>
<p>oder mach eine ssh verbindung! (so bist du immer im gleichen netz)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575743</guid><dc:creator><![CDATA[mRXXo]]></dc:creator><pubDate>Wed, 03 Sep 2008 08:47:17 GMT</pubDate></item></channel></rss>