credentialsniffer.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:EvilTwinFramework 作者: Esser420 项目源码 文件源码
def parse_eap_packet(self, packet):
        eap_layer = packet[EAP]
        if eap_layer.type not in EAP_TYPES:
            return

        REQUEST, RESPONSE = 1, 2

        # Means that we are the Access Point that the use is connecting to
        if Ether in packet:
            client_mac = packet[Ether].dst
        elif self._packet_is_from_ap(packet):
            client_mac = self._get_destination_from_packet(packet)
        else:
            client_mac = self._get_source_from_packet(packet)

        if client_mac:
            if client_mac not in self.wifi_clients:
                self.wifi_clients[client_mac] = WiFiClient(client_mac)
        else:
            return

        client = self.wifi_clients[client_mac]

        client.user_id = eap_layer.id

        if EAP_TYPES[eap_layer.type] == "ID" and eap_layer.code == RESPONSE:
            client.identity = eap_layer.identity

        elif EAP_TYPES[eap_layer.type] == "MD5":
            auth_id = eap_layer.id
            if auth_id not in client.authentications["MD5"]:
                client.authentications["MD5"][auth_id] = ChallengeResponseAuth(auth_id, "MD5")
            authentication = client.authentications["MD5"][auth_id]

            if eap_layer.code == REQUEST:
                authentication.challenge = eap_layer.load[1:17].encode("HEX")
            elif packet[EAP].code == RESPONSE:
                authentication.response = eap_layer.load[1:17].encode("HEX")

        elif EAP_TYPES[eap_layer.type] == "LEAP":
            auth_id = eap_layer.id

            if auth_id not in client.authentications["LEAP"]:
                client.authentications["LEAP"][auth_id] = ChallengeResponseAuth(auth_id, "LEAP")
            authentication = client.authentications["LEAP"][auth_id]

            leap_layer = packet[LEAP]
            if leap_layer.name:
                authentication.username = leap_layer.name
            if eap_layer.code == REQUEST:
                if len(leap_layer.data) == 8:
                    authentication.challenge = leap_layer.data.encode("HEX")
            elif packet[EAP].code == RESPONSE:
                if len(leap_layer.data) == 24:
                    authentication.response = eap_layer.data.encode("HEX")

        client.check_and_log_credentials()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号