updating some server scripts

This commit is contained in:
jakani24
2024-02-19 17:24:41 +01:00
parent a6290d5404
commit 85e09032ce
21 changed files with 37 additions and 11 deletions

View File

@@ -64,7 +64,8 @@
"RelativeToolTip": "download.h", "RelativeToolTip": "download.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAABIAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAABIAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2023-12-22T19:47:23.597Z" "WhenOpened": "2023-12-22T19:47:23.597Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
@@ -74,7 +75,7 @@
"RelativeDocumentMoniker": "ma_installer.cpp", "RelativeDocumentMoniker": "ma_installer.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\ma_installer.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\ma_installer.cpp",
"RelativeToolTip": "ma_installer.cpp", "RelativeToolTip": "ma_installer.cpp",
"ViewState": "AQIAACwAAAAAAAAAAAAuwDwAAAAyAAAA", "ViewState": "AQIAAAoDAAAAAAAAAAAAACcDAAAnAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2023-12-22T18:52:51.74Z", "WhenOpened": "2023-12-22T18:52:51.74Z",
"EditorCaption": "" "EditorCaption": ""

View File

@@ -31,7 +31,7 @@ Tasks to do:
using namespace std; using namespace std;
int CreateTask() int create_task()
{ {
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (FAILED(hr)) if (FAILED(hr))
@@ -141,6 +141,18 @@ int CreateTask()
return 1; return 1;
} }
hr = pSettings->put_ExecutionTimeLimit(_bstr_t(L"PT0S")); // Set execution time limit to zero seconds
pSettings->Release();
if (FAILED(hr))
{
cout << "Cannot set execution time limit: " << hex << hr << endl;
pRootFolder->Release();
pService->Release();
CoUninitialize();
return 1;
}
hr = pSettings->put_DisallowStartIfOnBatteries(VARIANT_FALSE); // Set to allow start on batteries hr = pSettings->put_DisallowStartIfOnBatteries(VARIANT_FALSE); // Set to allow start on batteries
pSettings->Release(); pSettings->Release();
if (FAILED(hr)) if (FAILED(hr))
@@ -255,7 +267,6 @@ int CreateTask()
//check if programm is run as admin //check if programm is run as admin
bool is_admin() { bool is_admin() {
BOOL fIsRunAsAdmin = FALSE; BOOL fIsRunAsAdmin = FALSE;
@@ -780,18 +791,22 @@ int main()
} }
HRESULT hr = CreateTask(); HRESULT hr = create_task();
if (FAILED(hr)) if (FAILED(hr))
{ {
std::cerr << "Task creation failed!" << std::endl; std::cerr << "Task creation failed!" << std::endl;
error=5; error=5;
} }
} }
switch (error) { switch (error) {
case 0: case 0:
printf("Installation successful\n"); printf("Installation successful\n");
printf("You have installed Cyberhex, thank you!\n"); printf("You have installed Cyberhex, thank you!\n");
MessageBox(NULL, L"Installation successful", L"Success", MB_OK); printf("The machine needs to be rebooted to finish the installation\n");
if (MessageBox(NULL, L"Installation successful. The machine needs to reboot for the installation to finish. Reboot now?", L"Success",MB_YESNO )==IDYES) {
system("shutdown /r /t 0");
}
break; break;
case 1: case 1:
printf("Failed to create access control list\n"); printf("Failed to create access control list\n");
@@ -833,6 +848,10 @@ int main()
printf("Failed to download database file\n"); printf("Failed to download database file\n");
MessageBox(NULL, L"Failed to download database file", L"Error", MB_OK); MessageBox(NULL, L"Failed to download database file", L"Error", MB_OK);
break; break;
case 11:
printf("failed to start cyberhex\n");
MessageBox(NULL, L"failed to start cyberhex", L"Error", MB_OK);
break;
default: default:
break; break;
} }

View File

@@ -1,3 +1,3 @@
 ma_installer.cpp  ma_installer.cpp
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer.cpp(693,15): warning C4101: "fp": Unreferenzierte lokale Variable C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer.cpp(704,15): warning C4101: "fp": Unreferenzierte lokale Variable
ma_installer.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\x64\Debug\ma_installer.exe ma_installer.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\x64\Debug\ma_installer.exe

View File

@@ -24,7 +24,7 @@
"RelativeDocumentMoniker": "ma_uninstaller.cpp", "RelativeDocumentMoniker": "ma_uninstaller.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_uninstaller\\ma_uninstaller.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_uninstaller\\ma_uninstaller.cpp",
"RelativeToolTip": "ma_uninstaller.cpp", "RelativeToolTip": "ma_uninstaller.cpp",
"ViewState": "AQIAAI0AAAAAAAAAAAAAALYAAAAhAAAA", "ViewState": "AQIAAI0AAAAAAAAAAAAAALcAAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2023-12-23T09:04:19.505Z", "WhenOpened": "2023-12-23T09:04:19.505Z",
"EditorCaption": "" "EditorCaption": ""

View File

@@ -181,6 +181,7 @@ int main()
else { else {
printf("Stopping cyberhex"); printf("Stopping cyberhex");
system("taskkill /F /IM cyberhex.exe"); system("taskkill /F /IM cyberhex.exe");
Sleep(1000);
printf("Removing directorys\n"); printf("Removing directorys\n");
printf("Removing directory for application\n"); printf("Removing directory for application\n");
error = remove_dir(L"C:\\Program Files\\Cyberhex"); error = remove_dir(L"C:\\Program Files\\Cyberhex");

View File

@@ -5,7 +5,12 @@ FROM php:apache
RUN docker-php-ext-install mysqli RUN docker-php-ext-install mysqli
RUN a2enmod ssl RUN a2enmod ssl
RUN service apache2 restart RUN service apache2 restart
RUN mkdir /var/www/html/install/ COPY ./cyberhex-code /var/www/html
RUN mkdir /var/www/html/install/database_srv RUN mkdir -p /var/www/html/install/
RUN mkdir -p /var/www/html/database_srv
RUN mkdir -p /var/www/html/export
RUN mkdir -p /var/www/html/import
RUN chown -R www-data:www-data /var/www/html/export/
RUN chown -R www-data:www-data /var/www/html/import/
RUN chown -R www-data:www-data /var/www/html/install/ RUN chown -R www-data:www-data /var/www/html/install/
RUN chown -R www-data:www-data /var/www/html/database_srv/ RUN chown -R www-data:www-data /var/www/html/database_srv/