Exemple #1
0
def test_scan_list():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # test values: not present, valid, valid repeat, valid, valid, not valid
    hash_file = ["# command: ","# hashdb-Version: ", \
"# marker 1", \
"fp1	0000000000000000", \
"# marker 2", \
"fp1	2222222222222222", \
"# marker 3", \
"fp2	2222222222222222", \
"fp3	8899aabbccddeeff", \
"fp4	ffffffffffffffff", \
"# marker4", \
"fp4	invalid_hash_value", \
"# marker5"]
    H.make_tempfile("temp_1.txt", hash_file)

    returned_answer = H.hashdb(["scan_list", "temp_1.hdb", "temp_1.txt"])
    expected_answer = [
        '# command: ', '# hashdb-Version: ', '# command: ',
        '# hashdb-Version: ', '# marker 1', '# marker 2',
        'fp1	2222222222222222	{"block_hash":"2222222222222222","k_entropy":7,"block_label":"bl1","count":1,"source_list_id":1303964917,"sources":[{"file_hash":"1111111111111111","filesize":5,"file_type":"ftc","zero_count":60,"nonprobative_count":6,"name_pairs":["r3","f3"]}],"source_sub_counts":["1111111111111111",1]}',
        '# marker 3', 'fp2	2222222222222222	{"block_hash":"2222222222222222"}',
        'fp3	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8,"block_label":"bl2","count":3,"source_list_id":36745675,"sources":[{"file_hash":"0000000000000000","filesize":3,"file_type":"ftb","zero_count":40,"nonprobative_count":4,"name_pairs":["r2","f2"]},{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0000000000000000",1,"0011223344556677",2]}',
        'fp4	ffffffffffffffff	{"block_hash":"ffffffffffffffff","k_entropy":9,"block_label":"bl3","count":1,"source_list_id":2343118327,"sources":[],"source_sub_counts":["0011223344556677",1]}',
        '# marker4', '# marker5', '# scan_list completed.', ''
    ]

    H.lines_equals(returned_answer, expected_answer)
Exemple #2
0
def test_export_json_hash_partition_range():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.rm_tempfile("temp_2.json")

    temp1_input = [
'{"block_hash":"2222222222222222","k_entropy":1,"block_label":"bl1","source_offsets":["1111111111111111",2,[4096]]}',
'{"block_hash":"8899aabbccddeeff","k_entropy":2,"block_label":"bl2","source_offsets":["0000000000000000",1,[0],"0011223344556677",2,[0,512]]}',
'{"block_hash":"ffffffffffffffff","k_entropy":3,"block_label":"bl3","source_offsets":["0011223344556677",1,[1024]]}',
'{"file_hash":"0000000000000000","filesize":3,"file_type":"ftb","zero_count":4,"nonprobative_count":5,"name_pairs":["r2","f2"]}',
'{"file_hash":"0011223344556677","filesize":6,"file_type":"fta","zero_count":7,"nonprobative_count":8,"name_pairs":["r1","f1"]}',
'{"file_hash":"1111111111111111","filesize":9,"file_type":"ftc","zero_count":10,"nonprobative_count":11,"name_pairs":["r3","f3"]}'
]

    expected_answer = [
"# command: ","# hashdb-Version: ",
'{"block_hash":"2222222222222222","k_entropy":1,"block_label":"bl1","source_offsets":["1111111111111111",2,[4096]]}',
'{"file_hash":"1111111111111111","filesize":9,"file_type":"ftc","zero_count":10,"nonprobative_count":11,"name_pairs":["r3","f3"]}'
]

    H.make_tempfile("temp_1.json", temp1_input)
    H.hashdb(["create", "temp_1.hdb"])
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])
    H.hashdb(["export", "-p", "00:80", "temp_1.hdb", "temp_2.json"])

    returned_answer = H.read_file("temp_2.json")
    H.lines_equals(returned_answer, expected_answer)
Exemple #3
0
def test_import_tab1():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.tab", [
          "# <file hash> <tab> <block hash> <tab> <index>",
          "0011223344556677	8899aabbccddeeff	1",
          "0000000000000000	8899aabbccddeeff	1",
          "0011223344556677	8899aabbccddeeff	2",
          "0011223344556677	ffffffffffffffff	3",
          "1111111111111111	2222222222222222	9",
          "1111111111111111	2222222222222222	9"])
    H.hashdb(["import_tab", "temp_1.hdb", "temp_1.tab"])
    H.hashdb(["export", "temp_1.hdb", "temp_1.json"])

    returned_answer = H.read_file("temp_1.json")
    expected_answer = ["# command: ","# hashdb-Version: ",
'{"block_hash":"2222222222222222","k_entropy":0,"block_label":"","source_offsets":["1111111111111111",2,[4096]]}',
'{"block_hash":"8899aabbccddeeff","k_entropy":0,"block_label":"","source_offsets":["0000000000000000",1,[0],"0011223344556677",2,[0,512]]}',
'{"block_hash":"ffffffffffffffff","k_entropy":0,"block_label":"","source_offsets":["0011223344556677",1,[1024]]}',
'{"file_hash":"0000000000000000","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}',
'{"file_hash":"0011223344556677","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}',
'{"file_hash":"1111111111111111","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}'
]

    H.lines_equals(returned_answer, expected_answer)
Exemple #4
0
def test_import_tab1():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.tab", [
        "# <file hash> <tab> <block hash> <tab> <index>",
        "0011223344556677	8899aabbccddeeff	1",
        "0000000000000000	8899aabbccddeeff	1",
        "0011223344556677	8899aabbccddeeff	2",
        "0011223344556677	ffffffffffffffff	3",
        "1111111111111111	2222222222222222	9",
        "1111111111111111	2222222222222222	9"
    ])
    H.hashdb(["import_tab", "temp_1.hdb", "temp_1.tab"])
    H.hashdb(["export", "temp_1.hdb", "temp_1.json"])

    returned_answer = H.read_file("temp_1.json")
    expected_answer = [
        "# command: ", "# hashdb-Version: ",
        '{"block_hash":"2222222222222222","k_entropy":0,"block_label":"","source_sub_counts":["1111111111111111",2]}',
        '{"block_hash":"8899aabbccddeeff","k_entropy":0,"block_label":"","source_sub_counts":["0000000000000000",1,"0011223344556677",2]}',
        '{"block_hash":"ffffffffffffffff","k_entropy":0,"block_label":"","source_sub_counts":["0011223344556677",1]}',
        '{"file_hash":"0000000000000000","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}',
        '{"file_hash":"0011223344556677","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}',
        '{"file_hash":"1111111111111111","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["temp_1.tab","temp_1.tab"]}'
    ]

    H.lines_equals(returned_answer, expected_answer)
Exemple #5
0
def test_export_json_hash_partition_range():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.rm_tempfile("temp_2.json")

    temp1_input = [
        '{"block_hash":"2222222222222222","k_entropy":1,"block_label":"bl1","source_sub_counts":["1111111111111111",2]}',
        '{"block_hash":"8899aabbccddeeff","k_entropy":2,"block_label":"bl2","source_sub_counts":["0000000000000000",1,"0011223344556677",2]}',
        '{"block_hash":"ffffffffffffffff","k_entropy":3,"block_label":"bl3","source_sub_counts":["0011223344556677",1]}',
        '{"file_hash":"0000000000000000","filesize":3,"file_type":"ftb","zero_count":4,"nonprobative_count":5,"name_pairs":["r2","f2"]}',
        '{"file_hash":"0011223344556677","filesize":6,"file_type":"fta","zero_count":7,"nonprobative_count":8,"name_pairs":["r1","f1"]}',
        '{"file_hash":"1111111111111111","filesize":9,"file_type":"ftc","zero_count":10,"nonprobative_count":11,"name_pairs":["r3","f3"]}'
    ]

    expected_answer = [
        "# command: ", "# hashdb-Version: ",
        '{"block_hash":"2222222222222222","k_entropy":1,"block_label":"bl1","source_sub_counts":["1111111111111111",2]}',
        '{"file_hash":"1111111111111111","filesize":9,"file_type":"ftc","zero_count":10,"nonprobative_count":11,"name_pairs":["r3","f3"]}'
    ]

    H.make_tempfile("temp_1.json", temp1_input)
    H.hashdb(["create", "temp_1.hdb"])
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])
    H.hashdb(["export", "-p", "00:80", "temp_1.hdb", "temp_2.json"])

    returned_answer = H.read_file("temp_2.json")
    H.lines_equals(returned_answer, expected_answer)
Exemple #6
0
def test_json_modes():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # make hash file
    hash_file = [
"fp1	8899aabbccddeeff",
"fp2	8899aabbccddeeff"]
    H.make_tempfile("temp_1.txt", hash_file)

    # expanded
    returned_answer = H.hashdb(["scan_list", "-j", "e", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
'# scan_list completed.',
''
])

    # expanded optimized
    returned_answer = H.hashdb(["scan_list", "-j", "o", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff"}',
'# scan_list completed.',
''
])

    # count only
    returned_answer = H.hashdb(["scan_list", "-j", "c", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
'# scan_list completed.',
''
])

    # approximate count
    returned_answer = H.hashdb(["scan_list", "-j", "a", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","approximate_count":1}',
'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","approximate_count":1}',
'# scan_list completed.',
''
])
Exemple #7
0
def test_json_commands():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # scan_list: alredy done

    # scan_hash
    returned_answer = H.hashdb(["scan_hash", "-j", "c", "temp_1.hdb", "8899aabbccddeeff"])
    H.lines_equals(returned_answer, [
'{"block_hash":"8899aabbccddeeff","count":1}',
''
])

    # scan_media: skip

    # duplicates
    returned_answer = H.hashdb(["duplicates", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
'# Processing 1 of 1 completed.',
''
])

    # hash_table
    returned_answer = H.hashdb(["hash_table", "-j", "c", "temp_1.hdb", "0011223344556677"])
    H.lines_equals(returned_answer, [
'# command: ',
'# hashdb-Version: ',
'8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
'# Processing 1 of 1 completed.',
''
])

    # scan_random: nothing returned but accepts -j
    returned_answer = H.hashdb(["scan_random", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, [
'# Processing 1 of 1 completed.',
''
])

    # scan_same: nothing returned but accepts -j
    returned_answer = H.hashdb(["scan_same", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, [
'Match not found, hash 80000000000000000000000000000000:',
'# Processing 1 of 1 completed.',
''
])
Exemple #8
0
def test_json_modes():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # make hash file
    hash_file = ["fp1	8899aabbccddeeff", "fp2	8899aabbccddeeff"]
    H.make_tempfile("temp_1.txt", hash_file)

    # expanded
    returned_answer = H.hashdb(
        ["scan_list", "-j", "e", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
        'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
        '# scan_list completed.', ''
    ])

    # expanded optimized
    returned_answer = H.hashdb(
        ["scan_list", "-j", "o", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8000,"block_label":"bl2","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
        'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff"}',
        '# scan_list completed.', ''
    ])

    # count only
    returned_answer = H.hashdb(
        ["scan_list", "-j", "c", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
        'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
        '# scan_list completed.', ''
    ])

    # approximate count
    returned_answer = H.hashdb(
        ["scan_list", "-j", "a", "temp_1.hdb", "temp_1.txt"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        'fp1	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","approximate_count":1}',
        'fp2	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","approximate_count":1}',
        '# scan_list completed.', ''
    ])
Exemple #9
0
def test_import_tab2():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.tab", [
          "# <file hash> <tab> <block hash> <tab> <index>",
          "0011223344556677	8899aabbccddeeff	1"])
    H.hashdb(["import_tab", "-rr", "temp_1.hdb", "temp_1.tab"])
    H.hashdb(["export", "temp_1.hdb", "temp_1.json"])

    returned_answer = H.read_file("temp_1.json")
    expected_answer = ["# command: ","# hashdb-Version: ", \
'{"block_hash":"8899aabbccddeeff","k_entropy":0,"block_label":"","source_sub_counts":["0011223344556677",1]}',
'{"file_hash":"0011223344556677","filesize":0,"file_type":"","zero_count":0,"nonprobative_count":0,"name_pairs":["r","temp_1.tab"]}'
]
    H.lines_equals(returned_answer, expected_answer)
Exemple #10
0
def test_scan_hash():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # test individual hash, hash present
    returned_answer = H.hashdb(["scan_hash", "temp_1.hdb", "ffffffffffffffff"])
    H.lines_equals(returned_answer, [
'{"block_hash":"ffffffffffffffff","k_entropy":9,"block_label":"bl3","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_offsets":["0011223344556677",1,[1024]]}',
''])
    # test individual hash, hash not present
    returned_answer = H.hashdb(["scan_hash", "temp_1.hdb", "0000000000000000"])
    H.lines_equals(returned_answer, [
'Hash not found for \'0000000000000000\'', \
''])
Exemple #11
0
def test_scan_hash():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # test individual hash, hash present
    returned_answer = H.hashdb(["scan_hash", "temp_1.hdb", "ffffffffffffffff"])
    H.lines_equals(returned_answer, [
        '{"block_hash":"ffffffffffffffff","k_entropy":9,"block_label":"bl3","count":1,"source_list_id":2343118327,"sources":[{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_sub_counts":["0011223344556677",1]}',
        ''
    ])
    # test individual hash, hash not present
    returned_answer = H.hashdb(["scan_hash", "temp_1.hdb", "0000000000000000"])
    H.lines_equals(returned_answer, [
        'Hash not found for \'0000000000000000\'', \
''])
Exemple #12
0
def test_json_commands():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # scan_list: alredy done

    # scan_hash
    returned_answer = H.hashdb(
        ["scan_hash", "-j", "c", "temp_1.hdb", "8899aabbccddeeff"])
    H.lines_equals(returned_answer,
                   ['{"block_hash":"8899aabbccddeeff","count":1}', ''])

    # scan_media: skip

    # duplicates
    returned_answer = H.hashdb(["duplicates", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        '8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
        '# Processing 1 of 1 completed.', ''
    ])

    # hash_table
    returned_answer = H.hashdb(
        ["hash_table", "-j", "c", "temp_1.hdb", "0011223344556677"])
    H.lines_equals(returned_answer, [
        '# command: ', '# hashdb-Version: ',
        '8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","count":1}',
        '# Processing 1 of 1 completed.', ''
    ])

    # scan_random: nothing returned but accepts -j
    returned_answer = H.hashdb(["scan_random", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, ['# Processing 1 of 1 completed.', ''])

    # scan_same: nothing returned but accepts -j
    returned_answer = H.hashdb(["scan_same", "-j", "c", "temp_1.hdb", "1"])
    H.lines_equals(returned_answer, [
        'Match not found, hash 80000000000000000000000000000000:',
        '# Processing 1 of 1 completed.', ''
    ])
Exemple #13
0
def test_scan_list():
    H.rm_tempdir("temp_1.hdb")
    H.rm_tempfile("temp_1.json")
    H.hashdb(["create", "temp_1.hdb"])
    H.make_tempfile("temp_1.json", json_data)
    H.hashdb(["import", "temp_1.hdb", "temp_1.json"])

    # test values: not present, valid, valid repeat, valid, valid, not valid
    hash_file = ["# command: ","# hashdb-Version: ", \
"# marker 1", \
"fp1	0000000000000000", \
"# marker 2", \
"fp1	2222222222222222", \
"# marker 3", \
"fp2	2222222222222222", \
"fp3	8899aabbccddeeff", \
"fp4	ffffffffffffffff", \
"# marker4", \
"fp4	invalid_hash_value", \
"# marker5"]
    H.make_tempfile("temp_1.txt", hash_file)

    returned_answer = H.hashdb(["scan_list", "temp_1.hdb", "temp_1.txt"])
    expected_answer = [
'# command: ',
'# hashdb-Version: ',
'# command: ',
'# hashdb-Version: ',
'# marker 1',
'# marker 2',
'fp1	2222222222222222	{"block_hash":"2222222222222222","k_entropy":7,"block_label":"bl1","count":1,"source_list_id":1303964917,"sources":[{"file_hash":"1111111111111111","filesize":5,"file_type":"ftc","zero_count":60,"nonprobative_count":6,"name_pairs":["r3","f3"]}],"source_offsets":["1111111111111111",1,[4096]]}',
'# marker 3',
'fp2	2222222222222222	{"block_hash":"2222222222222222"}',
'fp3	8899aabbccddeeff	{"block_hash":"8899aabbccddeeff","k_entropy":8,"block_label":"bl2","count":3,"source_list_id":36745675,"sources":[{"file_hash":"0000000000000000","filesize":3,"file_type":"ftb","zero_count":40,"nonprobative_count":4,"name_pairs":["r2","f2"]},{"file_hash":"0011223344556677","filesize":1,"file_type":"fta","zero_count":20,"nonprobative_count":2,"name_pairs":["r1","f1"]}],"source_offsets":["0000000000000000",1,[0],"0011223344556677",2,[0,512]]}',
'fp4	ffffffffffffffff	{"block_hash":"ffffffffffffffff","k_entropy":9,"block_label":"bl3","count":1,"source_list_id":2343118327,"sources":[],"source_offsets":["0011223344556677",1,[1024]]}',
'# marker4',
'# marker5',
'# scan_list completed.',
'']

    H.lines_equals(returned_answer, expected_answer)