Changeset 1403

Show
Ignore:
Timestamp:
10/06/07 21:14:17 (11 months ago)
Author:
common
Message:

libemu

  • sctest -o for manual offset, understands hex and decimal
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libemu/trunk/testsuite/sctest.c

    r1374 r1403  
    20642064                        if ( (off = emu_shellcode_test(e, (uint8_t *)opts.scode, opts.size)) >= 0 ) 
    20652065                        { 
    2066                                 printf(SUCCESS"\n"); 
     2066                                printf(SUCCESS" (offset %i (0x%x))\n",off,(unsigned int)off); 
    20672067                                opts.offset = off; 
    20682068                                test(n); 
     
    21262126                {"l", "listtests"   , NULL              , "list all tests"}, 
    21272127                {"d", "dump"        , "INTEGER" , "dump the shellcode (binary) to stdout"}, 
    2128                 {"g", "getpc"       , "INTEGER"       , "run getpc mode, try to detect a shellcode"}, 
     2128                {"g", "getpc"       , NULL            , "run getpc mode, try to detect a shellcode"}, 
    21292129                {"G", "graph"       , "FILEPATH", "save a dot formatted callgraph in filepath"}, 
    21302130                {"h", "help"        , NULL              , "show this help"}, 
    21312131                {"S", "stdin"           , NULL          , "read shellcode/buffer from stdin, works with -g"}, 
     2132                {"o", "offset"          , "[INT|HEX]", "manual offset for shellcode, accepts int and hexvalues"}, 
    21322133        }; 
    21332134 
     
    21712172                        {"help"                         , 0, 0, 'h'}, 
    21722173                        {"stdin"                        , 0, 0, 'S'}, 
     2174                        {"offset"                       , 1, 0, 'o'}, 
    21732175                        {0, 0, 0, 0} 
    21742176                }; 
    21752177 
    2176                 c = getopt_long (argc, argv, "vs:t:ld:gG:hS", long_options, &option_index); 
     2178                c = getopt_long (argc, argv, "vs:t:ld:gG:hSo:", long_options, &option_index); 
    21772179                if ( c == -1 ) 
    21782180                        break; 
     
    22202222                        break; 
    22212223 
     2224                case 'o': 
     2225                        if (strncasecmp(optarg, "0x", 2) == 0) 
     2226                                opts.offset = strtol(optarg+2, NULL, 16); // hex vvalue 
     2227                        else 
     2228                                opts.offset = strtol(optarg, NULL, 10);   // decimal vvalue 
     2229                        printf("offset %i (0x%x)\n", opts.offset, (unsigned int)opts.offset); 
     2230                        break; 
     2231 
     2232 
    22222233                default: 
    22232234                        printf ("?? getopt returned character code 0%o ??\n", c); 
    22242235                        break; 
     2236 
    22252237                } 
    22262238        }