def search_corresponding_transaction(currency, tx_hash, exchange_id):
    for attempt in range(5):
        try:
            if currency == "ETH":
                transaction = requests.get("https://etherchain.org/api/tx/" +
                                           str(tx_hash)).json()["data"][0]
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (transaction["time"].replace("T", " ")[:-5],
                     (transaction["gasUsed"] *
                      (transaction["price"] / 1E+18)), exchange_id))
            elif currency == "BTC":
                transaction = requests.get("https://chain.so/api/v2/tx/BTC/" +
                                           str(tx_hash)).json()["data"]
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (datetime.datetime.utcfromtimestamp(
                        transaction["time"]).strftime('%Y-%m-%d %H:%M:%S'),
                     transaction["fee"], exchange_id))
            elif currency == "LTC":
                transaction = requests.get("https://chain.so/api/v2/tx/LTC/" +
                                           str(tx_hash)).json()["data"]
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (datetime.datetime.utcfromtimestamp(
                        transaction["time"]).strftime('%Y-%m-%d %H:%M:%S'),
                     transaction["fee"], exchange_id))
            Database_manager.db.commit()
        except:
            Tor.change_ip()
        else:
            break
    else:
        search_corresponding_transaction2(currency, tx_hash, exchange_id)
Beispiel #2
0
def get_fees_shapeshift():
    """ Returns the Shapeshift fees for all currency pairs """
    Tor.change_ip()
    for attempt in range(5):
        try:
            fees = requests.get("https://shapeshift.io/marketinfo/").json()
        except:
            print("Wait 5 sec")
            time.sleep(5)
            Tor.change_ip()
        else:
            return fees
    else:
        traceback.print_exc()
        print("Couldn't get fees from Shapeshift")
        return None
Beispiel #3
0
def get_exchanges_shapeshift():
    """ Returns the recent 50 Shapeshift exchanges """
    Tor.change_ip()
    for attempt in range(5):
        try:
            exchanges = requests.get(
                "https://shapeshift.io/recenttx/50").json()
        except:
            print("Wait 5 sec")
            time.sleep(5)
            Tor.change_ip()
        else:
            return exchanges
    else:
        traceback.print_exc()
        print("Couldn't get exchanges from Shapeshift")
        return None
def search_corresponding_transaction2(currency, tx_hash, exchange_id):
    for attempt in range(5):
        try:
            if currency == "ETH":
                transaction = requests.get(
                    "https://api.infura.io/v1/jsonrpc/mainnet/eth_getTransactionByHash?params=%5B%22"
                    + str(tx_hash) +
                    "%22%5D&token=Wh9YuEIhi7tqseXn8550").json()["result"]
                block = requests.get(
                    "https://api.infura.io/v1/jsonrpc/mainnet/eth_getBlockByNumber?params=%5B%22"
                    + str(transaction["blockNumber"]) +
                    "%22%2C%20true%5D&token=Wh9YuEIhi7tqseXn8550").json(
                    )["result"]
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (datetime.datetime.utcfromtimestamp(
                        int(block["timestamp"],
                            16)).strftime('%Y-%m-%d %H:%M:%S'),
                     int(transaction["gas"], 16) *
                     (int(transaction["gasPrice"], 16) / 1E+18), exchange_id))
            elif currency == "BTC":
                transaction = requests.get(
                    "https://api.blockcypher.com/v1/btc/main/txs/" +
                    str(tx_hash)).json()
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (transaction["received"].replace("T", " ")[:-5],
                     (transaction["fees"] / 100000000), exchange_id))
            elif currency == "LTC":
                transaction = requests.get(
                    "https://api.blockcypher.com/v1/ltc/main/txs/" +
                    str(tx_hash)).json()
                Database_manager.cur.execute(
                    "UPDATE exchanges SET  time_to = %s, fee_to = %s WHERE id = %s",
                    (transaction["received"].replace("T", " ")[:-5],
                     (transaction["fees"] / 100000000), exchange_id))
            Database_manager.db.commit()
        except:
            Tor.change_ip()
        else:
            break
    else:
        print("Counldn't get the corresponding Transaction for " +
              str(currency))
        traceback.print_exc()
Beispiel #5
0
def get_exchanger_name(address_from, address_to):
    """ Check if transaction is a Shapeshift transaction """
    Tor.change_ip()
    for attempt in range(5):
        try:
            exchange_details = requests.get("https://shapeshift.io/txStat/" +
                                            address_from).json()
        except:
            print("Wait a minute")
            time.sleep(60)
            Tor.change_ip()
        else:
            if exchange_details["status"] == "complete" and exchange_details[
                    "withdraw"] == address_to:
                return "Shapeshift"
            return "Unknown"
    else:
        traceback.print_exc()
        return None
 def get_value(self, transaction_time):
     """ Returns the value of a cryptocurrency for a given time in Dollar """
     transaction_timestamp = calendar.timegm(transaction_time.timetuple())
     if not self.currency_data or len(self.currency_data) == 1:
         Tor.change_ip()
         self.currency_data = self.h.histoHour(self.currency_from, self.currency_to, toTs=(transaction_timestamp + 60 * 60), limit=2000)["Data"][::-1]
     for data_set in list(self.currency_data):
         # Delete Data which is older than 1 hour
         if (transaction_timestamp - data_set["time"]) < -60*60:
             self.currency_data.remove(data_set)
             if not self.currency_data or len(self.currency_data) == 1:
                 return self.get_value(transaction_time)
         # Ignore Data which is older but still not older than 1 hour
         elif (transaction_timestamp - data_set["time"]) < 0:
             continue
         # Return rate if data set is in range of 1 hour
         elif (transaction_timestamp - data_set["time"]) <= 60*60:
             return max(data_set["low"], data_set["high"]) - abs(data_set["low"] - data_set["high"])/2
         else:
             print ("No currency rate data found for Exchange from " + self.currency_from + " to " + self.currency_to)
             return
Beispiel #7
0
 def get_transactions_for_address(self, start_block_nr, end_block_nr):
     """ Gets transactions involving Shapeshifts main address using the Etherscan API """
     Tor.change_ip()
     for attempt in range(5):
         try:
             transactions = requests.get("http://api.etherscan.io/api?module=account&"
                                         "action=txlist&" +
                                         "address=" + self.shapeshift_main_address_ETH +
                                         "&startblock=" + str(start_block_nr) +
                                         "&endblock=" + str(end_block_nr) +
                                         "&sort=desc" +
                                         "&apikey=" + self.etherscan_key).json()["result"]
         except:
             print ("Wait 5 sec")
             time.sleep(5)
             Tor.change_ip()
         else:
             return transactions
     else:
         traceback.print_exc()
         sys.exit("Couldn't get transactions from Etherscan")
def get_transactions_for_address(currency, address):
    """ Returns all transactions involving a given address for a given currency """
    Tor.change_ip()
    transactions = None
    for attempt in range(5):
        try:
            if currency == "ETH":
                transactions = requests.get("http://api.etherscan.io/api?module=account&"
                                            "action=txlist&" +
                                            "address=" + address +
                                            "&sort=desc" +
                                            "&apikey=" + "2BBQWBUF94KBKWQMASY3PBCGF7737FTK5N").json()["result"]
            elif currency == "BTC":
                transactions = requests.get("https://blockchain.info/de/rawaddr/" + address).json()["txs"]
        except:
            print ("Wait 5 sec")
            time.sleep(5)
            Tor.change_ip()
        else:
            return transactions
    else:
        traceback.print_exc()
        print("Couldn't get transactions from Etherscan")
def get_last_block_number(currency):
    """ Gets the most recent block number for the given currency """
    Tor.change_ip()
    for attempt in range(10):
        try:
            if currency == "BTC":
                last_block_number = requests.get("https://blockchain.info/de/latestblock").json()["height"]
            elif currency == "ETH":
                last_block_number = int(requests.get("https://api.infura.io/v1/jsonrpc/mainnet/eth_blockNumber?token=Wh9YuEIhi7tqseXn8550").json()["result"], 16)
            elif currency == "LTC":
                last_block_number = requests.get("https://chain.so/api/v2/get_info/LTC").json()["data"]["blocks"]
            else:
                print ("Couldn't get last number of block. Not such a currency: " + currency)
                return
        except:
            print ("Wait a minute. Loading block number for " + currency)
            time.sleep(60)
            Tor.change_ip()
        else:
            return last_block_number
    else:
        traceback.print_exc()
        sys.exit("Couldn't get last number of block for " + currency)
Beispiel #10
0
def get_exchange(address_from):
    """ Get exchange details from Shapeshift API by sending the deposit address """
    Tor.change_ip()
    for attempt in range(5):
        try:
            exchange_details = requests.get("https://shapeshift.io/txStat/" +
                                            address_from).json()
        except:
            print("Wait a minute")
            time.sleep(60)
            Tor.change_ip()
        else:
            return exchange_details
    else:
        traceback.print_exc()
        if address_from:
            print("Couldn't get transaction data from Shapeshift: " +
                  address_from)
        else:
            print(
                "Couldn't get transaction data from Shapeshift, no output address"
            )
        return None
Beispiel #11
0
def get_block_by_number(currency, number):
    """ Gets a block with the given block number for a given currency """
    Tor.change_ip()
    for attempt in range(5):
        try:
            if currency == "BTC":
                block = requests.get("https://blockchain.info/de/block-height/" + (str(number)) + "?format=json").json()["blocks"][0]
                block["tx"].sort(key=lambda x: datetime.datetime.utcfromtimestamp(x["time"]), reverse=True)
            elif currency == "ETH":
                block = requests.get("https://api.infura.io/v1/jsonrpc/mainnet/eth_getBlockByNumber?params=%5B%22" + hex(number) + "%22%2C%20true%5D&token=Wh9YuEIhi7tqseXn8550").json()["result"]
            elif currency == "LTC":
                block = requests.get("https://chain.so/api/v2/block/LTC/" + (str(number))).json()["data"]
            else:
                print ("Couldn't get block. Not such a currency: " + currency)
                return
        except:
            print ("Wait a minute. Loading block for " + currency)
            time.sleep(60)
            Tor.change_ip()
        else:
            return standardize(currency, block)
    else:
        traceback.print_exc()
        sys.exit("Counldn't get block for " + currency + ": " + str(number))
Beispiel #12
0
class baseController(controller.CementBaseController):

    imap = Imap.Imap()
    tor = Tor.Tor()

    class Meta:
        interface = controller.IController
        label = 'base'
        # config_defaults = defaults
        description = 'Email batch credential verifer'

        # default values
        config_defaults = dict(debug=False,
                               imap='True',
                               pop=False,
                               tor=False,
                               torport=7000,
                               delay='0.5')

        arguments = [
            # TODO Verify STMP
            (['-c', '--csv'],
             dict(action='store',
                  help='CSV file containing email login and password')),
            (['-o', '--output'],
             dict(action='store',
                  help='Output CSV file of successful logins')),
            (['-v',
              '--verbose'], dict(action='store_true', help='Verbose Output')),
            (['-p', '--pop'],
             dict(action='store_true',
                  help='force connection to POP3 (default: False)')),
            (['-i', '--imap'],
             dict(action='store_true',
                  help='force connection to IMAP (default: True)')),
            (['-d', '--delay'],
             dict(action='store',
                  help='Delay in seconds after login attempt (default: 0.5)')),
            (['-t', '--tor'],
             dict(action='store_true',
                  help='Connect to Tor? (default: False)')),
            (['-z', '--torport'],
             dict(action='store', help='Tor port (default: 7000)'))
        ]

        epilog = "Sample Usage: EmBat --csv ~/emails.csv -i -o ~/results.csv -t -z 7000"

    @controller.expose(hide=True, aliases=['run'])
    def default(self):
        if (self.app.pargs.csv):
            self.__parseCSV()

        return True

    # parses CSV file
    def __parseCSV(self):

        c = None
        cred = Credentials.Credentials()

        try:
            pprint(self.app.pargs)

            # if tor flag isset will attempt to connect
            if (self.app.pargs.tor):
                self.tor.connect(self.app.pargs.torport)

            lines = 0
            c = open(self.app.pargs.csv)
            ch = csv.reader(c)

            # lines = int(len(list(ch)))

            # if (self.app.pargs.verbose):
            # print("[!] Total Lines: %u" % lines)

            #default email/password columns
            emailCol = 0
            passwdCol = 1
            hasHeader = True

            # gets some basic info about file to properly parse file
            firstLineHeader = raw_input(
                "[?] Does the first row contain column titles? [Y/n]: ")

            if (firstLineHeader.upper() == 'N'):
                hasHeader = False
                lines -= 1

            emailCol = int(
                raw_input(
                    "[?] Enter column number of email login. 0 equals column A. [0]: "
                ) or emailCol)
            passwdCol = int(
                raw_input("[?] Enter column number of passwords [1]: ")
                or passwdCol)

            o = Output.Output()
            if (self.app.pargs.output is not None):
                # print("OUTPUT:" + self.app.pargs.output)
                oFile = o.createFile(self.app.pargs.output)

            for k, r in enumerate(ch):

                if (k == 0 and hasHeader == True):
                    if (self.app.pargs.verbose):
                        print("\n[!] Skipping header row")
                    continue

                email = cred.checkEmail(r[emailCol])
                pw = cred.checkPassword(r[passwdCol])

                if (email == False):
                    print("[-] Not a valid email address... skipping.")
                    continue

                if (pw == False):
                    print(Fore.RED + "[-] " + email +
                          ": Password is empty... skipping." +
                          Style.RESET_ALL + "\n")
                    continue

                print(Style.BRIGHT + "[" + str(k + 1) + "] Checking: " +
                      email + ":" + pw + Style.RESET_ALL)

                if (self.app.pargs.imap):
                    validImap = self.imap.checkAccount(email, pw)

                    if (validImap == True
                            and self.app.pargs.output is not None):
                        o.addRow(email, pw)

                    # if valid login and saving success result - will add csv row
                    if (self.app.pargs.pop):
                        print("POP not currently supported")

                # if delay is set
                # print('DELAY:' + self.app.pargs.delay)
                if float(self.app.pargs.delay or 0.5) > 0:
                    sleep(float(self.app.pargs.delay or 0.5))

        except ValueError:
            print(Style.BRIGHT + Fore.RED + "[-] Invalid input value: " +
                  str(e) + Style.RESET_ALL)
        except Exception as e:
            print(Style.BRIGHT + Fore.RED + "[-] Error parsing CSV File: " +
                  str(e) + Style.RESET_ALL)
            print traceback.format_exc()
        finally:
            c.close()

            # if tor flag is set, will disconnect before exiting
            if (self.app.pargs.tor):
                baseController.tor.disconnect()

        print("\n" + Style.BRIGHT + "[*] Finished. Exiting!" +
              Style.RESET_ALL + "\n")

        return True
Beispiel #13
0
def get_ethereum_transaction_infura(new_exchanges):
    # Take ETH exchanges only
    filtered_new__exchanges = [
        exchange for exchange in new_exchanges if "ETH" == exchange["curIn"]
    ]
    if filtered_new__exchanges:
        # Request last block number
        for attempt in range(10):
            try:
                last_block_number = int(
                    requests.get(
                        "https://api.infura.io/v1/jsonrpc/mainnet/eth_blockNumber?token=Wh9YuEIhi7tqseXn8550"
                    ).json()["result"], 16)
            except:
                Tor.change_ip()
            else:
                break
        else:
            print("Counldn't get last number of block from Infura")
            traceback.print_exc()
            return
        for number in range(60):
            # Get Block
            # print (str(last_block_number - number))
            Tor.change_ip()
            transactions = None

            for attempt in range(5):
                try:
                    block = requests.get(
                        "https://api.infura.io/v1/jsonrpc/mainnet/eth_getBlockByNumber?params=%5B%22"
                        + hex(last_block_number - number) +
                        "%22%2C%20true%5D&token=Wh9YuEIhi7tqseXn8550").json(
                        )["result"]
                    transactions = block["transactions"]
                except:
                    Tor.change_ip()
                else:
                    break
            else:
                print("Counldn't get block from Etherchain: " +
                      str(last_block_number - number))
                traceback.print_exc()
                pass

            if transactions:
                # Check if Block much older than Exchanges
                time_oldest_transaction = datetime.datetime.utcfromtimestamp(
                    filtered_new__exchanges[-1]["timestamp"])
                time_block = datetime.datetime.utcfromtimestamp(
                    int(block["timestamp"], 16))
                if ((time_oldest_transaction -
                     time_block)).total_seconds() > 180:
                    return

                for transaction in transactions:
                    for exchange in filtered_new__exchanges:
                        time_exchange = datetime.datetime.utcfromtimestamp(
                            exchange["timestamp"])
                        # BC1 Tx must happen before SS Tx (SS Tx Time is when money recieved)
                        if exchange["amount"] == int(
                                transaction["value"], 16) / 1E+18 and (
                                    (time_exchange -
                                     time_block)).total_seconds() > 0:
                            # Change Ip Address
                            Tor.change_ip()
                            exchange_details = requests.get(
                                "https://shapeshift.io/txStat/" +
                                transaction["to"]).json()
                            if exchange_details[
                                    "status"] == "complete" and exchange_details[
                                        "outgoingType"] == exchange["curOut"]:
                                # Update DB
                                try:
                                    Database_manager.cur.execute(
                                        "UPDATE exchanges SET amount_to = %s, fee_from = %s, address_from = %s, address_to = %s, hash_from = %s, hash_to = %s, time_from = %s WHERE id = %s",
                                        (exchange_details["outgoingCoin"],
                                         int(transaction["gas"], 16) *
                                         (int(transaction["gasPrice"], 16) /
                                          1E+18), exchange_details["address"],
                                         exchange_details["withdraw"],
                                         transaction["hash"],
                                         exchange_details["transaction"],
                                         time_block.strftime(
                                             '%Y-%m-%d %H:%M:%S'),
                                         exchange["id"]))
                                    Database_manager.db.commit()
                                    Corresponding_tx.search_corresponding_transaction(
                                        exchange_details["outgoingType"],
                                        exchange_details["transaction"],
                                        exchange["id"])
                                except:
                                    print(
                                        "Problem updating found Transaction for: "
                                        +
                                        str(exchange["curIn"] + " " +
                                            str(exchange_details["address"])))
                                    traceback.print_exc()
                                    Database_manager.db.rollback()

                                filtered_new__exchanges.remove(exchange)
                                # Quit search if no more new exchanges
                                if not filtered_new__exchanges:
                                    return
                                # Search in next transaction
                                break
Beispiel #14
0
def get_ethereum_transaction(new_exchanges):
    # Take ETH exchanges only
    filtered_new__exchanges = [
        exchange for exchange in new_exchanges if "ETH" == exchange["curIn"]
    ]
    if filtered_new__exchanges:
        # Request last block number
        for attempt in range(10):
            try:
                last_block_number = requests.get(
                    "https://etherchain.org/api/blocks/count").json(
                    )["data"][0]["count"]
            except:
                Tor.change_ip()
            else:
                break
        else:
            print("Counldn't get last number of block from Etherchain")
            traceback.print_exc()
            return filtered_new__exchanges

        for number in range(90):
            # Get Block
            # print (str(last_block_number - number))
            Tor.change_ip()
            transactions = None

            for attempt in range(5):
                try:
                    transactions = requests.get(
                        "https://etherchain.org/api/block/" +
                        (str(last_block_number - number)) +
                        "/tx").json()["data"]
                except:
                    Tor.change_ip()
                else:
                    break
            else:
                print("Counldn't get block from Etherchain: " +
                      str(last_block_number - number))
                traceback.print_exc()
                pass

            if transactions:
                # Check if Block much older than Exchanges
                time_oldest_transaction = datetime.datetime.utcfromtimestamp(
                    filtered_new__exchanges[-1]["timestamp"])
                time_block = datetime.datetime.strptime(
                    transactions[0]["time"].replace("T", " ")[:-5],
                    "%Y-%m-%d %H:%M:%S")
                if ((time_oldest_transaction -
                     time_block)).total_seconds() > 180:
                    return filtered_new__exchanges

                for transaction in transactions:
                    for exchange in filtered_new__exchanges:
                        time_exchange = datetime.datetime.utcfromtimestamp(
                            exchange["timestamp"])
                        # BC1 Tx must happen before SS Tx (SS Tx Time is when money recieved)
                        if exchange["amount"] == transaction[
                                "amount"] / 1E+18 and (
                                    (time_exchange -
                                     time_block)).total_seconds() > 0:
                            # Change Ip Address
                            Tor.change_ip()
                            exchange_details = requests.get(
                                "https://shapeshift.io/txStat/" +
                                transaction["recipient"]).json()
                            if exchange_details[
                                    "status"] == "complete" and exchange_details[
                                        "outgoingType"] == exchange["curOut"]:
                                # Update DB
                                try:
                                    Database_manager.cur.execute(
                                        "UPDATE exchanges SET amount_to=%s, fee_from=%s, address_from=%s, address_to=%s, hash_from=%s, hash_to=%s, time_from=%s, block_nr=%s WHERE id=%s",
                                        (exchange_details["outgoingCoin"],
                                         (transaction["gasUsed"] *
                                          (transaction["price"] / 1E+18)),
                                         exchange_details["address"],
                                         exchange_details["withdraw"],
                                         transaction["hash"],
                                         exchange_details["transaction"],
                                         transaction["time"].replace("T",
                                                                     " ")[:-5],
                                         (last_block_number -
                                          number), exchange["id"]))
                                    Database_manager.db.commit()
                                    Corresponding_tx.search_corresponding_transaction(
                                        exchange_details["outgoingType"],
                                        exchange_details["transaction"],
                                        exchange["id"])
                                except:
                                    print(
                                        "Problem updating found Transaction for: "
                                        +
                                        str(exchange["curIn"] + " " +
                                            str(exchange_details["address"])))
                                    traceback.print_exc()
                                    Database_manager.db.rollback()

                                # Not deleting, cause might to found with infura
                                #filtered_new__exchanges.remove(exchange)

                                # Quit search if no more new exchanges
                                if not filtered_new__exchanges:
                                    return filtered_new__exchanges
                                # Search in next transaction
                                break
    return filtered_new__exchanges
Beispiel #15
0
def get_litecoin_transaction(new_exchanges):
    # Take ETH exchanges only
    filtered_new__exchanges = [
        exchange for exchange in new_exchanges if "LTC" == exchange["curIn"]
    ]
    if filtered_new__exchanges:
        # Request last block number
        for attempt in range(5):
            try:
                last_block_number = requests.get(
                    "https://chain.so/api/v2/get_info/LTC").json(
                    )["data"]["blocks"]
            except:
                Tor.change_ip()
            else:
                break
        else:
            for attempt in range(5):
                try:
                    last_block_number = requests.get(
                        "https://api.blockcypher.com/v1/ltc/main").json(
                        )["height"]
                except:
                    Tor.change_ip()
                else:
                    break
            else:
                print("Counldn't get last number of block for LTC")
                traceback.print_exc()
                return filtered_new__exchanges

        for number in range(60):
            # Get Block
            #if (number%10 == 9):
            Tor.change_ip()
            for attempt in range(5):
                try:
                    block = requests.get("https://chain.so/api/v2/block/LTC/" +
                                         (str(last_block_number -
                                              number))).json()["data"]
                    transactions = block["txs"]
                except:
                    Tor.change_ip()
                else:
                    break
            else:
                print("Counldn't get block from Chain.so: " +
                      str(last_block_number - number))
                traceback.print_exc()
                return filtered_new__exchanges
                #pass

            if transactions:
                # Check if Block much older than Exchanges
                time_oldest_transaction = datetime.datetime.utcfromtimestamp(
                    filtered_new__exchanges[-1]["timestamp"])
                time_block = datetime.datetime.utcfromtimestamp(block["time"])
                if ((time_oldest_transaction -
                     time_block)).total_seconds() > 1200:
                    return filtered_new__exchanges

                for transaction in transactions:
                    for out in transaction["outputs"]:
                        for exchange in filtered_new__exchanges:
                            time_exchange = datetime.datetime.utcfromtimestamp(
                                exchange["timestamp"])
                            # BC1 Tx must happen before SS Tx (SS Tx Time is when money recieved)
                            if exchange["amount"] == float(out["value"]) and (
                                (time_exchange -
                                 time_block)).total_seconds() > -300:
                                # Change Ip Address
                                Tor.change_ip()
                                exchange_details = requests.get(
                                    "https://shapeshift.io/txStat/" +
                                    out["address"]).json()
                                if exchange_details[
                                        "status"] == "complete" and exchange_details[
                                            "outgoingType"] == exchange[
                                                "curOut"]:

                                    # Update DB
                                    try:
                                        Database_manager.cur.execute(
                                            "UPDATE exchanges SET  amount_to = %s, fee_from = %s, address_from = %s, address_to = %s, hash_from = %s, hash_to = %s, time_from = %s, block_nr = %s WHERE id = %s",
                                            (exchange_details["outgoingCoin"],
                                             transaction["fee"],
                                             exchange_details["address"],
                                             exchange_details["withdraw"],
                                             transaction["txid"],
                                             exchange_details["transaction"],
                                             time_block.strftime(
                                                 '%Y-%m-%d %H:%M:%S'),
                                             (last_block_number - number),
                                             exchange["id"]))
                                        Database_manager.db.commit()
                                        Corresponding_tx.search_corresponding_transaction(
                                            exchange_details["outgoingType"],
                                            exchange_details["transaction"],
                                            exchange["id"])
                                    except:
                                        print(
                                            "Problem updating found Transaction for: "
                                            +
                                            str(exchange["curIn"] + " " + str(
                                                exchange_details["address"])))
                                        traceback.print_exc()
                                        Database_manager.db.rollback()
                                    filtered_new__exchanges.remove(exchange)
                                    # Quit search if no more new exchanges
                                    if not filtered_new__exchanges:
                                        return filtered_new__exchanges
                                    # Search in next transaction
                                    break
    return filtered_new__exchanges