main.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from optparse import OptionParser
  2. from oracle.oracle import Oracle
  3. from user.user import User
  4. from command import install,comp,compCrypto
  5. import os
  6. def main():
  7. os.system("clear")
  8. parser = OptionParser()
  9. parser.add_option("-i", "--installation", action="store_true", dest="installation", default=False, help="installation")
  10. parser.add_option("-o", "--oracle", action="store_true", dest="oracle", default=False, help="if true -> orcle will be run")
  11. parser.add_option("-u", "--user", action="store_true", dest="user", default=False, help="if true -> user will be run")
  12. parser.add_option("-s", "--server", dest="server", default="127.0.0.1", help="destination Server for feed data to Oracles")
  13. parser.add_option("-d", "--data", dest="data", default="", help="Data to send to destination server for response")
  14. parser.add_option("-b", "--broadcast", dest="broadcast", default="255.255.255.255", help="Broad cast IP")
  15. parser.add_option("-p", "--broadcast-port", dest="broadcastPort", default=6666, help="Broad cast Port")
  16. parser.add_option("-c", "--compile", dest="compile", help="file compile")
  17. parser.add_option("-t", "--tls", dest="tls", help="Crypto compile")
  18. # parser.add_option("-h", "--help",action="store_true", dest="help", default=False)
  19. (options, args) = parser.parse_args()
  20. if len(args) >= 1 or (options.oracle + options.user != 1 and not options.installation and not options.compile):
  21. 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")
  22. parser.print_help()
  23. return
  24. if(options.compile):
  25. comp(options.compile)
  26. if(options.tls):
  27. compCrypto(options.tls)
  28. if(options.installation):
  29. install()
  30. if(options.oracle):
  31. Oracle(broadcast=options.broadcast, broadcastPort=options.broadcastPort)
  32. if(options.user):
  33. User(data=options.data, server=options.server, broadcast=options.broadcast, broadcastPort=options.broadcastPort).run()
  34. if __name__ == '__main__':
  35. main()