Wednesday, 28 March 2018

Program for Enable/Disable proxy on Windows 7 using Python

Hi,

It's time to share with you my program which allows you disable/enable proxy on from your web browser.

Program was wrote by me in Python. I would like to show you my code and process how to create exe file from .py file.



Program disable/enable proxy using MS Windows registry for Windows 7.
It is working on Windows systems (Windows 7 only).
It is compatibile with IE 11. Chrome also works but proces when registy synchronize with web browser is slower than when you use IE.

There is button with host info like: hostname, IP. Button quit for fast close app.
I will try to explain code in python.

Short analyze source code:

Loading library os for operation system commands, tkinter for GUI, tkinter.messagebox for message windows, socket for hostname and IP, threading for enable using thradings.

import os
import tkinter
import tkinter.messagebox
import socket
import threading

Here is definition for registry modification and pinging IP 8.8.8.8. If ping is successful than variable "response" holding 0 else 1. Message is a simple message box. I start ping only one ICMP echo request.

def Pingowanie():     os.system(r'REG ADD "HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f')
response = os.system("ping 8.8.8.8 -n 1") 
if response == 0: message = tkinter.messagebox.showinfo("Sukces", "Proxy wyłączone! - Uruchom ponownie Internet Explorer") 
else: message = tkinter.messagebox.showinfo("Problem", "Spróbuj ponownie lub sprawdż ustawienia firewalla")

Here is one thread for using independent ping to avoid program freeze when you click button:

def Proxy_disable():    threading.Thread(target=Pingowanie).start()

Here is building GUI and buttons i think that this is easy to understand.
top.resizable - is blocking window for resizable
top.geometry - is for set persistant size of window
przycisk_1.pack() - install button on form.
top.mainloop() - run form



def Okno():    top = tkinter.Tk()    top.resizable(width=False, height=False) 
top.geometry('{}x{}'.format((230),(140))) 
top.title("Version 1.1_2018") 
przycisk_1 = tkinter.Button(top, justify="right", text="ENABLE_PROXY", command=Win_command_en, width="50") przycisk_2 = tkinter.Button(top, justify="right", text="DISABLE_PROXY", fg="red", command=Proxy_disable, width="50") przycisk_3 = tkinter.Button(top, justify="right", text="HOST INFO", fg="blue", command=Host_info, width="50") 
 przycisk_4 = tkinter.Button(top, justify="right", text="Quit", command=top.destroy, width="50") przycisk_1.pack() 
 przycisk_2.pack() 
 przycisk_3.pack() 
 przycisk_4.pack()
 label = tkinter.Label(top, text="Made by Kiloparówek \n \n Compatibile with Microsoft IE 11") label.pack() top.mainloop()


For compile all sorurces and librarys in one exe file and replace icon for your own you must use this command:




 I hope it is informative for you. If you have any question please comment. 

Here you have exe file and source code.

Tuesday, 20 March 2018

How to factory default (reset) Fortgate 100EF (Forti Ios 5.4)

Some steps how to do this:


  1. Connect cable to "CONSOLE" port on fortidevice (ethernet cable). Ususally this cable you should get in box.
  2. Connect this cable to your PC with COM. If you don't have COM user USB/COM converter.
  3. Open Putty or other client - which allows you establish serial session.
  4. User standard settings for serial connection 9600, no parity, 1 bit stop.
  5. Observe console.
  6. Put something thin to forti device small hole on front of device.
  7. You should see on the screen information. That you have 60 second after next power cycle.
  8. Please power off cable and power on
  9. When iOS will be loaded and you will see prompt when system is waiting for enter username please put again something thin to forti device small hole and system should be factory default. Remember that you have 60 second after system will be completly ready.

Contact with me

Name

Email *

Message *