From 065d0f23bbdaf561a54bcf158d6bcb643efbe9c7 Mon Sep 17 00:00:00 2001 From: leon Date: Thu, 29 Dec 2022 05:15:40 +0000 Subject: [PATCH] config db --- data.py | 44 ++++++++++++++++++++++++++++++-------------- db | Bin 12288 -> 8192 bytes gen.sh | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) 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 efca662540dd4271091b9164ec900c1b9e31057e..0575a4ef1b86847984d48f574eb22176d539d022 100644 GIT binary patch literal 8192 zcmeI#K}y3=5C-6RNwp>*(-?}|SKKH_XcYIhl7-MkYwKE~JTXw)(mspe$_sc058%#2 z^bVfEJ2(+r+6L?e{$U=;{0s?vyVvcsGHdkxaQv8BeM%Kliq5qrB43UpXI@HPO7lUU z`MjxoitcDvwiJJmGztO`fB*y_009U<00Izz00bZaflUG(Ro)Ln_3GL5wr?)mU1{gy zDrxi*-D@;kiIzYg`uew?CT4sy9Sx3`=WI05);!z4>?psRdwfm&&0jp@Pk!e&e&Gj+ zP!NCs1Rwwb2tWV=5P$##AOHaf{3j52ZnZYeY#P_2yyNIB*paAjhJ!^E2jyb4U5vI0 d(O$`|9;|+=9=L_IisObgx&JTyQLQhX`~YBhMnnJr delta 200 zcmZp0Xh@hKEy%>cz`zW|Fu*iX#~3K6m(0Km6k_6UW8go`-?p((jKAKRiA`KwoH4v4 zF)1fCG}tvL7)&rb2e~?ixGID=I{CONfQ7g;xDSfM1fqJ&G+nvqRhSeP*$ stl2Xl7>JlqGy(;{njl&;3!oZ7=4gVP!oVo7vCxKpV#7W*Fc-!H05_;Ct^fc4 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