-
-
Save lasteminista/f988195c41a1c74f503806454f8c574b to your computer and use it in GitHub Desktop.
Port Scanner Code Snippet 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import tkinter as tk | |
from tkinter import ttk, font, scrolledtext | |
from ctypes import windll | |
class App(tk.Tk): | |
def __init__(self): | |
... | |
# Get default background | |
self.defaultbg = self.cget('bg') | |
... | |
# Get Target Value | |
def get_target(self): | |
try: | |
target = socket.gethostbyname(self.hostname.get()) | |
except socket.gaierror: | |
return False | |
except socket.error: | |
return False | |
except UnicodeError: | |
return False | |
else: | |
ttk.Label(self, text=" Scan target : " + target, background=self.defaultbg) \ | |
.grid(column=1, row=6, columnspan=3, sticky=tk.EW) | |
return target | |
if __name__ == "__main__": | |
app = App() | |
windll.shcore.SetProcessDpiAwareness(1) | |
app.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment