<commit_before>from autofocus import AFSample

#AutoFocusAPI.api_key = "<my API key>"

# Get a list of hashes you're interested in looking for
# IMPORTANT: The API currently has a 100 hash limit per query. You'll have to chunk hashes
# if you want to run more than 100 hashes.
hashes = [
    "7f38fd3e55a4139d788a4475ab0a5d83bf7686a37ef5e54a65364a0d781b523c",
    "9906a8a55e5a50d2993408c7f1ba9cf97d8f38ca3fe68750bb62a8d0785b8c4b",
    "b25a964c954d386ab67df52d20dbf210e803f0ada2ed6feb38fc5dc93e31c873",
    "47633cc3e4adf583c4b40e0f64b56eaf8005b4232e5bd493f811875e4c4d47a0"
]

# Build the query for AutoFocus API
search_terms = {
    "field" : "sample.sha256",
    "operator" : "is in the list",
    "value" : hashes
}
<commit_msg>Adding sphinx documentation directory<commit_after>from autofocus import AFSample

#AutoFocusAPI.api_key = "<my API key>"

###############################
# Searching for a single hash #
###############################
hash = "7f38fd3e55a4139d788a4475ab0a5d83bf7686a37ef5e54a65364a0d781b523c"
sample = AFSample.get(hash)

print "Pulled sample {} and got the follow attributes".format(hash)
for k,v in sample.__dict__.items():
    print "\t{}={}".format(k, v)


################################################
# Run an autofocus query (Exported via the UI) #
################################################
query = '{"operator":"all","children":[{"field":"sample.malware","operator":"is","value":1}]}'

# * AFSample.search is a generator, so you have to iterate over the results, which is required since it's common
#   to search for large datasets
# * The client library handles all paging for you, so you just need to pose a question
#   and parse the results
for sample in AFSample.search(query):
    pass

#################################
# Searching for multiple hashes #
#################################

# Get a list of hashes you're interested in looking for
# IMPORTANT: The API currently has a 100 hash limit per query. You'll have to chunk hashes
# if you want to run more than 100 hashes.
hashes = [
    "7f38fd3e55a4139d788a4475ab0a5d83bf7686a37ef5e54a65364a0d781b523c",
    "9906a8a55e5a50d2993408c7f1ba9cf97d8f38ca3fe68750bb62a8d0785b8c4b",
    "b25a964c954d386ab67df52d20dbf210e803f0ada2ed6feb38fc5dc93e31c873",
    "47633cc3e4adf583c4b40e0f64b56eaf8005b4232e5bd493f811875e4c4d47a0"
]

# Build the query for AutoFocus API
search_terms = {
    "field" : "sample.sha256",
    "operator" : "is in the list",
    "value" : hashes
}

{'fraction_non_alphanumeric': 0.16821298910851148, 'fraction_numerical': 0.15288422751109318, 'mean_word_length': 5.794520547945205, 'pattern_counts': {'":': 5, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5296858', 'n_tokens_mistral': 1111, 'n_tokens_neox': 915, 'n_words': 217}