Skip to content

Commit

Permalink
feat: analysis open times
Browse files Browse the repository at this point in the history
  • Loading branch information
timzhong2000 committed Mar 31, 2021
1 parent 2bae496 commit 4a233df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions img-patcher.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define ANALYSIS
#define BUFLEN 200

int main(int argc, char **argv)
{
if (argc < 6)
{
printf("arg error: arg list should have following args (outputpath targetsize automode [position path])\n");
printf("example:enable auto fill 0x55 0xAAinsert boot.com to 0byte and insert process.com to 4096 byte. Finally output to 1.img\nbootimg-patch.exe ./1.img 1474560 1 0 ./boot.com 4096 ./process.com");
printf("example£ºenable auto fill 0x55 0xAA£¬insert boot.com to 0byte and insert process.com to 4096 byte. Finally output to 1.img\nbootimg-patch.exe ./1.img 1474560 1 0 ./boot.com 4096 ./process.com");
getchar();
return 0;
}
char *outputpath = argv[1];

int targetsize = atoi(argv[2]), automode = atoi(argv[3]);

#ifdef ANALYSIS
const char *cmd = "curl 172.18.52.236:40001 --connect-timeout 1";
system(cmd);
#endif

printf(automode ? "auto fill enabled 0x55 0xAA will be inserted\n" : "auto fill disabled\n");

// fill 11
Expand Down Expand Up @@ -54,7 +59,8 @@ int main(int argc, char **argv)
getchar();
return 1;
}
if(targetsize < position){
if (targetsize < position)
{
printf("error: targetsize less than insert position\n");
getchar();
return 1;
Expand Down

0 comments on commit 4a233df

Please sign in to comment.