fix(quarantine): prevent directory moves
This commit is contained in:
parent
1c5dfc1a84
commit
9b168e81ef
3 changed files with 0 additions and 1315 deletions
1213
src/activation.cpp
1213
src/activation.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* BastionGuard™ Recovery Data
|
||||
* Copyright (C) 2025–2026 Calogero Scarnà. All rights reserved.
|
||||
*
|
||||
* Proprietary activation support for donation-based distribution.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace BastionGuard::Activation {
|
||||
|
||||
struct ActivationStatus {
|
||||
bool active = false;
|
||||
bool expired = false;
|
||||
std::string machine_id;
|
||||
std::string motherboard_serial;
|
||||
std::string owner;
|
||||
std::string edition;
|
||||
std::string expires;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
std::string activation_engine_id();
|
||||
std::string machine_id();
|
||||
std::string motherboard_serial();
|
||||
std::string activation_key_path();
|
||||
std::string hardware_cache_path();
|
||||
bool refresh_hardware_cache(std::string& error_message);
|
||||
bool save_system_key_if_valid(const std::string& raw_key, std::string& error_message);
|
||||
ActivationStatus validate_key(const std::string& raw_key);
|
||||
ActivationStatus validate_installed_key();
|
||||
bool save_key_if_valid(const std::string& raw_key, std::string& error_message);
|
||||
|
||||
} // namespace BastionGuard::Activation
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* BastionGuard™ Activation Helper
|
||||
* Runs through pkexec to read root-only DMI identifiers and save the
|
||||
* donation-bundle activation key system-wide.
|
||||
*/
|
||||
|
||||
#include "activation.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace {
|
||||
|
||||
std::string read_stdin_all() {
|
||||
std::ostringstream content;
|
||||
content << std::cin.rdbuf();
|
||||
return content.str();
|
||||
}
|
||||
|
||||
void print_hardware_info() {
|
||||
std::cout << "MACHINE_ID=" << BastionGuard::Activation::machine_id() << "\n"
|
||||
<< "MOTHERBOARD_SERIAL=" << BastionGuard::Activation::motherboard_serial() << "\n"
|
||||
<< "ENGINE=" << BastionGuard::Activation::activation_engine_id() << "\n"
|
||||
<< "KEY_FORMAT=BGRD3 + KEYID" << "\n"
|
||||
<< "ACTIVATION_KEY_PATH=" << BastionGuard::Activation::activation_key_path() << "\n"
|
||||
<< "HARDWARE_CACHE_PATH=" << BastionGuard::Activation::hardware_cache_path() << "\n";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (::geteuid() != 0) {
|
||||
std::cerr << "This helper must run with administrator rights through pkexec.\n";
|
||||
return 10;
|
||||
}
|
||||
|
||||
const std::string command = (argc >= 2 && argv[1]) ? argv[1] : "";
|
||||
|
||||
if (command == "hardware") {
|
||||
std::string error;
|
||||
if (!BastionGuard::Activation::refresh_hardware_cache(error)) {
|
||||
std::cerr << error << "\n";
|
||||
return 20;
|
||||
}
|
||||
print_hardware_info();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (command == "save-key") {
|
||||
const std::string raw_key = read_stdin_all();
|
||||
std::string error;
|
||||
if (!BastionGuard::Activation::save_system_key_if_valid(raw_key, error)) {
|
||||
std::cerr << error << "\n";
|
||||
return 30;
|
||||
}
|
||||
std::cout << "OK\n";
|
||||
print_hardware_info();
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::cerr << "Usage: bastionguard-activation-helper hardware | save-key\n";
|
||||
return 64;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue