Jump to content
hozarares

Breaking Weak CAPTCHA

Recommended Posts

01 from PIL import Image

02

03 img = Image.open('input.gif')

04 img = img.convert("RGBA")

05

06 pixdata = img.load()

07

08 # Clean the background noise, if color != black, then set to white.

09 for y in xrange(img.size[1]):

10 for x in xrange(img.size[0]):

11 if pixdata[x, y] != (0, 0, 0, 255):

12 pixdata[x, y] = (255, 255, 255, 255)

13

14 img.save("input-black.gif", "GIF")

15

16 # Make the image bigger (needed for OCR)

17 im_orig = Image.open('input-black.gif')

18 big = im_orig.resize((116, 56), Image.NEAREST)

19

20 ext = ".tif"

21 big.save("input-NEAREST" + ext)

22

23 # Perform OCR using pytesser library

24 from pytesser import *

25 image = Image.open('input-NEAREST.tif')

26 print image_to_string(image)

Sursa http://www.bonsai-sec.com

Edited by hozarares
lio
Link to comment
Share on other sites

Nu sunt bun in python am incercat cat am putut si mia dat aceasta eroare:

root@bt:~# python captha.py

Traceback (most recent call last):

File "captha.py", line 25, in <module>

from pytesser import *

ImportError: No module named pytesser

Folosesc BackTrack4. daca aveti vreo solutie postati aici, am incercat sal definesc separat pe pytesser , dar stiam de la inceput ca nu o sa reusesc. Multumesc

Edited by linux_terminal
Link to comment
Share on other sites

Nu sunt bun in python am incercat cat am putut si mia dat aceasta eroare:

root@bt:~# python captha.py

Traceback (most recent call last):

File "captha.py", line 25, in <module>

from pytesser import *

ImportError: No module named pytesser

Folosesc BackTrack4. daca aveti vreo solutie postati aici, am incercat sal definesc separat pe pytesser , dar stiam de la inceput ca nu o sa reusesc. Multumesc

pytesser este un modul care trebuie importat, comanda aceea importa tot (*) din modulul respectiv (pytesser), in ordine sa-ti functioneze, trebuie:

1: sa cauti daca exista modulul in folderele respective (extrase din arhiva -- daca asa s-a intamplat), daca nu vezi 2 ->

-> 2: o cauti pe net sau dai e-mail celui care a facut proiectul, il poti intreba ce s-a intamplat cu libraria respectiva, daca este privata, iar daca nu si este sub gpl si open source... roaga-l frumos sa o impartaseasca cu tine

sau.. 3: o faci tu de la 0

// Le: arunca un ochi pe:

http://github.com/srobertson/pytesser/blob/144e57a70bc46d4fd08fd067b6fb8d18a78661af/pytesser.py

si pe: http://code.google.com/p/pytesser/downloads/detail?name=pytesser_v0.0.1.zip

sper sa te fi ajutat, salut

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...