예제 #1
0
파일: breakme.c 프로젝트: drbeco/breakme
/**
 * @ingroup GroupUnique
 * @brief This is the main event of the evening
 * @details Ladies and Gentleman... It's tiiiime!
 * Fightiiiiing at the blue corner,
 * he, who has compiled more C code than any other adversary in the history,
 * he, who has developed UNIX and Linux, and is an inspiration to maaany languages
 * and compilers, the GNU C Compiler, GCC!
 * Fightiiiiing at the red corner, the challenger, in his first fight, lacking of any
 * valid experience but angrily, blindly, and no doubtfully, will try to
 * compile this program without errors. He, the student, the apprentice,
 * the developer, beco!!
 *
 * @param[in] argc Argument counter
 * @param[in] argv Argument strings (argument values)
 *
 * @retval 0 If succeed (EXIT_SUCCESS).
 * @retval 1 Or another error code if failed.
 *
 * @par Example
 * @code
 *    $./breakme -h
 * @endcode
 *
 * @warning   Be carefull with...
 * @bug There is a bug with...
 * @todo Need to do...
 * @note You can read more about it at <<a href="http://www.beco.cc">www.beco.cc</a>>
 * @author Ruben Carlo Benante
 * @version 20160612.152232
 * @date 2016-06-12
 *
 */
int main(int argc, char *argv[])
{
    int opt; /* return from getopt() */
    int lines=6; /* number of lines to generate */
    int tips=6; /* number of letters in each group */
    int grps=6; /* groups per password letter */
    char *p=NULL; /* the password to crack */
    int i;

    IFDEBUG("Starting optarg loop...");

    /* getopt() configured options:
     *        -h      help
     *        -V      version
     *        -v      verbose
     *        -s X    password size (default 6 chars)
     *        -t X    tip size (default 6 chars per group)
     *        -d X    lines of data generated
     *        -g X    groups per password letter
     */
    opterr = 0;
    while((opt = getopt(argc, argv, "vhVd:t:g:")) != EOF)
        switch(opt)
        {
        case 'h':
            help();
            break;
        case 'V':
            copyr();
            break;
        case 'v':
            verb++;
            break;
        case 'd':
            lines=strtoul(optarg, NULL, 10);
            break;
        case 't':
            tips=strtoul(optarg, NULL, 10);
            break;
        case 'g':
            grps=strtoul(optarg, NULL, 10);
            break;
        case '?':
        default:
            printf("Type\n\t$man %s\nor\n\t$%s -h\nfor help.\n\n", argv[0], argv[0]);
            return EXIT_FAILURE;
        }

    if(verb)
        printf("Verbose level set at: %d\n", verb);

    breakme_init(); /* initialization function */

    p=passgen(6); /* generate password with a seed */

    for(i=0; i<lines; i++)
        tipgen(p, grps, tips);

    return EXIT_SUCCESS;
}
예제 #2
0
int main(int argc, char **argv)
  {
  HFILE dHandle;
  char  *drive = "a:";
  int   choice;

  copyr();
  if ((argc > 2) || ((argc == 2) && (argv[1][1] != ':')))
    {
    fputs("usage: dskcpy2 drive_letter:", stderr);
    exit(1);
    }

  if (argc == 2)
    drive = argv[1];

  DosError(HARDERROR_DISABLE);
  do
    {
    choice = dskcpy_menu(gotSource, drive);
    switch (choice)
      {
      case READ_SOURCE:
        query("Place SOURCE disk in drive %s and strike any key when ready..", drive);
        if ((dHandle = opendrive(drive)) == 0) errorexit(dHandle);
        if (lockdrive(dHandle))                errorexit(dHandle);
        if (readsource(dHandle))               errorexit(dHandle);
        if (unlockdrive(dHandle))              errorexit(dHandle);
        DosClose(dHandle);
        break;
      case COPY_TARGET:
        query("Place TARGET disk in drive %s and strike any key when ready..", drive);
        if ((dHandle = opendrive(drive)) == 0) errorexit(dHandle);
        if (lockdrive(dHandle))                errorexit(dHandle);
        if (writetarget(dHandle))              errorexit(dHandle);
        if (unlockdrive(dHandle))              errorexit(dHandle);
        DosClose(dHandle);
        break;
      default:
        break;
      }
    }
  while (choice != EXIT_DSKCPY);

  return _DosError;
  }