Beispiel #1
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:
			the_cheese_stands_alone = True
			for piece in ['Manufacturer', 'Model Name', 'Model Number', 'Device Name']:
				if self.wpsData.has_key(piece):
					if the_cheese_stands_alone:
						output += '\tWPS Information:\n'
						the_cheese_stands_alone = 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
		return output[:-1]
Beispiel #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:
            the_cheese_stands_alone = True
            for respObj in self.mschap:
                if not 'r' in respObj:  # no response? useless
                    continue
                if the_cheese_stands_alone:
                    output += ('\t' *
                               tabs) + 'MS Chap Challenge & Responses:\n'
                    the_cheese_stands_alone = 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:
            the_cheese_stands_alone = True
            for piece in [
                    'Manufacturer', 'Model Name', 'Model Number', 'Device Name'
            ]:
                if self.wpsData.has_key(piece):
                    if the_cheese_stands_alone:
                        output += ('\t' * tabs) + 'WPS Information:\n'
                        the_cheese_stands_alone = False
                    output += (
                        '\t' * tabs
                    ) + '\t' + piece + ': ' + self.wpsData[piece] + '\n'
        return output.rstrip()
Beispiel #3
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:
			the_cheese_stands_alone = True
			for respObj in self.mschap:
				if not 'r' in respObj:									# no response? useless
					continue
				if the_cheese_stands_alone:
					output += ('\t' * tabs) + 'MS Chap Challenge & Responses:\n'
					the_cheese_stands_alone = 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:
			the_cheese_stands_alone = True
			for piece in ['Manufacturer', 'Model Name', 'Model Number', 'Device Name']:
				if self.wpsData.has_key(piece):
					if the_cheese_stands_alone:
						output += ('\t' * tabs) + 'WPS Information:\n'
						the_cheese_stands_alone = False
					output += ('\t' * tabs) + '\t' + piece + ': ' + self.wpsData[piece] + '\n'
		return output.rstrip()