from optparse import OptionParser from src.oracle import oracle from src.user import user def main(): parser = OptionParser() parser.add_option("-o", "--oracle", action="store_true", dest="oracle", default=False, help="if true -> orcle will be run") parser.add_option("-u", "--user", action="store_true", dest="user", default=False, help="if true -> user will be run") parser.add_option("-s", "--server", dest="server", default="127.0.0.1", help="destination Server for feed data to Oracles") parser.add_option("-d", "--data", dest="data", default="", help="Data to send to destination server for response") parser.add_option("-b", "--broadcast", dest="broadcast", default="255.255.255.255", help="Broad cast IP") parser.add_option("-p", "--broadcast-port", dest="broadcastPort", default=6666, help="Broad cast Port") # parser.add_option("-h", "--help",action="store_true", dest="help", default=False) (options, args) = parser.parse_args() if len(args) >= 1 or options.oracle + options.user != 1: print("\n\n\tWhat do you want to run? Oracle or User? \n\n\tplease use -o OR -u. \n\n\tFor more Info you can use -h or --help or i can do it for you\n \n\t~~~ GOOD LUCK :) ~~~\n") parser.print_help() return if(options.oracle): oracle.run(broadcast=options.broadcast, broadcastPort=options.broadcastPort) if(options.user): user.run(data=options.data, server=options.server, broadcast=options.broadcast, broadcastPort=options.broadcastPort) if __name__ == '__main__': main()