parser=argparse.ArgumentParser(description="Construct a graph file to visualize the relation between servers discovered by SSH-Snake.")
parser.add_argument("--file",help="Path to a file containing the output of SSH-Snake.")
parser.add_argument("--format",help="The format of the graph file to export. The options are gexf or dot.")
parser.add_argument("--with-users",action="store_true",help="Create nodes based on their 'user@host' instead of just 'host'. This setting is optional and not recommended.")
args=parser.parse_args()
ifnotany(vars(args).values()):
parser.print_help()
exit()
ifargs.formatnotin("gexf","dot"):
print("Valid options for --format are: gexf or dot")
print("Your dot file has been created in ./sshsnake_dot_file.dot.\n")
print("To convert your dot file to a png or svg, use the following command to sample different algorithms available from graphviz:\n")
print("for alg in sfdp fdp circo twopi neato dot; do\n\t$alg -Tpng -Gsplines=true -Gconcentrate=true -Gnodesep=0.1 -Goverlap=false SSHSnake_dot_file.dot -o $alg.png\ndone\n\n")
print("Alternatively, you can just paste the .dot file into https://dreampuf.github.io/GraphvizOnline/ -- if pasting that type of information into your browser is in your threat model...\n\n")
print("Try placing splines=true; concentrate=true; nodesep=0.1; overlap=false; in the file just after the first line, too!")