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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void configuration_de_la_cmd (void);
void affichage_des_reseaux_locaux (void);
int modification_ip (void);
int main (void)
{
configuration_de_la_cmd ();
affichage_des_reseaux_locaux ();
modification_ip ();
getchar ();
return 0;
}
void configuration_de_la_cmd (void)
{
COORD coord = { 83, 35 };
char username[50] = "";
DWORD size = sizeof username;
HANDLE console = GetStdHandle (STD_OUTPUT_HANDLE);
GetUserNameA (username, &size);
SetConsoleTitleA (username);
SetConsoleScreenBufferSize (console, coord);
SetConsoleTextAttribute (console, 79);
}
void affichage_des_reseaux_locaux (void)
{
puts
(" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~~~~~~~~~~+\n"
" | VOS RESEAUX LOCAUX "
" +\n"
" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~~~~~~~~~~+\n");
system ("netsh interface ip show address");
puts
(" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~~~~~~~~~~+\n\n\n");
}
int modification_ip (void)
{
char nom_du_reseau[50];
char ip[16];
char netsh[1024];
char oem[1024];
printf
(" +--------------------------------------------------------------------"
"----------+\n"
" | MODFICATION DE L'ADRESSE IP "
" |\n"
" +--------------------------------------------------------------------"
"----------+\n"
" |\n" " | [1] Entrez le nom du r\x82seau a modifier : ");
scanf_s ("%49[^\n]", nom_du_reseau, 50);
fflush (stdin);
printf (" |\n" " | [2] Entrez la nouvelle adresse ip : ");
scanf_s ("%15s", ip, 16);
fflush (stdin);
puts (" |\n"
" +------------------------------------------------------------------"
"------------+\n");
sprintf_s
(netsh, sizeof netsh,
"netsh interface ip set address \"%s\" static %15s 255.255.255.0",
nom_du_reseau, ip);
#if 0
CharToOemA (netsh, netsh);
#endif
return system (netsh);
} |
Partager