pwnlib.update — Updating Pwntools

# Pwntools Update

In order to ensure that Pwntools users always have the latest and greatest version, Pwntools automatically checks for updates.

Since this update check takes a moment, it is only performed once every week. It can be permanently disabled via:

$ echo never > ~/.pwntools-cache/update

Return True if an update is available on PyPI.

>>> available_on_pypi() 
>>> available_on_pypi(prerelease=False).is_prerelease

Returns the path of the file used to cache update data, and ensures that it exists.


Return the date of the last check


Perform the update check, and report to the user.

Parameters:prerelease (bool) – Whether or not to include pre-release versions.
Returns:A list of arguments to the update command.
>>> from packaging.version import Version
>>> pwnlib.update.current_version = Version("999.0.0")
>>> print perform_check()
>>> pwnlib.update.current_version = Version("0.0.0")
>>> perform_check() 
['pip', 'install', '-U', ...]
>>> def bail(*a): raise Exception()
>>> pypi   = pwnlib.update.available_on_pypi
>>> perform_check(prerelease=False)
['pip', 'install', '-U', 'pwntools']
>>> perform_check(prerelease=True)  
['pip', 'install', '-U', 'pwntools...']

Return True if we should check for an update