Skip to main content

Experimental OpenSSL wrapper for Python 2.7 and SSLyze.

Project description

[![Build Status](https://travis-ci.org/nabla-c0d3/nassl.svg?branch=master)](https://travis-ci.org/nabla-c0d3/nassl) [![PyPI version](https://badge.fury.io/py/nassl.svg)](https://badge.fury.io/py/nassl)

Experimental OpenSSL wrapper for Python 2.7 and SSLyze. Do NOT use for anything serious. This code has not been properly tested/reviewed and is absolutely not production ready.

Quick Start

Nassl can be installed directly via pip:

pip install nassl

On OS X and Linux, it is also easy to directly clone the repository, build the _nassl C extension and then run the sample client:

git clone https://github.com/nabla-c0d3/nassl.git cd nassl python setup.py build_ext -i python sample_client.py

Building the C extension

Nassl relies on a C extension to call into OpenSSL; the extension can be directly built using the pre-compiled OpenSSL binaries available in ./bin, by running the following command:

python setup.py build_ext -i

On Windows, a “Platform Wheel” can be built using:

python setup.py bdist_wheel

If you do not want to use the pre-compiled binaries, compiling the C extension requires successively building:

The whole build process is all taken care of by the _build_from_scratch.py_ script:

git clone https://github.com/nabla-c0d3/nassl.git cd nassl wget http://zlib.net/zlib-1.2.8.tar.gz tar xvfz zlib-1.2.8.tar.gz git clone https://github.com/PeterMosmans/openssl python build_from_scratch.py

For Windows builds, Visual Studio is expected to be installed at the default location.

The build script was tested on the following platforms: Windows 7 (32 and 64 bits), Debian 7 (32 and 64 bits), macOS Sierra. It will build the C extension for the interpreter and platform that was used to run the script (ie. no cross-compiling).

Project structure

### nassl/

Classes implemented in Python are part of the nassl namespace; they are designed to provide a simpler, higher-level interface to perform SSL connections.

### nassl/_nassl/

Classes implemented in C are part of the nassl._nassl namespace; they try to stay as close as possible to OpenSSL’s API. In most cases, Python methods of such objects directly match the OpenSSL function with same name. For example the _nassl.SSL.read() Python method matches OpenSSL’s SSL_read() function.

These classes should be considered internal.

Why another SSL library?

I’m the author of [SSLyze](https://github.com/nabla-c0d3/sslyze), an SSL scanner written in Python. Scanning SSL servers requires access to low-level SSL functions within the OpenSSL API, for example to test for things like insecure renegotiation or session resumption.

None of the existing OpenSSL wrappers for Python (including ssl, M2Crypto and pyOpenSSL) expose the APIs that I need for SSLyze, so I had to write my own wrapper.

License

Licensed under the GPLv2; see ./LICENSE

Please contact me if this license doesn’t work for you.

Author

Alban Diquet - @nabla_c0d3 - https://nabla-c0d3.github.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nassl-0.14.2.tar.gz (15.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nassl-0.14.2-cp27-none-win_amd64.whl (837.1 kB view details)

Uploaded CPython 2.7Windows x86-64

nassl-0.14.2-cp27-none-win32.whl (559.3 kB view details)

Uploaded CPython 2.7Windows x86

File details

Details for the file nassl-0.14.2.tar.gz.

File metadata

  • Download URL: nassl-0.14.2.tar.gz
  • Upload date:
  • Size: 15.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nassl-0.14.2.tar.gz
Algorithm Hash digest
SHA256 4ea0a364dd6af0f77ee5a7e0bd7d816f34598919609486a5c3f2750e732676ce
MD5 41bdabd75d61ee22b6441af6fcce2457
BLAKE2b-256 c653124f86c85fe612725d6dd405833f8ace110448af05bf42386dd6484193fb

See more details on using hashes here.

File details

Details for the file nassl-0.14.2-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for nassl-0.14.2-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 031b723a987f5221662122a9bfefc5838f45932bd9146b4b7c6502837f1bc37f
MD5 39beb825f50325f2158cd2a7adb3d69f
BLAKE2b-256 a7db1d8795dbad7b38d261b08c9b4cd0825b979d5feade91ce5ae40d0af0db9f

See more details on using hashes here.

File details

Details for the file nassl-0.14.2-cp27-none-win32.whl.

File metadata

File hashes

Hashes for nassl-0.14.2-cp27-none-win32.whl
Algorithm Hash digest
SHA256 b7c6828ae310a17bfb67072747ec6cdb4ddae0f77c28f8ceb02f487e0fcdbe17
MD5 673920b4f43bb4d4b457c1ee71cb1974
BLAKE2b-256 bfa5b88f4f2627cf11086edba92ab6c868670d32f3b30d956e20f5830c4fa7d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page