main.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env python
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2015 Philemon <mmgen-py@yandex.com>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. """
  19. main.py - Script launcher for the MMGen suite
  20. """
  21. def launch(what):
  22. def launch_addrgen(): import mmgen.main_addrgen
  23. def launch_addrimport(): import mmgen.main_addrimport
  24. def launch_keygen(): import mmgen.main_addrgen
  25. def launch_passchg(): import mmgen.main_passchg
  26. def launch_pywallet(): import mmgen.main_pywallet
  27. def launch_tool(): import mmgen.main_tool
  28. def launch_txcreate(): import mmgen.main_txcreate
  29. def launch_txsend(): import mmgen.main_txsend
  30. def launch_txsign(): import mmgen.main_txsign
  31. def launch_walletchk(): import mmgen.main_walletchk
  32. def launch_walletconv(): import mmgen.main_walletconv
  33. def launch_walletgen(): import mmgen.main_walletgen
  34. try: import termios
  35. except: locals()["launch_"+what]() # Windows
  36. else:
  37. import sys,atexit
  38. fd = sys.stdin.fileno()
  39. old = termios.tcgetattr(fd)
  40. def at_exit():
  41. termios.tcsetattr(fd, termios.TCSADRAIN, old)
  42. atexit.register(at_exit)
  43. try: locals()["launch_"+what]()
  44. except KeyboardInterrupt:
  45. sys.stderr.write("\nUser interrupt\n")
  46. except EOFError:
  47. sys.stderr.write("\nEnd of file\n")