add ALLOW_FILES flag to parse_data_string calls where needed
This commit is contained in:
+1
-1
@@ -136,6 +136,6 @@ void CatSession::on_channel_error(short events) {
|
|||||||
void CatSession::print_prompt() { }
|
void CatSession::print_prompt() { }
|
||||||
|
|
||||||
void CatSession::execute_command(const std::string& command) {
|
void CatSession::execute_command(const std::string& command) {
|
||||||
string full_cmd = parse_data_string(command);
|
string full_cmd = parse_data_string(command, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
send_command_with_header(this->channel, full_cmd.data(), full_cmd.size());
|
send_command_with_header(this->channel, full_cmd.data(), full_cmd.size());
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -565,7 +565,7 @@ int main(int argc, char** argv) {
|
|||||||
data = read_all(stdin);
|
data = read_all(stdin);
|
||||||
}
|
}
|
||||||
if (parse_data) {
|
if (parse_data) {
|
||||||
data = parse_data_string(data);
|
data = parse_data_string(data, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@@ -658,7 +658,7 @@ int main(int argc, char** argv) {
|
|||||||
crypt.reset(new PSOV3Encryption(stoul(seed, nullptr, 16)));
|
crypt.reset(new PSOV3Encryption(stoul(seed, nullptr, 16)));
|
||||||
break;
|
break;
|
||||||
case GameVersion::BB: {
|
case GameVersion::BB: {
|
||||||
seed = parse_data_string(seed);
|
seed = parse_data_string(seed, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
auto key = load_object_file<PSOBBEncryption::KeyFile>(
|
auto key = load_object_file<PSOBBEncryption::KeyFile>(
|
||||||
"system/blueburst/keys/" + key_file_name + ".nsk");
|
"system/blueburst/keys/" + key_file_name + ".nsk");
|
||||||
crypt.reset(new PSOBBEncryption(key, seed.data(), seed.size()));
|
crypt.reset(new PSOBBEncryption(key, seed.data(), seed.size()));
|
||||||
@@ -744,14 +744,14 @@ int main(int argc, char** argv) {
|
|||||||
vector<pair<string, string>> plaintexts;
|
vector<pair<string, string>> plaintexts;
|
||||||
for (const auto& plaintext_ascii : find_decryption_seed_plaintexts) {
|
for (const auto& plaintext_ascii : find_decryption_seed_plaintexts) {
|
||||||
string mask;
|
string mask;
|
||||||
string data = parse_data_string(plaintext_ascii, &mask);
|
string data = parse_data_string(plaintext_ascii, &mask, ParseDataFlags::ALLOW_FILES);
|
||||||
if (data.size() != mask.size()) {
|
if (data.size() != mask.size()) {
|
||||||
throw logic_error("plaintext and mask are not the same size");
|
throw logic_error("plaintext and mask are not the same size");
|
||||||
}
|
}
|
||||||
max_plaintext_size = max<size_t>(max_plaintext_size, data.size());
|
max_plaintext_size = max<size_t>(max_plaintext_size, data.size());
|
||||||
plaintexts.emplace_back(move(data), move(mask));
|
plaintexts.emplace_back(move(data), move(mask));
|
||||||
}
|
}
|
||||||
string ciphertext = parse_data_string(find_decryption_seed_ciphertext);
|
string ciphertext = parse_data_string(find_decryption_seed_ciphertext, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
|
|
||||||
auto mask_match = +[](const void* a, const void* b, const void* m, size_t size) -> bool {
|
auto mask_match = +[](const void* a, const void* b, const void* m, size_t size) -> bool {
|
||||||
const uint8_t* a8 = reinterpret_cast<const uint8_t*>(a);
|
const uint8_t* a8 = reinterpret_cast<const uint8_t*>(a);
|
||||||
|
|||||||
+4
-4
@@ -562,7 +562,7 @@ session with ID 17205AE4, run the command `on 17205AE4 sc 1D 00 04 00`.\n\
|
|||||||
// PROXY COMMANDS
|
// PROXY COMMANDS
|
||||||
|
|
||||||
} else if ((command_name == "sc") || (command_name == "ss")) {
|
} else if ((command_name == "sc") || (command_name == "ss")) {
|
||||||
string data = parse_data_string(command_args);
|
string data = parse_data_string(command_args, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
if (data.size() & 3) {
|
if (data.size() & 3) {
|
||||||
throw invalid_argument("data size is not a multiple of 4");
|
throw invalid_argument("data size is not a multiple of 4");
|
||||||
}
|
}
|
||||||
@@ -640,7 +640,7 @@ session with ID 17205AE4, run the command `on 17205AE4 sc 1D 00 04 00`.\n\
|
|||||||
data.push_back('\x09');
|
data.push_back('\x09');
|
||||||
data.push_back('E');
|
data.push_back('E');
|
||||||
if (is_dchat) {
|
if (is_dchat) {
|
||||||
data += parse_data_string(command_args);
|
data += parse_data_string(command_args, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
} else {
|
} else {
|
||||||
data += command_args;
|
data += command_args;
|
||||||
data.push_back('\0');
|
data.push_back('\0');
|
||||||
@@ -665,7 +665,7 @@ session with ID 17205AE4, run the command `on 17205AE4 sc 1D 00 04 00`.\n\
|
|||||||
|
|
||||||
string data;
|
string data;
|
||||||
if (command_name == "info-board-data") {
|
if (command_name == "info-board-data") {
|
||||||
data += parse_data_string(command_args);
|
data += parse_data_string(command_args, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
} else {
|
} else {
|
||||||
data += command_args;
|
data += command_args;
|
||||||
}
|
}
|
||||||
@@ -745,7 +745,7 @@ session with ID 17205AE4, run the command `on 17205AE4 sc 1D 00 04 00`.\n\
|
|||||||
throw runtime_error("proxy session is not game leader");
|
throw runtime_error("proxy session is not game leader");
|
||||||
}
|
}
|
||||||
|
|
||||||
string data = parse_data_string(command_args);
|
string data = parse_data_string(command_args, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||||
if (data.size() < 2) {
|
if (data.size() < 2) {
|
||||||
throw runtime_error("data too short");
|
throw runtime_error("data too short");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user