MCPcopy Index your code
hub / github.com/pyload/pyload / decrypt

Method decrypt

module/plugins/captcha/CircleCaptcha.py:524–754  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

522 return result
523
524 def decrypt(self, img):
525 iDebugSaveFile = 0
526 mypalette = None
527 for im in ImageSequence(img):
528 im.save("orig.png", "png")
529 if mypalette is not None:
530 im.putpalette(mypalette)
531 mypalette = im.getpalette()
532 im = im.convert('L')
533
534 if self.pyload.debug:
535 iDebugSaveFile = iDebugSaveFile + 1
536 # if iDebugSaveFile < 7:
537 # continue
538 im.save("output" + str(iDebugSaveFile) + ".png", "png")
539 raw_input('frame: ' + str(im))
540
541 pix = im.load()
542
543 stepheight = range(1, im.size[1], 2)
544 #: stepheight = range(45, 47)
545 lstPoints = [] # Declares an empty list for the points
546 lstX = [] # CoordinateX
547 lstY = [] # CoordinateY
548 lstColors = [] # Declares an empty list named lst
549 min_distance = 10
550 max_diameter = 70
551
552 if self.pyload.debug:
553 imdebug = im.copy()
554 draw = ImageDraw.Draw(imdebug)
555 pixcopy = imdebug.load()
556
557 #: Clean image for powerfull search
558 self.clean_image(im, pix)
559 im.save("cleaned" + str(iDebugSaveFile) + ".png", "png")
560
561 found = set()
562 findnewcircle = True
563
564 #: Finding all the circles
565 for y1 in stepheight:
566 x1 = 1
567 for k in range(1, 100):
568 findnewcircle = False
569 retval = self.find_first_pixel_x(
570 im, pix, x1, y1, -1, False)
571 x1 = retval[0]
572 if x1 == -2:
573 break
574 if x1 == -1:
575 break
576 if self.pyload.debug:
577 self.log_debug(
578 "x1, y1 -> " + str((x1, y1)) + ": " + str(pix[x1, y1]))
579
580 if (x1, y1) in self.pointsofcirclefound:
581 if self.pyload.debug:

Callers 4

decrypt_from_webMethod · 0.95
decrypt_from_fileMethod · 0.95
resultMethod · 0.45
resultMethod · 0.45

Calls 13

clean_imageMethod · 0.95
find_first_pixel_xMethod · 0.95
find_last_pixel_xMethod · 0.95
find_last_pixel_yMethod · 0.95
find_circleMethod · 0.95
verify_circleMethod · 0.95
ImageSequenceClass · 0.85
log_debugMethod · 0.80
saveMethod · 0.45
loadMethod · 0.45
copyMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected