def test_callback(call): mid = call.from_user.id data = call.data if utils.check_users(mid): if data == "ss restart": utils.start_sms_service() bot.send_sticker(mid, utils.get_random_sticker_cool(), reply_markup=markup) elif data == "thanks": markup = utils.generate_markup() bot.send_sticker(mid, utils.get_random_sticker(), reply_markup=markup) elif data == "conn": markup = utils.generate_markup() bot.send_message(mid, "ssh odroid@"+config.host + " -p " + str(config.outport), reply_markup=markup) elif data == "status": response = utils.parse_status() if response['status'] == "graph": try: photo = open(response['filename'], 'rb') bot.send_photo(mid, photo) try: os.remove(response['filename']) except Exception as e: bot.send_message(mid, "can't delete graph file", reply_markup=markup) except Exception as e: bot.send_message(mid, "can't open graph file", reply_markup=markup) elif response['status'] == "text": text = '' for line in response['text']: text += str(line) + "\n" bot.send_message(mid, text, reply_markup=markup) else: bot.send_message(mid, response['text'], reply_markup=markup) else: bot.send_sticker(mid, "BQADAgAD5gADDBrwAiHi-1ZEBxPNAg", reply_markup=markup)
def status(message): if utils.check_users(message.chat.id): response = utils.parse_status() if response['status'] == "graph": try: photo = open(response['filename'], 'rb') bot.send_photo(message.chat.id, photo) try: os.remove(response['filename']) except Exception as e: bot.send_message(message.chat.id, "can't delete graph file", reply_markup=markup) except Exception as e: bot.send_message(message.chat.id, "can't open graph file", reply_markup=markup) elif response['status'] == "text": text = '' for line in response['text']: text += str(line) + "\n" bot.send_message(message.chat.id, text, reply_markup=markup) else: bot.send_message(message.chat.id, response['text'], reply_markup=markup)
def test_callback(call): mid = call.from_user.id data = call.data if utils.check_users(mid): if data == "ss restart": utils.start_sms_service() bot.send_sticker(mid, utils.get_random_sticker_cool(), reply_markup=markup) elif data == "thanks": markup = utils.generate_markup() bot.send_sticker(mid, utils.get_random_sticker(), reply_markup=markup) elif data == "conn": markup = utils.generate_markup() bot.send_message(mid, "ssh odroid@" + config.host + " -p " + str(config.outport), reply_markup=markup) elif data == "status": response = utils.parse_status() if response['status'] == "graph": try: photo = open(response['filename'], 'rb') bot.send_photo(mid, photo) try: os.remove(response['filename']) except Exception as e: bot.send_message(mid, "can't delete graph file", reply_markup=markup) except Exception as e: bot.send_message(mid, "can't open graph file", reply_markup=markup) elif response['status'] == "text": text = '' for line in response['text']: text += str(line) + "\n" bot.send_message(mid, text, reply_markup=markup) else: bot.send_message(mid, response['text'], reply_markup=markup) else: bot.send_sticker(mid, "BQADAgAD5gADDBrwAiHi-1ZEBxPNAg", reply_markup=markup)
def cmd_status(self, reference_control = "0x20"): """Execute a GetStatus command and return the result.""" reference_control = int(reference_control, 0) result = self.get_status(reference_control) utils.parse_status(result.data)
+ Incorrect number of padding bytes, incorrect key used for encryption, or the specified key set or key index value is invalid. + Referenced AID is not found in the card registry or package, or the newly specified AID already exists in the registry. + Inappropriate application privilege byte value (installing security domain), or card already has a default selected application (specifying default selected application). + First block of input data for a load file is not preceded by the correct tag and/or valid length, or the load file refers to a nonexistent package.""", "\x6A\x81": "Target is locked (SelectApplication).", "\x6A\x82": "Registry contains no valid application (or no additional valid application) with the specified AID (SelectApplication).", "\x6A\x84": "Insufficient EEPROM memory available to add the object to the card.", "\x6A\x86": "Incorrect or unsupported value is specified for P1, P2, or both.", "\x6A\x88": "Data referred to in P1, P2, or both is not found.", "\x6D\x00": "Unsupported value entered for the INS byte.", "\x6E\x00": "Unsupported value entered for the CLA byte.", "\x6F\x00": "JVM error that has no specified diagnosis.", "\x90\x00": "Command succeeded.", "\x94\x81": "Target has an invalid life cycle state.", "\x94\x84": "Unsupported algorithm ID in input data (PutKey).", "\x94\x85": "Invalid key check value in input data (PutKey).", } ) if __name__ == "__main__": c = Cyberflex_Card() print utils.hexdump( c.select_application(DEFAULT_CARD_MANAGER_AID) ) c.open_secure_channel(security_level = SECURE_CHANNEL_MAC) utils.parse_status(c.get_status(224)[:-2])