Skip to content

Instantly share code, notes, and snippets.

@LoranKloeze
Last active October 31, 2023 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save LoranKloeze/5b39bb852452816fbd4a373065934849 to your computer and use it in GitHub Desktop.
Save LoranKloeze/5b39bb852452816fbd4a373065934849 to your computer and use it in GitHub Desktop.
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