2011-10-20 16:36:00 +02:00
|
|
|
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
|
|
|
|
|
2009-03-14 11:39:37 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <getopt.h>
|
2012-03-09 01:03:19 +01:00
|
|
|
|
|
|
|
#include "r_userconf.h"
|
2009-03-14 11:39:37 +00:00
|
|
|
#include "r_sign.h"
|
|
|
|
|
2009-09-25 04:04:51 +02:00
|
|
|
static int rasign_show_help() {
|
2010-03-15 17:15:48 +01:00
|
|
|
printf ("Usage: rasign2 [options] [file]\n"
|
|
|
|
" -r show output in radare commands\n"
|
2015-10-14 17:50:17 +02:00
|
|
|
" -j show output in json\n"
|
2010-03-15 17:15:48 +01:00
|
|
|
" -s [sigfile] specify one or more signature files\n"
|
2009-03-14 11:39:37 +00:00
|
|
|
"Examples:\n"
|
2010-03-15 17:15:48 +01:00
|
|
|
" rasign2 libc.so.6 > libc.sig\n"
|
|
|
|
" rasign2 -s libc.sig ls.static\n");
|
2009-03-14 11:39:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-04 01:46:25 +01:00
|
|
|
int main(int argc, char **argv) {
|
2009-03-14 11:39:37 +00:00
|
|
|
int c;
|
|
|
|
int action = 0;
|
|
|
|
int rad = 0;
|
2015-10-14 17:50:17 +02:00
|
|
|
int json = 0;
|
2017-03-13 11:49:23 +00:00
|
|
|
//RSign *sig = r_sign_new ();
|
2009-03-14 11:39:37 +00:00
|
|
|
|
2015-10-14 17:50:17 +02:00
|
|
|
while ((c=getopt (argc, argv, "o:hrsj:iV")) !=-1) {
|
2010-03-04 01:46:25 +01:00
|
|
|
switch (c) {
|
2009-03-14 11:39:37 +00:00
|
|
|
case 'o':
|
2010-04-08 18:01:45 +02:00
|
|
|
//r_sign_option (&sig, optarg);
|
2009-03-14 11:39:37 +00:00
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
action = c;
|
2010-04-08 18:01:45 +02:00
|
|
|
//r_sign_load_file (&sig, optarg);
|
2009-03-14 11:39:37 +00:00
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
rad = 1;
|
|
|
|
break;
|
2015-10-14 17:50:17 +02:00
|
|
|
case 'j':
|
|
|
|
json = 1;
|
|
|
|
break;
|
2009-09-25 04:04:51 +02:00
|
|
|
case 'V':
|
2012-03-09 01:03:19 +01:00
|
|
|
printf ("rasign2 v"R2_VERSION"\n");
|
2009-09-25 04:04:51 +02:00
|
|
|
return 0;
|
2009-03-14 11:39:37 +00:00
|
|
|
default:
|
2010-03-04 01:46:25 +01:00
|
|
|
return rasign_show_help ();
|
2009-03-14 11:39:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv[optind]==NULL)
|
2010-03-04 01:46:25 +01:00
|
|
|
return rasign_show_help ();
|
2009-03-14 11:39:37 +00:00
|
|
|
|
2017-03-13 11:49:23 +00:00
|
|
|
//r_sign_list (sig, rad, json);
|
2009-03-14 11:39:37 +00:00
|
|
|
|
2010-03-04 01:46:25 +01:00
|
|
|
switch (action) {
|
2009-03-14 11:39:37 +00:00
|
|
|
case 's':
|
|
|
|
/* check sigfiles in optarg file */
|
2010-04-08 18:01:45 +02:00
|
|
|
// r_sign_check (&sig, argv[optind]);
|
2009-03-14 11:39:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* generate signature file */
|
2010-04-09 11:32:17 +02:00
|
|
|
//r_sign_generate (&sig, argv[optind], stdout);
|
2009-03-14 11:39:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-05-20 17:40:58 +02:00
|
|
|
|
2017-03-13 11:49:23 +00:00
|
|
|
//r_sign_free (sig);
|
2010-05-20 17:40:58 +02:00
|
|
|
|
2009-03-14 11:39:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|