3 Replies - 538 Views - Last Post: 19 June 2012 - 11:43 AM Rate Topic: -----

#1 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Python Catchpa

Posted 19 June 2012 - 08:28 AM

Hello,
I've been working on my own Python Catchpa. Here's the code:
#PyCatchpa
#Cladus - 19/06/2012
import random
def rchGen():
        genrch = ''
        nocaps = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
        caps =  ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
        while len(genrch) != 4:
                listno = (random.randrange(2))+1
                if listno == 1:
                        sno = (random.randrange(26))+1
                        genrch = genrch + nocaps[sno]
                if listno == 2:
                        sno = (random.randrange(26))+1
                        genrch = genrch + caps[sno]
        return genrch
def genFch(rch): 
        asch = (
                (('a','A'),("""
     ___  
    /   | 
   / /| | 
  / / | | 
 / /  | | 
/_/   |_|""")),(('b','B'),("""
 _____  
|  _  \ 
| |_| | 
|  _  { 
| |_| | 
|_____/""")),(('c','C'),("""
 _____  
/  ___| 
| |     
| |     
| |___  
\_____|
""")),(('d','D'),("""
 _____  
|  _  \ 
| | | | 
| | | | 
| |_| | 
|_____/""")),(('e','E'),("""
 _____  
| ____| 
| |__   
|  __|  
| |___  
|_____|""")),(('f','F'),("""
 _____  
|  ___| 
| |__   
|  __|  
| |     
|_|""")),(('g','G'),("""
 _____  
/  ___| 
| |     
| |  _  
| |_| | 
\_____/ """)),(('h','H'),("""
 _   _  
| | | | 
| |_| | 
|  _  | 
| | | | 
|_| |_| """)),(('i','I'),("""
 _  
| | 
| | 
| | 
| | 
|_| """)),(('j','J'),("""
     _  
    | | 
    | | 
 _  | | 
| |_| | 
\_____/ """)),(('k','K'),("""
 _   _   
| | / /  
| |/ /   
| |\ \   
| | \ \  
|_|  \_\ """)),(('l','L'),("""
 _      
| |     
| |     
| |     
| |___  
|_____| """)),(('m','M'),("""
     ___  ___  
    /   |/   | 
   / /|   /| | 
  / / |__/ | | 
 / /       | | 
/_/        |_| """)),(('n','N'),("""
 __   _  
|  \ | | 
|   \| | 
| |\   | 
| | \  | 
|_|  \_| """)),(('o','O'),("""
 _____  
/  _  \ 
| | | | 
| | | | 
| |_| | 
\_____/ """)),(('p','P'),("""
 _____  
|  _  \ 
| |_| | 
|  ___/ 
| |     
|_| """)),(('q','Q'),("""
 _____    
/  _  \   
| | | |   
| | | |   
| |_| |_  
\_______| """)),(('r','R'),("""
 _____   
|  _  \  
| |_| |  
|  _  /  
| | \ \  
|_|  \_\ """)),(('s','S'),("""
 _____  
/  ___/ 
| |___  
\___  \ 
 ___| | 
/_____/ """)),(('t','T'),("""
 _____  
|_   _| 
  | |   
  | |   
  | |   
  |_| """)),(('u','U'),("""
 _   _  
| | | | 
| | | | 
| | | | 
| |_| | 
\_____/ """)),(('v','V'),("""
 _     _  
| |   / / 
| |  / /  
| | / /   
| |/ /    
|___/ """)),(('w','W'),("""
 _          __ 
| |        / / 
| |  __   / /  
| | /  | / /   
| |/   |/ /    
|___/|___/ """)),(('x','X'),("""
__    __ 
\ \  / / 
 \ \/ /  
  }  {   
 / /\ \  
/_/  \_\ """)),(('y','Y'),("""
__    __ 
\ \  / / 
 \ \/ /  
  \  /   
  / /    
 /_/ """)),(('z','Z'),("""
 ______ 
|___  / 
   / /  
  / /   
 / /__  
/_____| """)))
        for symbols, replaceStr in asch:
                for symbol in symbols:
                        rch = rch.replace(symbol, replaceStr)
        return rch
print genFch(rchGen())







Tell me what you think and how to optimize. Also I need a way to turn the Text into a Image.

This post has been edited by cladus: 19 June 2012 - 08:32 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Python Catchpa

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9097
  • View blog
  • Posts: 34,181
  • Joined: 12-June 08

Re: Python Catchpa

Posted 19 June 2012 - 08:31 AM

I am not sure about the pronouns in there... who the "we"s are and what not, but typically - no, we do not try to crowd source capatcha breaker apps that can be quickly utilized for malicious needs. If you have a question or comment shoot me a PM.

Reopened since someone was playing swap-a-roo with his post.

Quote

Tell me what you think and how to optimize. Also I need a way to turn the Text into a Image.


Try expanding on what you want people to do. Just saying "look at my code and tell me what you think" isn't an effective way to get the input you want, right?

This post has been edited by modi123_1: 19 June 2012 - 08:40 AM

Was This Post Helpful? 0
  • +
  • -

#3 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python Catchpa

Posted 19 June 2012 - 08:44 AM

Okay. Basically I'm looking to see if I can change the code so that instead of displaying:
R
A
N
D
O
M


It will display: RANDOM
I'm also look for away to lower the size of the code!
And finally I don't know if this is possible but I want to turn my ASCII Catchpa into a Image.
Thank You,
Cladus
Was This Post Helpful? 0
  • +
  • -

#4 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python Catchpa

Posted 19 June 2012 - 11:43 AM

I made some changes with the code but Its only minor (bug fix + small optimization)
#ASCII ART Chachpa
#Cladus - 15/06/2012
import random
def rchGen():
        genrch = ''
        alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
        while len(genrch) != 4:
                sno = (random.randrange(26))
                genrch = genrch + nocaps[sno]
        return genrch
def genFch(rch): 
        asch = (
                (('a','A'),("""
     ___  
    /   | 
   / /| | 
  / / | | 
 / /  | | 
/_/   |_|""")),(('b','B'),("""
 _____  
|  _  \ 
| |_| | 
|  _  { 
| |_| | 
|_____/""")),(('c','C'),("""
 _____  
/  ___| 
| |     
| |     
| |___  
\_____|
""")),(('d','D'),("""
 _____  
|  _  \ 
| | | | 
| | | | 
| |_| | 
|_____/""")),(('e','E'),("""
 _____  
| ____| 
| |__   
|  __|  
| |___  
|_____|""")),(('f','F'),("""
 _____  
|  ___| 
| |__   
|  __|  
| |     
|_|""")),(('g','G'),("""
 _____  
/  ___| 
| |     
| |  _  
| |_| | 
\_____/ """)),(('h','H'),("""
 _   _  
| | | | 
| |_| | 
|  _  | 
| | | | 
|_| |_| """)),(('i','I'),("""
 _  
| | 
| | 
| | 
| | 
|_| """)),(('j','J'),("""
     _  
    | | 
    | | 
 _  | | 
| |_| | 
\_____/ """)),(('k','K'),("""
 _   _   
| | / /  
| |/ /   
| |\ \   
| | \ \  
|_|  \_\ """)),(('l','L'),("""
 _      
| |     
| |     
| |     
| |___  
|_____| """)),(('m','M'),("""
     ___  ___  
    /   |/   | 
   / /|   /| | 
  / / |__/ | | 
 / /       | | 
/_/        |_| """)),(('n','N'),("""
 __   _  
|  \ | | 
|   \| | 
| |\   | 
| | \  | 
|_|  \_| """)),(('o','O'),("""
 _____  
/  _  \ 
| | | | 
| | | | 
| |_| | 
\_____/ """)),(('p','P'),("""
 _____  
|  _  \ 
| |_| | 
|  ___/ 
| |     
|_| """)),(('q','Q'),("""
 _____    
/  _  \   
| | | |   
| | | |   
| |_| |_  
\_______| """)),(('r','R'),("""
 _____   
|  _  \  
| |_| |  
|  _  /  
| | \ \  
|_|  \_\ """)),(('s','S'),("""
 _____  
/  ___/ 
| |___  
\___  \ 
 ___| | 
/_____/ """)),(('t','T'),("""
 _____  
|_   _| 
  | |   
  | |   
  | |   
  |_| """)),(('u','U'),("""
 _   _  
| | | | 
| | | | 
| | | | 
| |_| | 
\_____/ """)),(('v','V'),("""
 _     _  
| |   / / 
| |  / /  
| | / /   
| |/ /    
|___/ """)),(('w','W'),("""
 _          __ 
| |        / / 
| |  __   / /  
| | /  | / /   
| |/   |/ /    
|___/|___/ """)),(('x','X'),("""
__    __ 
\ \  / / 
 \ \/ /  
  }  {   
 / /\ \  
/_/  \_\ """)),(('y','Y'),("""
__    __ 
\ \  / / 
 \ \/ /  
  \  /   
  / /    
 /_/ """)),(('z','Z'),("""
 ______ 
|___  / 
   / /  
  / /   
 / /__  
/_____| """)))
        for symbols, replaceStr in asch:
                for symbol in symbols:
                        rch = rch.replace(symbol, replaceStr)
        return rch
def fullGen():
        return genFch(rchGen())
print fullGen()


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1