text
stringlengths
1
93.6k
model_out = sys.argv[3]
weights_path = sys.argv[4]
graph_path = sys.argv[5]
except:
print('Run with arguments !\nArguments:\nmodel_path model_in model_out weights_path graph_path')
exit()
keras_to_graph(model_path, model_in, model_out, weights_path, graph_path, False)
# <FILESEP>
#!/usr/bin/env python
import json
import requests
import sys
import time
# Github API token for making requests, insert here if blank
GITHUB_API_TOKEN = ""
# List of repos discovered during investigation
repos = []
def main(inform_keyword, confirm_keywords=""):
# Page count specifies the current page of the search results
PAGE_COUNT = 1
# Check to make sure a Github token is filled in
try:
if GITHUB_API_TOKEN != "":
results_log = ""
# Perform an initial search and return up to 100 results
count, results = github_search(inform_keyword, "100", str(PAGE_COUNT))
# Remaining results are kept track of in results_count
results_count = count
# Place the results into a variable with the total number
github_results = [count, results]
# Output the results to the user
print(output(github_results, PAGE_COUNT - 1))
results_log += output(github_results, PAGE_COUNT - 1)
print("====== DISCOVERED REPOS ======")
print(log_repo_list())
# Tell the user the total number of returned results
print("\nFound %s results on Github." % count)
else:
# Github API token is missing, return an error
print("[!] Github API token is missing!")
print("> Please fill in the GITHUB_API_TOKEN variable before continuing.")
sys.exit(0)
except Exception as e:
print(e)
# Results exceeded the return limit of 100 per page, enter loop to allow
# user to go to the next page of results
while True:
if results_count >= 100:
next_page_select = input("\nThere are more results to display, go to next page? (y/n) > ")
if next_page_select == "y" or next_page_select == "Y":
try:
# User has chosen to see next page of results, increment PAGE_COUNT
PAGE_COUNT += 1
# Make query for next page of 100 results
count, results = github_search(inform_keyword, "100", str(PAGE_COUNT))
github_results = [count, results]
# Output results of search to user
print(output(github_results, PAGE_COUNT - 1))
results_log += output(github_results, PAGE_COUNT - 1)
# Decrement remaining results by 100
results_count -= 100
print(log_repo_list())
print("\nResult count is now at %s" % str(results_count))
except Exception as e:
print(e)
else:
# User does not want to see more results, break loop
break
else:
# Break out of the loop
break
# Check if user provided confirmation keywords
if confirm_keywords != "" and results_count != 0:
try:
# Ask user if they would like to perform analysis on returned results
perform_analysis_select = input("\nWould you like to perform a confidentiality level analysis on the repositories found? (y/n) > ")
if perform_analysis_select == "y" or perform_analysis_select == "Y":
# Perform an analysis of how confident Gitformant is of repo confidentiality
analysis_result = informant_analysis(repos, confirm_keywords)
exit_and_log(results_log, log_repo_list(), analysis_result, inform_keyword, confirm_keywords)
else:
exit_and_log(results_log, log_repo_list(), "", inform_keyword, confirm_keywords)
except Exception as e:
print(e)
# Otherwise, just exit and ask for log output
else:
exit_and_log(results_log, log_repo_list(), "", inform_keyword)
def exit_and_log(results_log_output, repo_list_results, informant_analysis_results="", inform_keyword="", confirm_keywords=""):
if len(repo_list_results) != 0:
log_select = input("\nWould you like to log results before exiting? (y/n) > ")
if log_select == "y":