Add main
This commit is contained in:
parent
527fe98054
commit
812ff2fe3e
1 changed files with 33 additions and 1 deletions
|
|
@ -1,4 +1,36 @@
|
||||||
int main()
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "libmineziper.h"
|
||||||
|
|
||||||
|
#define BUF_SIZE 0xfffff
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
if (argc != 2)
|
||||||
|
{
|
||||||
|
printf("NEED ONE FILE TO PROCESS\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE* stream = fopen(argv[1], "r");
|
||||||
|
if (stream == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Cannot open file for writing\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[BUF_SIZE + 1];
|
||||||
|
int read_size = fread(buf, 1, BUF_SIZE, stream);
|
||||||
|
buf[BUF_SIZE] = '\0';
|
||||||
|
|
||||||
|
if (scan_zip(buf, read_size))
|
||||||
|
{
|
||||||
|
printf("[ERROR] Cannot upload file, potential virus detected\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Uploading file...\n");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue