diff --git a/data.py b/data.py index f762091..5948c6c 100644 --- a/data.py +++ b/data.py @@ -2,19 +2,35 @@ import sqlite3 create = sqlite3.connect("db") connect = create.cursor() -connect.execute(""" CREATE TABLE IPS - ( - ips text - ) -""") -connect.execute(""" CREATE TABLE USERS -( - users text -) -""") - - -create.commit() -create.close() +# connect.execute("""CREATE TABLE IPS ( +# user_vpn, +# user_ips text +# )""") +def insert_ips(): + #user input + user_name = input(str("username: ")) + user_ips = input(str("ip: ")) + #add input to list inside tuple + users = [ + (user_name,user_ips) + ] + # insert 2 values to IPS TABLE + connect.executemany("INSERT INTO IPS VALUES (?,?) ", users) + # commit the input to db + create.commit() + # read db + connect.execute("SELECT * FROM IPS") + + #close the db +def checking(): + items = connect.fetchall() + for item in items: + print(item[1]) + +#call the func +insert_ips() +checking() +#close the db +create.close() \ No newline at end of file diff --git a/db b/db index efca662..0575a4e 100644 Binary files a/db and b/db differ diff --git a/gen.sh b/gen.sh index 28525ac..8034546 100755 --- a/gen.sh +++ b/gen.sh @@ -27,7 +27,7 @@ sleep 1 #Checking IPS echo "Checking.....";sleep 1 python3 -c 'import cat;cat.cat_search()' -check_ip () { +check_ip() { for ip in "${ips[@]}" do if [[ "$ip" == "$user_input" ]];then