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
pwnlib.update.available_on_pypi(prerelease=True)[source]

Return True if an update is available on PyPI.

>>> available_on_pypi() 
<Version('...')>
>>> available_on_pypi(prerelease=False).is_prerelease
False
pwnlib.update.cache_file()[source]

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

pwnlib.update.last_check()[source]

Return the date of the last check

pwnlib.update.perform_check(prerelease=True)[source]

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()
None
>>> 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...']
pwnlib.update.should_check()[source]

Return True if we should check for an update