@albin and anyone else who wants to claim their Bitcoin Gold and avoid the malware:
I just pushed a fork of Vitalik's excellent pybitcointools (actually a fork of the bitcoincash fork by Conio), with a script included to claim the Bitcoin gold.
The code is here, in the bitcoingold branch:
https://github.com/awemany/pybitcointools/tree/bitcoingold
Extremely brief docs:
In addition to the trivial changes to support BTG instead of BCH transaction signing (setting the FORK_ID to 79 and tx version to 2, though the latter is likely not even necessary), three scripts are included:
"claimgold.py": This script will build a one-input to one-output transaction from a former BTC P2PKH input (which is now a BTG output) to another BTG output.
The idea is to move the funds away using a transaction signed offline, and move them into any online wallet that can then be used for further conversion of the BTG. I used coinomi on an android emulator.
The script requires a bit of manual work of pulling out the outpoint of a P2PKH output by using the blockchain.info explorer or your own, txindexed bitcoind. It further takes the output number, transaction id, private key for signing the script and will then output a hex transaction script for BTG on stdout.
This script "goldclaim.py" is the dangerous one and needs to be reviewed carefully. I have also added a test of the ecdsa_raw_sign functionality in Vitalik's library using old test vectors that floated around on BCT. As it is signing deterministically, I hope I am on the safe side there.
Furthermore, there is a "goldaddrconv.py" to convert between BTG, BCH/BTC and regtest addresses (for example, if you use a regtest bitcoind to call decoderawtransaction on the BTG transaction (any bitcoind works, Core/Cash, doesn't really matter) to doublecheck it.)
Finally, there is "injector.py" which speaks just barely enough of the bitcoind protocol directly so that you can inject a transaction into the BTG network. This script should be
universal enough to be used for BCH/BTC as well (after changing the magic bytes), so maybe it is of further use, too.
Of course, the usual disclaimer applies: I do not take responsibility for loss of funds or anything else that might happen if you use that code. The code has neither been reviewed nor thoroughly tested yet!
Given the nature of python imports, you should be able to use the scripts out of the box - without any further installation of the tweaked bitcointools. You should also make sure that no other version of pybitcointools will be used/imported by/available to the goldclaim.py script, to not accidentally sign BTC transactions!
(A bitcoind's decoderawtransaction should indicate SIGHASH_FORKID in the scriptsig by having byte 0x41 as the last byte of the first part, and one should check at least this. But moving BTC and BCH funds away from that address before using the above claimgold.py script is a good idea in any case.)