Category Archives: Python

Python tools If you are involved in vulnerability research

If you are involved in vulnerability research, reverse engineering or penetration testing, I suggest to try out the Python programming language. It has a rich set of useful libraries and programs. This page lists some of them. Most of the listed tools are written in Python, others are just Python

Sorting IP addresses

How to sort a list of strings that represent IP addresses? Of course, you could supply an appropriate comparison function to the sort() method of the list object, but that’s very inefficient (read: slow). It is better to first pre-process the list so it can be sorted with the efficient

collection of some useful shortcuts

The following are just a collection of some useful shortcuts and tools I’ve found in Python over the years. Hopefully you find them helpful. Swapping Variables 1 2 3 4 5 6 7 8 x = 6 y = 5 x, y = y, x print x >>> 5 print

Check if a file exists in a directory

With Python there are several methods which can be used to check if a file exists, in a certain directory. When checking if a file exists, often it is performed right before accessing (reading and/or writing) a file. Below we will go through each method of checking if a file

A simple HTTP Server

A simple HTTP Server can be started in seconds. python -m SimpleHTTPServer For Python3: python -m http.server The server starts on port 8000 by default which can be changed. I have found this quite handy at times. For example: To share a complete directory with someone over the Internet, I

HOWTO Fetch Internet Resources Using urllib2

Author: Michael Foord Introduction Related Articles You may also find useful the following article on fetching web resources with Python: Basic Authentication A tutorial on Basic Authentication, with examples in Python. urllib2 is a Python module for fetching URLs (Uniform Resource Locators). It offers a very simple interface, in the

« Older Entries