Changeset 401 for pwntcha


Ignore:
Timestamp:
Jan 4, 2005, 3:47:36 AM (18 years ago)
Author:
Sam Hocevar
Message:
  • Decode Auditor captchas.
Location:
pwntcha/trunk
Files:
102 added
2 edited

Legend:

Unmodified
Added
Removed
  • pwntcha/trunk/src/main.c

    r400 r401  
    118118        }
    119119
     120        dprintf("image size %ix%i\n", img->width, img->height);
     121
    120122        if(!strcmp(mode, "test"))
    121123            result = decode_test(img);
     
    133135                result = decode_phpbb(img);
    134136            }
    135             else if(img->height == 25)
     137            else if(img->height == 25 || img->height == 30)
    136138            {
    137139                dprintf("autodetecting scode captcha\n");
  • pwntcha/trunk/src/scode.c

    r400 r401  
    3131    result = malloc(1024 * sizeof(char));
    3232
    33     /* Detect background: first 3 lines */
     33    /* Detect background: first and last 3 lines */
    3434    for(i = 0; i < 256; i++)
    3535        stats[i] = 0;
     
    3939        {
    4040            getpixel(img, x, y, &r, &g, &b);
     41            stats[r]++;
     42            getpixel(img, x, img->width - 1 - y, &r, &g, &b);
    4143            stats[r]++;
    4244        }
     
    121123            getpixel(img, x, y, &r, &g, &b);
    122124            if(!r)
    123                 count += y - ymin;
     125                count += 5 * (y - ymin) ^ 3 * (x - xmin);
     126                //count += y - ymin;
    124127        }
    125128    }
     
    127130    switch(count)
    128131    {
     132        /* Scode font */
     133        case 778: return '0';
     134        case 621: return '1';
     135        case 854: return '2';
     136        case 784: return '3';
     137        case 766: return '4';
     138        case 771: return '5';
     139        case 976: return '6';
     140        case 585: return '7';
     141        case 980: return '8';
     142        case 896: return '9';
     143        /* Small font */
     144        case 584: return '0';
     145        case 454: return '1';
     146        case 517: return '2';
     147        case 447: return '3';
     148        case 469: return '4';
     149        case 472: return '5';
     150        case 564: return '6';
     151        case 298: return '7';
     152        case 560: return '8';
     153        case 536: return '9';
     154        /* Thin font */
     155        case 438: return '0';
     156        case 405: return '1';
     157        case 485: return '2';
     158        case 486: return '3';
     159        case 413: return '4';
     160        case 509: return '5';
     161        case 582: return '6';
     162        case 242: return '7';
     163        case 579: return '8';
     164        case 440: return '9';
     165#if 0
    129166        case 162: return '0';
    130167        case 131: return '1';
     
    137174        case 180: return '8';
    138175        case 170: return '9';
     176#endif
    139177        default:
    140178            dprintf("don't know about checksum %i\n", count);
Note: See TracChangeset for help on using the changeset viewer.