Esempio n. 1
0
    def load_ts_lyric_obfuscators():
        lo0 = MarkovKeyState(16)
        lo1 = MarkovKeyState(16)

        with open(join("datasets", "ts_lyrics.lst"), "r") as f:
            text = f.read()

        lo0.learn_book(text)
        lo1.learn_book(text)

        return lo0, lo1
    def load_ts_lyric_obfuscators():
        lo0 = MarkovKeyState(16)
        lo1 = MarkovKeyState(16)

        with open(join("datasets", "ts_lyrics.lst"), "r") as f:
            text = f.read()

        lo0.learn_book(text)
        lo1.learn_book(text)

        return lo0, lo1
    def test_splitting_and_joining(self):
        test_string = "test0 test1 test2\ntest3 test4 test5"
        split_string = MarkovKeyState.split_obfuscated_string(test_string)
        joined_string = MarkovKeyState.join_obfuscated_string(split_string)

        assert joined_string == test_string
Esempio n. 4
0
    parser.add_argument('-r', '--remote', default=None, type=str, action='append', help='Remote server to tunnel to')
    parser.add_argument('-p', '--port', default=9050, type=int, help='Port to listen on')
    parser.add_argument('-P', '--remoteport', default=9999, type=int, help='Port for remote server')

    args = parser.parse_args()

    logging.basicConfig(level=logging.DEBUG)

    # Regular expression to split our training files on
    split_regex = r'\.'

    # File/book to read for training the Markov model (will be read into memory)
    training_file = "datasets/98.txt"

    # Obfuscating Markov engine
    m = MarkovKeyState()

    # Read the shared key into memory
    logging.info("Reading {0}".format(training_file))
    with open(training_file, "r") as f:
        text = f.read()

    import re
    # Split learning data into sentences, in this case, based on periods.
    logging.info("Teaching the Markov model")
    map(m.learn_sentence, re.split(split_regex, text))

    if args.server:
        # We are the terminating server
        host = "0.0.0.0"
        port = int(args.remoteport)
Esempio n. 5
0
    def test_splitting_and_joining(self):
        test_string = "test0 test1 test2\ntest3 test4 test5"
        split_string = MarkovKeyState.split_obfuscated_string(test_string)
        joined_string = MarkovKeyState.join_obfuscated_string(split_string)

        assert joined_string == test_string
Esempio n. 6
0
 def __init__(self, *args):
     MarkovKeyState.__init__(self, *args)
Esempio n. 7
0
 def __init__(self, *args):
     MarkovKeyState.__init__(self, *args)