closer to working

This commit is contained in:
James Tomasino 2022-02-20 22:25:46 +00:00
parent 79d114a456
commit 686d1de191
3 changed files with 3 additions and 6 deletions

View File

@ -23,7 +23,7 @@ def add_user(conn):
:return: user id
"""
sql = ''' INSERT INTO user()
sql = ''' INSERT INTO users
DEFAULT VALUES '''
cur = conn.cursor()
cur.execute(sql)
@ -38,7 +38,6 @@ def add_hash(conn, cert_user):
:param cert_user:
:return: id
"""
sql = ''' INSERT INTO certs(hash,user_id)
VALUES(?,?) '''
cur = conn.cursor()
@ -77,7 +76,7 @@ def check_hash(tls_client_hash):
user_id = get_user(conn, tls_client_hash)
if (user_id is None):
user_id = add_user(conn)
cert_hash = (tls_client_hash, user_id)
cert_user = (tls_client_hash, user_id)
add_hash(conn, cert_user)
return user_id

View File

@ -1,4 +1,3 @@
#!/bin/python
import os
def get_client_cert():

View File

@ -1,11 +1,10 @@
#!/bin/python
#!/usr/bin/env python3
from helpers import get_client_cert
from db import check_hash
TLS_CLIENT_HASH = get_client_cert()
print("TLS_CLIENT_HASH:")
print(TLS_CLIENT_HASH)
user_id = check_hash(TLS_CLIENT_HASH)
print("USER ID:")
print(user_id)