Example #1
0
    def get(self):
        nwords = self.request.get('nwords')
        acrostic = self.request.get('acrostic')
        passwd = 'error'
        acrostic = acrostic.strip().lower()

        if acrostic in ('no', ''):
            passwd = generate_xkcdpassword(mywords, n_words=4)
        else:
            try:
                passwd = generate_xkcdpassword(mywords, acrostic=acrostic)
            except:
                passwd = "errore nella stringa specificata come acronimo"

        self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
        self.response.write('<h1>' + passwd + '</h1>')
 def test_delim(self):
     tdelim = "_"
     target = tdelim.join(["factual", "amazing", "captain", "exactly"])
     # use an acrostic for simpler target check
     result = xkcd_password.generate_xkcdpassword(
         self.wordlist_small,
         acrostic="face",
         delim=tdelim)
     self.assertEquals(result, target)
Example #3
0
 def test_delim(self):
     tdelim = "_"
     target = tdelim.join(["factual", "amazing", "captain", "exactly"])
     # use an acrostic for simpler target check
     result = xkcd_password.generate_xkcdpassword(
         self.wordlist_small,
         acrostic="face",
         delim=tdelim)
     self.assertEquals(result, target)
# import the generate_xkcdpassword and generate_wordlist functions
from xkcd_password import generate_wordlist, generate_xkcdpassword

# create a wordlist
mywords = generate_wordlist(wordfile='3esl.txt', min_length=5, max_length=8,)

# create a password with the acrostic 'face'
print(generate_xkcdpassword(mywords, acrostic="face"))
# import the generate_xkcdpassword and generate_wordlist functions
from xkcd_password import generate_wordlist, generate_xkcdpassword

# create a wordlist
mywords = generate_wordlist(
    wordfile='3esl.txt',
    min_length=5,
    max_length=8,
)

# create a password with the acrostic 'face'
print(generate_xkcdpassword(mywords, acrostic="face"))
Example #6
0
def _generate_password():
    wordfile = xkcd_password.locate_wordfile()
    mywords = xkcd_password.generate_wordlist(wordfile=wordfile,
                                              min_length=4,
                                              max_length=8)
    return xkcd_password.generate_xkcdpassword(mywords, delim='-', n_words=3)
 def test_acrostic(self):
     target = ["factual", "amazing", "captain", "exactly"]
     result = xkcd_password.generate_xkcdpassword(
         self.wordlist_small,
         acrostic="face")
     self.assertEquals(result.split(), target)
Example #8
0
 def test_acrostic(self):
     target = ["factual", "amazing", "captain", "exactly"]
     result = xkcd_password.generate_xkcdpassword(
         self.wordlist_small,
         acrostic="face")
     self.assertEquals(result.split(), target)
Example #9
0
__FILENAME__ = example_import
# import the generate_xkcdpassword and generate_wordlist functions
from xkcd_password import generate_wordlist, generate_xkcdpassword

# create a wordlist
mywords = generate_wordlist(wordfile='3esl.txt', min_length=5, max_length=8,)

# create a password with the acrostic 'face'
print generate_xkcdpassword(mywords, acrostic="face")

########NEW FILE########
__FILENAME__ = xkcdp_tests
import unittest
import subprocess
import xkcd_password


class XkcdPasswordTests(unittest.TestCase):
    def setUp(self):
        self.wordlist_full = xkcd_password.generate_wordlist(
            wordfile='3esl.txt',
            min_length=5,
            max_length=8,)
        self.wordlist_small = xkcd_password.generate_wordlist(
            wordfile='tests/test_list.txt',
            valid_chars='[a-z]')

    def test_loadwordfile(self):
        self.assertEquals(len(self.wordlist_full), 10730)

    def test_regex(self):