updated some files
did some more testing and added the yara.h header
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,23 +1,20 @@
|
|||||||
|
#pragma warning(disable:4996)
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
|
#include <yara.h>
|
||||||
#include "md5hash.h"
|
#include "md5hash.h"
|
||||||
|
#include "connect.h"
|
||||||
|
#include "scan.h"
|
||||||
int main() {
|
int main() {
|
||||||
|
printf("welcome to the jakach security tool\n");
|
||||||
char md5Hash[2 * MD5_DIGEST_LENGTH + 1]; // +1 for null-terminator
|
char md5Hash[2 * MD5_DIGEST_LENGTH + 1]; // +1 for null-terminator
|
||||||
|
printf("Hash of the executable: ");
|
||||||
md5_file("C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\x64\\Debug\\client_backend.exe", md5Hash);
|
md5_file("C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\x64\\Debug\\client_backend.exe", md5Hash);
|
||||||
printf("%s", md5Hash);
|
printf("%s", md5Hash);
|
||||||
|
char a[2000];
|
||||||
CURL* curl = curl_easy_init();
|
printf("\nerror:%d\n",connect_to_srv("https://self-signed.badssl.com/", a, 2000,1)); //error 60: self signed => option f<>r self-signed ignorieren aktivieren (bool ignore_invalid=true)
|
||||||
|
printf("%s", a); //error 6: not reachable
|
||||||
if (!curl) {
|
|
||||||
std::cerr << "Failed to initialize libcurl." << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "libcurl is correctly installed and initialized." << std::endl;
|
|
||||||
|
|
||||||
// Clean up libcurl
|
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Multi-Byte-Zeichensatz verwenden</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
@@ -136,10 +136,14 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="client_backend.cpp" />
|
<ClCompile Include="client_backend.cpp" />
|
||||||
|
<ClCompile Include="connect.cpp" />
|
||||||
<ClCompile Include="md5hash.cpp" />
|
<ClCompile Include="md5hash.cpp" />
|
||||||
|
<ClCompile Include="scan.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="connect.h" />
|
||||||
<ClInclude Include="md5hash.h" />
|
<ClInclude Include="md5hash.h" />
|
||||||
|
<ClInclude Include="scan.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -21,10 +21,22 @@
|
|||||||
<ClCompile Include="md5hash.cpp">
|
<ClCompile Include="md5hash.cpp">
|
||||||
<Filter>Headerdateien</Filter>
|
<Filter>Headerdateien</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="connect.cpp">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="scan.cpp">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="md5hash.h">
|
<ClInclude Include="md5hash.h">
|
||||||
<Filter>Headerdateien</Filter>
|
<Filter>Headerdateien</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="connect.h">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="scan.h">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
35
src/client_backend/connect.cpp
Normal file
35
src/client_backend/connect.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#pragma warning(disable:4996)
|
||||||
|
#ifndef CONNECT_CPP
|
||||||
|
#define CONNECT_CPP
|
||||||
|
#include "connect.h"
|
||||||
|
|
||||||
|
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp)
|
||||||
|
{
|
||||||
|
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||||
|
return size * nmemb;
|
||||||
|
}
|
||||||
|
|
||||||
|
int connect_to_srv(const char*url,char*out,int max_len, bool ignore_insecure) {
|
||||||
|
CURL* curl;
|
||||||
|
CURLcode res;
|
||||||
|
std::string readBuffer;
|
||||||
|
|
||||||
|
curl = curl_easy_init();
|
||||||
|
if (curl) {
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||||
|
if(ignore_insecure==true)
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||||
|
res = curl_easy_perform(curl);
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
if (max_len > (int)strlen(readBuffer.c_str())) {
|
||||||
|
strcpy(out, readBuffer.c_str());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
5
src/client_backend/connect.h
Normal file
5
src/client_backend/connect.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <curl/curl.h>
|
||||||
|
int connect_to_srv(const char* url, char* out, int max_len, bool ignore_insecure);
|
||||||
43
src/client_backend/scan.cpp
Normal file
43
src/client_backend/scan.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "scan.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
#ifndef SCAN_CPP
|
||||||
|
#define SCAN_CPP
|
||||||
|
#include <string>
|
||||||
|
int cnt = 0;
|
||||||
|
void ListFilesRecursive(const std::string& directory) {
|
||||||
|
std::string search_path = directory + "\\*.*";
|
||||||
|
WIN32_FIND_DATA find_file_data;
|
||||||
|
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
|
||||||
|
|
||||||
|
if (hFind == INVALID_HANDLE_VALUE) {
|
||||||
|
std::cerr << "Error opening directory: " << directory << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
|
||||||
|
continue; // Skip the current and parent directories
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string full_path = directory + "\\" + find_file_data.cFileName;
|
||||||
|
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
// If it's a directory, recurse into it
|
||||||
|
ListFilesRecursive(full_path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If it's a file, print its name
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 1000 == 0) {
|
||||||
|
printf("Processed %d files\n", cnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (FindNextFile(hFind, &find_file_data) != 0);
|
||||||
|
|
||||||
|
FindClose(hFind);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
3
src/client_backend/scan.h
Normal file
3
src/client_backend/scan.h
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
void ListFilesRecursive(const std::string& directory);
|
||||||
Binary file not shown.
@@ -1 +1,2 @@
|
|||||||
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
client_backend.cpp
|
||||||
|
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,4 @@
|
|||||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.obj
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.obj
|
||||||
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\connect.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\connect.obj
|
||||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\md5hash.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\md5hash.obj
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\md5hash.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\md5hash.obj
|
||||||
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\scan.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\scan.obj
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1,3 @@
|
|||||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
||||||
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.vcxproj.CopyComplete
|
||||||
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\libcrypto-3-x64.dll
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1,2 @@
|
|||||||
|
|
||||||
|
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\libcrypto-3-x64.dll
|
||||||
|
|||||||
Reference in New Issue
Block a user