Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import psycopg2
- W = "\033[0m" # white (normal)
- R = "\033[31m" # red
- T = "\033[93m" # tan
- G = "\033[32m" # green
- LG = "\033[1;32m" # light green
- def prr1t(rows):
- for row in rows:
- if row is not None:
- row = row[1:]
- print(G + "-" * 45 + W)
- print(
- R + "\t" + "TC Kimlik Numarası" + W + ": " + G + str(row[0]) + W + "\n"
- )
- print(R + "\t" + "Isim" + W + ": " + G + str(row[1]) + W)
- print(R + "\t" + "Soy Isim" + W + ": " + G + str(row[2]) + W + "\n")
- print(R + "\t" + "Anne Adı" + W + ": " + G + str(row[3]) + W)
- print(R + "\t" + "Baba Adı" + W + ": " + G + str(row[4]) + W + "\n")
- print(R + "\t" + "Cinsiyet" + W + ": " + G + str(row[5]) + W + "\n")
- print(R + "\t" + "Doğum Şehiri" + W + ": " + G + str(row[6]) + W)
- print(R + "\t" + "Doğum Tarihi" + W + ": " + G + str(row[7]) + W + "\n")
- print(R + "\t" + "Kutuk Şehir" + W + ": " + G + str(row[8]) + W)
- print(R + "\t" + "Kutuk İlce" + W + ": " + G + str(row[9]) + W + "\n")
- print(R + "\t" + "İkamet Ettiği Şehir" + W + ": " + G + str(row[10]) + W)
- print(R + "\t" + "İkamet Ettiği Ilçe" + W + ": " + G + str(row[11]) + W)
- print(R + "\t" + "İkamet Ettiği Mahalle" + W + ": " + G + str(row[12]) + W)
- print(R + "\t" + "Sokak Adresi" + W + ": " + G + str(row[13]) + W)
- print(R + "\t" + "Kapı Numarası" + W + ": " + G + str(row[14]) + W + "\n")
- def executeTc(ru):
- query = "SELECT * FROM citizen WHERE national_identifier='" + ru + "';"
- conn = psycopg2.connect(dbname="mernis", user="postgres", password="toor")
- cursor = conn.cursor()
- cursor.execute(query)
- rows = cursor.fetchall()
- return rows
- def pad(pad, string1=None, padLeft=None):
- if string1 == None:
- return pad
- if padLeft:
- return (pad + str(string1))[-len(pad) :]
- else:
- return (pad + str(string1))[: len(pad)]
- def sonIkiHane(tc):
- tc_rakam = []
- for i in range(0, 11):
- tc_rakam.append(int(tc) % 10)
- tc = (int(tc) - tc_rakam[i]) / 10
- tc_rakam = tc_rakam[::-1]
- cift = tc_rakam[0] + tc_rakam[2] + tc_rakam[4] + tc_rakam[6] + tc_rakam[8]
- tek = tc_rakam[1] + tc_rakam[3] + tc_rakam[5] + tc_rakam[7]
- tc_rakam[9] = (7 * cift - tek) % 10
- tc_rakam[10] = (
- tc_rakam[9]
- + tc_rakam[8]
- + tc_rakam[7]
- + tc_rakam[6]
- + tc_rakam[5]
- + tc_rakam[4]
- + tc_rakam[3]
- + tc_rakam[2]
- + tc_rakam[1]
- + tc_rakam[0]
- ) % 10
- return tc_rakam[9] * 10 + tc_rakam[10]
- def tc_new(tc, tc_sayisi, yasli):
- tc_sayisi = int(tc_sayisi)
- stringss = []
- tc5digit = int(str(tc)[0:5])
- tc4digit = int(str(tc)[5:9])
- while tc_sayisi:
- if yasli > 0:
- tc4digit = tc4digit - 1
- tc5digit = tc5digit + 3
- if tc5digit > 99999:
- tc5digit = tc5digit - 100000
- if tc4digit < 0:
- tc4digit = tc4digit + 10000
- else:
- tc5digit = tc5digit - 3
- tc4digit = tc4digit + 1
- if tc4digit > 9999:
- tc4digit = tc4digit - 10000
- if tc5digit < 0:
- tc5digit = tc5digit + 100000
- raw_tc = (
- pad("00000", str(tc5digit), True) + pad("0000", str(tc4digit), True) + "00"
- )
- stringss.append(
- pad("00000", str(tc5digit), True)
- + pad("0000", str(tc4digit), True)
- + pad("00", sonIkiHane(raw_tc), True)
- )
- tc_sayisi = tc_sayisi - 1
- return stringss
- # string = []
- #
- def posibleFam(tc, x, y):
- print("Ailesinde ondan küçük olanlar")
- print("*"*30)
- ro = []
- anne34= tc_new(tc, x, 0)
- for poe in anne34:
- ro += executeTc(poe)
- prr1t(ro)
- ro = []
- print("Ailesinde ondan büyük olanlar")
- anne34= tc_new(tc, x, 1)
- for poe in anne34:
- ro += executeTc(poe)
- prr1t(ro)
- posibleFam(sys.argv[1], 4, 4)
Add Comment
Please, Sign In to add comment