|
| 1 | +# import librery |
| 2 | +import os |
| 3 | +import socket |
| 4 | +from tkinter import Menu |
| 5 | +import tkinter as tk |
| 6 | +from tkinter.constants import DISABLED, HIDDEN, NORMAL |
| 7 | +# root is windows for Home(class: frame) |
| 8 | +root = tk.Tk() |
| 9 | +root.geometry("745x449+444+290") |
| 10 | +root.title("ip_tools") |
| 11 | +root.resizable(False, False) |
| 12 | +root.configure(background="black") |
| 13 | + |
| 14 | + |
| 15 | +class info1: |
| 16 | + def __init__(self): |
| 17 | + import os |
| 18 | + import tkinter as tk |
| 19 | + import time |
| 20 | + import webbrowser |
| 21 | + root_i = tk.Tk() |
| 22 | + root_i.geometry('400x400') |
| 23 | + root_i.title('info app ') |
| 24 | + root_i.resizable(False, False) |
| 25 | + root_i.configure(background='black') |
| 26 | + |
| 27 | + # var link |
| 28 | + link = 'https://github.com/RedAnonymusITA/ip-tools/releases/tag/v0.0.1' |
| 29 | + |
| 30 | + t = tk. Label(root_i, text=""" dev nikname: RDA(REDANONYMUS2) |
| 31 | + real name dev is : Pop Mario Denis |
| 32 | + leg : en |
| 33 | + cod : python |
| 34 | + os:for windows ,mac os and GUI/linux |
| 35 | + ver :ip_tools_gui_0.0.1 alpha |
| 36 | + req:python 3.0 or latest version (not python 2.0) |
| 37 | + original lenguage ip_tools: italy |
| 38 | + -------------------------------------- |
| 39 | + other software by rda |
| 40 | + ip_tools_0.0.1 for termux and cmd |
| 41 | + leg : en |
| 42 | + Os= windows,Mac and GUI/linux |
| 43 | + ip_tools_0.1.1 for termux and cmd |
| 44 | + leg= ita and en |
| 45 | + Os= windows,Mac and GUI/linux """, bg='black', fg='red') |
| 46 | + t.place(x=20, y=3) |
| 47 | + def other(): |
| 48 | + win_install = tk.Tk() |
| 49 | + win_install.geometry("500x200") |
| 50 | + win_install.resizable(False, False) |
| 51 | + win_install.configure(background="black") |
| 52 | + win_install.title("install_ip_tools for terminal and cmd ") |
| 53 | + |
| 54 | + def l_dow(): |
| 55 | + |
| 56 | + |
| 57 | + t2 =time.sleep(2) |
| 58 | + terminal = os.system('git clone https://github.com/RedAnonymusITA/ip-tools.git') |
| 59 | + win_start = tk.Tk() |
| 60 | + win_start.title('start-ip.sh execution permissions') |
| 61 | + win_start.geometry('400x300') |
| 62 | + txt4 = tk.Label(win_start,text='open folder cod/ip-tools double click start-ip.sh') |
| 63 | + txt4.place(x=7,y=100) |
| 64 | + |
| 65 | + |
| 66 | + def dow(): |
| 67 | + |
| 68 | + url2 = "https://github.com/RedAnonymusITA/ip-tools/releases/tag/v0.0.1" |
| 69 | + self.t = time.sleep(2) |
| 70 | + self.web = webbrowser.open(url2) |
| 71 | + bt_dow1 = tk.Button(win_install, text="download latest version",command=l_dow) |
| 72 | + bt_dow1.place(relx=0.220, rely=0.120, height=41, width=300) |
| 73 | + bt_dow1.configure(bg="red",fg='black',activebackground='black',activeforeground='red') |
| 74 | + bt_dow1.configure(relief='flat') |
| 75 | + |
| 76 | + |
| 77 | + bt_dow = tk.Button(win_install,text="download V0.0.1",command=dow) |
| 78 | + bt_dow.place(relx=0.220, rely=0.520, height=41, width=300) |
| 79 | + bt_dow.configure(bg="red",fg="black",activebackground='black',activeforeground='red') |
| 80 | + bt_dow.configure(relief='flat') |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + # buttun more |
| 85 | + self.bt_other = tk.Button(root_i, text='other ', command=other) |
| 86 | + self.bt_other.place(x=200, y=310) |
| 87 | + self.bt_other.configure(bg='red', fg='black', |
| 88 | + activebackground='black', activeforeground='red') |
| 89 | + self.bt_other.configure(borderwidth='3') |
| 90 | + self.bt_other.configure(relief='flat') |
| 91 | + |
| 92 | + |
| 93 | +class ip_web: |
| 94 | + def __init__(self): |
| 95 | + |
| 96 | + # tk root |
| 97 | + import os |
| 98 | + import time |
| 99 | + import socket |
| 100 | + import tkinter as tk |
| 101 | + import webbrowser |
| 102 | + |
| 103 | + root2 = tk.Tk() |
| 104 | + root2.geometry("600x450+444+290") |
| 105 | + root2.minsize(120, 1) |
| 106 | + root2.maxsize(1444, 881) |
| 107 | + root2.resizable(False, False) |
| 108 | + root2.title("web_ip") |
| 109 | + root2.configure(background="#000000") |
| 110 | + |
| 111 | + # text box |
| 112 | + textbox1 = tk.Entry(root2, bg='white', fg='black', borderwidth='1') |
| 113 | + textbox1.place(relx=0.270, rely=0.190, height=29, width=279) |
| 114 | + textbox1.configure(bg='black', fg='red') |
| 115 | + |
| 116 | + def help(): |
| 117 | + import tkinter as tk |
| 118 | + root6 = tk.Tk() |
| 119 | + root6.geometry('300x300') |
| 120 | + root6.title('HELP_WEBIP') |
| 121 | + root6.configure(bg='black') |
| 122 | + root6.resizable(False, False) |
| 123 | + t_h = tk.Label(root6, text=""" write hostname ex:pc99 |
| 124 | + write web ip ex:www.webname.com |
| 125 | + and localhost for localhost ip""") |
| 126 | + t_h.configure(fg='red') |
| 127 | + t_h.place(x=50, y=100) |
| 128 | + root.mainloop() |
| 129 | + |
| 130 | + def go1(): |
| 131 | + try: |
| 132 | + time.sleep(2) |
| 133 | + web_ip = socket.gethostbyname(textbox1.get()) |
| 134 | + res = tk.Label(root2, text=web_ip) |
| 135 | + res.place(x=260, y=200) |
| 136 | + res.configure(bg='black', fg='red') |
| 137 | + res.configure(font="-family {Segoe UI} -size 21 -weight bold") |
| 138 | + textbox1.configure(state=DISABLED) |
| 139 | + class dir1(): |
| 140 | + def __init__(self): |
| 141 | + |
| 142 | + win = tk.Tk() |
| 143 | + from tkinter import Menu |
| 144 | + win.geometry("500x300") |
| 145 | + win.title("SAVE FILE") |
| 146 | + win.resizable(False,False) |
| 147 | + win.configure(background='black') |
| 148 | + |
| 149 | + self.txt1 = tk.Label(win, text="WRITE FILE NAME : ") |
| 150 | + self.txt1.place(relx=0.220, rely=0.099) |
| 151 | + self.txt1.configure(bg='black',fg='red') |
| 152 | + self.filename = tk.Entry(win) |
| 153 | + self.filename.place(relx=0.220, rely=0.190, height=29, width=279) |
| 154 | + self.filename.configure(bg='black',fg='red') |
| 155 | + self.txt2 = tk.Label(win, text="WRITE FOLDER PATH : ") |
| 156 | + self.txt2.place(relx=0.220, rely=0.320) |
| 157 | + self.txt2.configure(bg='black',fg='red') |
| 158 | + self.folder = tk.Entry(win) |
| 159 | + self.folder.place(relx=0.220, rely=0.420, height=29, width=279) |
| 160 | + self.folder.configure(bg='black',fg='red') |
| 161 | + |
| 162 | + def help_save(): |
| 163 | + win2 = tk.Tk() |
| 164 | + win2.geometry("400x99") |
| 165 | + win2.resizable(False, False) |
| 166 | + win2.configure(background="black") |
| 167 | + win2.title("HELP") |
| 168 | + txt3 = tk.Label(win2, text="""example filename : my-web-ip.txt \n |
| 169 | + example folder path:/home/user-name/Desktop/""") |
| 170 | + txt3.place(x=4, y=3) |
| 171 | + txt3.configure(bg='black',fg='red' ) |
| 172 | + win2.mainloop() |
| 173 | + |
| 174 | + def save_file(): |
| 175 | + try: |
| 176 | + name = self.filename.get() |
| 177 | + src = self.folder.get() |
| 178 | + file=open(src+name,'w') |
| 179 | + file.write(web_ip) |
| 180 | + file.close() |
| 181 | + file_info = tk.Label(win,text='file saved in folder:') |
| 182 | + file_info2 =tk.Label(win, text=file) |
| 183 | + file_info.configure(bg='black',fg='red') |
| 184 | + file_info2.configure(bg='black',fg='red') |
| 185 | + file_info2.place(relx=0.489,rely=0.870,width=212) |
| 186 | + file_info.place(relx =0.220,rely=0.870,width=124) |
| 187 | + except: |
| 188 | + pass |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + self.bt_save1 = tk.Button(win, text="SAVE FILE",command=save_file) |
| 193 | + self.bt_save1.place(relx=0.220, rely=0.620, height=44, width=99) |
| 194 | + self.bt_save1.configure(bg='red',fg="black",activebackground='black',activeforeground="red") |
| 195 | + self.bt_save1.configure(relief='flat') |
| 196 | + |
| 197 | + self.bt_help = tk.Button(win, text="HELP", command=help_save) |
| 198 | + self.bt_help.place(relx=0.590, rely=0.620, height=44, width=99) |
| 199 | + self.bt_help.configure(bg='red',fg="black",activebackground='black',activeforeground="red") |
| 200 | + self.bt_help.configure(relief='flat') |
| 201 | + # ------------------------------------- |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + def save(): |
| 207 | + dir1() |
| 208 | + pass |
| 209 | + |
| 210 | + def reset(): |
| 211 | + res.destroy() |
| 212 | + bt_res.destroy() |
| 213 | + bt_save.destroy() |
| 214 | + open_browser.destroy() |
| 215 | + |
| 216 | + textbox1.configure(state=NORMAL) |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + pass |
| 223 | + |
| 224 | + def open_wb(): |
| 225 | + ip = str(web_ip) |
| 226 | + txt_ip =str("http://%s"%((ip))) |
| 227 | + web = webbrowser.open(txt_ip) |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + bt_res = tk.Button(root2, text="CLEAR", command=reset) |
| 238 | + bt_res.place(x=230, y=345) |
| 239 | + bt_res.configure( |
| 240 | + bg='red', fg='black', activeforeground='red', activebackground='black') |
| 241 | + bt_res.configure(relief='flat') |
| 242 | + |
| 243 | + bt_save = tk.Button(root2, text="SAVE FILE", command=save) |
| 244 | + bt_save.place(x=310, y=345) |
| 245 | + bt_save.configure(bg='red', fg='black', activeforeground='red', activebackground='black') |
| 246 | + bt_save.configure(relief='flat') |
| 247 | + open_browser= tk.Button(root2, text = ' open_browser',command=open_wb) |
| 248 | + open_browser.place(x=410, y=345) |
| 249 | + |
| 250 | + |
| 251 | + open_browser.configure(bg='red', fg='black', activeforeground='red', activebackground='black') |
| 252 | + open_browser.configure(relief='flat') |
| 253 | + |
| 254 | + |
| 255 | + |
| 256 | + except: |
| 257 | + print(' website or host not existing :(') |
| 258 | + # label res |
| 259 | + spa = tk.Label(root2, text=' ', |
| 260 | + bg='black').grid(row=1, column=8) |
| 261 | + bt_go = tk.Button(root2, text='GO', command=go1) |
| 262 | + bt_go.place(x=493, y=90) |
| 263 | + bt_go.configure(bg='red', fg='black', |
| 264 | + activeforeground='red', activebackground='black') |
| 265 | + bt_go.configure(relief='flat') |
| 266 | + bt_help = tk.Button(root2, text='HELP', command=help) |
| 267 | + bt_help.place(x=100, y=200) |
| 268 | + bt_help.configure(bg='red', state=DISABLED, fg='black', |
| 269 | + activeforeground='red', activebackground='black') |
| 270 | + bt_help.configure(relief='flat') |
| 271 | + |
| 272 | + |
| 273 | + if __name__ == "__main__": |
| 274 | + root2.mainloop() |
| 275 | + |
| 276 | +class more_tools: |
| 277 | + def __init__(self): |
| 278 | + master = tk.Tk() |
| 279 | + master.geometry('300x300') |
| 280 | + master.title('More Tools') |
| 281 | + master.configure(bg='black') |
| 282 | + master.resizable(False, False) |
| 283 | + |
| 284 | + # set button |
| 285 | + self.bt_new_host = tk.Button(master, text='set_new_hostname',command=hostname1) |
| 286 | + self.bt_new_host.place(x=20, y=10) |
| 287 | + self.bt_new_host.configure(bg='red', fg='black', |
| 288 | + activebackground='black', activeforeground='red', relief='flat', borderwidth='2') |
| 289 | +class hostname1: |
| 290 | + def __init__(self): |
| 291 | + |
| 292 | + |
| 293 | + master = tk.Tk() |
| 294 | + master.geometry('600x300') |
| 295 | + master.title('Set_Hostname') |
| 296 | + master.configure(bg='black') |
| 297 | + master.resizable(False, False) |
| 298 | + # def command for button go and entry |
| 299 | + def go_host (): |
| 300 | + |
| 301 | + self.entry_convert = self.new_hostname.get() |
| 302 | + self.host =os.system('hostnamectl set-hostname %s'%((self.entry_convert))) |
| 303 | + self.myhostname =os.system('hostname') |
| 304 | + self.help1 = tk.Label(master,text="open you terminal and type : hostname or hostnamectl") |
| 305 | + self.help1.place(x=120,y=100) |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + # set entry |
| 312 | + self.new_hostname= tk.Entry(master, text= 'new_hostname') |
| 313 | + self.new_hostname.place(relx=0.270, rely=0.190, height=29, width=279) |
| 314 | + self.new_hostname.configure(bg='black', fg='red') |
| 315 | + # set button go to entry |
| 316 | + self.bt_go = tk.Button(master,text='GO',command=go_host) |
| 317 | + self.bt_go.place(x=470, y=60) |
| 318 | + self.bt_go.configure(bg='red', fg='black',activebackground='black', activeforeground='red', relief='flat', borderwidth='2') |
| 319 | + |
| 320 | +class frame(): |
| 321 | + def __init__(self, master): |
| 322 | + |
| 323 | + self.Frame1 = tk.Frame(master) |
| 324 | + self. Frame1.place(relx=0.068, rely=0.044, |
| 325 | + relheight=0.744, relwidth=0.899) |
| 326 | + self.Frame1.configure(relief='groove') |
| 327 | + self.Frame1.configure(borderwidth="3") |
| 328 | + self.Frame1.configure(background="#000000") |
| 329 | + hostname = socket.gethostname() |
| 330 | + ip_pc = socket.gethostbyname(hostname) |
| 331 | + self.t1 = tk.Label(master, text='HOSTNAME_PC: ', bg='black', fg='red') |
| 332 | + self.t1.place(relx=0.267, rely=0.06, height=41, width=300) |
| 333 | + self.t1.configure(font="-family {Segoe UI} -size 21 -weight bold") |
| 334 | + |
| 335 | + self.t_host = tk.Label(master, text=hostname, bg='black', fg='red') |
| 336 | + self.t_host.place(relx=0.267, rely=0.239, height=41, width=300) |
| 337 | + self.t_host.configure(font="-family {Segoe UI} -size 21 -weight bold") |
| 338 | + |
| 339 | + self.t2 = tk.Label(master, text=' PC_IP: ', bg='black', fg='red') |
| 340 | + self.t2.place(relx=0.220, rely=0.388, height=41, width=300) |
| 341 | + self.t2.configure(font="-family {Segoe UI} -size 21 -weight bold") |
| 342 | + |
| 343 | + self.t_ip = tk.Label(master, text=ip_pc, bg='black', fg='red') |
| 344 | + self.t_ip.place(relx=0.248, rely=0.537, height=41, width=300) |
| 345 | + self.t_ip.configure(font="-family {Segoe UI} -size 21 -weight bold") |
| 346 | + |
| 347 | + |
| 348 | + |
| 349 | + |
| 350 | + |
| 351 | + menu1=tk.Menu(root,bg="black",fg='red',borderwidth=0) |
| 352 | + root.configure(menu=menu1) |
| 353 | + file_menu=Menu(menu1,bg="black") |
| 354 | + menu1.add_cascade(label="Menu",menu=file_menu) |
| 355 | + file_menu.add_command(label="web_ip",command=ip_web,activebackground='red') |
| 356 | + file_menu.add_command(label="more tools",command=more_tools,activebackground='red') |
| 357 | + file_menu.add_separator() |
| 358 | + file_menu.add_command(label="INFO",command=info1,activebackground='red') |
| 359 | + file_menu.add_command(label="EXIT",command=quit,activebackground='red') |
| 360 | + |
| 361 | + |
| 362 | +e = frame(root) |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | +root.mainloop() |
0 commit comments