Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- const char *ReadLine(char * NameFile)
- {
- FILE * file;
- file = fopen(NameFile, "r");
- if(!file)
- {
- puts("error in file");
- return;
- }
- char *lineBuffer=calloc(1,1), line[128];
- if(!lineBuffer)
- {
- printf("error in readLine() at %s",NameFile);
- return;
- }
- while(fgets(line,sizeof line-1,file))
- {
- lineBuffer=realloc(lineBuffer,strlen(lineBuffer)+strlen(line)+1);
- if(!lineBuffer)
- {
- printf("error in readLine() at %s",NameFile);
- return;
- }
- strcat(lineBuffer,line);
- }
- return lineBuffer;
- }
- int main()
- {
- int *aslr=(int *)atoi(ReadLine("/proc/sys/kernel/randomize_va_space"));
- printf("%d \n",(int)aslr);
- if(aslr == 0)
- {
- puts("sem ASLR");
- exit(0);
- } else
- puts("com ASLR");
- // programm code....
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment