1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include <string.h>
#define TAILLE_COMMANDE 512
int scan(const char *ip)
{
char commande [TAILLE_COMMANDE];
// On créer notre futur commande ms_dos (Xcmd)
strcpy(commande, "xCmd.exe \\\\");
strcat(commande, ip);
strcat(commande, " /NOWAIT /HIGH /D:%SystemRoot%\\temp "); // Don't wait for remote process to terminate, High priority class, Set working directory
strcat(commande, "\""); // Pour prendre en compte toute la commande à executer dans Xcmd
strcat(commande, "MD temp & CD temp &"); // Création d'un dossier et aller dedans
strcat(commande, " START \\\\Akffs10\\UNIX\\AFN\\install_OCS_inventory\\ocs-ng\\OCSInventory.exe /SERVER:AKF1118.***.*****.int"); // Executer l'application à distance
strcat(commande, "\""); // Pour prendre en compte toute la commande à executer dans Xcmd
int result_xcmd=system(commande); // execution de la commande
system("echo.");
// Test si toutes les manipulations se sont bien déroulés
if (result_xcmd==0)
{
return 1;
}
else
{
return 0;
}
} |
Partager