summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrenton Earl <brent@exitstatusone.com>2015-11-18 23:25:28 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-11-18 23:25:28 +0700
commite1e61f6fffc725fdfeedfe6293fce26862279f1b (patch)
tree8fe1cb1d0dd2afbe2c105478e868839db5ba7116
parent119ea43024bfe56a3a97a11d5f3d700caa3e2f36 (diff)
downloadslackbuilds-e1e61f6fffc725fdfeedfe6293fce26862279f1b.tar.gz
libraries/python-ntlm: Added (Python NTLM Support).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--libraries/python-ntlm/DOCUMENTATION102
-rw-r--r--libraries/python-ntlm/README11
-rw-r--r--libraries/python-ntlm/python-ntlm.SlackBuild87
-rw-r--r--libraries/python-ntlm/python-ntlm.info10
-rw-r--r--libraries/python-ntlm/slack-desc19
5 files changed, 229 insertions, 0 deletions
diff --git a/libraries/python-ntlm/DOCUMENTATION b/libraries/python-ntlm/DOCUMENTATION
new file mode 100644
index 0000000000..4d68dc29ca
--- /dev/null
+++ b/libraries/python-ntlm/DOCUMENTATION
@@ -0,0 +1,102 @@
+# python-ntlm
+Python library that provides NTLM support, including an authentication
+handler for urllib2.
+
+This library allows you to retrieve content from (usually corporate)
+servers protected with windows authentication (NTLM) using the python
+urllib2.
+
+## Python 3 Support
+There is work going on to port the library to python 3, you can find it
+in the python30 directory. (at this time it seems to work as good as the
+python 2 library)
+
+# Usage
+
+## Simple example
+```python
+import urllib2
+from ntlm import HTTPNtlmAuthHandler
+
+user = 'DOMAIN\User'
+password = "Password"
+url = "http://ntlmprotectedserver/securedfile.html"
+
+passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
+passman.add_password(None, url, user, password)
+# create the NTLM authentication handler
+auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
+
+# create and install the opener
+opener = urllib2.build_opener(auth_NTLM)
+urllib2.install_opener(opener)
+
+# retrieve the result
+response = urllib2.urlopen(url)
+print(response.read())
+```
+
+## Extended Example
+```python
+import urllib2
+from urlparse import urlparse, urlunparse
+from ntlm import HTTPNtlmAuthHandler
+
+user = 'DOMAIN\User'
+password = "Password"
+url = "http://ntlmprotectedserver/securedfile.html"
+# determine a base_uri for which the username and password can be used
+parsed_url = urlparse(self.href)
+base_uri = urlunparse((parsed_url[0],parsed_url[1],"","","",""))
+
+passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
+passman.add_password(None, base_uri, user, password)
+# create the NTLM authentication handler
+auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
+
+# other authentication handlers
+auth_basic = urllib2.HTTPBasicAuthHandler(passman)
+auth_digest = urllib2.HTTPDigestAuthHandler(passman)
+
+# disable proxies (if you want to stay within the corporate network)
+proxy_handler = urllib2.ProxyHandler({})
+
+# create and install the opener
+opener = urllib2.build_opener(proxy_handler, auth_NTLM, auth_digest,
+auth_basic)
+urllib2.install_opener(opener)
+
+# retrieve the result
+response = urllib2.urlopen(url)
+print(response.read())
+```
+
+## Limitations
+ * A request using the `HTTPNtlmAuthHandler` has no HTTP status
+ * handling, for example: redirects are not handled by the opener, you
+ * must check and handle the response yourself.
+
+ # Resources
+
+ ## Inspired by
+ * [http://sourceforge.net/projects/ntlmaps/ NTLM Authorization Proxy
+ * Server]
+ (Dmitri Rozmanov kindly allowed his code to be redistributed under
+ the LGPL)
+
+ The NTLM Authorization Proxy Server can be used to make applications
+ that do not support NTLM proxies use them anyway: "Opens up IIS
+ Proxy Servers using NTLM to non-Microsoft browsers, etc"
+
+ In contrast the python-ntlm library is used to make it possible for
+ python code to retrieve content from an NTLM protected server.
+
+ ## References
+ * [MS-NLMP]:
+ * [http://download.microsoft.com/download/a/e/6/ae6e4142-aa58-45c6-8dcf-a657e5900cd3/%5BMS-NLMP%5D.pdf
+ * NT LAN Manager (NTLM) Authentication Protocol Specification]
+ * [MS-NTHT]:
+ * [http://download.microsoft.com/download/a/e/6/ae6e4142-aa58-45c6-8dcf-a657e5900cd3/%5BMS-NTHT%5D.pdf
+ * NTLM Over HTTP Protocol Specification]
+ * [http://www.blackhat.com/presentations/bh-asia-04/bh-jp-04-pdfs/bh-jp-04-seki.pdf
+ * Optimized Attack for NTLM2 Session Response]
diff --git a/libraries/python-ntlm/README b/libraries/python-ntlm/README
new file mode 100644
index 0000000000..470765e9c1
--- /dev/null
+++ b/libraries/python-ntlm/README
@@ -0,0 +1,11 @@
+Python library that provides NTLM support, including an authentication
+handler for urllib2. Works with pass-the-hash in additon to password
+authentication.
+
+This library is useful for passing hashes to servers requiring ntlm
+authentication in instances where using windows tools is not desirable.
+
+It allows Python clients running on any operating system to provide NTLM
+authentication to a supporting Windows server.
+
+Usage and Examples located in /usr/doc/python-ntlm-$VERSION/README.md.
diff --git a/libraries/python-ntlm/python-ntlm.SlackBuild b/libraries/python-ntlm/python-ntlm.SlackBuild
new file mode 100644
index 0000000000..7da4da552c
--- /dev/null
+++ b/libraries/python-ntlm/python-ntlm.SlackBuild
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# Slackware build script for python-ntlm
+
+# Copyright 2015 Brenton Earl <brent@exitstatusone.com>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=python-ntlm
+VERSION=${VERSION:-1.1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+python setup.py install --root=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a PKG-INFO $PKG/usr/doc/$PRGNAM-$VERSION
+# Copy README.md from github, needs to be checked periodically
+cat $CWD/DOCUMENTATION > $PKG/usr/doc/$PRGNAM-$VERSION/README.md
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/libraries/python-ntlm/python-ntlm.info b/libraries/python-ntlm/python-ntlm.info
new file mode 100644
index 0000000000..38bbfb218a
--- /dev/null
+++ b/libraries/python-ntlm/python-ntlm.info
@@ -0,0 +1,10 @@
+PRGNAM="python-ntlm"
+VERSION="1.1.0"
+HOMEPAGE="https://github.com/mullender/python-ntlm"
+DOWNLOAD="https://pypi.python.org/packages/source/p/python-ntlm/python-ntlm-1.1.0.tar.gz"
+MD5SUM="c1b036401a29dd979ee56d48a2267686"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="pysetuptools"
+MAINTAINER="Brenton Earl"
+EMAIL="brent@exitstatusone.com"
diff --git a/libraries/python-ntlm/slack-desc b/libraries/python-ntlm/slack-desc
new file mode 100644
index 0000000000..0ffe1aa8f3
--- /dev/null
+++ b/libraries/python-ntlm/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+python-ntlm: python-ntlm (Python NTLM Support)
+python-ntlm:
+python-ntlm: Python library that provides NTLM support, including an
+python-ntlm: authentication handler for urllib2. Works with pass-the-hash in
+python-ntlm: additon to password authentication.
+python-ntlm:
+python-ntlm: Home page: https://github.com/mullender/python-ntlm
+python-ntlm:
+python-ntlm:
+python-ntlm:
+python-ntlm: