From c2675c15ed3394957a7ee32c13e1a89c8973a291 Mon Sep 17 00:00:00 2001 From: MMGen Date: Sat, 17 Nov 2018 20:34:04 +0000 Subject: [PATCH] py3port: headers --- mmgen/addr.py | 1 - mmgen/altcoins/eth/contract.py | 1 - mmgen/altcoins/eth/obj.py | 1 - mmgen/altcoins/eth/tw.py | 1 - mmgen/altcoins/eth/tx.py | 1 - mmgen/common.py | 1 - mmgen/ed25519ll_djbec.py | 4 ++++ mmgen/exception.py | 1 - mmgen/obj.py | 1 - mmgen/opts.py | 1 - mmgen/protocol.py | 2 +- mmgen/seed.py | 1 - mmgen/share/Opts.py | 6 ++--- mmgen/tool.py | 1 - mmgen/tx.py | 1 - scripts/bitcoind-walletunlock.py | 40 -------------------------------- scripts/create-token.py | 16 +++++++++++++ scripts/txsign-eval-exploit.diff | 22 +++++++++++++++--- test/mmgen_pexpect.py | 2 +- test/objtest.py | 1 - test/sha256test.py | 17 +++++++++++++- test/test.py | 2 +- 22 files changed, 61 insertions(+), 63 deletions(-) delete mode 100755 scripts/bitcoind-walletunlock.py diff --git a/mmgen/addr.py b/mmgen/addr.py index fce78ac0..994e34e3 100755 --- a/mmgen/addr.py +++ b/mmgen/addr.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/altcoins/eth/contract.py b/mmgen/altcoins/eth/contract.py index 190683c2..1972c0c4 100755 --- a/mmgen/altcoins/eth/contract.py +++ b/mmgen/altcoins/eth/contract.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/altcoins/eth/obj.py b/mmgen/altcoins/eth/obj.py index 90bae64d..434d377c 100755 --- a/mmgen/altcoins/eth/obj.py +++ b/mmgen/altcoins/eth/obj.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/altcoins/eth/tw.py b/mmgen/altcoins/eth/tw.py index 7fd9ff34..bd5b84fc 100755 --- a/mmgen/altcoins/eth/tw.py +++ b/mmgen/altcoins/eth/tw.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/altcoins/eth/tx.py b/mmgen/altcoins/eth/tx.py index 3e9468b7..6a827447 100755 --- a/mmgen/altcoins/eth/tx.py +++ b/mmgen/altcoins/eth/tx.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/common.py b/mmgen/common.py index 0a104a7e..8eef7750 100755 --- a/mmgen/common.py +++ b/mmgen/common.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/ed25519ll_djbec.py b/mmgen/ed25519ll_djbec.py index adbda67f..7594041b 100644 --- a/mmgen/ed25519ll_djbec.py +++ b/mmgen/ed25519ll_djbec.py @@ -1,3 +1,7 @@ +#!/usr/bin/env python3 +# +# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution +# # Ported to Python 3 (added floor division) from ed25519ll package: # https://pypi.org/project/ed25519ll/ # This module is adapted from that package's pure-Python fallback diff --git a/mmgen/exception.py b/mmgen/exception.py index 5b445c71..c3e74e81 100755 --- a/mmgen/exception.py +++ b/mmgen/exception.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/obj.py b/mmgen/obj.py index cd5c3ddd..e8df9a98 100755 --- a/mmgen/obj.py +++ b/mmgen/obj.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/opts.py b/mmgen/opts.py index 3ad141f2..c28e14ce 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/protocol.py b/mmgen/protocol.py index 9800fccf..b7183047 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# MMGen = Multi-Mode GENerator, command-line Bitcoin cold storage solution +# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project # # This program is free software: you can redistribute it and/or modify diff --git a/mmgen/seed.py b/mmgen/seed.py index 32e90811..ff14cd37 100755 --- a/mmgen/seed.py +++ b/mmgen/seed.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/share/Opts.py b/mmgen/share/Opts.py index 5d3b732c..d708218f 100755 --- a/mmgen/share/Opts.py +++ b/mmgen/share/Opts.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -# Opts.py, an options parsing library for Python. Copyright (C) 2014-2016 -# Philemon . +# Opts.py, an options parsing library for Python. +# Copyright (C)2013-2018 The MMGen Project # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ # along with this program. If not, see . """ -Opts.py: Generic options handling +Opts.py: Generic options parsing """ import sys,getopt diff --git a/mmgen/tool.py b/mmgen/tool.py index 543dedb6..6518c52f 100755 --- a/mmgen/tool.py +++ b/mmgen/tool.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/mmgen/tx.py b/mmgen/tx.py index 517a239c..026fffbd 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/scripts/bitcoind-walletunlock.py b/scripts/bitcoind-walletunlock.py deleted file mode 100755 index 3a6f67e8..00000000 --- a/scripts/bitcoind-walletunlock.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -# -# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution -# Copyright (C) 2013 by philemon -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -""" -bitcoind-walletunlock.py: Unlock a Bitcoin wallet securely -""" - -import sys,getpass -from mmgen.common import * - -opts_data = { - 'prog_name': sys.argv[0].split('/')[-1], - 'desc': "Unlock a Bitcoin wallet securely", - 'usage': "[opts]", - 'options': """ --h, --help Print this help message --e, --echo-passphrase Print passphrase to screen when typing it ---, --testnet Use testnet instead of mainnet -""" -} - -cmd_args = opts.init(opts_data) - -password = (getpass.getpass,raw_input)[bool(opt.echo_passphrase)]('Enter passphrase: ') - -bitcoin_connection().walletpassphrase(password, 9999); msg('OK') diff --git a/scripts/create-token.py b/scripts/create-token.py index f8bc6843..a4e085e4 100755 --- a/scripts/create-token.py +++ b/scripts/create-token.py @@ -1,4 +1,20 @@ #!/usr/bin/env python3 +# +# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution +# Copyright (C)2013-2018 The MMGen Project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import sys,os,json from subprocess import Popen,PIPE diff --git a/scripts/txsign-eval-exploit.diff b/scripts/txsign-eval-exploit.diff index 76fbf300..c3a229b8 100644 --- a/scripts/txsign-eval-exploit.diff +++ b/scripts/txsign-eval-exploit.diff @@ -1,6 +1,22 @@ -# Implements the exploit that allowed a compromised MMGen on an online machine -# to fool an offline signing MMGen into passing the user's seed back to the -# online machine via a specially crafted transaction +# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution +# Copyright (C)2013-2018 The MMGen Project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This patch implements the exploit that allowed a compromised MMGen on an +# online machine to fool an offline signing MMGen into passing the user's seed +# back to the online machine via a specially crafted transaction # The seed is split in two and passed via the the input and output transaction # comments diff --git a/test/mmgen_pexpect.py b/test/mmgen_pexpect.py index 34da1f05..dc85e0af 100755 --- a/test/mmgen_pexpect.py +++ b/test/mmgen_pexpect.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- +# # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project # diff --git a/test/objtest.py b/test/objtest.py index 19dd6ff4..da680c25 100755 --- a/test/objtest.py +++ b/test/objtest.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project diff --git a/test/sha256test.py b/test/sha256test.py index 83a644fa..206be401 100755 --- a/test/sha256test.py +++ b/test/sha256test.py @@ -1,5 +1,20 @@ #!/usr/bin/env python3 - +# +# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution +# Copyright (C)2013-2018 The MMGen Project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import sys,os,hashlib from binascii import hexlify diff --git a/test/test.py b/test/test.py index 8846dabd..9529e065 100755 --- a/test/test.py +++ b/test/test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# -*- coding: UTF-8 -*- +# # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2018 The MMGen Project #