home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Mammon_ / ss.idc < prev    next >
Text File  |  2000-05-25  |  2KB  |  50 lines

  1.  
  2. //ss.idc
  3. // This is intended to mimic the functionality of ss.exe (string search) by outputting all
  4. // defined strings to the IDA message window (and, optionally, to an output file). Note that
  5. // a string must be defined (with the name starting with "a", such as "aUnregisteredDemo") in
  6. // order for ss.idc to catch it, so you should run through the various data segments with
  7. // segstrings.idc to create the strings. I may produce a global strings script to automate
  8. // this task as well.
  9. //
  10. // String reading is not handled well in IDA; this script uses the name of the string address
  11. // to represent the string in its output. Therefore, it is a good idea to put the following line
  12. // in your IGA.CFG:
  13. //      MAX_NAMES_LENGTH  = 120
  14. // This sets address names to a max of 120 characters, so that a good portion of the string will
  15. // be represented in the output of ss.idc
  16. //
  17. //code by mammon_ rev 4.02
  18.  
  19. #include <idc.idc>
  20.  
  21. static main(){
  22.     auto x, ea, end_seg, write, OutFName, Outfile;
  23.     write = AskYN( 0, "Write output to file?");
  24.     if ( write == 1){
  25.         OutFName = AskFile( "*.txt", "Name of output file?");
  26.         Outfile = fopen(OutFName, "wt") ;
  27.     }
  28.     ea = FirstSeg();
  29.     end_seg = SegEnd(ea);
  30.     while ( ea != BADADDR) {
  31.         if( substr( Name(ea), 0, 1) == "a") {
  32.             Message( "String " + Name(ea) +" found at " + atoa(ea) + "\n" );
  33.             if ( write == 1){
  34.                 fprintf(Outfile, "String " + Name(ea) +" found at " + atoa(ea) + "\n" );
  35.             }
  36.         }
  37.         if (ea == end_seg){
  38.                 ea = NextSeg(ea);
  39.                 if (ea!=BADADDR) end_seg = SegEnd(ea);
  40.         }
  41.         else ea = NextHead(ea);
  42.     }
  43.     if ( write == 1){
  44.         fclose (Outfile);
  45.     }
  46.     Message( "String Search complete!\n\n" );
  47. }
  48.  
  49.  
  50.