블로그 이미지
Flying Mr.Cheon youGom

Recent Comment»

Recent Post»

Recent Trackback»

« 2024/4 »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

[Captcha] 캡챠 우회 하기

보안/기술 정보 | 2017. 8. 3. 16:17 | Posted by youGom

# 기본 출처 : http://kthan.tistory.com/176

# 버젼 최신화로 인해, 위 링크 내용을 토대로 수정됨


------------------------------------------------------------------------------------------------------------------------------------------


설치 Lib


* leptonica 1.74

  : http://www.leptonica.com/download.html

  :: file << http://www.leptonica.com/source/leptonica-1.74.4.tar.gz

  :: latest git << https://github.com/DanBloomberg/leptonica


* tesseract-ocr

  : https://github.com/tesseract-ocr/tesseract/wiki/Compiling-%E2%80%93-GitInstallation


* tesser data 


* pytesser

  : https://code.google.com/archive/p/pytesser/



------------------------------------------------------------------------------------------------------------------------------------------



기본 테스트


아래 테스트 코드로 샘플 검사하는데 제대로 안되길래, 에러 메시지 확인해 보니,

TESSDATA_PREFIX 설정이 필요하다고 해서 아래 명령어로 경로 추가함.

( /usr/local/share/tessdata를 링크걸려고 했으나 용량 때문에 다른 파티션에 추가 했더니.. 링크가 안걸려서..에러 발생 )



------------------------------------------------------------------------------------------------------------------------------------------


captcha 이미지 보정

ref : http://effbot.org/imagingbook/image.htm

위 PIL 활용해서 인식이 모호한 텍스트 그림 보정 가능



------------------------------------------------------------------------------------------------------------------------------------------



convert 이미지 수정


convert test3image.png -blur 0x3 -level 30%,70% b.png


>> 이건 잘 안먹혀서.. 일단 패쓰~ ( 난중에 다른거에 활요하면 좋을듯..?! )



------------------------------------------------------------------------------------------------------------------------------------------


captcha 라인, 노이즈 제거 함수 활용

ref : https://robertgawron.blogspot.kr/2010/11/almost-all-sites-use-images-with-text.html


이 사이트의 함수 활용

$ command arg1 arg2

arg1 : image-file

arg2 : level




------------------------------------------------------------------------------------------------------------------------------------------


PIL 활용하여, BG 및 기타 노이즈 효과 제거 가능


https://stackoverflow.com/questions/24687760/numpy-pil-python-crop-image-on-whitespace-or-crop-text-with-histogram-threshol

: