コード例 #1
0
ファイル: networks.py プロジェクト: jacobj10/eapeak
	def show(self):
		"""
		This returns a string of human readable information describing
		the network object.
		"""
		output = 'SSID: ' + self.ssid + '\n'
		if self.bssids:
			output += '\tBSSIDs:\n\t\t' + "\n\t\t".join(self.bssids) + '\n'
		if self.eapTypes:
			output += '\tEAP Types:\n'
			for eapType in self.eapTypes:
				if eapType in EAP_TYPES.keys():
					output += '\t\t' + EAP_TYPES[eapType] + '\n'
				else:
					output += '\t\tEAP Type: ' + str(eapType) + '\n'
		if self.expandedVendorIDs:
			output += '\tExpanded EAP Vendor IDs:\n'
			for vendorID in self.expandedVendorIDs:
				if vendorID in EXPANDED_EAP_VENDOR_IDS.keys():
					output += '\t\t' + EXPANDED_EAP_VENDOR_IDS[vendorID] + '\n'
				else:
					output += '\t\tVendor ID: ' + str(vendorID) + '\n'
		if self.wpsData:
			output_control = True
			for piece in ['Manufacturer', 'Model Name', 'Model Number', 'Device Name']:
				if self.wpsData.has_key(piece):
					if output_control:
						output += '\tWPS Information:\n'
						output_control = False
					output += '\t\t' + piece + ': ' + self.wpsData[piece] + '\n'  # pylint: disable=unsubscriptable-object
		if self.clients:
			output += '\tClient Data:\n'
			i = 1
			for client in self.clients.values():
				output += '\t\tClient #' + str(i) + '\n' + client.show(2) + '\n\n'
				i += 1
		if self.x509certs:
			output += '\tCertificates:'
			i = 1
			for cert in self.x509certs:
				output += '\n\t\tCertificate #' + str(i)
				output += '\n\t\tExpiration Date: ' + str(cert.get_not_after())
				data = cert.get_issuer()
				output += '\n\t\tIssuer:'
				for X509_Name_Entry_inst in data.get_entries_by_nid(13):   # 13 is CN
					output += '\n\t\t\tCN: ' + X509_Name_Entry_inst.get_data().as_text()
				for X509_Name_Entry_inst in data.get_entries_by_nid(18):   # 18 is OU
					output += '\n\t\t\tOU: ' + X509_Name_Entry_inst.get_data().as_text()

				data = cert.get_subject()
				output += '\n\t\tSubject:'
				for X509_Name_Entry_inst in data.get_entries_by_nid(13):   # 13 is CN
					output += '\n\t\t\tCN: ' + X509_Name_Entry_inst.get_data().as_text()
				for X509_Name_Entry_inst in data.get_entries_by_nid(18):   # 18 is OU
					output += '\n\t\t\tOU: ' + X509_Name_Entry_inst.get_data().as_text()
				del data
				output += '\n'
				i += 1
			del cert  # pylint: disable=undefined-loop-variable
		return output[:-1]
コード例 #2
0
    def show(self, tabs=0):
        """
		This returns a string of human readable information describing
		the client object, tabs is an optional offset.
		"""
        output = ('\t' * tabs) + 'MAC: ' + self.mac + '\n'
        output += ('\t' * tabs) + 'Associated BSSID: ' + self.bssid + '\n'

        if self.identities:
            output += ('\t' * tabs) + 'Identities:\n\t' + ('\t' * tabs) + (
                "\n\t" + ('\t' * tabs)).join(self.identities.keys()) + '\n'

        if self.eapTypes:
            output += ('\t' * tabs) + 'EAP Types:\n'
            for eapType in self.eapTypes:
                if eapType in EAP_TYPES.keys():
                    output += ('\t' * tabs) + '\t' + EAP_TYPES[eapType] + '\n'
                else:
                    output += ('\t' *
                               tabs) + '\tEAP Type #' + str(eapType) + '\n'
        if self.mschap:
            output_control = True
            for respObj in self.mschap:
                if not 'r' in respObj:  # No response
                    continue
                if output_control:
                    output += ('\t' *
                               tabs) + 'MS Chap Challenge & Responses:\n'
                    output_control = False
                output += ('\t' *
                           tabs) + '\tEAP Type: ' + EAP_TYPES[respObj['t']]
                if respObj['i']:
                    output += ', Identity: ' + respObj['i']
                output += '\n'
                output += ('\t' * tabs) + '\t\tC: ' + respObj['c'] + '\n' + (
                    '\t' * tabs) + '\t\tR: ' + respObj['r'] + '\n'
        if self.wpsData:
            output_control = True
            for piece in [
                    'Manufacturer', 'Model Name', 'Model Number', 'Device Name'
            ]:
                if self.wpsData.has_key(piece):
                    if output_control:
                        output += ('\t' * tabs) + 'WPS Information:\n'
                        output_control = False
                    output += (
                        '\t' * tabs
                    ) + '\t' + piece + ': ' + self.wpsData[piece] + '\n'  # pylint: disable=unsubscriptable-object
        return output.rstrip()
コード例 #3
0
ファイル: clients.py プロジェクト: securestate/eapeak
	def show(self, tabs=0):
		"""
		This returns a string of human readable information describing
		the client object, tabs is an optional offset.
		"""
		tab = '    '
		output = (tab * tabs) + 'MAC: ' + self.mac + '\n'
		output += (tab * tabs) + 'Associated BSSID: ' + self.bssid + '\n'

		if self.identities:
			output += (tab * tabs) + 'Identities:\n' + (tab * (tabs + 1)) + ('\n' + (tab * (tabs + 1))).join(self.identities.keys()) + '\n'

		if self.eapTypes:
			output += (tab * tabs) + 'EAP Types:\n'
			for eapType in self.eapTypes:
				if eapType in EAP_TYPES.keys():
					output += (tab * (tabs + 1)) + EAP_TYPES[eapType] + '\n'
				else:
					output += (tab * (tabs + 1)) + 'EAP Type #' + str(eapType) + '\n'
		if self.mschap:
			output_control = True
			for respObj in self.mschap:
				if not 'r' in respObj:  # No response
					continue
				if output_control:
					output += (tab * tabs) + 'MS Chap Challenge & Responses:\n'
					output_control = False
				output += (tab * (tabs + 1)) + 'EAP Type: ' + EAP_TYPES[respObj['t']]
				if respObj['i']:
					output += ', Identity: ' + respObj['i']
				output += '\n'
				output += (tab * (tabs + 2)) + 'C: ' + respObj['c'] + '\n' + (tab * (tabs + 2)) + 'R: ' + respObj['r'] + '\n'
		if self.wpsData:
			output_control = True
			for piece in ['Manufacturer', 'Model Name', 'Model Number', 'Device Name']:
				if self.wpsData.has_key(piece):
					if output_control:
						output += (tab * tabs) + 'WPS Information:\n'
						output_control = False
					output += (tab * (tabs + 1)) + piece + ': ' + self.wpsData[piece] + '\n'  # pylint: disable=unsubscriptable-object
		return output.rstrip()
コード例 #4
0
    def show(self):
        """
		This returns a string of human readable information describing
		the network object.
		"""
        output = 'SSID: ' + self.ssid + '\n'
        if self.bssids:
            output += '\tBSSIDs:\n\t\t' + "\n\t\t".join(self.bssids) + '\n'
        if self.eapTypes:
            output += '\tEAP Types:\n'
            for eapType in self.eapTypes:
                if eapType in EAP_TYPES.keys():
                    output += '\t\t' + EAP_TYPES[eapType] + '\n'
                else:
                    output += '\t\tEAP Type: ' + str(eapType) + '\n'
        if self.expandedVendorIDs:
            output += '\tExpanded EAP Vendor IDs:\n'
            for vendorID in self.expandedVendorIDs:
                if vendorID in EXPANDED_EAP_VENDOR_IDS.keys():
                    output += '\t\t' + EXPANDED_EAP_VENDOR_IDS[vendorID] + '\n'
                else:
                    output += '\t\tVendor ID: ' + str(vendorID) + '\n'
        if self.wpsData:
            output_control = True
            for piece in [
                    'Manufacturer', 'Model Name', 'Model Number', 'Device Name'
            ]:
                if self.wpsData.has_key(piece):
                    if output_control:
                        output += '\tWPS Information:\n'
                        output_control = False
                    output += '\t\t' + piece + ': ' + self.wpsData[piece] + '\n'  # pylint: disable=unsubscriptable-object
        if self.clients:
            output += '\tClient Data:\n'
            i = 1
            for client in self.clients.values():
                output += '\t\tClient #' + str(i) + '\n' + client.show(
                    2) + '\n\n'
                i += 1
        if self.x509certs:
            output += '\tCertificates:'
            i = 1
            for cert in self.x509certs:
                output += '\n\t\tCertificate #' + str(i)
                output += '\n\t\tExpiration Date: ' + str(cert.get_not_after())
                data = cert.get_issuer()
                output += '\n\t\tIssuer:'
                for X509_Name_Entry_inst in data.get_entries_by_nid(
                        13):  # 13 is CN
                    output += '\n\t\t\tCN: ' + X509_Name_Entry_inst.get_data(
                    ).as_text()
                for X509_Name_Entry_inst in data.get_entries_by_nid(
                        18):  # 18 is OU
                    output += '\n\t\t\tOU: ' + X509_Name_Entry_inst.get_data(
                    ).as_text()

                data = cert.get_subject()
                output += '\n\t\tSubject:'
                for X509_Name_Entry_inst in data.get_entries_by_nid(
                        13):  # 13 is CN
                    output += '\n\t\t\tCN: ' + X509_Name_Entry_inst.get_data(
                    ).as_text()
                for X509_Name_Entry_inst in data.get_entries_by_nid(
                        18):  # 18 is OU
                    output += '\n\t\t\tOU: ' + X509_Name_Entry_inst.get_data(
                    ).as_text()
                del data
                output += '\n'
                i += 1
            del cert  # pylint: disable=undefined-loop-variable
        return output[:-1]