Commit 2111b090 authored by Julien Deneuville's avatar Julien Deneuville

parent 0987f074
\ No newline at end of file
# Various
A repository for small random scripts that don't need a repo of their own yet.
\ No newline at end of file
A repository for small random scripts that don't need a repo of their own yet.
Install dependencies:
pip install -r requirements.txt
A script to generate every possible _alias_ for a given email.
For example:
Usage: `python -e example@email.tld`
\ No newline at end of file
import argparse
from validate_email import validate_email
from itertools import chain, combinations
def powerset(iterable):
Returns all possible combinations of items in a list.
powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-e','--email', required=True, default='',
type=str, help='Base email')
args = parser.parse_args()
# Let's check if this is a valid email address
if not validate_email(
print('You must enter a valid email address.')
name,domain ='@')
name = name.replace('.','')
# Where can we put a dot ?
positions = list(powerset(list(range(1,len(name)))))
# We'll store the result aliases in this list
names = list()
# Loop through all possible positions
for i in positions:
j = list(i)
n = list(name)
counter = 0
for k in j:
counter += 1
# Print results
for name in names:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment