Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python captcha

from captcha.image import ImageCaptcha
import random, string

ran = ''.join(random.choices(string.ascii_letters + string.digits, k=5))

image = ImageCaptcha(width = 280, height = 90)

captcha_text = ran

data = image.generate(captcha_text)

image.write(captcha_text,"Captcha.png")
Comment

python captcha

from captcha.image import ImageCaptcha

image = ImageCaptcha(width = 280, height = 90)

captcha_text = "rand"

data = image.generate(captcha_text)

image.write(captcha_text,"Captcha.png")
Comment

python captcha bypass

# -*- coding: utf-8 -*-                                                         
import io                                                                       
import urllib2                                                                  

from PIL import Image                                                           
import pytesseract                                                              
import scrapy                                                                   


class CaptchaSpider(scrapy.Spider):                                             
    name = 'captcha'                                                            

    def start_requests(self):                                                   
        yield scrapy.Request('http://145.100.108.148/login3/',                  
                             cookies={'PHPSESSID': 'xyz'})                      

    def parse(self, response):                                                  
        img_url = response.urljoin(response.xpath('//img/@src').extract_first())

        url_opener = urllib2.build_opener()                                     
        url_opener.addheaders.append(('Cookie', 'PHPSESSID=xyz'))               
        img_bytes = url_opener.open(img_url).read()                             
        img = Image.open(io.BytesIO(img_bytes))                                 

        captcha = pytesseract.image_to_string(img)                              
        print 'Captcha solved:', captcha                                        

        return scrapy.FormRequest.from_response(                                
            response, formdata={'captcha': captcha},                            
            callback=self.after_captcha)                                        

    def after_captcha(self, response):                                          
        print 'Result:', response.body
Comment

PREVIOUS NEXT
Code Example
Python :: flask where to put db.create_all 
Python :: keras conv2d 
Python :: string list to int list python 
Python :: how to take space separated input in pyhon dicationary 
Python :: python A string float numeral into integer 
Python :: django admin readonly models 
Python :: get files in directory and subdirectory 
Python :: write string python 
Python :: python get text of QLineEdit 
Python :: python concatenate strings 
Python :: python binary 
Python :: python ternary elif 
Python :: defaultdict python 
Python :: python fill string with spaces to length 
Python :: usage of thread in python 
Python :: pytorch dill model save 
Python :: inpuit inf terfminal ppython 
Python :: flask rest api upload image 
Python :: python print string and variable 
Python :: pass 2d array to 1d python 
Python :: tkinter tutorial 
Python :: db connection string timeout 
Python :: python json check if key exist 
Python :: pygame scroll event 
Python :: np.array([(1,2),(3,4)],dtype 
Python :: opencv webcam 
Python :: python why call super(class).__init__() 
Python :: python get audio from video 
Python :: bubble python 
Python :: args and kwargs 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =