Tag Archives: python

[python]Disabling and enabling Windows proxy settings

References: https://superuser.com/questions/1113796/how-to-run-a-python-script-with-cmd-exe-and-make-it-invisible/1113801 https://stackoverflow.com/questions/31348111/setting-proxy-settings-in-windows-with-python-using-internetsetoption Requirements Disable and enable the proxy without closing internet explorer. Enable the proxy setting when auto configuration url (PAC location) is not available. Trigger the script to disable proxy when your laptop is connected out of office. … Continue reading

Posted in Python, Scripting, Windows | Tagged , , , , , | Leave a comment

[python]DNS resolution webapp with flask

Very simple webapp, I still need to do some styling with CSS… this is a simple concept. here’s an example: The output will be: Here are the jinja2 templates: Here’s the code.

Posted in Python, Scripting | Tagged , , | 2 Comments

[python] resolve a list of items from file

The list can be ip address, ip address range, ip subnet, firewall objects or hostname. The objective: If item is resolvable, resolve it and collect the ip address. If item is unresolvable, will collect it as it is. The list … Continue reading

Posted in Python, Scripting | Tagged , , | Leave a comment

[python]Resolve dns if hostname is resolvable else send as is

There are times which you need to try to resolve valid hostnames, however on user’s input there could be a possibility that the input contains ip addres, firewall objects or firewall object groups that are not resolvable. here’s a solution … Continue reading

Posted in Python, Scripting | Tagged , | Leave a comment

[python]Remove duplicates from a list

I have learned something interesting… removing duplicates in a list is actually quite easily achieved without using iteration… The output is self explanatory, you use set if you do not bother about the order, you use Ordereddict if you need … Continue reading

Posted in Python, Scripting | Tagged , , | Leave a comment

[python]List comprehension and map method

I want this output in string: [‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ’10’, ’11’, ’12’, ’13’, ’14’, ’15’, ’16’, ’17’, ’18’, ’19’, ’20’] Method one: List comprehension: Method two: Map method. map(function, iterable)

Posted in Python, Scripting | Tagged , , | Leave a comment

[python]Sending access request to Tufin SecureChange

Required improvements/Bugs IP address checking required, situation such as this 192.168.1.1/24. Dynamically update the action field, right now all request is assumed Accept. Dynamically update comment field on each access request, right now the script does not check comment Optimize … Continue reading

Posted in Python, Scripting | Tagged , , , , | Leave a comment