워너크라이가 벌어들인 비트코인을 확인하는 스크립트 소스코드

아래 소스 코드를 실행하면 워너크라이가 벌어들인 비트코인을 실시간으로 확인할 수 있다.

 

import urllib.request

import re

 

def main():

    #Place addresses in this array.

    address = [ "12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw",

                "115p7UMMngoj1pMvkpHijcRdfJNXj6LrLn",

                "13AM4VW2dhxYgXeQepoHkHSQuy6NgaEb94"]

 

    #Defines empty variable to calculate total.

    totalBTC=0

    #Prints the amount of addresses loaded.

    print(str(len(address)) + " addresses loaded (using coinbase for pricing)\n")

    #Grabs coinbase webpage for BTC to USD price.

    with urllib.request.urlopen('https://www.coinbase.com/charts') as response:

        #Decodes to readable HTML.

        html = str(response.read(), "utf-8")

        #Uses regular expression to grab BTC worth from source code.

        USD = float(re.search(r"(?<=<span>Bitcoin</span>\n<span class='charts-currency-price'>\n<span class='charts-middot'>·</span>\n<span>\$).*?(?= USD</span>)", html).group(0).replace(",",""))

 

    #For every address.

    for i in range(len(address)):

        #Grab blockchain webpage for the current address.

        with urllib.request.urlopen('https://blockchain.info/address/' + address[i]) as response:

            #Decodes to readable HTML.

            html = str(response.read(), "utf-8")

            #Uses regular expression to grab the total received BTC from the source code.

            BTC = float(re.search(r'(?<=<td id="total_received"><font color="green"><span data-c=").*?(?= BTC</span>)', html).group(0).split(">")[1])

            #Uses regular expression to grab the transaction amount from the source code.

            transactions = re.search(r'(?<=<td id="n_transactions">).*?(?=</td>)', html).group(0)

            #Prints the address.

            print("\033[95m\033[1mAddress\033[0m: \033[3m" + address[i] + "\033[0m")

            #Prints the amount of transactions.

            print("\033[95mTransactions\033[0m: " + transactions)

            #Prints the BTC receieved.

            print("\033[95mBTC received\033[0m: \033[94m" + str(BTC) + " BTC\033[0m")

            #Prints the USD received.

            print("\033[95mUSD received\033[0m: \033[92m" + format(int(BTC * USD), ',f').split(".")[0] + " USD\033[0m\n")

            #Increments totalBTC by the address BTC.

            totalBTC += BTC

 

    #Prints the total BTC receieved.

    print("\033[95m\033[1mTotal BTC received\033[0m: \033[94m" + str(totalBTC) + " BTC\033[0m")

    #Prints the total USD receieved.

    print("\033[95m\033[1mTotal USD received\033[0m: \033[92m" + format(int(totalBTC * USD), ',f').split(".")[0] + " USD\033[0m")

 

main()
0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오톡으로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기

잡담게시판

번호 제목 글쓴이 날짜 조회수
4 오랜만이네요... +1 캇수경력 07-09 104
3 워너크라이가 벌어들인 비트코인을 확인하는 스크립트 소스코드 캇수경력 05-17 160
2 카카오TV 조용하네 캇레이디캇 05-11 153
1 오늘 투표소를 가야합니다... 캇레이디캇 05-09 103