Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script that fetches and tweets the current balance of #petya ransomware bitcoin wallet
# Copyright Loran Kloeze
# License: MIT
# 27-06-2017
require 'nokogiri'
require 'open-uri'
require 'twitter'
require 'json'
while true do
btc = JSON.parse(open("http://api2.coindesk.com/headerchart/history?currency=BTC").read)
stock_price = btc['d'].last.to_f
client = Twitter::REST::Client.new do |config|
config.consumer_key = "XXXXXXXXXXXXXXXXX"
config.consumer_secret = "XXXXXXXXXXXXXXXXX"
config.access_token = "XXXXXXXXXXXXXXXXX"
config.access_token_secret = "XXXXXXXXXXXXXXXXX"
end
doc = Nokogiri::HTML(open("https://blockchain.info/address/1Mz7153HMuxXTuR2R1t78mGSdzaAtNbBWX"))
total_received = doc.css('#total_received > font > span')[0].text
final_balance = doc.css('#final_balance > font > span')[0].text
total_dollars = (total_received.to_f * stock_price).to_i.to_s
date = Time.now.strftime("%d/%m %H:%M CEST")
tweet = "#{date}: The new #goldeneye/#petya ransomware bitcoinwallet has received a total amount of #{total_received}, that's +/- $ #{total_dollars}"
print "Sending #{tweet}\n"
client.update(tweet)
sleep 600
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.