Ejemplo n.º 1
0
def home():
    """
    Main page
    :return:
    """
    if my_wlan0_ip() not in request.url_root and my_eth0_ip() not in request.url_root:
        return redirect("http://" + my_wlan0_ip())
        
    ip_address = request.remote_addr
    arp_address = read_arp_table()[ip_address]
    q = sessiondb.get_key(ip_address, arp_address)
    if not q:
        k = addrgen.gen_eckey()
        log.debug(k)
        if shortcuts["no_ssl"]:
            adds = ["abcdefg","1234567"]
        else:
            adds = addrgen.get_addr(k)
        sessiondb.create_key(pub_key=adds[0], priv_key=adds[1], ip_address=ip_address, mac_address=arp_address)
        bitcoin_address = adds[0]
    else:
        logging.debug("Found an entry", q)
        bitcoin_address = q.pub_key

    payment_options = sessiondb.get_prices()

    return render_template('index.html', ip=ip_address, arp=arp_address, bitcoinaddress=bitcoin_address, paymentoptions=payment_options)
Ejemplo n.º 2
0
def home():
    """
    Main page
    :return:
    """
    if my_wlan0_ip() not in request.url_root and my_eth0_ip(
    ) not in request.url_root:
        return redirect("http://" + my_wlan0_ip())

    ip_address = request.remote_addr
    arp_address = read_arp_table()[ip_address]
    q = sessiondb.get_key(ip_address, arp_address)
    if not q:
        k = addrgen.gen_eckey()
        log.debug(k)
        if shortcuts["no_ssl"]:
            adds = ["abcdefg", "1234567"]
        else:
            adds = addrgen.get_addr(k)
        sessiondb.create_key(pub_key=adds[0],
                             priv_key=adds[1],
                             ip_address=ip_address,
                             mac_address=arp_address)
        bitcoin_address = adds[0]
    else:
        logging.debug("Found an entry", q)
        bitcoin_address = q.pub_key

    payment_options = sessiondb.get_prices()

    return render_template('index.html',
                           ip=ip_address,
                           arp=arp_address,
                           bitcoinaddress=bitcoin_address,
                           paymentoptions=payment_options)
Ejemplo n.º 3
0
 def keygen_doge(self):
     manager_x = manager_c.begin_transaction()
     webserver_x = webserver_c.begin_transaction()
     for i in range (0, 5):
         addr = get_addr(113)
         print addr
         manager_x.put('dogecoin_keypairs', addr[0], {'priv_key': addr[1]})
         webserver_x.put('dogecoin_addresses', addr[0], {'pub_key_foo': addr[0]})
     manager_x.commit()
     webserver_x.commit()
     print 'Generated 5 keys'        
Ejemplo n.º 4
0
 def keygen_doge(self):
     manager_x = manager_c.begin_transaction()
     webserver_x = webserver_c.begin_transaction()
     for i in range(0, 5):
         addr = get_addr(113)
         print addr
         manager_x.put('dogecoin_keypairs', addr[0], {'priv_key': addr[1]})
         webserver_x.put('dogecoin_addresses', addr[0],
                         {'pub_key_foo': addr[0]})
     manager_x.commit()
     webserver_x.commit()
     print 'Generated 5 keys'
Ejemplo n.º 5
0
    def generate_new_btc_keys(self):
        import addrgen
        num = self.num_of_keys_spinner.get_value()
        keys = []
        for i in range(int(num)):
            keys.append(addrgen.gen_eckey(compressed=False))

        addrs = []
        for i in keys:
            addrs.append(addrgen.get_addr(i))
            print "Added address: %s" % addrs[-1][0]

        return addrs
Ejemplo n.º 6
0
    def generate_new_btc_keys(self):
        import addrgen
        num = self.num_of_keys_spinner.get_value()
        keys = []
        for i in range(int(num)):
            keys.append(addrgen.gen_eckey(compressed=False))

        addrs = []
        for i in keys:
            addrs.append(addrgen.get_addr(i))
            print "Added address: %s"%addrs[-1][0]

        return addrs
Ejemplo n.º 7
0
def home():
    if my_wlan0_ip() not in request.url_root and my_eth0_ip() not in request.url_root:
        return redirect("http://" + my_wlan0_ip())
        
    ip_address = request.remote_addr
    arp_address = read_arp_table()[ip_address]
    q = sessiondb.get_key(ip_address, arp_address)
    if not q:
        k = addrgen.gen_eckey()
        log.debug(k)
        adds = addrgen.get_addr(k)
        sessiondb.create_key(pub_key=adds[0], priv_key=adds[1], ip_address=ip_address, mac_address=arp_address)
        bitcoin_address = adds[0]
    if q:
        logging.debug("Found an entry", q)
        bitcoin_address = q.pub_key

    return render_template('home.html', ip=ip_address, arp=arp_address, bitcoinaddress=bitcoin_address, paymentoptions=payment_options)
Ejemplo n.º 8
0
def home():
    if my_wlan0_ip() not in request.url_root and my_eth0_ip() not in request.url_root:
        return redirect("http://" + my_wlan0_ip())
        
    ip_address = request.remote_addr
    arp_address = read_arp_table()[ip_address]
    q = session.query(Key).filter(Key.ip_address == ip_address).filter(Key.mac_address == arp_address).first()
    if not q:
        k = addrgen.gen_eckey()
        print k
        adds = addrgen.get_addr(k)
        key = Key(pub_key = adds[0], priv_key=adds[1], ip_address = ip_address, mac_address = arp_address)
        bitcoin_address = adds[0]
        print key
        session.add(key)
        session.commit()
        print key
    if q:
        logging.debug("Found an entry", q)
        bitcoin_address = q.pub_key

    ## lookup ip / arp

    return render_template('home.html',ip=ip_address,arp=arp_address,bitcoinaddress=bitcoin_address, paymentoptions=payment_options)
Ejemplo n.º 9
0
def gen():

	eckey = addrgen.gen_eckey(compressed=True, version = 0)
	pubkey, secretkey, address = addrgen.get_addr(eckey, version = 0)
	return [pubkey, secretkey, address]