vendredi 25 septembre 2015

Check for all similar domain names

I have this python script :

import string
import random
import difflib

def generate_similar(domain):
# Generates similar name by substituting vowels
similar_word = []
for char in domain:
 if char.lower() in 'aeiou':
  similar_word.append(random.choice('aeiou').lower())
 else:
  similar_word.append(char)
return ''.join(similar_word)

for i in range(1,20) :
 ratio = 0
 while ratio < 0.83:
  dom = generate_similar("potatoes")
  ratio = difflib.SequenceMatcher(None,"potatoes",dom).ratio()
 i =i +1
 print dom

And When I run it on terminal I get the following output :

potutoes

patatoes

potatues

potataos

potatees

potatoos

potatoos

potatoes

potatoos

patatoes

pitatoes

pitatoes

potatoos

pitatoes

potetoes

petatoes

potateis

potatuos

potateas

However,I need to generate similar domain names which can be taped by mistake.

For example if we gave potatoes.com. it should create all the permutations of potatoes like, pottatoe, pottatoes,potatos e.t.c.




Aucun commentaire:

Enregistrer un commentaire