/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tools/context/stat-key.c
34 строки
713 B
HD Moore
Add new context-keyed encoders from Dimitris Glynos ( http://census-labs.com/news/2010/06/04/athcon-2010-update/ )
09 июн 2010, 20:43
09 июн 2010, 20:43
74a6813
Код
Авторство
О чём код?
/* * Given a filename, outputs a 32bit key for use in * context keyed payload encoding. The key is derived from * XOR-ing the st_size and st_mtime fields of the * relevant struct stat for this file. * * Author: Dimitris Glynos <dimitris at census-labs.com> */ #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> int main(int argc, char *argv[]) { char *filename; struct stat stat_buf; if (argc != 2) { fprintf(stderr, "usage: %s <filename>\n", argv[0]); return 1; } filename = argv[1]; if (stat(filename, &stat_buf) == -1) { perror("error while stat(2)-ing file"); return 1; } printf("%#.8lx\n", stat_buf.st_mtime ^ stat_buf.st_size); return 0; }