Enumerating all the variables in the environment is a little trickier.To do this, you
must access a special global variable named environ, which is defined in the GNU C
library.This variable, of type char**, is a NULL-terminated array of pointers to character
strings. Each string contains one environment variable, in the form VARIABLE=value.
#include<stdio.h>
extern char** environ;
int main()
{
char** var;
for(var = environ; *var !=NULL; ++var)
printf("%s\n",*var);
return 0;
}
output:
Now you know each and every environment variable value ,you can use them to hack into system...try it !
must access a special global variable named environ, which is defined in the GNU C
library.This variable, of type char**, is a NULL-terminated array of pointers to character
strings. Each string contains one environment variable, in the form VARIABLE=value.
#include<stdio.h>
extern char** environ;
int main()
{
char** var;
for(var = environ; *var !=NULL; ++var)
printf("%s\n",*var);
return 0;
}
output:
Now you know each and every environment variable value ,you can use them to hack into system...try it !
No comments:
Post a Comment