def _mktx(self, outputs, fee = None, change_addr = None, domain = None): for to_address, amount in outputs: if not is_valid(to_address): raise Exception("Invalid Litecoin address", to_address) if change_addr: if not is_valid(change_addr): raise Exception("Invalid Litecoin address", change_addr) if domain is not None: for addr in domain: if not is_valid(addr): raise Exception("invalid Litecoin address", addr) if not self.wallet.is_mine(addr): raise Exception("address not in wallet", addr) for k, v in self.wallet.labels.items(): if change_addr and v == change_addr: change_addr = k final_outputs = [] for to_address, amount in outputs: for k, v in self.wallet.labels.items(): if v == to_address: to_address = k print_msg("alias", to_address) break amount = int(100000000*amount) final_outputs.append(('address', to_address, amount)) if fee: fee = int(100000000*fee) return self.wallet.mktx(final_outputs, self.password, fee , change_addr, domain)
def _mktx(self, outputs, fee=None, change_addr=None, domain=None): for to_address, amount in outputs: if not is_valid(to_address): raise Exception("Invalid Creditbit address", to_address) if change_addr: if not is_valid(change_addr): raise Exception("Invalid Creditbit address", change_addr) if domain is not None: for addr in domain: if not is_valid(addr): raise Exception("invalid Creditbit address", addr) if not self.wallet.is_mine(addr): raise Exception("address not in wallet", addr) for k, v in self.wallet.labels.items(): if change_addr and v == change_addr: change_addr = k final_outputs = [] for to_address, amount in outputs: for k, v in self.wallet.labels.items(): if v == to_address: to_address = k print_msg("alias", to_address) break amount = int(1000000 * amount) final_outputs.append(('address', to_address, amount)) if fee is not None: fee = int(1000000 * fee) return self.wallet.mktx(final_outputs, self.password, fee, change_addr, domain)
def maybe_search_redirect(search): search = search.strip() if Domain.is_onion_url(search): parsedurl = urlparse.urlparse(search) search = parsedurl.hostname if search != "": if re.match('.*\.onion$', search): return redirect(url_for("onion_info",onion=search), code=302) elif re.match(email_util.REGEX_ALL, search): return redirect(url_for("email_list",addr=search), code=302) elif bitcoin.is_valid(search): return redirect(url_for("bitcoin_list",addr=search), code=302) return None
def extract_other(self, page, body): self.log("extract_other") page.emails.clear() self.log("find_emails") for addr in re.findall(email_util.REGEX, body): addr = addr.lower() self.log("found email %s" % addr) email = Email.get(address=addr) if not email: email = Email(address=addr) page.emails.add(email) page.bitcoin_addresses.clear() self.log("find_bitcoin") for addr in re.findall(bitcoin.REGEX, body): self.log("testing address %s" % addr) if not bitcoin.is_valid(addr): continue bitcoin_addr = BitcoinAddress.get(address=addr) if not bitcoin_addr: bitcoin_addr = BitcoinAddress(address=addr) page.bitcoin_addresses.add(bitcoin_addr)
def validateaddress(self, addr): isvalid = is_valid(addr) out = { 'isvalid':isvalid } if isvalid: out['address'] = addr return out
def validateaddress(self, addr): isvalid = is_valid(addr) out = {'isvalid': isvalid} if isvalid: out['address'] = addr return out
def validateaddress(self, address, above_chain=False): """Check that the address is valid. """ if above_chain: return is_valid(address) return is_valid(address, chainparams.get_active_chain())
def index(): result_limit = int(os.environ['RESULT_LIMIT']) max_result_limit = int(os.environ['MAX_RESULT_LIMIT']) now = datetime.now() context = dict() context["is_up"] = request.args.get("is_up") context["rep"] = request.args.get("rep") context["show_subdomains"] = request.args.get("show_subdomains") context["show_fh_default"] = request.args.get("show_fh_default") context["search"] = request.args.get("search") context["never_seen"] = request.args.get("never_seen") context["more"] = request.args.get("more") context["search_title_only"] = "on" if ( not is_elasticsearch_enabled() or request.args.get("search_title_only")) else None page = int(request.args.get("page", 1)) if page < 1: page = 1 if not context["search"]: context["search"] = "" context["search"] = context["search"].strip() context["search"] = banned.delete_banned(context["search"]) if not context["rep"]: context["rep"] = "n/a" sort = request.args.get("sort") context["sort"] = sort search = context["search"] if search != "": if re.match('.*\.onion$', search): return redirect(url_for("onion_info", onion=search), code=302) elif re.match(email_util.REGEX_ALL, search): return redirect(url_for("email_list", addr=search), code=302) elif bitcoin.is_valid(search): return redirect(url_for("bitcoin_list", addr=search), code=302) if context["search_title_only"] or search == "": query = build_domain_query(context, sort) orig_count = count(query) n_results = result_limit if orig_count > result_limit else orig_count query = query.page(page, result_limit) is_more = (orig_count > result_limit) return render_template('index_domains_only.html', domains=query, context=context, orig_count=orig_count, n_results=n_results, per_page=result_limit, page=page, sort=sort, is_more=is_more) results = elasticsearch_pages(context, sort, page) orig_count = results.hits.total n_results = result_limit if orig_count > result_limit else orig_count is_more = (orig_count > result_limit) domain_set_dict = dict() for hit in results.hits: domain_set_dict[hit.domain_id] = True domain_set = domain_set_dict.keys() domain_precache = select(d for d in Domain if d.id in domain_set) return render_template('index_fulltext.html', results=results, context=context, orig_count=orig_count, n_results=n_results, page=page, per_page=result_limit, sort=sort, is_more=is_more)
def validateaddress(self, addr): isvalid = is_valid(addr) out = {"isvalid": isvalid} if isvalid: out["address"] = addr return out