def run(self):
        conn = self.frmwk.serial_connection
        logger = self.logger
        lower_boundary = self.options['LOWER']
        upper_boundary = self.options['UPPER']
        out_file = open(self.options['FILE'], 'w', 1)
        if not self.frmwk.serial_login():
            logger.warning(
                'meter login failed, some tables may not be accessible')

        number_of_tables = 0
        self.frmwk.print_status('Starting Dump. Writing table data to: ' +
                                self.options.get_option_value('FILE'))
        for tableid in xrange(lower_boundary, (upper_boundary + 1)):
            try:
                data = conn.get_table_data(tableid)
            except C1218ReadTableError as error:
                data = None
                if error.errCode == 10:  # ISSS
                    conn.stop()
                    logger.warning(
                        'received ISSS error, connection stopped, will sleep before retrying'
                    )
                    sleep(0.5)
                    if not self.frmwk.serial_login():
                        logger.warning(
                            'meter login failed, some tables may not be accessible'
                        )
                    try:
                        data = conn.get_table_data(tableid)
                    except C1218ReadTableError as error:
                        data = None
                        if error.errCode == 10:
                            raise error  # tried to re-sync communications but failed, you should reconnect and rerun the module
            if data:
                self.frmwk.print_status(
                    'Found readable table, ID: ' + str(tableid) + ' Name: ' +
                    (C1219_TABLES.get(tableid) or 'UNKNOWN'))
                # format is: table id, table name, table data length, table data
                out_file.write(','.join([
                    str(tableid), (C1219_TABLES.get(tableid) or 'UNKNOWN'),
                    str(len(data)),
                    data.encode('hex')
                ]) + os.linesep)
                number_of_tables += 1

        out_file.close()
        self.frmwk.print_status('Successfully copied ' +
                                str(number_of_tables) + ' tables to disk.')
        return
    def run(self):
        conn = self.frmwk.serial_connection
        logger = self.logger
        lower_boundary = self.options['LOWER']
        upper_boundary = self.options['UPPER']

        number_of_tables = 0
        self.frmwk.print_status('Enumerating tables, please wait...')
        for table_id in range(lower_boundary, (upper_boundary + 1)):
            try:
                conn.get_table_data(table_id)
            except C1218ReadTableError:
                self.frmwk.serial_disconnect()
                logger.warning(
                    'received ISSS error, connection stopped, will sleep before retrying'
                )
                sleep(0.5)
                self.frmwk.serial_connect()
                if not self.frmwk.serial_login():
                    logger.warning(
                        'meter login failed, some tables may not be accessible'
                    )
                conn = self.frmwk.serial_connection
            else:
                self.frmwk.print_status(
                    'Found readable table, ID: ' + str(table_id) + ' Name: ' +
                    (C1219_TABLES.get(table_id) or 'UNKNOWN'))
                number_of_tables += 1
        self.frmwk.print_status("Found {0:,} tables in range {1}-{2}.".format(
            number_of_tables, lower_boundary, upper_boundary))
    def run(self):
        conn = self.frmwk.serial_connection
        logger = self.logger
        lower_boundary = self.options['LOWER']
        upper_boundary = self.options['UPPER']
        if not self.frmwk.serial_login():
            logger.warning('meter login failed')

        self.frmwk.print_status('Enumerating tables, please wait...')
        tables_found = 0
        for tableid in xrange(lower_boundary, (upper_boundary + 1)):
            data = self.get_table_data_ex(conn, tableid, 4)
            if data[0] == '\x00':
                self.frmwk.print_status(
                    'Found readable table, ID: ' + str(tableid) + ' Name: ' +
                    (C1219_TABLES.get(tableid) or 'UNKNOWN'))
                tables_found += 1
            else:
                error_code = ord(data[0])
                error_type = str(
                    C1218_RESPONSE_CODES.get(error_code) or 'UNKNOWN')
                logger.info('received error code: ' + str(error_code) +
                            ' type: ' + error_type)
            while not conn.stop():
                sleep(0.5)
            sleep(0.25)
            while not conn.start():
                sleep(0.5)
            sleep(0.25)
            while not conn.login():
                sleep(0.5)
            sleep(0.25)
        self.frmwk.print_status('Found ' + str(tables_found) + ' table(s).')
        return
	def run(self, frmwk, args):
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']
		logger = frmwk.get_module_logger(self.name)
		if not frmwk.serial_login():
			logger.warning('meter login failed')
		conn = frmwk.serial_connection
		
		frmwk.print_status('Enumerating tables, please wait...')
		tables_found = 0
		for tableid in xrange(lower_boundary, (upper_boundary + 1)):
			data = self.getTableDataEx(conn, tableid, 4)
			if data[0] == '\x00':
				frmwk.print_status('Found readable table, ID: ' + str(tableid) + ' Name: ' + (C1219_TABLES.get(tableid) or 'UNKNOWN'))
				tables_found += 1
			else:
				logger.info('received nak/error code: ' + str(ord(data[0])))
			while not conn.stop():
				sleep(0.5)
			sleep(0.25)
			while not conn.start():
				sleep(0.5)
			sleep(0.25)
			while not conn.login():
				sleep(0.5)
			sleep(0.25)
		frmwk.print_status('Found ' + str(tables_found) + ' table(s).')
		return
	def run(self, frmwk, args):
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']
		out_file = open(self.options['FILE'], 'w', 1)
		logger = frmwk.get_module_logger(self.name)
		if not frmwk.serial_login():
			logger.warning('meter login failed, some tables may not be accessible')
		conn = frmwk.serial_connection
		
		number_of_tables = 0
		frmwk.print_status('Starting Dump. Writing table data to: ' + self.options.getOptionValue('FILE'))
		for tableid in xrange(lower_boundary, (upper_boundary + 1)):
			try:
				data = conn.getTableData(tableid)
			except C1218ReadTableError as error:
				data = None
				if error.errCode == 10:	# ISSS
					conn.stop()
					logger.warning('received ISSS error, connection stopped, will sleep before retrying')
					sleep(0.5)
					if not frmwk.serial_login():
						logger.warning('meter login failed, some tables may not be accessible')
					try:
						data = conn.getTableData(tableid)
					except C1218ReadTableError as error:
						data = None
						if error.errCode == 10:
							raise error	# tried to re-sync communications but failed, you should reconnect and rerun the module
			if data:
				frmwk.print_status('Found readable table, ID: ' + str(tableid) + ' Name: ' + (C1219_TABLES.get(tableid) or 'UNKNOWN'))
				# format is: table id, table name, table data length, table data
				out_file.write(','.join([str(tableid), (C1219_TABLES.get(tableid) or 'UNKNOWN'), str(len(data)), data.encode('hex')]) + os.linesep)
				number_of_tables += 1
		
		out_file.close()
		frmwk.print_status('Successfully copied ' + str(number_of_tables) + ' tables to disk.')
		return
    def run(self):
        conn = self.frmwk.serial_connection
        logger = self.logger
        lower_boundary = self.options['LOWER']
        upper_boundary = self.options['UPPER']
        if not self.frmwk.serial_login():
            logger.warning('meter login failed')

        number_of_tables = 0
        self.frmwk.print_status('Enumerating tables, please wait...')
        for tableid in xrange(lower_boundary, (upper_boundary + 1)):
            try:
                data = conn.get_table_data(tableid)
            except C1218ReadTableError as error:
                data = None
                if error.errCode == 10:  # ISSS
                    conn.stop()
                    logger.warning(
                        'received ISSS error, connection stopped, will sleep before retrying'
                    )
                    sleep(0.5)
                    if not self.frmwk.serial_login():
                        logger.warning(
                            'meter login failed, some tables may not be accessible'
                        )
                    try:
                        data = conn.get_table_data(tableid)
                    except C1218ReadTableError as error:
                        data = None
                        if error.errCode == 10:
                            raise error  # tried to re-sync communications but failed, you should reconnect and rerun the module
            if data:
                self.frmwk.print_status(
                    'Found readable table, ID: ' + str(tableid) + ' Name: ' +
                    (C1219_TABLES.get(tableid) or 'UNKNOWN'))
                number_of_tables += 1
        self.frmwk.print_status('Found ' + str(number_of_tables) +
                                ' table(s).')
        return
Beispiel #7
0
	def run(self):
		conn = self.frmwk.serial_connection
		logger = self.logger
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']
		out_file = open(self.options['FILE'], 'w', 1)

		number_of_tables = 0
		self.frmwk.print_status('Starting dump, writing table data to: ' + self.options['FILE'])
		for tableid in range(lower_boundary, (upper_boundary + 1)):
			try:
				data = conn.get_table_data(tableid)
			except C1218ReadTableError as error:
				data = None
				if error.code == 10:  # ISSS
					conn.stop()
					logger.warning('received ISSS error, connection stopped, will sleep before retrying')
					time.sleep(0.5)
					if not self.frmwk.serial_login():
						logger.warning('meter login failed, some tables may not be accessible')
					try:
						data = conn.get_table_data(tableid)
					except C1218ReadTableError as error:
						data = None
						if error.code == 10:
							raise error  # tried to re-sync communications but failed, you should reconnect and rerun the module
			if not data:
				continue
			tablename = C1219_TABLES.get(tableid, 'UNKNOWN')
			tableid = str(tableid)
			self.frmwk.print_status('Found readable table, ID: ' + tableid + ' Name: ' + tablename)
			# format is: table id, table name, table data length, table data
			out_file.write(','.join([tableid, tablename, str(len(data)), binascii.b2a_hex(data).decode('utf-8')]) + os.linesep)
			number_of_tables += 1

		out_file.close()
		self.frmwk.print_status('Successfully copied ' + str(number_of_tables) + ' tables to disk.')
Beispiel #8
0
	def run(self):
		conn = self.frmwk.serial_connection
		logger = self.logger
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']

		number_of_tables = 0
		self.frmwk.print_status('Enumerating tables, please wait...')
		for table_id in range(lower_boundary, (upper_boundary + 1)):
			try:
				conn.get_table_data(table_id)
			except C1218ReadTableError:
				self.frmwk.serial_disconnect()
				logger.warning('received ISSS error, connection stopped, will sleep before retrying')
				sleep(0.5)
				self.frmwk.serial_connect()
				if not self.frmwk.serial_login():
					logger.warning('meter login failed, some tables may not be accessible')
				conn = self.frmwk.serial_connection
			else:
				self.frmwk.print_status('Found readable table, ID: ' + str(table_id) + ' Name: ' + (C1219_TABLES.get(table_id) or 'UNKNOWN'))
				number_of_tables += 1
		self.frmwk.print_status("Found {0:,} tables in range {1}-{2}.".format(number_of_tables, lower_boundary, upper_boundary))
	def run(self):
		conn = self.frmwk.serial_connection
		logger = self.logger
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']
		if not self.frmwk.serial_login():
			logger.warning('meter login failed')

		number_of_tables = 0
		self.frmwk.print_status('Enumerating tables, please wait...')
		for tableid in xrange(lower_boundary, (upper_boundary + 1)):
			try:
				data = conn.get_table_data(tableid)
			except C1218ReadTableError as error:
				data = None
				if error.errCode == 10: # ISSS
					conn.stop()
					logger.warning('received ISSS error, connection stopped, will sleep before retrying')
					sleep(0.5)
					if not self.frmwk.serial_login():
						logger.warning('meter login failed, some tables may not be accessible')
					try:
						data = conn.get_table_data(tableid)
					except C1218ReadTableError as error:
						data = None
						if error.errCode == 10:
							raise error # tried to re-sync communications but failed, you should reconnect and rerun the module
			if data:
				self.frmwk.print_status('Found readable table, ID: ' + str(tableid) + ' Name: ' + (C1219_TABLES.get(tableid) or 'UNKNOWN'))
				number_of_tables += 1
		self.frmwk.print_status('Found ' + str(number_of_tables) + ' table(s).')
		return
Beispiel #10
0
	def run(self):
		conn = self.frmwk.serial_connection
		logger = self.logger
		lower_boundary = self.options['LOWER']
		upper_boundary = self.options['UPPER']
		if not self.frmwk.serial_login():
			logger.warning('meter login failed')
		
		self.frmwk.print_status('Enumerating tables, please wait...')
		tables_found = 0
		for tableid in xrange(lower_boundary, (upper_boundary + 1)):
			data = self.get_table_data_ex(conn, tableid, 4)
			if data[0] == '\x00':
				self.frmwk.print_status('Found readable table, ID: ' + str(tableid) + ' Name: ' + (C1219_TABLES.get(tableid) or 'UNKNOWN'))
				tables_found += 1
			else:
				error_code = ord(data[0])
				error_type = str(C1218_RESPONSE_CODES.get(error_code) or 'UNKNOWN')
				logger.info('received error code: ' + str(error_code) + ' type: ' + error_type)
			while not conn.stop():
				sleep(0.5)
			sleep(0.25)
			while not conn.start():
				sleep(0.5)
			sleep(0.25)
			while not conn.login():
				sleep(0.5)
			sleep(0.25)
		self.frmwk.print_status('Found ' + str(tables_found) + ' table(s).')
		return