⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exe2bat.c

📁 MYSQL上传工具
💻 C
字号:
#include <stdio.h>
#include <string.h>

#define M 65279

char *msg="GOOD_LUCK";

void help(void);
char exe2bat(char *,char *);

int main(int argc,char **argv)
{
  if(argc==1)
  {
    help();
  }
  exe2bat(argv[1],argv[2]);
  return 0;
}

void help()
{
  printf("\nWritten by W.Z.T <==Don't be lazy,Just go ahead==>\n\n");
  printf("exe2bat.exe input.exe output.bat\n");
  exit(0);
}

char exe2bat(char *s_f,char *t_f)
{
  FILE *s_fp,*t_fp;
  char *s_fe=s_f;
  char *t_fe=t_f;
  char c;
  char ch;
  long lenth;
  int i=1,k=256;
  if((s_fp=fopen(s_fe,"rb"))==NULL)
  {
    printf("Can't open the file %s.\n",s_fe);
    exit(0);
  }
  if((t_fp=fopen(t_fe,"w+"))==NULL)
  {
    printf("Can't create the file %s.\n",t_fe);
    exit(0);
  }
  fseek(s_fp,0,SEEK_END);
  lenth=ftell(s_fp);
  fseek(s_fp,0,SEEK_SET);
  printf("%ld,%x\n",lenth,lenth);
  if(lenth>=M)
  {
    printf("The exe file's lenth must be <= M-1\n");
    exit(0);
  }
  fputs("@echo e ",t_fp);
  fprintf(t_fp,"%04x ",k);
  while(!feof(s_fp))
  {
    k++;
    c = fgetc(s_fp);
    if(( unsigned char ) c<= ( unsigned char )15)
        fprintf(t_fp,"0",c);
    fprintf(t_fp,"%x ",(unsigned char)c);
    if(i%16==0)
    {
        fputs(">>sgl\n",t_fp);
        fputs("@echo e ",t_fp);
        fprintf(t_fp,"%04x ",k);
    }
    i++;
  }
  if(lenth%16!=0)
    fputs(">>%tmp%\\sgl\n",t_fp);
  fputs("@echo rcx>>sgl\n",t_fp);
  fprintf(t_fp,"@echo %x>>sgl\n",lenth,t_fp);
  fputs("@echo n tthacker>>sgl\n",t_fp);
  fputs("@echo w>>sgl\n",t_fp);
  fputs("@echo q>>sgl\n",t_fp);
  fputs("@debug<sgl>nul\n",t_fp);
  fputs("@del sgl\n",t_fp);
  fputs("@ren tthacker ",t_fp);
  fprintf(t_fp,"%s>>sgl\n",s_fe);
  fputs("@",t_fp);
  fprintf(t_fp,"%s",s_fe);
  fclose(s_fp);
  fclose(t_fp);
  puts(msg);
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -