Last active
October 31, 2023 19:45
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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