├── Calculator ├── README.md └── Simple Calculator.py ├── Hangman ├── README.md ├── hangman0.png ├── hangman1.png ├── hangman2.png ├── hangman3.png ├── hangman4.png ├── hangman5.png ├── hangman6.png └── main.py ├── Library Management System Projec ├── Library Management system ├── Library.py ├── README.md ├── bookshelf+library+icon.ico └── library-management-db.sql ├── Point of Sale System ├── README.md ├── Stop-Watch ├── Alarm.ico ├── README.md ├── Stop_Watch.py └── tomato.png ├── Sudoku_Solver.py ├── Voice Bot ├── README.md ├── VoiceBot.py ├── chabot.ico ├── chatbot-1.png ├── chatbot-2.jpg ├── gramophone-record.png ├── green-settings.png ├── ot.png ├── record.png └── setting.png ├── atm.py ├── chatbot.py ├── forensic └── dban.py ├── meet_bot.py ├── smart_calc.py ├── tic_tac_toe.py └── wifi_scanner.py /Calculator/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Simple-Calculator 3 | Python tkinter gui application 4 | 5 | ![cal](https://user-images.githubusercontent.com/52861859/100331795-cd710e00-2ffa-11eb-86b3-d6704dc9dda9.PNG) 6 | 7 | I used Python eval() Function which is Built-in Function.The eval() function evaluates the specified mathemetical expression 8 | -------------------------------------------------------------------------------- /Calculator/Simple Calculator.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | 3 | 4 | 5 | win=Tk() 6 | win.geometry("315x418") 7 | win.resizable(False,False) 8 | win.title("Calculator") 9 | op="" 10 | 11 | def button_click(number): 12 | 13 | global op 14 | op=op+str(number) 15 | e.delete(0,END) 16 | e.insert(0,op) 17 | 18 | def clear(): 19 | global op 20 | op="" 21 | e.delete(0,END) 22 | 23 | def button_equal(): 24 | global op 25 | result=str(eval(op)) 26 | e.delete(0,END) 27 | e.insert(0,result) 28 | op=result 29 | 30 | 31 | #----Entry---- 32 | s=StringVar() 33 | e=Entry(win,textvariable=s,bd=15,relief=RIDGE,font=("Arial",15,"bold"),bg="#5F9EA0",justify='right') 34 | e.place(width=315,height=60,y=10) 35 | 36 | 37 | frame=Frame(win,height=350,width=332,bg="#5F9EA0",bd=5,relief=RAISED) 38 | frame.place(y=70) 39 | 40 | #----Numbers------ 41 | n1=Button(frame,text="0",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("0"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 42 | n1.grid(row=0,column=0) 43 | 44 | n2=Button(frame,text="+",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("+"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 45 | n2.grid(row=0,column=1) 46 | 47 | n3=Button(frame,text="%",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("%"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 48 | n3.grid(row=0,column=2) 49 | 50 | n4=Button(frame,text="=",bd=5,relief=RAISED,height=2,width=5,command=button_equal,font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 51 | n4.grid(row=0,column=3) 52 | 53 | 54 | 55 | n5=Button(frame,text="7",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(7),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 56 | n5.grid(row=1,column=0) 57 | 58 | n6=Button(frame,text="8",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(8),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 59 | n6.grid(row=1,column=1) 60 | 61 | n7=Button(frame,text="9",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(9),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 62 | n7.grid(row=1,column=2) 63 | 64 | n8=Button(frame,text="X",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("*"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 65 | n8.grid(row=1,column=3) 66 | 67 | n9=Button(frame,text="4",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(4),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 68 | n9.grid(row=2,column=0) 69 | 70 | n10=Button(frame,text="5",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(5),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 71 | n10.grid(row=2,column=1) 72 | 73 | n11=Button(frame,text="6",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(6),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 74 | n11.grid(row=2,column=2) 75 | 76 | n12=Button(frame,text="-",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("-"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 77 | n12.grid(row=2,column=3) 78 | 79 | 80 | n13=Button(frame,text="1",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(1),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 81 | n13.grid(row=3,column=0) 82 | 83 | n14=Button(frame,text="2",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(2),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 84 | n14.grid(row=3,column=1) 85 | 86 | n15=Button(frame,text="3",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click(3),font=("Arial",14,"bold"),bg="#5F9EA0",activebackground="#9fc4c6") 87 | n15.grid(row=3,column=2) 88 | 89 | n16=Button(frame,text="/",bd=5,relief=RAISED,height=2,width=5,command=lambda:button_click("/"),font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 90 | n16.grid(row=3,column=3) 91 | 92 | n17=Button(frame,text="Clear",bd=5,relief=RAISED,height=2,width=24,command=clear,font=("Arial",14,"bold"),bg="#CD5C5C",activebackground="#e7b1b1") 93 | n17.grid(row=4,columnspan=4) 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | win.mainloop() 102 | -------------------------------------------------------------------------------- /Hangman/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Hangman/hangman0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman0.png -------------------------------------------------------------------------------- /Hangman/hangman1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman1.png -------------------------------------------------------------------------------- /Hangman/hangman2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman2.png -------------------------------------------------------------------------------- /Hangman/hangman3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman3.png -------------------------------------------------------------------------------- /Hangman/hangman4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman4.png -------------------------------------------------------------------------------- /Hangman/hangman5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman5.png -------------------------------------------------------------------------------- /Hangman/hangman6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Hangman/hangman6.png -------------------------------------------------------------------------------- /Hangman/main.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import math 3 | import random 4 | 5 | # setup display 6 | pygame.init() 7 | WIDTH, HEIGHT = 800, 500 8 | win = pygame.display.set_mode((WIDTH, HEIGHT)) 9 | pygame.display.set_caption("Hangman Game!") 10 | 11 | # button variables 12 | RADIUS = 20 13 | GAP = 15 14 | letters = [] 15 | startx = round((WIDTH - (RADIUS * 2 + GAP) * 13) / 2) 16 | starty = 400 17 | A = 65 18 | for i in range(26): 19 | x = startx + GAP * 2 + ((RADIUS * 2 + GAP) * (i % 13)) 20 | y = starty + ((i // 13) * (GAP + RADIUS * 2)) 21 | letters.append([x, y, chr(A + i), True]) 22 | 23 | # fonts 24 | LETTER_FONT = pygame.font.SysFont('comicsans', 40) 25 | WORD_FONT = pygame.font.SysFont('comicsans', 60) 26 | TITLE_FONT = pygame.font.SysFont('comicsans', 70) 27 | 28 | # load images. 29 | images = [] 30 | for i in range(7): 31 | image = pygame.image.load("hangman" + str(i) + ".png") 32 | images.append(image) 33 | 34 | # game variables 35 | hangman_status = 0 36 | words = ["INSTAGRAM", "PYCODERS", "PYTHON", "PYGAME", "FOLLOW"] 37 | word = random.choice(words) 38 | guessed = [] 39 | 40 | # colors 41 | YELLOW = (247,232,0) 42 | BLACK = (0,0,0) 43 | 44 | 45 | def draw(): 46 | win.fill(YELLOW) 47 | 48 | # draw title 49 | text = TITLE_FONT.render("MLBACKBENCHERS", 1, BLACK) 50 | win.blit(text, (WIDTH/2 - text.get_width()/2, 20)) 51 | 52 | # draw word 53 | display_word = "" 54 | for letter in word: 55 | if letter in guessed: 56 | display_word += letter + " " 57 | else: 58 | display_word += "_ " 59 | text = WORD_FONT.render(display_word, 1, BLACK) 60 | win.blit(text, (400, 200)) 61 | 62 | # draw buttons 63 | for letter in letters: 64 | x, y, ltr, visible = letter 65 | if visible: 66 | pygame.draw.circle(win, BLACK, (x, y), RADIUS, 3) 67 | text = LETTER_FONT.render(ltr, 1, BLACK) 68 | win.blit(text, (x - text.get_width()/2, y - text.get_height()/2)) 69 | 70 | win.blit(images[hangman_status], (150, 100)) 71 | pygame.display.update() 72 | 73 | 74 | def display_message(message): 75 | pygame.time.delay(1000) 76 | win.fill(YELLOW) 77 | text = WORD_FONT.render(message, 1, BLACK) 78 | win.blit(text, (WIDTH/2 - text.get_width()/2, HEIGHT/2 - text.get_height()/2)) 79 | pygame.display.update() 80 | pygame.time.delay(3000) 81 | 82 | def main(): 83 | global hangman_status 84 | 85 | FPS = 60 86 | clock = pygame.time.Clock() 87 | run = True 88 | 89 | while run: 90 | clock.tick(FPS) 91 | 92 | for event in pygame.event.get(): 93 | if event.type == pygame.QUIT: 94 | run = False 95 | if event.type == pygame.MOUSEBUTTONDOWN: 96 | m_x, m_y = pygame.mouse.get_pos() 97 | for letter in letters: 98 | x, y, ltr, visible = letter 99 | if visible: 100 | dis = math.sqrt((x - m_x)**2 + (y - m_y)**2) 101 | if dis < RADIUS: 102 | letter[3] = False 103 | guessed.append(ltr) 104 | if ltr not in word: 105 | hangman_status += 1 106 | 107 | draw() 108 | 109 | won = True 110 | for letter in word: 111 | if letter not in guessed: 112 | won = False 113 | break 114 | 115 | if won: 116 | display_message("You WON!") 117 | break 118 | 119 | if hangman_status == 6: 120 | display_message("You LOST!") 121 | break 122 | 123 | while True: 124 | 125 | main() 126 | pygame.quit() -------------------------------------------------------------------------------- /Library Management System Projec: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | from tkinter import messagebox 3 | import os 4 | import mysql.connector 5 | from mysql.connector import Error 6 | py=sys.executable 7 | 8 | 9 | #creating window 10 | class Lib(Tk): 11 | def __init__(self): 12 | super().__init__() 13 | self.a = StringVar() 14 | self.b = StringVar() 15 | self.maxsize(1200, 700) 16 | self.minsize(1200, 700) 17 | self.configure(bg="gray") 18 | self.title("LIBRARY MANAGEMENT SYSTEM") 19 | 20 | 21 | #verifying input 22 | def chex(): 23 | if len(self.user_text.get()) < 0: 24 | messagebox.showinfo(" INVALID USERNAME OR PASSWORD" ) 25 | elif len(self.pass_text.get()) < 0: 26 | messagebox.showinfo(" INVALID USERNAME OR PASSWORD") 27 | else: 28 | try: 29 | conn = mysql.connector.connect(host='localhost', 30 | database='library', 31 | user='root', 32 | password='') 33 | cursor = conn.cursor() 34 | user = self.user_text.get() 35 | password = self.pass_text.get() 36 | cursor.execute('Select * from `admin` where user= %s AND password = %s ',(user,password,)) 37 | pc = cursor.fetchone() 38 | if pc: 39 | self.destroy() 40 | os.system('%s %s' % (py, 'options.py')) 41 | else: 42 | print(pc) 43 | messagebox.showinfo('Error', 'Username and password not found') 44 | self.user_text.delete(0, END) 45 | self.pass_text.delete(0, END) 46 | except Error: 47 | messagebox.showinfo('Error',"Something Goes Wrong,Try restarting") 48 | 49 | def check(): 50 | 51 | 52 | self.label = Label(self, text="LOGIN", bg = 'gray' , fg = 'black', font=("courier-new", 24,'bold')) 53 | self.label.place(x=550, y=90) 54 | self.label1 = Label(self, text="User-Id" , bg = 'gray' , fg = 'black', font=("courier-new", 18, 'bold')) 55 | self.label1.place(x=370, y=180) 56 | self.user_text = Entry(self, textvariable=self.a, width=45) 57 | self.user_text.place(x=480, y=190) 58 | self.label2 = Label(self, text="Password" , bg = 'gray' , fg = 'black', font=("courier-new", 18, 'bold')) 59 | self.label2.place(x=340, y=250) 60 | self.pass_text = Entry(self, show='*', textvariable=self.b, width=45) 61 | self.pass_text.place(x=480, y=255) 62 | self.butt = Button(self, text="Login",bg ='white', font=10, width=8, command=chex).place(x=580, y=300) 63 | self.label3 = Label(self, text="LIBRARY MANAGEMENT SYSTEM", bg='gray', fg='black', font=("courier-new", 24, 'bold')) 64 | self.label3.place(x=350, y=30) 65 | 66 | 67 | check() 68 | 69 | Lib().mainloop() 70 | -------------------------------------------------------------------------------- /Library Management system/Library.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import messagebox 3 | import mysql.connector as mysql 4 | from tkinter import ttk 5 | from tkcalendar import DateEntry 6 | 7 | 8 | 9 | 10 | 11 | #---Exit Window--- 12 | def window(): 13 | win.destroy() 14 | 15 | 16 | #---Window--- 17 | win=Tk() 18 | win.title("Library System") 19 | win.geometry('990x650+200+15') 20 | win.resizable(False,False) 21 | win.config(bg="#70a9a9") 22 | win.iconbitmap(r'bookshelf+library+icon.ico') 23 | 24 | 25 | #---Back Dashboard--- 26 | def back_dashboard(): 27 | dashboard() 28 | 29 | 30 | 31 | 32 | #---Add Book--- 33 | def Add_Book(): 34 | def add_details(): 35 | def win_destroy(): 36 | win2.destroy() 37 | 38 | 39 | def Delete(): 40 | by1.delete(0,'end') 41 | by2.delete(0,'end') 42 | by3.delete(0,'end') 43 | by4.delete(0,'end') 44 | by5.delete(0,'end') 45 | 46 | Id = by1.get() 47 | TITLE = by2.get() 48 | AUTHOR = by3.get() 49 | EDITION = by4.get() 50 | TOTAL = by5.get() 51 | 52 | if Id == "" or TITLE == "" or AUTHOR == "" or EDITION == "" or TOTAL == "": 53 | win2 = Toplevel(win) 54 | win2.title("Insert Status") 55 | win2.resizable(False,False) 56 | win2.geometry("300x120+500+320") 57 | 58 | lu1 = Label(win2,image="::tk::icons::error") 59 | lu1.place(x=40,y=20) 60 | lu2 = Label(win2,text="All Fields are required") 61 | lu2.place(x=90,y=25) 62 | 63 | bu1 = Button(win2,text='Ok',height=1,width=10,font=('veranda',10,''),command=win_destroy) 64 | bu1.place(x=180,y=80) 65 | win2.mainloop() 66 | 67 | else: 68 | flg=0 69 | conn = mysql.connect(host="localhost",user="root",password="",database="library-management-db") 70 | cursor = conn.cursor() 71 | cursor.execute("SELECT `Book ID` ,`Title` FROM `book_details` where `Book ID`=" + Id) 72 | for (I,T) in cursor: 73 | if str(I) == (Id): 74 | flg = 1 75 | 76 | cursor.close() 77 | if flg==1: 78 | win2 = Toplevel(win) 79 | win2.title("Error") 80 | win2.resizable(False,False) 81 | win2.geometry("250x120+500+320") 82 | 83 | Lu1 = Label(win2,image="::tk::icons::error") 84 | Lu1.place(x=40,y=20) 85 | Lu2 = Label(win2,text="ID is already Exist!!") 86 | Lu2.place(x=90,y=25) 87 | 88 | B1 = Button(win2,text='Ok',height=1,width=10,font=('veranda',10,''),command=win_destroy) 89 | B1.place(x=90,y=80) 90 | win2.mainloop() 91 | else: 92 | conn = mysql.connect(host="localhost",user="root",password="",database="library-management-db") 93 | 94 | cursor = conn.cursor() 95 | cursor.execute( 96 | "INSERT INTO `book_details`(`Book ID`, `Title`, `Author`, `Edition`, `Total`) VALUES('" + Id + "','" + TITLE + "','" + AUTHOR + "','" + EDITION + "','" + TOTAL + "')") 97 | cursor.execute("commit") 98 | cursor.close() 99 | 100 | win2 = Toplevel(win) 101 | win2.title("Add Books") 102 | win2.resizable(False,False) 103 | win2.geometry("300x120+500+320") 104 | 105 | lu2 = Label(win2,image="::tk::icons::information") 106 | lu2.place(x=40,y=20) 107 | lu3 = Label(win2,text="Inserted Successfully") 108 | lu3.place(x=90,y=25) 109 | 110 | bu2 = Button(win2,text='Ok',height=1,width=10,font=('veranda',10,''),command=win_destroy) 111 | bu2.place(x=180,y=80) 112 | Delete() 113 | by1.focus() 114 | win2.mainloop() 115 | 116 | 117 | f2 = Frame(bg="#8fbcbc") 118 | f2.place(x=0,y=0,width=990,height=650) 119 | 120 | f3=Frame(f2,bg="#396060") 121 | f3.place(x=0,y=0,width=990,height=90) 122 | 123 | l= Label(f3,text="Pikachu Library",font=('veranda',45,'bold'),bg='#396060',fg='#F5FFFA') 124 | l.place(x=280,y=5) 125 | 126 | wh=Frame(f2,bg="#F5FFFA") 127 | wh.place(x=0,y=90,width=990,height=30) 128 | 129 | f4=Frame(f2,bg="#F5FFFA") 130 | f4.place(x=200,y=150,width=600,height=460) 131 | 132 | f5=Frame(f4,bg="#396060") 133 | f5.place(x=0,y=0,width=600,height=50) 134 | 135 | l1=Label(f5,text="Add Book Details",font=('veranda',25,'bold'),bg="#396060",fg='#F5FFFA') 136 | l1.place(x=170,y=2) 137 | 138 | id = StringVar() 139 | title = StringVar() 140 | author = StringVar() 141 | edition = StringVar() 142 | total = StringVar() 143 | 144 | ID = Label(f4,text="Book ID",font=('veranda',10,'bold'),bg="#F5FFFA") 145 | ID.place(x=60,y=100) 146 | 147 | by1 = Entry(f4,textvariable=id,bd=1,font=('Arial',15,'bold'),bg="white",border=2,relief=GROOVE) 148 | by1.place(x=180,y=100,height=25,width=300) 149 | 150 | Title = Label(f4,text="Title",font=('veranda',10,'bold'),bg="#F5FFFA") 151 | Title.place(x=60,y=160) 152 | 153 | by2 = Entry(f4,textvariable=title,bd=1,font=('Arial',15,'bold'),bg="white",border=2,relief=GROOVE) 154 | by2.place(x=180,y=160,height=25,width=300) 155 | 156 | Author = Label(f4,text="Author",font=('veranda',10,'bold'),bg="#F5FFFA") 157 | Author.place(x=60,y=220) 158 | 159 | by3 = Entry(f4,textvariable=author,bd=1,font=('Arial',15,'bold'),bg="white",border=2,relief=GROOVE) 160 | by3.place(x=180,y=220,height=25,width=300) 161 | 162 | Edition = Label(f4,text="Edition",font=('veranda',10,'bold'),bg="#F5FFFA") 163 | Edition.place(x=60,y=280) 164 | 165 | by4 = Entry(f4,textvariable=edition,bd=1,font=('Arial',15,'bold'),bg="white",border=2,relief=GROOVE) 166 | by4.place(x=180,y=280,height=25,width=300) 167 | 168 | Total = Label(f4,text="Total Books",font=('veranda',10,'bold'),bg="#F5FFFA") 169 | Total.place(x=60,y=340) 170 | 171 | by5 = Entry(f4,textvariable=total,bd=1,font=('Arial',15,'bold'),bg="white",border=2,relief=GROOVE) 172 | by5.place(x=180,y=340,height=25,width=300) 173 | 174 | Submit = Button(f4,text='Submit',height=1,width=20,font=('veranda',12,'bold'),bg="#3366ff",fg="white",command=add_details) 175 | Submit.place(x=220,y=390) 176 | 177 | De1 = Button(f2,text='=8: 1554 | np = Label(win1,text=100*space) 1555 | np.place(x=180,y=250) 1556 | 1557 | if f == 1: 1558 | np = Label(win1,text='User Name is already exist',font=('Arial',10,'bold'),fg='#B22222') 1559 | np.place(x=180,y=129) 1560 | 1561 | if len(Password)<8: 1562 | np = Label(win1,text='Password must be at least 8 characters',font=('Arial',10,'bold'),fg='#B22222') 1563 | np.place(x=180,y=250) 1564 | 1565 | if f!=1 and len(Password)>=8: 1566 | conn = mysql.connect(host="localhost",user="root",password="",database="library-management-db") 1567 | cursor = conn.cursor() 1568 | cursor.execute("INSERT INTO `admin` VALUES ('"+User_Name+"' ,'"+Name+"', '"+Password+"', '"+Email+"')") 1569 | cursor.execute("commit") 1570 | cursor.close() 1571 | 1572 | win3 = Toplevel(win) 1573 | win3.title("Sign Up") 1574 | win3.resizable(False,False) 1575 | win3.geometry("300x120+500+320") 1576 | 1577 | lu2 = Label(win3,image="::tk::icons::information") 1578 | lu2.place(x=40,y=20) 1579 | lu3 = Label(win3,text="You have Signed up Successfully") 1580 | lu3.place(x=80,y=25) 1581 | 1582 | bu2 = Button(win3,text='Ok',height=1,width=10,font=('veranda',10,''),command=win2_destroy) 1583 | bu2.place(x=180,y=80) 1584 | win3.mainloop() 1585 | 1586 | 1587 | win1=Toplevel(win) 1588 | win1.title("Sign Up") 1589 | win1.geometry("500x450+450+110") 1590 | win1.resizable(False,False) 1591 | 1592 | 1593 | si1 = StringVar() 1594 | si2 = StringVar() 1595 | si3=StringVar() 1596 | si4=StringVar() 1597 | 1598 | title2 = Label(win1,text='Sign Up',font=('Arial',25,'bold'),fg='#B22222') 1599 | title2.place(x=190,y=25) 1600 | 1601 | l2 = Label(win1,text="User Name:",font=('veranda',10,'bold')) 1602 | l2.place(x=60,y=100) 1603 | by = Entry(win1,textvariable=si1,bd=1,font=('Arial',15,'bold')) 1604 | by.place(x=180,y=100,height=25,width=200) 1605 | 1606 | l3 = Label(win1,text="Name:",font=('veranda',10,'bold')) 1607 | l3.place(x=60,y=160) 1608 | by2 = Entry(win1,textvariable=si2,bd=1,font=('Arial',15,'bold')) 1609 | by2.place(x=180,y=160,height=25,width=200) 1610 | 1611 | l4 = Label(win1,text="Password:",font=('veranda',10,'bold')) 1612 | l4.place(x=60,y=220) 1613 | by3 = Entry(win1,textvariable=si3,bd=1,font=('Arial',15,'bold'),show="*") 1614 | by3.place(x=180,y=220,height=25,width=200) 1615 | 1616 | l5 = Label(win1,text="Email:",font=('veranda',10,'bold')) 1617 | l5.place(x=60,y=280) 1618 | by4 = Entry(win1,textvariable=si4,bd=1,font=('Arial',15,'bold')) 1619 | by4.place(x=180,y=280,height=25,width=200) 1620 | 1621 | but = Button(win1,text='Submit',height=1,width=20,font=('veranda',12,'bold'),fg="#F5FFFA",bg="#396060",command=sub) 1622 | but.place(x=150,y=350) 1623 | 1624 | by.focus() 1625 | 1626 | 1627 | win1.mainloop() 1628 | 1629 | 1630 | def change_password(): 1631 | 1632 | def submit(): 1633 | def win2_destroy(): 1634 | win2.destroy() 1635 | def end(): 1636 | win1.destroy() 1637 | 1638 | user_name = by.get() 1639 | pas = by2.get() 1640 | 1641 | if (user_name == "" or pas == ""): 1642 | win2 = Toplevel(win1) 1643 | win2.title("Insert Status") 1644 | win2.resizable(False,False) 1645 | win2.geometry("300x120+500+320") 1646 | 1647 | lu1 = Label(win2,image="::tk::icons::error") 1648 | lu1.place(x=40,y=20) 1649 | lu2 = Label(win2,text="All Fields are required") 1650 | lu2.place(x=90,y=25) 1651 | 1652 | bu1 = Button(win2,text='Ok',height=1,width=10,font=('veranda',10,''),command=win2_destroy) 1653 | bu1.place(x=180,y=80) 1654 | win2.mainloop() 1655 | else: 1656 | f = 0 1657 | conn = mysql.connect(host="localhost",user="root",password="",database="library-management-db") 1658 | cursorr = conn.cursor() 1659 | cursorr.execute("SELECT `User Name`,`Name` FROM `admin`") 1660 | for (us_name,name) in cursorr: 1661 | if us_name == user_name: 1662 | f=1 1663 | break 1664 | conn.close() 1665 | 1666 | 1667 | space=" " 1668 | 1669 | if f == 1: 1670 | np = Label(win1,text=100*space) 1671 | np.place(x=180,y=129) 1672 | 1673 | if len(pas)>=8: 1674 | np = Label(win1,text=100*space) 1675 | np.place(x=180,y=185) 1676 | 1677 | 1678 | 1679 | if f == 0: 1680 | np = Label(win1,text='User Name is not found',font=('Arial',10,'bold'),fg='#B22222') 1681 | np.place(x=180,y=129) 1682 | 1683 | if len(pas)<8: 1684 | np = Label(win1,text='Password must be at least 8 characters',font=('Arial',10,'bold'),fg='#B22222') 1685 | np.place(x=180,y=185) 1686 | 1687 | if f==1 and len(pas)>=8: 1688 | conn = mysql.connect(host="localhost",user="root",password="",database="library-management-db") 1689 | cursorr = conn.cursor() 1690 | cursorr.execute("UPDATE admin SET `Password` = '" + pas + "' WHERE `User Name`= '" + user_name +"'") 1691 | cursorr.execute("commit") 1692 | cursorr.close() 1693 | 1694 | win3 = Toplevel(win1) 1695 | win3.title("Update Status") 1696 | win3.resizable(False,False) 1697 | win3.geometry("300x120+500+320") 1698 | 1699 | lu2 = Label(win3,image="::tk::icons::information") 1700 | lu2.place(x=40,y=20) 1701 | lu3 = Label(win3,text="Updated Successfully") 1702 | lu3.place(x=90,y=25) 1703 | 1704 | bu2 = Button(win3,text='Ok',height=1,width=10,font=('veranda',10,''),command=end) 1705 | bu2.place(x=180,y=80) 1706 | win3.mainloop() 1707 | 1708 | 1709 | 1710 | 1711 | win1=Toplevel(win) 1712 | win1.title("Change Password") 1713 | win1.geometry("500x300+400+220") 1714 | win1.resizable(False,False) 1715 | 1716 | 1717 | si1 = StringVar() 1718 | si2 = StringVar() 1719 | title2 = Label(win1,text='New Password',font=('Arial',25,'bold'),fg='#B22222') 1720 | title2.place(x=130,y=25) 1721 | 1722 | l2 = Label(win1,text="User Name:",font=('veranda',10,'bold')) 1723 | l2.place(x=60,y=100) 1724 | by = Entry(win1,textvariable=si1,bd=1,font=('Arial',15,'bold')) 1725 | by.place(x=180,y=100,height=25,width=200) 1726 | 1727 | l3 = Label(win1,text="New Password:",font=('veranda',10,'bold')) 1728 | l3.place(x=60,y=160) 1729 | by2 = Entry(win1,textvariable=si2,bd=1,font=('Arial',15,'bold'),show="*") 1730 | by2.place(x=180,y=160,height=25,width=200) 1731 | 1732 | but = Button(win1,text='Submit',height=1,width=20,font=('veranda',12,'bold'),fg="#F5FFFA",bg="#396060",command=submit) 1733 | but.place(x=150,y=230) 1734 | 1735 | by.focus() 1736 | 1737 | 1738 | 1739 | 1740 | 1741 | win1.mainloop() 1742 | 1743 | #----Clear Enter Username & Password 1744 | def reset(): 1745 | b1.delete(0,'end') 1746 | b2.delete(0,'end') 1747 | b1.focus() 1748 | 1749 | def logIn(): 1750 | 1751 | username=b1.get() 1752 | password=b2.get() 1753 | 1754 | 1755 | if(username=="" or password=="" ): 1756 | messagebox.showinfo("Insert Status","All Fields are required") 1757 | else: 1758 | try: 1759 | con=mysql.connect(host="localhost",user="root",password="",database="library-management-db") 1760 | except: 1761 | messagebox.showerror("Error","You are not connected to server(localhost)") 1762 | 1763 | else: 1764 | flg=0 1765 | cursor=con.cursor() 1766 | cursor.execute("SELECT `User Name`, `Password` FROM `admin` ") 1767 | 1768 | for (us,pas)in cursor: 1769 | if username == us and password == pas: 1770 | flg=1 1771 | break 1772 | if flg==1: 1773 | dashboard() 1774 | else: 1775 | messagebox.showerror("Library System","Your User Name or Password is wrong") 1776 | con.close() 1777 | 1778 | 1779 | # ----Frame1---- 1780 | f1 = Frame(bg="#70a9a9") 1781 | f1.place(x=0,y=0,width=990,height=650) 1782 | 1783 | # ----Title---- 1784 | title = Label(f1,text='Library Management System',font=('Arial',45,'bold'),bg='#70a9a9',fg='#B22222') 1785 | title.place(x=100,y=60) 1786 | 1787 | # ----UserName & Password 1788 | frame1 = Frame(f1,bg="#396060",relief=RIDGE,bd=20,height=180,width=700) 1789 | frame1.place(x=135,y=200) 1790 | 1791 | s1 = StringVar() 1792 | s2 = StringVar() 1793 | 1794 | l1 = Label(frame1,text="User Name",font=('veranda',20,'bold'),fg='#F5FFFA',bg='#396060') 1795 | l1.place(x=5,y=10) 1796 | b1 = Entry(frame1,textvariable=s1,bd=5,font=('Arial',15,'bold'),bg="#e6e6e6") 1797 | b1.place(x=200,y=15,height=35,width=420) 1798 | 1799 | l2 = Label(frame1,text="Password",font=('veranda',20,'bold'),fg='#F5FFFA',bg='#396060') 1800 | l2.place(x=5,y=90) 1801 | b2 = Entry(frame1,textvariable=s2,bd=5,font=('Arial',15,'bold'),bg="#e6e6e6",show="*") 1802 | b2.place(x=200,y=90,height=35,width=420) 1803 | 1804 | # ----3 Buttons---- 1805 | frame2 = Frame(f1,bg="#396060",relief=RIDGE,bd=20,height=100,width=700) 1806 | frame2.place(x=135,y=390) 1807 | 1808 | bu1 = Button(frame2,text='Login',height=1,width=16,font=('veranda',15,'bold'),bg="#C0C0C0",command=logIn) 1809 | bu1.place(x=10,y=7) 1810 | bu2 = Button(frame2,text='Reset',height=1,width=16,font=('veranda',15,'bold'),bg="#C0C0C0",command=reset) 1811 | bu2.place(x=230,y=7) 1812 | bu3 = Button(frame2,text='Exit Window',height=1,width=16,font=('veranda',15,'bold'),bg="#C0C0C0", 1813 | command=window) 1814 | bu3.place(x=450,y=7) 1815 | 1816 | bu4 = Button(f1,text="Forgot Password?",font=('veranda',15,'bold'),activebackground="#70a9a9",bg="#70a9a9", 1817 | fg="#B22222",relief=FLAT,command=change_password) 1818 | bu4.place(x=250,y=500) 1819 | 1820 | bu5 = Button(f1,text="Sign Up",font=('veranda',15,'bold'),activebackground="#70a9a9",bg="#70a9a9", 1821 | fg="#B22222",relief=FLAT,command=sign_up) 1822 | bu5.place(x=580,y=500) 1823 | 1824 | b1.focus() 1825 | 1826 | 1827 | 1828 | home() 1829 | win.mainloop() 1830 | -------------------------------------------------------------------------------- /Library Management system/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Library Management System 3 | 4 | ### Connect to the MySql server before running this program. Create a database. The name of the database must be : 5 | library-management-db 6 | Only registered students can issue books from this system which means that the student information must be stored in the student-information table.There are 4 tables in the database. The name of the table must be same. 7 | 8 | 1. admin 9 | 2. book-details 10 | 3. issue-information 11 | 4. student-information 12 | 13 | These 4 tables must be created inside the database or You can import the .sql file after creating the database. 14 | 15 | # Screenshot 16 | 17 | 18 | Sign up 19 | 20 | ![1](https://user-images.githubusercontent.com/52861859/119842603-a1dacc00-bf28-11eb-8582-1288287158cc.PNG) 21 | 22 | Change Password 23 | 24 | ![2](https://user-images.githubusercontent.com/52861859/119842615-a4d5bc80-bf28-11eb-8a6c-3b5d5ec9ec17.PNG) 25 | 26 | 27 | Add Book 28 | 29 | ![3](https://user-images.githubusercontent.com/52861859/119842628-a8694380-bf28-11eb-94db-1c6896ee299d.PNG) 30 | 31 | Delete Book 32 | 33 | ![4](https://user-images.githubusercontent.com/52861859/119842645-ab643400-bf28-11eb-8b49-f443865b409d.PNG) 34 | 35 | Book details 36 | 37 | ![5](https://user-images.githubusercontent.com/52861859/119843036-fda55500-bf28-11eb-9799-abf7113674e2.PNG) 38 | 39 | Issue Book 40 | 41 | ![6](https://user-images.githubusercontent.com/52861859/119843057-01d17280-bf29-11eb-8ff2-04fb20172049.PNG) 42 | 43 | Return Book 44 | 45 | ![7](https://user-images.githubusercontent.com/52861859/119843064-039b3600-bf29-11eb-97c8-42de38b7518c.PNG) 46 | 47 | Update Book 48 | 49 | ![8](https://user-images.githubusercontent.com/52861859/119843084-072ebd00-bf29-11eb-95ea-32f4141b6144.PNG) 50 | 51 | Search Book 52 | 53 | ![9](https://user-images.githubusercontent.com/52861859/119843090-085fea00-bf29-11eb-86f8-c18f982a39de.PNG) 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Library Management system/bookshelf+library+icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Library Management system/bookshelf+library+icon.ico -------------------------------------------------------------------------------- /Library Management system/library-management-db.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.0.4 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: May 27, 2021 at 03:10 PM 7 | -- Server version: 10.4.17-MariaDB 8 | -- PHP Version: 8.0.1 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | START TRANSACTION; 12 | SET time_zone = "+00:00"; 13 | 14 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 18 | /*!40101 SET NAMES utf8mb4 */; 19 | 20 | -- 21 | -- Database: `library-management-db` 22 | -- 23 | 24 | -- -------------------------------------------------------- 25 | 26 | -- 27 | -- Table structure for table `admin` 28 | -- 29 | 30 | CREATE TABLE `admin` ( 31 | `User Name` varchar(200) NOT NULL, 32 | `Name` varchar(200) NOT NULL, 33 | `Password` varchar(200) NOT NULL, 34 | `Email` varchar(200) NOT NULL 35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 36 | 37 | -- 38 | -- Dumping data for table `admin` 39 | -- 40 | 41 | INSERT INTO `admin` (`User Name`, `Name`, `Password`, `Email`) VALUES 42 | ('saira12', 'Saira Tabassum', '12345678', 'saira34@gmail.com'), 43 | ('saira23', 'saira tabassum', '1372173612', 'saira23@gmail.com'); 44 | 45 | -- -------------------------------------------------------- 46 | 47 | -- 48 | -- Table structure for table `book_details` 49 | -- 50 | 51 | CREATE TABLE `book_details` ( 52 | `Book ID` int(11) NOT NULL, 53 | `Title` varchar(200) NOT NULL, 54 | `Author` varchar(200) NOT NULL, 55 | `Edition` int(11) NOT NULL, 56 | `Total` int(11) NOT NULL 57 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 58 | 59 | -- 60 | -- Dumping data for table `book_details` 61 | -- 62 | 63 | INSERT INTO `book_details` (`Book ID`, `Title`, `Author`, `Edition`, `Total`) VALUES 64 | (1001, 'Golpo Kotha', 'Humayun Ahmed', 2001, 9), 65 | (1002, 'Twilight', 'Stephen Mayer', 2002, 14), 66 | (1003, 'Flyover', 'A P J Abdul Kalam', 2003, 12), 67 | (1004, 'Himu', 'Humayun Ahmed', 2004, 5), 68 | (1005, 'Twilight Eclipse', 'Stephen Mayer', 2002, 21); 69 | 70 | -- -------------------------------------------------------- 71 | 72 | -- 73 | -- Table structure for table `issue_information` 74 | -- 75 | 76 | CREATE TABLE `issue_information` ( 77 | `Issue ID` int(11) NOT NULL, 78 | `Std_ID` int(11) NOT NULL, 79 | `Book ID` int(11) NOT NULL, 80 | `From Date` varchar(200) NOT NULL, 81 | `To Date` varchar(200) NOT NULL 82 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 83 | 84 | -- 85 | -- Dumping data for table `issue_information` 86 | -- 87 | 88 | INSERT INTO `issue_information` (`Issue ID`, `Std_ID`, `Book ID`, `From Date`, `To Date`) VALUES 89 | (12, 1, 1001, '4/16/21', '4/16/21'), 90 | (13, 1, 1001, '4/19/2021', '5/19/2021'), 91 | (56, 1, 1003, '4/19/2021', '8/19/2021'), 92 | (78, 1, 1001, '4/21/21', '4/21/21'); 93 | 94 | -- -------------------------------------------------------- 95 | 96 | -- 97 | -- Table structure for table `student_information` 98 | -- 99 | 100 | CREATE TABLE `student_information` ( 101 | `Std_ID` int(11) NOT NULL, 102 | `Name` varchar(200) NOT NULL, 103 | `Department` varchar(200) NOT NULL, 104 | `Year` int(11) NOT NULL, 105 | `Semester` varchar(200) NOT NULL, 106 | `Contact` varchar(200) NOT NULL 107 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 108 | 109 | -- 110 | -- Dumping data for table `student_information` 111 | -- 112 | 113 | INSERT INTO `student_information` (`Std_ID`, `Name`, `Department`, `Year`, `Semester`, `Contact`) VALUES 114 | (1, 'Saira Tabassum', 'CSE', 2019, '7', '0177272913'); 115 | 116 | -- 117 | -- Indexes for dumped tables 118 | -- 119 | 120 | -- 121 | -- Indexes for table `admin` 122 | -- 123 | ALTER TABLE `admin` 124 | ADD PRIMARY KEY (`Password`); 125 | 126 | -- 127 | -- Indexes for table `book_details` 128 | -- 129 | ALTER TABLE `book_details` 130 | ADD PRIMARY KEY (`Book ID`); 131 | 132 | -- 133 | -- Indexes for table `issue_information` 134 | -- 135 | ALTER TABLE `issue_information` 136 | ADD PRIMARY KEY (`Issue ID`), 137 | ADD KEY `Std_ID` (`Std_ID`), 138 | ADD KEY `Book ID` (`Book ID`); 139 | 140 | -- 141 | -- Indexes for table `student_information` 142 | -- 143 | ALTER TABLE `student_information` 144 | ADD PRIMARY KEY (`Std_ID`); 145 | 146 | -- 147 | -- Constraints for dumped tables 148 | -- 149 | 150 | -- 151 | -- Constraints for table `issue_information` 152 | -- 153 | ALTER TABLE `issue_information` 154 | ADD CONSTRAINT `issue_information_ibfk_1` FOREIGN KEY (`Std_ID`) REFERENCES `student_information` (`Std_ID`), 155 | ADD CONSTRAINT `issue_information_ibfk_2` FOREIGN KEY (`Book ID`) REFERENCES `book_details` (`Book ID`); 156 | COMMIT; 157 | 158 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 159 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 160 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 161 | -------------------------------------------------------------------------------- /Point of Sale System: -------------------------------------------------------------------------------- 1 | 2 | class cashieringsystem: 3 | 4 | def __init__(self, a=0, r=0,recieve=0,change=0,temp=0): 5 | 6 | print("\n\n*****WELCOME TO SIMPLE CASHIERING SYSTEM*****\n") 7 | 8 | self.a = a 9 | self.r = r 10 | self.recieve = recieve 11 | self.change = change 12 | self.temp = temp 13 | 14 | def foods(self): 15 | 16 | print("*****JUDE'S RESTAURANT MENU*****") 17 | 18 | print("1.Adobo----->30", "\n2.Nilaga----->35", "\n3.Pork Chop--->50", "\n4.Letchon Paksiw---->40","\n5.Cash Out", "\n6.Exit") 19 | 20 | while (1): 21 | 22 | c = int(input("Choose:\n")) 23 | 24 | if (c == 1): 25 | 26 | d = int(input("Enter the quantity:\n")) 27 | self.r = self.r + 30 * d 28 | 29 | elif (c == 2): 30 | d = int(input("Enter the quantity:\n")) 31 | self.r = self.r + 35 * d 32 | 33 | elif (c == 3): 34 | d = int(input("Enter the quantity:\n")) 35 | self.r = self.r + 50 * d 36 | 37 | elif (c == 4): 38 | d = int(input("Enter the quantity:\n")) 39 | self.r = self.r + 40 * d 40 | 41 | elif (c == 5): 42 | print("total:", self.r) 43 | if (self.r > 0): 44 | recieve = int(input("Input Money Recieve:\n")) 45 | print("Change:",recieve - self.r) 46 | print("*****Thank You Come Again!!!*****") 47 | quit() 48 | elif (c == 6): 49 | quit() 50 | else: 51 | print("Invalid option") 52 | 53 | 54 | 55 | 56 | 57 | def main(): 58 | a = cashieringsystem() 59 | 60 | while (1): 61 | 62 | a.foods() 63 | 64 | 65 | 66 | 67 | 68 | main() 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python_projects 2 | 3 | 🧡🧡In this repository, I will provide some practice projects, Feel free to add any python projects you like and you have done and make a pull request🧡🧡 4 | 5 | ![ezgif-6-f8aad4de11bf](https://user-images.githubusercontent.com/68724228/89905849-442efa80-dc08-11ea-97fe-632c774e6b69.gif) 6 | 7 |

©Gleb Kuznetsov

8 | -------------------------------------------------------------------------------- /Stop-Watch/Alarm.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Stop-Watch/Alarm.ico -------------------------------------------------------------------------------- /Stop-Watch/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Stop-Watch 3 | 4 | **Install** 5 | 6 | pip install pillow 7 | 8 | pip install image 9 | 10 | ![stop watch](https://user-images.githubusercontent.com/52861859/100788623-89896900-343f-11eb-9cee-48e1d3076041.PNG) 11 | -------------------------------------------------------------------------------- /Stop-Watch/Stop_Watch.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from PIL import ImageTk, Image 3 | 4 | 5 | ''' 6 | Before running this program,download or install 7 | ---pip install pillow 8 | ---install Image 9 | ''' 10 | 11 | 12 | 13 | state=False 14 | #----Windows--- 15 | win=Tk() 16 | win.title("StopWatch") 17 | win.geometry("650x550") 18 | win.resizable(False,False) 19 | win.config(bg="#ffc299") 20 | win.iconbitmap(r'Alarm.ico') 21 | 22 | 23 | #---initialize--- 24 | second=0;min=0;hour=0 25 | 26 | 27 | #---Exist--- 28 | def exit(): 29 | win.destroy() 30 | 31 | 32 | def update_time(): 33 | if (state): 34 | global second,min,hour 35 | 36 | second+=1 37 | 38 | 39 | #---60second=1minute 40 | 41 | if (second>=60): 42 | min+=1 43 | second=0 44 | 45 | #---60minute=1hour 46 | 47 | if(min>=60): 48 | hour+=1 49 | min=0 50 | 51 | #---Update Current Time--- 52 | 53 | la.configure(text='%ih:%im:%is'%(hour,min,second)) 54 | 55 | #it acts similar to time.sleep (but in milliseconds instead of seconds) 56 | 57 | win.after(1000,update_time) 58 | 59 | 60 | def start(): 61 | global state 62 | state=True 63 | 64 | 65 | 66 | def stop(): 67 | global state 68 | state=False 69 | 70 | 71 | 72 | def reset(): 73 | 74 | global second,min,hour 75 | second=0 76 | min=0 77 | hour=0 78 | la.configure(text='%ih:%im:%is'%(hour,min,second)) 79 | 80 | 81 | 82 | #---Title--- 83 | 84 | tymer=Label(win,text="StopWatch",bg="#ffc299",fg="#6fdc6f",font=("Times new roman",30,"bold")) 85 | tymer.place(x=230,y=10) 86 | 87 | 88 | 89 | #---Image--- 90 | img=Image.open("C:\\Users\\saira\\Desktop\\Stop_Watch\\tomato.png") #---Image.open(filename) filename of the photo 91 | img=img.resize((500,340)) 92 | io=ImageTk.PhotoImage(img) 93 | 94 | #----Time---- 95 | la=Label(win,text='%ih:%im:%is'%(hour,min,second),image=io,bg="#ffc299",fg="white",compound="center",font=("Arial",35,"")) 96 | la.place(y=90,x=80) 97 | 98 | 99 | #---Button---- 100 | 101 | b1=Button(win,text="Start",width=12,height=1,font=("Arial",13,""),bg="#fff0e6",command=start) 102 | b1.place(x=50,y=420) 103 | 104 | b2=Button(win,text="Reset",width=12,height=1,font=("Arial",13,""),bg="#fff0e6",command=reset) 105 | b2.place(x=450,y=421) 106 | 107 | b3=Button(win,text="Stop",width=12,height=1,font=("Arial",13,""),bg="#fff0e6",command=stop) 108 | b3.place(x=172,y=480) 109 | 110 | b4=Button(win,text="Exit",width=12,height=1,font=("Arial",13,""),bg="#fff0e6",command=exit) 111 | b4.place(x=340,y=480) 112 | 113 | #---update time-- 114 | update_time() 115 | 116 | win.mainloop() -------------------------------------------------------------------------------- /Stop-Watch/tomato.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Stop-Watch/tomato.png -------------------------------------------------------------------------------- /Sudoku_Solver.py: -------------------------------------------------------------------------------- 1 | board = [ 2 | [7, 8, 0, 4, 0, 0, 1, 2, 0], 3 | [6, 0, 0, 0, 7, 5, 0, 0, 9], 4 | [0, 0, 0, 6, 0, 1, 0, 7, 8], 5 | [0, 0, 7, 0, 4, 0, 2, 6, 0], 6 | [0, 0, 1, 0, 5, 0, 9, 3, 0], 7 | [9, 0, 4, 0, 6, 0, 0, 0, 5], 8 | [0, 7, 0, 3, 0, 0, 0, 1, 2], 9 | [1, 2, 0, 0, 0, 7, 4, 0, 0], 10 | [0, 4, 9, 2, 0, 6, 0, 0, 7], 11 | ] 12 | 13 | 14 | def solve(bo): 15 | find = find_empty(bo) 16 | if not find: 17 | return True 18 | else: 19 | row, col = find #Unpacking 20 | 21 | for i in range(1, 10): 22 | if valid(bo, i, (row, col)): 23 | bo[row][col] = i 24 | 25 | if solve(bo): 26 | return True 27 | 28 | bo[row][col] = 0 29 | 30 | return False 31 | 32 | 33 | def valid(bo, num, pos): #pos = (i, j) 34 | 35 | # Check Row 36 | for i in range(len(bo[0])): 37 | if bo[pos[0]][i] == num and pos[1] != i: 38 | return False 39 | 40 | #Check column 41 | for i in range(len(bo[0])): 42 | if bo[i][pos[1]] == num and pos[0] != i: 43 | return False 44 | 45 | #Check in a box 46 | box_x = pos[1] // 3 47 | box_y = pos[0] // 3 48 | 49 | for i in range(box_y * 3, box_y * 3 + 3): 50 | for j in range(box_x * 3, box_x * 3 + 3): 51 | if bo[i][j] == num and (i, j) != pos: 52 | return False 53 | 54 | return True 55 | 56 | 57 | def print_board(bo): 58 | 59 | for i in range(len(bo)): 60 | if i % 3 == 0 and i != 0: 61 | print("- " * 10) 62 | 63 | for j in range(len(bo)): 64 | if j % 3 == 0 and j != 0: 65 | print("|", end="") 66 | 67 | if j == 8: 68 | print(bo[i][j]) 69 | 70 | else: 71 | print(str(bo[i][j]) + " ", end="") 72 | 73 | 74 | def find_empty(bo): 75 | for i in range(len(bo)): 76 | for j in range(len(bo[0])): 77 | if bo[i][j] == 0: 78 | return (i, j) 79 | 80 | return None 81 | 82 | print_board(board) 83 | solve(board) 84 | print("*"*20) 85 | print() 86 | print("Solved Sudoku Board:") 87 | print() 88 | print("*"*20) 89 | print_board(board) -------------------------------------------------------------------------------- /Voice Bot/README.md: -------------------------------------------------------------------------------- 1 | # Voice-Bot 2 | 3 | 4 | A simple Python based Voice Bot. Voice bot can speak and interact with user through the voice. If you ask a random question, the bot will answer to your question :robot: 5 | 6 | 7 | 8 | # Some list that Voice Bot will answer 9 | 10 | - [x] Current time & date 11 | - [x] Google Search 12 | - [x] Location Map 13 | - [x] Wikipedia Result 14 | - [x] Weather of any city 15 | - [x] Covid-19 statistics of any country 16 | - [x] Add to-do-list 17 | - [x] Set Time 18 | 19 | 20 | # How to run 21 | 22 | **Before running this program,download or install:** 23 | 24 | - pip install pillow 25 | - pip install SpeechRecognition 26 | - pip install pipwin 27 | - pipwin install pyaudio 28 | - pip install gTTS 29 | - pip install requests 30 | - pip install bs4 31 | - pip install playsound 32 | 33 | `This program requires internet connection.` 34 | 35 | 36 | 37 | # Screenshot 38 | 39 | 40 | ![bot1](https://user-images.githubusercontent.com/52861859/115128964-654fb280-a003-11eb-9a0f-e5c7073b00bf.PNG) ![bot2](https://user-images.githubusercontent.com/52861859/115128966-67b20c80-a003-11eb-97fe-bd2f9f4de051.PNG) 41 | 42 | -------------------------------------------------------------------------------- /Voice Bot/VoiceBot.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import colorchooser 3 | from PIL import ImageTk,Image 4 | import speech_recognition as sp 5 | from time import ctime 6 | import webbrowser 7 | import playsound 8 | import os 9 | import random 10 | from gtts import gTTS 11 | import time 12 | import requests 13 | import bs4 14 | from tkinter import messagebox 15 | 16 | 17 | 18 | #---Main Windows--- 19 | win=Tk() 20 | win.geometry('400x590+400+15') 21 | win.title("Pikachu VoiceBot") 22 | win.resizable(False,False) 23 | win.iconbitmap(r'chabot.ico') 24 | win.config(bg="#ececec") 25 | 26 | ''' 27 | Before running this program,download or install: 28 | 29 | pip install pillow 30 | pip install SpeechRecognition 31 | pip install pipwin 32 | pipwin install pyaudio 33 | pip install gTTS 34 | pip install requests 35 | pip install bs4 36 | pip install playsound 37 | 38 | ''' 39 | 40 | 41 | ''' 42 | This program requires internet connection. 43 | ''' 44 | 45 | 46 | #---Question--- 47 | tar1=['who made you', 'who created you'] 48 | tar2=['I was created by Pikachu.', 'Pikachu a cartoon'] 49 | question=['what is your name', 'who are you'] 50 | greetings = ['hey there', 'hello', 'hi', 'hai', 'hey'] 51 | how=['how are you', 'how are you doing'] 52 | tme=['what time is it now','time','tell me about time','current time','what is the time'] 53 | srch=['search','search in Google'] 54 | loc=['find location','location','open Google Map'] 55 | wikip=['Wikipedia','open Wikipidea','search on Wikipedia'] 56 | wther = ['tell me the weather', 'weather', 'what about the weather','the weather'] 57 | cov=['covid-19','covid','covid statistics','covid status'] 58 | tymr=['set time','set a time','timer','open timer'] 59 | to_do=['add item','add an item','add list'] 60 | ex = ['exit', 'close', 'close the program'] 61 | 62 | 63 | 64 | 65 | #--Enter Voice-Bot 66 | def chat_enter(): 67 | 68 | #---To recognize input from the microphone,use a recognizer class 69 | r = sp.Recognizer() 70 | 71 | #---Speech to Text 72 | def record_audio(ask=False): 73 | 74 | #---Set microphone to accept sound & PyAudio is required 75 | with sp.Microphone() as source: 76 | 77 | if ask: 78 | 79 | pikachu_speak(ask) 80 | 81 | 82 | #---record the source and save it into audio 83 | audio = r.record(source,duration=3) 84 | text = '' 85 | 86 | try: 87 | #---Audio into text 88 | text = r.recognize_google(audio) 89 | 90 | except sp.UnknownValueError: 91 | 92 | pikachu_speak("Sorry I did not get that") 93 | 94 | 95 | except sp.RequestError: 96 | 97 | pikachu_speak("Sorry, my speech service is down") 98 | #---Return The text file 99 | return text 100 | 101 | #---Text to Speech 102 | def pikachu_speak(audio_string): 103 | 104 | #---gTTS (Google Text-to-Speech) 105 | #---Convert the string into voice 106 | adio=gTTS(text=audio_string,lang='en') 107 | #---Returns a random integer number & randint() method 108 | ran=random.randint(1,10000000) 109 | #---Audio file name 110 | audio_file='audio-'+str(ran)+'.mp3' 111 | #---The voice save in the audio_file 112 | adio.save(audio_file) 113 | #---Play the audio file 114 | playsound.playsound(audio_file) 115 | #---Remove the audio file 116 | os.remove(audio_file) 117 | 118 | 119 | def respond(voice_or_text_data): 120 | 121 | print(voice_or_text_data) 122 | 123 | if voice_or_text_data in tar1: 124 | 125 | r_answer=random.choice(tar2) 126 | l1.config(text=r_answer) 127 | pikachu_speak(r_answer) 128 | 129 | elif voice_or_text_data in question : 130 | 131 | l1.config(text="My name is pikachu.\nI am a bot.I work for you") 132 | pikachu_speak("My name is pikachu. I am a bot. I work for you") 133 | 134 | elif voice_or_text_data in greetings: 135 | 136 | r_choice=random.choice(greetings) 137 | pikachu_speak(r_choice) 138 | l1.config(text=r_choice) 139 | 140 | elif voice_or_text_data in how: 141 | 142 | pikachu_speak("I am fine.Nice to talk with you") 143 | l1.config(text="I am fine.\nNice to talk with you") 144 | 145 | elif voice_or_text_data in tme: 146 | 147 | pikachu_speak("Current Local Time:") 148 | pikachu_speak(ctime()) 149 | l1.config(text="Current Local Time:\n" + ctime()) 150 | 151 | 152 | elif voice_or_text_data in srch: 153 | 154 | search = record_audio("what do you want to search for?") 155 | url = 'https://google.com/search?q=' + search 156 | #---The webbrowser module open() method will open default web browser with a given url 157 | webbrowser.get().open(url) 158 | pikachu_speak("here is search" + search) 159 | l1.config(text="Here is search:\n" + search) 160 | 161 | 162 | elif voice_or_text_data in loc: 163 | 164 | location = record_audio("Say the name of the location?") 165 | url = 'https://google.nl/maps/place/' + location + '/&' 166 | webbrowser.get().open(url) 167 | pikachu_speak("The location map: "+location) 168 | l1.config(text="The location map:\n"+location) 169 | 170 | elif voice_or_text_data in wikip: 171 | 172 | wiki=record_audio("what do you want to search in wikipedia?") 173 | url = 'https://en.wikipedia.org/wiki/=' + wiki 174 | webbrowser.get().open(url) 175 | l1.config(text="Here is wikipedia:\n" + wiki) 176 | pikachu_speak("Here is wikipedia " + wiki) 177 | 178 | 179 | 180 | elif voice_or_text_data in wther: 181 | 182 | location=record_audio("Say the name of the city:") 183 | link = "https://api.openweathermap.org/data/2.5/weather?q=" + location + "&appid=c4c80c6387c03dde649323ba4e878114" 184 | #--- get() method sends a GET request to the specified url. 185 | api_link = requests.get(link) 186 | api_data = api_link.json() 187 | 188 | 189 | 190 | if api_data['cod']=='404': 191 | 192 | pikachu_speak("Incorrect location name.Please check the location") 193 | l1.config(text="Incorrect location name.\nPlease check the location.") 194 | else: 195 | 196 | #---Store data 197 | #---Kelvin to celsius 198 | city = ((api_data['main']['temp']) - 273.15) 199 | weather = api_data['weather'][0]['description'] 200 | humadity = api_data['main']['humidity'] 201 | wind_speed = api_data['wind']['speed'] 202 | 203 | temp=float("{:.2f}".format(city)) 204 | 205 | l1.config(text="Location Name: "+location+"\nCurrent temperature is: "+str(temp)+" degree Celsius\nWeather forecast : " + weather+"\nHumidity : " +str( humadity)+" %\nWind speed : " + str(wind_speed) + "km/h",font=('calibri',12,'')) 206 | 207 | pikachu_speak("Current temperature is: "+str(temp)+" degree Celsius") 208 | pikachu_speak("Weather forecast: " + weather) 209 | pikachu_speak("Humidity: " +str( humadity)+" percentage") 210 | pikachu_speak("Wind speed: " + str(wind_speed) + 'kilometre per hour') 211 | 212 | elif voice_or_text_data in cov: 213 | 214 | country=record_audio("Which country?") 215 | url = "https://worldometers.info/coronavirus/country/"+country+"/" 216 | html_data = requests.get(url) 217 | web_scrap = bs4.BeautifulSoup(html_data.text,'html.parser') 218 | all_info = "" 219 | 220 | try: 221 | info = web_scrap.find("div",class_="content-inner").findAll("div",id="maincounter-wrap") 222 | 223 | for block in info: 224 | h1 = block.find("h1",class_=None).get_text() 225 | span = block.find("span",class_=None).get_text() 226 | all_info = all_info + h1 + " " + span + "\n" 227 | pikachu_speak("Country name: "+country+"\n"+all_info) 228 | l1.config(text="Country name: "+country+"\n"+all_info) 229 | 230 | except: 231 | 232 | pikachu_speak("Country name is not found.") 233 | l1.config(text="Country name is not found.") 234 | 235 | elif voice_or_text_data in tymr: 236 | 237 | pikachu_speak("Here is Time counter. Set a time") 238 | l1.config(text="Here is Time counter. Set a time") 239 | 240 | #---Time Counter 241 | win1 = Toplevel(win) 242 | win1.title("Time Counter") 243 | win1.geometry("340x220+430+200") 244 | win1.resizable(False,False) 245 | win1.config(bg="#DAA520") 246 | 247 | def tim(): 248 | try: 249 | total_sec = int(hour.get())*3600+int(minute.get())*60+int(second.get()) 250 | except: 251 | messagebox.showerror("Error","Input the correct value") 252 | 253 | while total_sec >= 0: 254 | hours = 0 255 | # mins=total_sec/60; secs=total_sec%60 256 | mins,secs = divmod(total_sec,60) 257 | 258 | if mins > 60: 259 | # hours=total_sec/60 ;mins=total_sec%60 260 | hours,mins = divmod(total_sec,60) 261 | 262 | hour.set("{0:2d}".format(hours)) 263 | minute.set("{0:2d}".format(mins)) 264 | second.set("{0:2d}".format(secs)) 265 | 266 | win1.update() 267 | time.sleep(1) 268 | 269 | if (total_sec == 0): 270 | win2 = Toplevel(win) 271 | win2.title("Time Counter") 272 | win2.geometry("340x150+430+200") 273 | win2.resizable(False,False) 274 | win2.config(bg="#DAA520") 275 | 276 | def win_destroy(): 277 | win2.destroy() 278 | win1.destroy() 279 | 280 | la1 = Label(win2,text="Time's up",font=('calibri',30,'bold'),fg="#fe1a0e",bg="#DAA520") 281 | la1.place(x=90,y=8) 282 | 283 | but = Button(win2,text="OK",height=1,width=8,font=('veranda',10,''),command=win_destroy, 284 | bg="#F5DEB3") 285 | but.place(x=130,y=90) 286 | 287 | win2.mainloop() 288 | 289 | total_sec = total_sec - 1 290 | 291 | hour = StringVar() 292 | minute = StringVar() 293 | second = StringVar() 294 | 295 | hour.set("00") 296 | minute.set("00") 297 | second.set("00") 298 | 299 | h1 = Entry(win1,width=3,font=('Arial',30,''),textvariable=hour) 300 | h1.place(x=50,y=30) 301 | 302 | m1 = Entry(win1,width=3,font=('Arial',30,''),textvariable=minute) 303 | m1.place(x=140,y=30) 304 | 305 | s1 = Entry(win1,width=3,font=('Arial',30,''),textvariable=second) 306 | s1.place(x=230,y=30) 307 | 308 | buto = Button(win1,text="Set Time",height=1,width=8,font=('verandra',10,''),bg="#008080",bd=5,fg="white", 309 | command=tim) 310 | buto.place(x=130,y=130) 311 | 312 | win1.mainloop() 313 | 314 | elif voice_or_text_data in to_do: 315 | 316 | li=record_audio("What do you want to add in list?") 317 | pikachu_speak("Added. Here is List") 318 | l1.config(text="Added. Here is List") 319 | 320 | win1 = Toplevel(win) 321 | win1.title("To-Do-List") 322 | win1.geometry("340x220+430+200") 323 | win1.resizable(False,False) 324 | 325 | def delete(): 326 | selected_item = work.get(ACTIVE) 327 | work.delete(ACTIVE) 328 | 329 | if os.path.exists("To-Do-List.txt"): 330 | os.remove("To-Do-List.txt") 331 | 332 | fil = 'To-Do-List.txt' 333 | fi = open(fil,'a') 334 | cnt = 0 335 | 336 | for i in list1: 337 | if i == selected_item and cnt == 0: 338 | cnt = 1 339 | else: 340 | fi.write(i) 341 | 342 | fi.close() 343 | 344 | selected_item = "" 345 | list1 = [] 346 | 347 | scroll = Scrollbar(win1) 348 | scroll.place(x=323,y=0,height=218) 349 | 350 | work = Listbox(win1,yscrollcommand=scroll.set,bg="#DAA520") 351 | work.place(x=0,y=0,height=220,width=320) 352 | 353 | scroll.config(command=work.yview) 354 | 355 | de = Button(work,text="Delete",bg="#F5DEB3",command=delete) 356 | de.place(x=140,y=190) 357 | 358 | #--Add item in list & file 359 | file = 'To-Do-List.txt' 360 | file1 = open(file,'a') 361 | file1.write(li+ "\n") 362 | file1.close() 363 | 364 | f = open(file,"r") 365 | for i in f: 366 | work.insert(END,i) 367 | list1.append(i) 368 | 369 | f.close() 370 | 371 | win1.mainloop() 372 | 373 | elif voice_or_text_data in ex: 374 | 375 | pikachu_speak("Good Bye") 376 | win.destroy() 377 | 378 | else: 379 | 380 | pikachu_speak("I am a pikachu chatbot") 381 | l1.config(text="I am a pikachu chatbot.") 382 | 383 | 384 | def ri(): 385 | 386 | #---Take input from microphone 387 | voice_data = record_audio() 388 | #---Respond to the voice 389 | respond(voice_data) 390 | 391 | 392 | 393 | global cl 394 | global var 395 | color = "";bg_clr1="";mode = "";fg_clr1="";bg_clr2="";fg_clr2="";ac1="" 396 | select_value = var.get() 397 | 398 | if select_value == 1: 399 | color = "#262626";mode = "#808080";bg_clr1="#262626";fg_clr1="#C0C0C0";bg_clr2="#696969";fg_clr2="white";ac1="#d1d0c6" 400 | if select_value == 2: 401 | color = "#ececec";mode = "#C0C0C0";bg_clr1="#2E8B57";fg_clr1="#F8F8FF";bg_clr2="#625f3e";fg_clr2="white";ac1="#A3A18E" 402 | 403 | cnt = 0 404 | clp = "" 405 | try: 406 | for i in cl: 407 | cnt = cnt + 1 408 | if cnt == 2: 409 | clp = i 410 | except: 411 | print(" ") 412 | 413 | if clp != None and clp != "": 414 | color = clp 415 | 416 | frmi=Frame(bg=color) 417 | frmi.place(x=0,y=0,height=590,width=400) 418 | 419 | frm1=Frame(frmi,bg=color) 420 | frm1.place(x=0,y=0,height=500,width=400) 421 | 422 | frm2=Frame(frmi,bg=mode) 423 | frm2.place(x=0,y=500,height=90,width=400) 424 | 425 | if select_value==1: 426 | 427 | im=Image.open("setting.png") 428 | n=im.resize((48,48)) 429 | img=ImageTk.PhotoImage(n) 430 | bu=Button(frm2,command=dark,relief=FLAT,image=img) 431 | bu.image=img 432 | bu.place(x=360,y=28,height=30,width=30) 433 | 434 | im2 = Image.open("gramophone-record.png") 435 | n2 = im2.resize((60,60)) 436 | img2 = ImageTk.PhotoImage(n2) 437 | bu2 = Button(frm2,relief=RAISED,image=img2,command=ri,activebackground="#da3e3e",bg="#D3D3D3") 438 | bu2.image = img2 439 | bu2.place(x=70,y=20,height=50,width=250) 440 | 441 | elif select_value==2: 442 | 443 | im=Image.open("green-settings.png") 444 | n=im.resize((40,40)) 445 | img=ImageTk.PhotoImage(n) 446 | bu = Button(frm2,relief=FLAT,command=light,image=img) 447 | bu.image=img 448 | bu.place(x=360,y=28,height=30,width=30) 449 | 450 | im2 = Image.open("record.png") 451 | n2 = im2.resize((55,55)) 452 | img2 = ImageTk.PhotoImage(n2) 453 | bu2 = Button(frm2,relief=RAISED,image=img2,command=ri,activebackground="#F5DEB3",bg="#DAA520") 454 | bu2.image = img2 455 | bu2.place(x=70,y=20,height=50,width=250) 456 | 457 | i=Image.open("ot.png") 458 | po=i.resize((300,300)) 459 | image = ImageTk.PhotoImage(po) 460 | p = Label(frm1,image=image,bg=color) 461 | p.image = image 462 | p.place(x=50,y=10) 463 | 464 | l1 = Label(frm1,text="Result",bg="#FA8072",font=('calibri',15,'')) 465 | l1.place(x=50,y=340,height=130,width=300) 466 | 467 | 468 | #---Color Palette 469 | def color(): 470 | global cl 471 | cl = colorchooser.askcolor() 472 | 473 | 474 | #---Change into Light Mode 475 | def light(): 476 | 477 | fr1=Frame(win,bg="#ececec") 478 | fr1.place(x=0,y=0,width=400,height=590) 479 | 480 | #---Image Add 481 | image = ImageTk.PhotoImage(Image.open("chatbot-1.png")) 482 | p = Label(fr1,image=image) 483 | p.image=image 484 | p.place(x=-215,y=0) 485 | 486 | #---Welcome to pikachu chatbot 487 | la1 = Label(fr1,text="Welcome to Pikachu",font=('veranda',25,''),bg="#ececec") 488 | la1.place(x=50,y=310) 489 | 490 | la2 = Label(fr1,text="VoiceBot",font=('veranda',25,''),bg="#ececec") 491 | la2.place(x=130,y=360) 492 | 493 | #---Theme & Chat background 494 | la3 = Label(fr1,text="Theme",font=('calibri',11,''),bg="#ececec") 495 | la3.place(x=50,y=450) 496 | 497 | global var 498 | var = IntVar() 499 | var.set("2") 500 | r1 = Radiobutton(fr1,text="Dark",variable=var,value=1,bg="#ececec",command=dark) 501 | r1.place(x=190,y=450) 502 | r2 = Radiobutton(fr1,text="Light",variable=var,value=2,bg="#ececec",command=light) 503 | r2.place(x=290,y=450) 504 | 505 | 506 | la4 = Label(fr1,text="Background",font=('calibri',11,''),bg="#ececec") 507 | la4.place(x=50,y=490) 508 | but1 = Button(fr1,text="Pick Color",width=20,font=('calibri',10,''),bg="#878f84",fg="white",command=color) 509 | but1.place(x=190,y=490) 510 | 511 | #---Enter to the chat 512 | but2 = Button(fr1,text="Enter",width=10,font=('calibri',11,''),bg="#2E8B57",fg="white",command=chat_enter) 513 | but2.place(x=160,y=540) 514 | 515 | 516 | #---Change into Dark Mode 517 | def dark(): 518 | 519 | fr1 = Frame(win,bg="#262626") 520 | fr1.place(x=0,y=0,width=400,height=590) 521 | 522 | #---Image Add 523 | image = ImageTk.PhotoImage(Image.open("chatbot-2.jpg")) 524 | p = Label(fr1,image=image) 525 | p.image = image 526 | p.place(x=-215,y=0) 527 | 528 | #---Welcome to pikachu chatbot 529 | la1 = Label(fr1,text="Welcome to Pikachu",font=('veranda',25,''),bg="#262626",fg="#F5F5F5") 530 | la1.place(x=50,y=310) 531 | 532 | la2 = Label(fr1,text="VoiceBot",font=('veranda',25,''),bg="#262626",fg="#F5F5F5") 533 | la2.place(x=130,y=360) 534 | 535 | #---Theme & Chat background 536 | la3 = Label(fr1,text="Theme",font=('calibri',11,''),bg="#262626",fg="#F5F5F5") 537 | la3.place(x=50,y=450) 538 | 539 | global var 540 | var = IntVar() 541 | var.set("1") 542 | r1 = Radiobutton(fr1,text="Dark",variable=var,value=1,bg="#262626",fg="#F5F5F5",command=dark) 543 | r1.place(x=190,y=450) 544 | r2 = Radiobutton(fr1,text="Light",variable=var,value=2,bg="#262626",fg="#F5F5F5",command=light) 545 | r2.place(x=290,y=450) 546 | 547 | la4 = Label(fr1,text="Background",font=('calibri',11,''),bg="#262626",fg="#F5F5F5") 548 | la4.place(x=50,y=490) 549 | but1 = Button(fr1,text="Pick Color",width=20,font=('calibri',10,''),bg="#878f84",fg="white",command=color) 550 | but1.place(x=190,y=490) 551 | 552 | #---Enter to the chat 553 | but2 = Button(fr1,text="Enter",width=10,font=('calibri',11,''),bg="#2E8B57",fg="white",command=chat_enter) 554 | but2.place(x=160,y=540) 555 | 556 | 557 | light() 558 | win.mainloop() 559 | -------------------------------------------------------------------------------- /Voice Bot/chabot.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/chabot.ico -------------------------------------------------------------------------------- /Voice Bot/chatbot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/chatbot-1.png -------------------------------------------------------------------------------- /Voice Bot/chatbot-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/chatbot-2.jpg -------------------------------------------------------------------------------- /Voice Bot/gramophone-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/gramophone-record.png -------------------------------------------------------------------------------- /Voice Bot/green-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/green-settings.png -------------------------------------------------------------------------------- /Voice Bot/ot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/ot.png -------------------------------------------------------------------------------- /Voice Bot/record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/record.png -------------------------------------------------------------------------------- /Voice Bot/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rupam-Shil/python_projects/e1a8840feb2705c510d63e1e095ae6c77c88f895/Voice Bot/setting.png -------------------------------------------------------------------------------- /atm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import getpass 3 | import string 4 | import os 5 | 6 | # creatinga lists of users, their PINs and bank statements 7 | users = ['user', 'user2', 'user3'] 8 | pins = ['1234', '2222', '3333'] 9 | amounts = [1000, 2000, 3000] 10 | count = 0 11 | # while loop checks existance of the enterd username 12 | while True: 13 | user = input('\nENTER USER NAME: ') 14 | user = user.lower() 15 | if user in users: 16 | if user == users[0]: 17 | n = 0 18 | elif user == users[1]: 19 | n = 1 20 | else: 21 | n = 2 22 | break 23 | else: 24 | print('----------------') 25 | print('****************') 26 | print('INVALID USERNAME') 27 | print('****************') 28 | print('----------------') 29 | 30 | # comparing pin 31 | while count < 3: 32 | print('------------------') 33 | print('******************') 34 | pin = str(input('PLEASE ENTER PIN: ')) 35 | print('******************') 36 | print('------------------') 37 | if pin.isdigit(): 38 | if user == 'user1': 39 | if pin == pins[0]: 40 | break 41 | 42 | else: 43 | count += 1 44 | print('-----------') 45 | print('***********') 46 | print('INVALID PIN') 47 | print('***********') 48 | print('-----------') 49 | print() 50 | 51 | if user == 'user2': 52 | if pin == pins[1]: 53 | break 54 | else: 55 | count += 1 56 | print('-----------') 57 | print('***********') 58 | print('INVALID PIN') 59 | print('***********') 60 | print('-----------') 61 | print() 62 | 63 | if user == 'user3': 64 | if pin == pins[2]: 65 | break 66 | else: 67 | count += 1 68 | print('-----------') 69 | print('***********') 70 | print('INVALID PIN') 71 | print('***********') 72 | print('-----------') 73 | print() 74 | else: 75 | print('------------------------') 76 | print('************************') 77 | print('PIN CONSISTS OF 4 DIGITS') 78 | print('************************') 79 | print('------------------------') 80 | count += 1 81 | 82 | # in case of a valid pin- continuing, or exiting 83 | if count == 3: 84 | print('-----------------------------------') 85 | print('***********************************') 86 | print('3 UNSUCCESFUL PIN ATTEMPTS, EXITING') 87 | print('!!!!!YOUR CARD HAS BEEN LOCKED!!!!!') 88 | print('***********************************') 89 | print('-----------------------------------') 90 | exit() 91 | 92 | print('-------------------------') 93 | print('*************************') 94 | print('LOGIN SUCCESFUL, CONTINUE') 95 | print('*************************') 96 | print('-------------------------') 97 | print() 98 | print('--------------------------') 99 | print('**************************') 100 | print(str.capitalize(users[n]), 'welcome to ATM') 101 | print('**************************') 102 | print('----------ATM SYSTEM-----------') 103 | # Main menu 104 | while True: 105 | #os.system('clear') 106 | print('-------------------------------') 107 | print('*******************************') 108 | response = input('SELECT FROM FOLLOWING OPTIONS: \nStatement__(S) \nWithdraw___(W) \nLodgement__(L) \nChange PIN_(P) \nQuit_______(Q) \n: ').lower() 109 | print('*******************************') 110 | print('-------------------------------') 111 | valid_responses = ['s', 'w', 'l', 'p', 'q'] 112 | response = response.lower() 113 | if response == 's': 114 | print('---------------------------------------------') 115 | print('*********************************************') 116 | print(str.capitalize(users[n]), 'YOU HAVE ', amounts[n],'EURO ON YOUR ACCOUNT.') 117 | print('*********************************************') 118 | print('---------------------------------------------') 119 | 120 | elif response == 'w': 121 | print('---------------------------------------------') 122 | print('*********************************************') 123 | cash_out = int(input('ENTER AMOUNT YOU WOULD LIKE TO WITHDRAW: ')) 124 | print('*********************************************') 125 | print('---------------------------------------------') 126 | if cash_out%10 != 0: 127 | print('------------------------------------------------------') 128 | print('******************************************************') 129 | print('AMOUNT YOU WANT TO WITHDRAW MUST TO MATCH 10 EURO NOTES') 130 | print('******************************************************') 131 | print('------------------------------------------------------') 132 | elif cash_out > amounts[n]: 133 | print('-----------------------------') 134 | print('*****************************') 135 | print('YOU HAVE INSUFFICIENT BALANCE') 136 | print('*****************************') 137 | print('-----------------------------') 138 | else: 139 | amounts[n] = amounts[n] - cash_out 140 | print('-----------------------------------') 141 | print('***********************************') 142 | print('YOUR NEW BALANCE IS: ', amounts[n], 'EURO') 143 | print('***********************************') 144 | print('-----------------------------------') 145 | 146 | elif response == 'l': 147 | print() 148 | print('---------------------------------------------') 149 | print('*********************************************') 150 | cash_in = int(input('ENTER AMOUNT YOU WANT TO LODGE: ')) 151 | print('*********************************************') 152 | print('---------------------------------------------') 153 | print() 154 | if cash_in%10 != 0: 155 | print('----------------------------------------------------') 156 | print('****************************************************') 157 | print('AMOUNT YOU WANT TO LODGE MUST TO MATCH 10 EURO NOTES') 158 | print('****************************************************') 159 | print('----------------------------------------------------') 160 | else: 161 | amounts[n] = amounts[n] + cash_in 162 | print('----------------------------------------') 163 | print('****************************************') 164 | print('YOUR NEW BALANCE IS: ', amounts[n], 'EURO') 165 | print('****************************************') 166 | print('----------------------------------------') 167 | elif response == 'p': 168 | print('-----------------------------') 169 | print('*****************************') 170 | new_pin = str(getpass.getpass('ENTER A NEW PIN: ')) 171 | print('*****************************') 172 | print('-----------------------------') 173 | if new_pin.isdigit() and new_pin != pins[n] and len(new_pin) == 4: 174 | print('------------------') 175 | print('******************') 176 | new_ppin = str(getpass.getpass('CONFIRM NEW PIN: ')) 177 | print('*******************') 178 | print('-------------------') 179 | if new_ppin != new_pin: 180 | print('------------') 181 | print('************') 182 | print('PIN MISMATCH') 183 | print('************') 184 | print('------------') 185 | else: 186 | pins[n] = new_pin 187 | print('NEW PIN SAVED') 188 | else: 189 | print('-------------------------------------') 190 | print('*************************************') 191 | print(' NEW PIN MUST CONSIST OF 4 DIGITS \nAND MUST BE DIFFERENT TO PREVIOUS PIN') 192 | print('*************************************') 193 | print('-------------------------------------') 194 | elif response == 'q': 195 | exit() 196 | else: 197 | print('------------------') 198 | print('******************') 199 | print('RESPONSE NOT VALID') 200 | print('******************') 201 | print('------------------') 202 | -------------------------------------------------------------------------------- /chatbot.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | root = Tk() 4 | root.title('MLBACKBENCHERS SIMPLE CHATBOT') 5 | 6 | def send(): 7 | send = "You:"+ e.get() 8 | text.insert(END,"\n" + send) 9 | if(e.get()=='hi'): 10 | text.insert(END, "\n" + "Bot: hello") 11 | elif(e.get()=='hello'): 12 | text.insert(END, "\n" + "Bot: hi") 13 | elif (e.get() == 'how are you?'): 14 | text.insert(END, "\n" + "Bot: i'm fine and you?") 15 | elif (e.get() == "i'm fine too"): 16 | text.insert(END, "\n" + "Bot: nice to hear that") 17 | elif (e.get() == "do you know me?"): 18 | text.insert(END, "\n" + "Bot: yes you are in instagram as MLBACKBENCHERS") 19 | else: 20 | text.insert(END, "\n" + "Bot: Sorry I didnt get it.") 21 | text = Text(root,bg='light blue') 22 | text.grid(row=0,column=0,columnspan=2) 23 | e = Entry(root,width=80) 24 | send = Button(root,text='Send',bg='blue',width=20,command=send).grid(row=1,column=1) 25 | e.grid(row=1,column=0) 26 | 27 | root.mainloop() 28 | -------------------------------------------------------------------------------- /forensic/dban.py: -------------------------------------------------------------------------------- 1 | import sqlite3 2 | import os 3 | from sys import argv 4 | from colorama import Fore, Style, init 5 | #import textwrap ~ Almost crap..wraps on words and not char..bugs 6 | 7 | def help(): 8 | help_string = f"""\n Welcome To Database Analysis! (Version: 1.0)\n\t\t ~ Made by Md Zidan Khan\n{"-".ljust(46, "-")} 9 | \n Help \n-----------\n\nSyntax:\n\t\tdban.py [-h] 10 | \t\tdban.py [-d] [-s] 11 | \t\tdban.py [-d] [-t] [-hd]
[-id] [-w] [-o] [-l] 12 | \nDetails: 13 | \t1. Database [-d]: 14 | \t\t[+] You MUST provide the complete path to the database inside quotation marks ("") 15 | \t\tExample: 16 | \t\t\tdban.py -d "C:\..\example.db" 17 | \n\t2. Structure [-s]: 18 | \t\t[+] It doesNOT take any arguments. 19 | \t\t[+] It is used to show the Table Names of the database and their corresponding Headers (or columns) 20 | \n\t3. Table [-t]: 21 | \t\t[+] It only takes the table name as argument 22 | \t\t[+] If you don't know the table name, feel free to see the structure of the table using the following syntax: 23 | \t\t\tdban.py [-d] [-s] 24 | \n\t4. Table Header [-hd]: 25 | \t\t[+] It only takes the table header (or column) as argument 26 | \t\t[+] If you don't know the table header, feel free to see the structure of the table using the following syntax: 27 | \t\t\tdban.py [-d] [-s] 28 | \t\t[+] You may provide several table headers seperated by a comma (,) 29 | \t\tExample: 30 | \t\t\tdban.py -d "C:\..\example.db" -t example -hd name,value 31 | \n\t5. Rowid [-id]: 32 | \t\t[+] It MUST be an integer value 33 | \t\t[+] Decimals or anything else are NOT accepted 34 | \t\t[+] You may provide several rowid seperated by a comma (,) 35 | \t\tExample: 36 | \t\t\tdban.py -d "C:\..\example.db" -t example -id 6780,690 37 | \t\t\tdban.py -d "C:\..\example.db" -t example -hd name,value -id 320,6780 38 | \n\t6. Where [-w]: 39 | \t\t[+] It utilizes the "WHERE" clause of sqlite3 and so provides the same functionality 40 | \t\t[+] You can provide several conditions through this argument seperated by ",AND" or ",OR" 41 | \t\t[+] ",AND" is the same as "AND" in WHERE clause of sqlite3 42 | \t\t[+] ",OR" is the same as "OR" in WHERE clause of sqlite3 43 | \t\t[-] Can't handle argument when both ",AND" and ",OR" are present. 44 | \t\t[+] This will be fixed soon 45 | \t\t[+] Please give the "where" argument inside quotation marks 46 | \t\tExample: 47 | \t\t\tdban.py -d "C:\..\example.db" -t example -w "name=don" 48 | \t\t\tdban.py -d "C:\..\example.db" -t example -w "name=don,ANDaddress=bangladesh,ANDrowid>=50" 49 | \t\t\tdban.py -d "C:\..\example.db" -t example -hd name,value -w "value<60,ORname=joe" 50 | \n\t7. Order By [-o]: 51 | \t\t[+] It is the only option that takes 2 arguments 52 | \t\t[+] 1st argument is the table header based on which the datas will be ordered by 53 | \t\t[+] 2nd argument determines whether order will be done in ascending or descending 54 | \t\t[+] 2nd argument ONLY takes "asc" or "desc" as arguments regardless of them being in lowercase or uppercase or mixed 55 | \t\tExample: 56 | \t\t\tdban.py -d "C:\..\example.db" -t example -o name asc 57 | \t\t\tdban.py -d "C:\..\example.db" -t example -o name desc 58 | \t\t\tdban.py -d "C:\..\example.db" -t example -o name DesC 59 | \n\t8. Limit [-l]: 60 | \t\t[+] It MUST be an integer value 61 | \t\t[+] It always comes in the last option 62 | \t\tExample: 63 | \t\t\tdban.py -d "C:\..\example.db" -t example -l 100 64 | \t\t\tdban.py -d "C:\..\example.db" -t example -hd name -w "nameLIKE%john%" -l 100 65 | """ 66 | print(help_string) 67 | 68 | def more_h(): 69 | print(f"[+] For more info, type \"dban.py -h\" or simply \"dban.py\"") 70 | exit(0) 71 | 72 | def struc_an(database): 73 | conn = sqlite3.connect(database) 74 | c = conn.cursor() 75 | 76 | # Enables coloring in windows 77 | init(convert = True) 78 | 79 | # list all the tables 80 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 81 | 82 | table_names = c.fetchall() 83 | print("\nTables\n---------------") 84 | for table_name in table_names: 85 | # table_name is a tuple 86 | print(Fore.GREEN + table_name[0] + Style.RESET_ALL) 87 | 88 | if table_name[0]: 89 | # selects all the data from table 90 | c.execute(f"SELECT * FROM {table_name[0]}") 91 | 92 | # print each row in the table 93 | rows = c.description 94 | space = " " 95 | for row in rows: 96 | print(Fore.CYAN + space * 20 + row[0] + Style.RESET_ALL) # prints the tuple 97 | c.close() 98 | 99 | 100 | 101 | def db_fetch_handler(db, table, header, rowid, where, order_by, limit): 102 | conn = sqlite3.connect(db) 103 | c = conn.cursor() 104 | 105 | if (table != "") and (header == "") and (rowid == ""): 106 | if where == "": 107 | if order_by == "": 108 | # Fetches full table WITH LIMIT 109 | if limit != "": 110 | c.execute(f"SELECT rowid, * FROM {table} LIMIT {limit}") 111 | # Fetches FULL TABLE 112 | else: 113 | c.execute(f"SELECT rowid, * FROM {table}") # default order by 114 | 115 | # Fetches full table IN ORDER WITH LIMIT 116 | elif order_by != "": 117 | property_name = order_by[0] 118 | asc_desc = order_by[1] 119 | if limit != "": 120 | c.execute(f"SELECT rowid, * FROM {table} ORDER BY {property_name} {asc_desc} LIMIT {limit}") 121 | 122 | # Fetches full table IN ORDER 123 | else: 124 | c.execute(f"SELECT rowid, * FROM {table} ORDER BY {property_name} {asc_desc}") 125 | elif where != "": 126 | where = where_handler(db, table, where) 127 | if order_by == "": 128 | # Fetches rows IN CONDITION WITH LIMIT 129 | if limit != "": 130 | c.execute(f"SELECT rowid, * FROM {table} WHERE {where} LIMIT {limit}") 131 | # Fetches rows IN CONDITION 132 | else: 133 | c.execute(f"SELECT rowid, * FROM {table} WHERE {where}") # default order by 134 | 135 | # Fetches rows IN CONDITION IN ORDER WITH LIMIT 136 | elif order_by != "": 137 | property_name = order_by[0] 138 | asc_desc = order_by[1] 139 | if limit != "": 140 | c.execute(f"SELECT rowid, * FROM {table} WHERE {where} ORDER BY {property_name} {asc_desc} LIMIT {limit}") 141 | 142 | # Fetches rows IN CONDITION IN ORDER 143 | else: 144 | c.execute(f"SELECT rowid, * FROM {table} WHERE {where} ORDER BY {property_name} {asc_desc}") 145 | 146 | 147 | # print the headers 148 | headers = c.description 149 | header_format = "" 150 | for header in headers: 151 | if header[0] == "rowid": 152 | header_format += header[0].ljust(10) 153 | else: 154 | header_format += header[0].ljust(50) 155 | print(header_format) 156 | underscore = "-" 157 | print(underscore.ljust(10+50*(len(headers)-1), "-")) 158 | 159 | # print the description or values of headers 160 | all_table_info = c.fetchall() 161 | for column in all_table_info: 162 | i = 0 163 | column_format = "" 164 | while i < len(column): 165 | if len(str(column[i])) > 48: 166 | if i == len(column) - 1: 167 | item = str(column[i]) 168 | else: 169 | item = str(column[i])[:44] + " [..] " 170 | else: 171 | item = str(column[i]) 172 | if i == 0: 173 | column_format = column_format + item.ljust(10) 174 | else: 175 | column_format = column_format + item.ljust(50) 176 | i += 1 177 | print(column_format) 178 | 179 | 180 | # Fetches a header or column from the table 181 | elif (table != "") and (header != "") and (rowid == ""): 182 | if where == "": 183 | if order_by == "": 184 | # Fetches full column WITH LIMIT 185 | if limit != "": 186 | c.execute(f"SELECT rowid, {header} FROM {table} LIMIT {limit}") 187 | # Fetches FULL HEADER/COLUMN 188 | else: 189 | c.execute(f"SELECT rowid, {header} FROM {table}") # default order by 190 | 191 | # Fetches a column IN ORDER WITH LIMIT 192 | elif order_by != "": 193 | property_name = order_by[0] 194 | asc_desc = order_by[1] 195 | if limit != "": 196 | c.execute(f"SELECT rowid, {header} FROM {table} ORDER BY {property_name} {asc_desc} LIMIT {limit}") 197 | # Fetches a column IN ORDER 198 | else: 199 | c.execute(f"SELECT rowid, {header} FROM {table} ORDER BY {property_name} {asc_desc}") 200 | elif where != "": 201 | where = where_handler(db, table, where) 202 | if order_by == "": 203 | # Fetches rows of headers WITH LIMIT 204 | if limit != "": 205 | c.execute(f"SELECT rowid, {header} FROM {table} WHERE {where} LIMIT {limit}") 206 | # Fetches rows of HEADER/COLUMN 207 | else: 208 | c.execute(f"SELECT rowid, {header} FROM {table} WHERE {where}") # default order by 209 | 210 | # Fetches rows of column IN ORDER WITH LIMIT 211 | elif order_by != "": 212 | property_name = order_by[0] 213 | asc_desc = order_by[1] 214 | if limit != "": 215 | c.execute(f"SELECT rowid, {header} FROM {table} WHERE {where} ORDER BY {property_name} {asc_desc} LIMIT {limit}") 216 | # Fetches rows of column IN ORDER 217 | else: 218 | c.execute(f"SELECT rowid, {header} FROM {table} WHERE {where} ORDER BY {property_name} {asc_desc}") 219 | 220 | # print the headers 221 | headers = c.description 222 | header_format = "" 223 | for header in headers: 224 | if header[0] == "rowid": 225 | header_format += header[0].ljust(10) 226 | else: 227 | header_format += header[0].ljust(50) 228 | print(header_format) 229 | underscore = "-" 230 | print(underscore.ljust(10+50*(len(headers)-1), "-")) 231 | 232 | # print the description or values of headers 233 | fetched_info = c.fetchall() 234 | for r in fetched_info: 235 | i = 0 236 | r_format = "" 237 | while i < len(r): 238 | if len(str(r[i])) > 48: 239 | if i == len(r) - 1: 240 | item = str(r[i]) 241 | else: 242 | item = str(r[i])[:44] + " [..] " 243 | else: 244 | item = str(r[i]) 245 | if i == 0: 246 | r_format = r_format + item.ljust(10) 247 | else: 248 | r_format = r_format + item.ljust(50) 249 | i += 1 250 | print(r_format) 251 | 252 | # Fetches a rowid from the table 253 | elif (table != "") and (header == "") and (rowid != ""): 254 | rowids = rowid.split(",") 255 | #row_id = "" 256 | for row_id in rowids: 257 | # Rowid checker 258 | try: 259 | int(row_id) 260 | except: 261 | print(f"[-] \"{row_id}\" is NOT valid!") 262 | print("[-] Please provide a valid rowid") 263 | more_h() 264 | if row_id == rowids[0]: 265 | r = f"rowid = {row_id}" 266 | else: 267 | r += f" OR rowid = {row_id}" 268 | c.execute(f"SELECT rowid, * FROM {table} WHERE {r}") 269 | 270 | # print the headers 271 | headers = c.description 272 | header_format = "" 273 | for header in headers: 274 | if header[0] == "rowid": 275 | header_format += header[0].ljust(10) 276 | else: 277 | header_format += header[0].ljust(50) 278 | print(header_format) 279 | underscore = "-" 280 | print(underscore.ljust(10+50*(len(headers)-1), "-")) 281 | 282 | # print the description or values of headers 283 | all_table_info = c.fetchall() 284 | for column in all_table_info: 285 | i = 0 286 | column_format = "" 287 | while i < len(column): 288 | if len(str(column[i])) > 48: 289 | if i == len(column) - 1: 290 | item = str(column[i]) 291 | else: 292 | item = str(column[i])[:44] + " [..] " 293 | else: 294 | item = str(column[i]) 295 | if i == 0: 296 | column_format = column_format + item.ljust(10) 297 | else: 298 | column_format = column_format + item.ljust(50) 299 | i += 1 300 | print(column_format) 301 | 302 | c.close() 303 | 304 | def arg_validator(database, table, hdr, order_by, limit): 305 | conn = sqlite3.connect(database) 306 | c = conn.cursor() 307 | 308 | table_matched = False 309 | order_by_0 = False 310 | hdr_matched = 0 311 | 312 | # Table Name checker 313 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") # list all the tables 314 | 315 | table_names = c.fetchall() 316 | for table_name in table_names: 317 | if table == table_name[0]: 318 | table_matched = True 319 | if table_matched == False: 320 | print("[-] No such table Found!") 321 | more_h() 322 | 323 | # Header checker 324 | if hdr != "": 325 | hdr = hdr.split(",") 326 | hdr_len = len(hdr) 327 | c.execute(f"SELECT rowid, * FROM {table}") 328 | headers = c.description 329 | for header in headers: 330 | for i in hdr: 331 | if i == header[0]: 332 | hdr_matched += 1 333 | if hdr_matched != hdr_len: 334 | print("[-] No such column exists!") 335 | more_h() 336 | 337 | # Order Checker 338 | if order_by != "": 339 | c.execute(f"SELECT rowid, * FROM {table}") 340 | headers = c.description 341 | for header in headers: 342 | if order_by[0] == header[0]: 343 | order_by_0 = True 344 | if order_by_0 == False: 345 | print("[-] No such column exists!") 346 | more_h() 347 | 348 | if (order_by[1].lower() == "asc") or (order_by[1].lower() == "desc"): 349 | pass 350 | else: 351 | print("[-] Please type \"asc\" or \"desc\" as argument of order (regardless of small letter or captial letter)") 352 | more_h() 353 | 354 | # Limit Checker 355 | if limit != "": 356 | try: 357 | int(limit) 358 | except: 359 | print(f"[-] \"{limit}\" is NOT an integer!") 360 | print("[-] Please provide an integer value for limit.") 361 | more_h() 362 | 363 | c.close() 364 | 365 | 366 | def where_handler(db, table, where): 367 | conn = sqlite3.connect(db) 368 | c = conn.cursor() 369 | c.execute(f"SELECT rowid, * FROM {table}") 370 | headers = c.description 371 | 372 | where_math = False 373 | header_match = 0 374 | condi_splitter = "" 375 | splitter = "" 376 | where_clause = "" 377 | 378 | if ",AND" in where: 379 | condi_splitter = ",AND" 380 | elif ",OR" in where: 381 | condi_splitter = ",OR" 382 | else: 383 | if ">=" in where: 384 | splitter = ">=" 385 | where_math = True 386 | elif "<=" in where: 387 | splitter = "<=" 388 | where_math = True 389 | elif ">" in where: 390 | splitter = ">" 391 | where_math = True 392 | elif "<" in where: 393 | splitter = "<" 394 | where_math = True 395 | elif "=" in where: 396 | splitter = "=" 397 | elif "LIKE" in where: 398 | splitter = "LIKE" 399 | else: 400 | print("[-] Invalid WHERE Clause") 401 | c.close() 402 | more_h() 403 | condi_array = where.split(f"{splitter}") 404 | 405 | # Header Checker 406 | for header in headers: 407 | if condi_array[0] == header[0]: 408 | header_match = 1 409 | if header_match != 1: # Only 1 condition/tuple 410 | print("[-] No such column exists!") 411 | more_h() 412 | 413 | if where_math == False: 414 | condition_formatted = f"{condi_array[0]} {splitter} '{condi_array[1]}'" 415 | else: 416 | condition_formatted = f"{condi_array[0]} {splitter} {condi_array[1]}" 417 | c.close() 418 | return condition_formatted 419 | 420 | conditions = where.split(f"{condi_splitter}") 421 | for condition in conditions: 422 | if ">=" in condition: 423 | splitter = ">=" 424 | where_math = True 425 | elif "<=" in condition: 426 | splitter = "<=" 427 | where_math = True 428 | elif ">" in condition: 429 | splitter = ">" 430 | where_math = True 431 | elif "<" in condition: 432 | splitter = "<" 433 | where_math = True 434 | elif "=" in condition: 435 | splitter = "=" 436 | elif "LIKE" in condition: 437 | splitter = "LIKE" 438 | else: 439 | print("[-] Invalid WHERE Clause") 440 | c.close() 441 | more_h() 442 | 443 | condi_array = condition.split(f"{splitter}") 444 | 445 | # Header Checker 446 | for header in headers: 447 | if condi_array[0] == header[0]: 448 | header_match += 1 449 | 450 | if where_math == False: 451 | condition_formatted = f"{condi_array[0]} {splitter} '{condi_array[1]}'" 452 | else: 453 | condition_formatted = f"{condi_array[0]} {splitter} {condi_array[1]}" 454 | 455 | if condition == conditions[0]: 456 | where_clause = condition_formatted 457 | else: 458 | where_clause += f" {condi_splitter[1:]} {condition_formatted}" 459 | 460 | if header_match != len(conditions): 461 | print("[-] No such column exists!") 462 | more_h() 463 | c.close() 464 | return where_clause 465 | 466 | 467 | def main(): 468 | table = "" 469 | header = "" 470 | rowid = "" 471 | where = "" 472 | order_by = "" 473 | limit = "" 474 | 475 | # Help 476 | if len(argv) == 1: 477 | help() 478 | exit(0) 479 | 480 | # Help 481 | if argv[1] == "-h": 482 | help() 483 | exit(0) 484 | 485 | if len(argv) < 4: 486 | print("Error: arguments must be equal to or greater than 3") 487 | more_h() 488 | 489 | # database 490 | if argv[1] == "-d": 491 | database = argv[2] 492 | if os.path.isfile(database) == False: 493 | print("[-] database NOT Found!") 494 | more_h() 495 | 496 | # analyse the structue 497 | if argv[3] == "-s": 498 | struc_an(database) 499 | 500 | # Table 501 | elif argv[3] == "-t": 502 | try: 503 | table = argv[4] 504 | except: 505 | print("[-] Table Name cannot be empty...") 506 | more_h() 507 | arg_validator(database, table, header, order_by, limit) 508 | 509 | # Full table fetch 510 | if len(argv) == 5: 511 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 512 | 513 | elif len(argv) == 7: 514 | # Fetches a single row 515 | if argv[5] == "-id": 516 | rowid = argv[6] 517 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 518 | # Fetches full table WITH LIMIT 519 | elif argv[5] == "-l": 520 | limit = argv[6] 521 | arg_validator(database, table, header, order_by, limit) 522 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 523 | # Feteches A FULL header 524 | elif argv[5] == "-hd": 525 | header = argv[6] 526 | arg_validator(database, table, header, order_by, limit) 527 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 528 | # Fetches rows IN CONDITION 529 | elif argv[5] == "-w": 530 | where = argv[6] 531 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 532 | else: 533 | print("[-] Invalid Argument") 534 | more_h() 535 | 536 | elif len(argv) == 8: 537 | # Fetches full table IN ORDER 538 | if argv[5] == "-o": 539 | order_by = [argv[6], argv[7]] 540 | arg_validator(database, table, header, order_by, limit) 541 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 542 | else: 543 | print("[-] Invalid Argument") 544 | more_h() 545 | 546 | elif len(argv) == 9: 547 | # Fetches full header WITH LIMIT 548 | if argv[5] == "-hd": 549 | header = argv[6] 550 | if argv[7] == "-l": 551 | limit = argv[8] 552 | arg_validator(database, table, header, order_by, limit) 553 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 554 | # Fetches rows of header in Conditon 555 | elif argv[7] == "-w": 556 | where = argv[8] 557 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 558 | else: 559 | print("[-] Invalid Argument") 560 | more_h() 561 | # Fetches rows IN CONDITION WITH LIMIT 562 | elif argv[5] == "-w": 563 | where = argv[6] 564 | if argv[7] == "-l": 565 | limit = argv[8] 566 | arg_validator(database, table, header, order_by, limit) 567 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 568 | else: 569 | print("[-] Invalid Argument") 570 | more_h() 571 | else: 572 | print("[-] Invalid Argument") 573 | more_h() 574 | 575 | elif len(argv) == 10: 576 | # Feteches Full table IN ORDER WITH LIMIT 577 | if argv[5] == "-o": 578 | order_by = [argv[6], argv[7]] 579 | arg_validator(database, table, order_by, limit) 580 | if argv[8] == "-l": 581 | limit = argv[9] 582 | arg_validator(database, table, header, order_by, limit) 583 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 584 | else: 585 | print("[-] Invalid Argument") 586 | more_h() 587 | # Fetches a Full Header IN ORDER 588 | elif argv[5] == "-hd": 589 | header = argv[6] 590 | if argv[7] == "-o": 591 | order_by = [argv[8], argv[9]] 592 | arg_validator(database, table, header, order_by, limit) 593 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 594 | else: 595 | print("[-] Invalid Argument") 596 | more_h() 597 | # Fetches rows IN CONDITION IN ORDER 598 | elif argv[5] == "-w": 599 | where = argv[6] 600 | if argv[7] == "-o": 601 | order_by = [argv[8], argv[9]] 602 | arg_validator(database, table, header, order_by, limit) 603 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 604 | else: 605 | print("[-] Invalid Argument") 606 | more_h() 607 | else: 608 | print("[-] Invalid Argument") 609 | more_h() 610 | 611 | elif len(argv) == 11: 612 | # Fetches rows of headers IN CONDITION WITH LIMIT 613 | if argv[5] == "-hd": 614 | header = argv[6] 615 | if argv[7] == "-w": 616 | where = argv[8] 617 | if argv[9] == "-l": 618 | limit = argv[10] 619 | arg_validator(database, table, header, order_by, limit) 620 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 621 | else: 622 | print("[-] Invalid Argument") 623 | more_h() 624 | else: 625 | print("[-] Invalid Argument") 626 | more_h() 627 | else: 628 | print("[-] Invalid Argument") 629 | more_h() 630 | 631 | elif len(argv) == 12: 632 | # Fetches a Full Header IN ORDER WITH LIMIT 633 | if argv[5] == "-hd": 634 | header = argv[6] 635 | if argv[7] == "-o": 636 | order_by = [argv[8], argv[9]] 637 | arg_validator(database, table, header, order_by, limit) 638 | if argv[10] == "-l": 639 | limit = argv[11] 640 | arg_validator(database, table, header, order_by, limit) 641 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 642 | else: 643 | print("[-] Invalid Argument") 644 | more_h() 645 | # Fetches rows of header IN CONDITION IN ORDER 646 | elif argv[7] == "-w": 647 | where = argv[8] 648 | if argv[9] == "-o": 649 | order_by = [argv[10], argv[11]] 650 | arg_validator(database, table, header, order_by, limit) 651 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 652 | else: 653 | print("[-] Invalid Argument") 654 | more_h() 655 | else: 656 | print("[-] Invalid Argument") 657 | more_h() 658 | # Fetches rows IN CONDITION IN ORDER WITH LIMIT 659 | elif argv[5] == "-w": 660 | where = argv[6] 661 | if argv[7] == "-o": 662 | order_by = [argv[8], argv[9]] 663 | arg_validator(database, table, header, order_by, limit) 664 | if argv[10] == "-l": 665 | limit = argv[11] 666 | arg_validator(database, table, header, order_by, limit) 667 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 668 | else: 669 | print("[-] Invalid Argument") 670 | more_h() 671 | else: 672 | print("[-] Invalid Argument") 673 | more_h() 674 | else: 675 | print("[-] Invalid Argument") 676 | more_h() 677 | 678 | elif len(argv) == 14: 679 | # Fetches rows of headers IN CONDITION IN ONDER WITH LIMIT 680 | if argv[5] == "-hd": 681 | header = argv[6] 682 | if argv[7] == "-w": 683 | where = argv[8] 684 | if argv[9] == "-o": 685 | order_by = [argv[10], argv[11]] 686 | arg_validator(database, table, header, order_by, limit) 687 | if argv[12] == "-l": 688 | limit = argv[13] 689 | arg_validator(database, table, header, order_by, limit) 690 | db_fetch_handler(database, table, header, rowid, where, order_by, limit) 691 | else: 692 | print("[-] Invalid Argument") 693 | more_h() 694 | else: 695 | print("[-] Invalid Argument") 696 | more_h() 697 | else: 698 | print("[-] Invalid Argument") 699 | more_h() 700 | else: 701 | print("[-] Invalid Argument") 702 | more_h() 703 | 704 | else: 705 | print("[-] Invalid Argument") 706 | more_h() 707 | 708 | else: 709 | print("[-] Invalid Argument") 710 | more_h() 711 | 712 | 713 | if __name__ == "__main__": 714 | main() 715 | -------------------------------------------------------------------------------- /meet_bot.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver import ActionChains 3 | from selenium.webdriver.common.by import By 4 | from selenium.webdriver.chrome.options import Options 5 | from selenium.webdriver.support.ui import WebDriverWait as wait 6 | from selenium.webdriver.support import expected_conditions as EC 7 | from selenium.webdriver.common.keys import Keys 8 | import time 9 | import pause 10 | import pynput 11 | import os 12 | from pynput.keyboard import Key, Controller 13 | from datetime import datetime 14 | #######YEAR#MONTH#DAY#HOUR#MINUTE###### DO NOT PUT ZERO BEFORE A NUMBER 15 | # pause.until(datetime(2020, 3, 27, 11, 29)) 16 | # MAIL & PASSWORD (THE MAIL U WILL USE TO ENTER TO THE MEET) 17 | usernameStr = 'yourgmail' 18 | passwordStr = 'yourpasword' 19 | url_meet = 'https://meet.google.com/cku-wjgt-ram' 20 | options = webdriver.ChromeOptions() 21 | options.add_argument("--disable-infobars") 22 | options.add_argument("--window-size=800,600") 23 | options.add_experimental_option("prefs", { \ 24 | "profile.default_content_setting_values.media_stream_mic": 2, # 1:allow, 2:block 25 | "profile.default_content_setting_values.media_stream_camera": 2, 26 | "profile.default_content_setting_values.notifications": 2 27 | }) 28 | browser = webdriver.Chrome(chrome_options=options) 29 | browser.get(('https://accounts.google.com/ServiceLogin?' 30 | 'service=mail&continue=https://mail.google' 31 | '.com/mail/#identifier')) 32 | username = browser.find_element_by_id('identifierId') 33 | username.send_keys(usernameStr) 34 | nextButton = browser.find_element_by_id('identifierNext') 35 | nextButton.click() 36 | time.sleep(5) 37 | keyboard = Controller() 38 | #keyboard.type(passwordStr) 39 | password = browser.find_element_by_xpath("//input[@class='whsOnd zHQkBf']") 40 | password.send_keys(passwordStr) 41 | #keyboard.type(passwordStr) 42 | signInButton = browser.find_element_by_id('passwordNext') 43 | signInButton.click() 44 | time.sleep(3) 45 | browser.get(url_meet) 46 | time.sleep(6) 47 | element = browser.find_element_by_class_name('CwaK9') 48 | browser.execute_script("arguments[0].click();", element) 49 | browser.find_element_by_xpath("//span[@class='NPEfkd RveJvd snByac' and contains(text(), 'Ask to join')]").click() 50 | pause 51 | -------------------------------------------------------------------------------- /smart_calc.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | #MATH 4 | def add(a,b): 5 | return a + b 6 | 7 | def sub(a,b): 8 | return a - b 9 | 10 | def mul(a, b): 11 | try: 12 | return a * b 13 | except ZeroDivisionError: 14 | return "Can't divide with zero" 15 | 16 | def div(a, b): 17 | return a/b 18 | 19 | def mod(a, b): 20 | return a % b 21 | 22 | def lcm(a, b): 23 | L = a if a>b else b 24 | while L <=a*b: 25 | if L %a == 0 and L % b == 0: 26 | return L 27 | 28 | L+=1 29 | 30 | def hcf(a, b): 31 | H = a if a=1: 33 | if a % H == 0 and b % H==0: 34 | return H 35 | 36 | H -=1 37 | 38 | #CAlculate 39 | def extract_from_text(text): 40 | l = [] 41 | for t in text.split(' '): 42 | try: 43 | l.append(float(t)) 44 | except ValueError: 45 | pass 46 | return l 47 | 48 | def calculate(): 49 | text = textin.get() 50 | for word in text.split(' '): 51 | if word.upper() in operations.keys(): 52 | try: 53 | l = extract_from_text(text) 54 | r = operations[word.upper()](l[0],l[1]) 55 | lst.delete(0,END) 56 | lst.insert(END,"The answer is {}".format(r)) 57 | except: 58 | lst.delete(0,END) 59 | lst.insert(END,"SOMETHING WENT WRONG!\nPlease Enter Again") 60 | finally: 61 | break 62 | 63 | elif word.upper() not in operations.keys(): 64 | lst.delete(0,END) 65 | lst.insert(END,"OOPS!Seems like a new function that I didn't learned yet") 66 | 67 | 68 | #OPERATIONS 69 | operations = {"ADD":add, "ADDITION":add,"SUM":add,"PLUS": add, "SUB":sub,"DIFFERENCE": sub, "MINUS":sub,"SUBTRACT":sub,"LCM":lcm,"HCF":hcf,"PRODUCT":mul,"MULTIPLY":mul,"MUL":mul,"INTO":mul,"MULTIPLICATION":mul,"DIVISION":div,"DIVIDE":div,"DIV":div,"MOD":mod,"REMAINDER":mod,"MODULUS":mod} 70 | 71 | 72 | 73 | 74 | #FRONTEND 75 | win = Tk() 76 | win.geometry('500x300') 77 | win.title("MLBACKBENCHERS") 78 | win.configure(bg = "yellow") 79 | 80 | l1 = Label(win, text="Mlbackbencher Smart Calc.", width =25,padx = 3) 81 | l1.place(x=150, y = 10) 82 | 83 | l2 = Label(win, text="I am MLbot", width =20,padx = 3) 84 | l2.place(x=170, y = 40) 85 | 86 | l3 = Label(win, text="How can I help you?", width =25,padx = 3) 87 | l3.place(x=150, y = 100) 88 | 89 | textin = StringVar() 90 | e1 = Entry(win, width= 30, textvariable = textin) 91 | e1.place(x= 130,y=130) 92 | 93 | b1 = Button(win, text="Just This", command = calculate) 94 | b1.place(x=210, y = 160) 95 | 96 | lst = Listbox(win, width = 30,height = 3) 97 | lst.place(x = 130, y= 200) 98 | 99 | win.mainloop() 100 | -------------------------------------------------------------------------------- /tic_tac_toe.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | 3 | game = [[2, 0, 2], 4 | [2, 0, 0], 5 | [1, 1, 1], 6 | ] 7 | 8 | 9 | def win(current_game): 10 | def all_same(l): 11 | if l.count(l[0]) == len(l) and l[0] != 0: 12 | return True 13 | else: 14 | return False 15 | 16 | # Horizontal 17 | for row in game: 18 | print(row) 19 | if all_same(row): 20 | print("Player {} is the winner horizontally".format(row[0])) 21 | return True 22 | # diagoanal 23 | diags = [] 24 | for col, row in enumerate(reversed(range(len(game)))): 25 | diags.append(game[row][col]) 26 | if all_same(diags): 27 | print("Player {} is the winner diagonally".format(diags[0])) 28 | return True 29 | diags = [] 30 | for ix in range(len(game)): 31 | diags.append(game[ix][ix]) 32 | if all_same(diags): 33 | print("Player {} is the winner diagonally".format(diags[0])) 34 | return True 35 | 36 | # Vertical 37 | for col in range(len(game)): 38 | check = [] 39 | for row in game: 40 | check.append(row[col]) 41 | if all_same(check): 42 | print("Player {} is the winner vertically".format(check[0])) 43 | return True 44 | 45 | return False 46 | 47 | 48 | def game_board(game_map, player=0, row=0, column=0, just_display=False): 49 | try: 50 | if game_map[row][column] != 0: 51 | print("This position is occupied") 52 | return game_map, False 53 | print(" " + " ".join(str(i) for i in range(len(game_map)))) 54 | if not just_display: 55 | game_map[row][column] = player 56 | 57 | for index, row in enumerate(game_map): 58 | print(index, row) 59 | return game_map, True 60 | 61 | except IndexError as e: 62 | print("Something went wrong! Did you enter row/column as 0 or 2?", e) 63 | return game_map, False 64 | except Exception as e: 65 | print("Something went very wrong", e) 66 | return game_map, False 67 | 68 | 69 | play = True 70 | players = [1, 2] 71 | while play: 72 | game = [[0, 0, 0], 73 | [0, 0, 0], 74 | [0, 0, 0], 75 | ] 76 | game_won = False 77 | game, _ = game_board(game, just_display=True) 78 | player_choice = itertools.cycle([1, 2]) 79 | while not game_won: 80 | current_player = next(player_choice) 81 | print(f"Current Player is no: {current_player}") 82 | played = False 83 | 84 | while not played: 85 | column_choice = int(input('''What column you want play?(0,1,2): ''')) 86 | row_choice = int(input('''What row you want to play (0,1,2): ''')) 87 | game, played = game_board(game, 88 | current_player, 89 | row_choice, 90 | column_choice) 91 | 92 | if win(game): 93 | game_won = True 94 | again = input("""The game is over , would you like to play again(y/n)""") 95 | if again.casefold() == "y": 96 | print("restarting...") 97 | elif again.lower() == "n": 98 | print("Byee") 99 | play = False 100 | else: 101 | print("Not a valid answer,So see you later") 102 | 103 | # game = game_board(game, just_display=True) 104 | # game = game_board(game, player=1, row=10, column=1) 105 | # game = game_board(game, 2, 1, 2) 106 | -------------------------------------------------------------------------------- /wifi_scanner.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | from threading import Thread 3 | import pandas 4 | import time 5 | import os 6 | 7 | # initialize the networks dataframe that will contain all access points nearby 8 | networks = pandas.DataFrame(columns=["BSSID", "SSID", "dBm_Signal", "Channel", "Crypto"]) 9 | # set the index BSSID (MAC address of the AP) 10 | networks.set_index("BSSID", inplace=True) 11 | 12 | def callback(packet): 13 | if packet.haslayer(Dot11Beacon): 14 | # extract the MAC address of the network 15 | bssid = packet[Dot11].addr2 16 | # get the name of it 17 | ssid = packet[Dot11Elt].info.decode() 18 | try: 19 | dbm_signal = packet.dBm_AntSignal 20 | except: 21 | dbm_signal = "N/A" 22 | # extract network stats 23 | stats = packet[Dot11Beacon].network_stats() 24 | # get the channel of the AP 25 | channel = stats.get("channel") 26 | # get the crypto 27 | crypto = stats.get("crypto") 28 | networks.loc[bssid] = (ssid, dbm_signal, channel, crypto) 29 | 30 | 31 | def print_all(): 32 | while True: 33 | os.system("clear") 34 | print(networks) 35 | time.sleep(0.5) 36 | 37 | 38 | def change_channel(): 39 | ch = 1 40 | while True: 41 | os.system(f"iwconfig {interface} channel {ch}") 42 | # switch channel from 1 to 14 each 0.5s 43 | ch = ch % 14 + 1 44 | time.sleep(0.5) 45 | 46 | 47 | if __name__ == "__main__": 48 | # interface name, check using iwconfig 49 | interface = "wlan0mon" 50 | # start the thread that prints all the networks 51 | printer = Thread(target=print_all) 52 | printer.daemon = True 53 | printer.start() 54 | # start the channel changer 55 | channel_changer = Thread(target=change_channel) 56 | channel_changer.daemon = True 57 | channel_changer.start() 58 | # start sniffing 59 | sniff(prn=callback, iface=interface) 60 | --------------------------------------------------------------------------------