def test_url(): """ Test url function """ output = md.url('a', 'b') assert output == '[a](b)'
def binary_carver_markdown(self, json): output = md.table_header(('Name', 'SHA256 Digest', 'File Type')) output += md.table_row( (json['name'], md.url( json['sha256_digest'], '/#/{}/{}'.format(json['file_type'], json['sha256_digest'])), json['file_type'])) if not json.keys(): output += md.table_row(('-', '-', '-')) return output
def extract_markdown(self, json): output = md.table_header(('Name', 'SHA256 Digest', 'File Type')) for sample in json: output += md.table_row( (sample['name'], md.url( sample['sha256_digest'], '/#/{}/{}'.format(sample['file_type'], sample['sha256_digest'])), sample['file_type'])) if not json: output += md.table_row(('-', '-', '-')) return output
def fuzzy_search_markdown(json): output = md.table_header(('File Name', 'SHA256', 'Match (%)')) count = 0 for j in json: output += md.table_row( (md.url(str(j[0]), 'samples/' + str(j[1])), str(j[1]), str(j[3]))) count += 1 if count: output += md.paragraph(md.bold('Hits:') + str(count)) else: output += md.table_row(('-', '-', '-')) output += md.paragraph(md.bold('Hits:') + '0') return output
def oleobj_markdown(self, json): output = "Ole obj from oletools\n" if not json: raise error.CommandWarning('No ole object was found') j = 0 for i in json: if not i: raise error.CommandWarning('No ole object was found') output += "**Found embedded file =** ") + str(i['Saved_Filename']) + "\n" output += "**Source path =** ") + str(i['Source_path']) + "\n" output += "**Temp path =** ") + str(i['Temp_path']) + "\n" for j in i['samples']: # XXX - Fix me hardcoded URL output += "**Extracted_file.URL:** ") + md.url("SNAKE_URL", "/sample/" + str(j['sha256_digest'])) + '\n' output += "**Extracted_file.DESCRIPTION:** ") + str(j['description']) + '\n' output += "**Extracted_file.MIME:** ") + str(j['mime']) + '\n' output += "**Extracted_file.SIZE:** ") + str(j['size']) + '\n' output += "**Extracted_file.MAGIC:** ") + str(j['magic']) + '\n' output += "**Extracted_file.SHA256:** ") + str(j['sha256_digest']) + '\n' return output