From f1609155d54c82b535f50a6b4693b2be47d272aa Mon Sep 17 00:00:00 2001 From: Max Dymond Date: Fri, 30 Jun 2017 13:53:19 +0100 Subject: test: add impacket for SMB testing Import impacket 0.9.15 for use in SMB testing. This was generated by doing "pip2.7 install -t . impacket" Unnecessary files for current testing were deleted. --- tests/python_dependencies/impacket/uuid.py | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/python_dependencies/impacket/uuid.py (limited to 'tests/python_dependencies/impacket/uuid.py') diff --git a/tests/python_dependencies/impacket/uuid.py b/tests/python_dependencies/impacket/uuid.py new file mode 100644 index 000000000..fb4d7b3a0 --- /dev/null +++ b/tests/python_dependencies/impacket/uuid.py @@ -0,0 +1,68 @@ +# Copyright (c) 2003-2016 CORE Security Technologies +# +# This software is provided under under a slightly modified version +# of the Apache Software License. See the accompanying LICENSE file +# for more information. +# +# Description: +# Generate UUID compliant with http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt. +# A different, much simpler (not necessarily better) algorithm is used. +# +# Author: +# Javier Kohen (jkohen) +# + +import re + +from random import randrange +from struct import pack, unpack + +def generate(): + # UHm... crappy Python has an maximum integer of 2**31-1. + top = (1L<<31)-1 + return pack("IIII", randrange(top), randrange(top), randrange(top), randrange(top)) + +def bin_to_string(uuid): + uuid1, uuid2, uuid3 = unpack('HHL', uuid[8:16]) + return '%08X-%04X-%04X-%04X-%04X%08X' % (uuid1, uuid2, uuid3, uuid4, uuid5, uuid6) + +def string_to_bin(uuid): + matches = re.match('([\dA-Fa-f]{8})-([\dA-Fa-f]{4})-([\dA-Fa-f]{4})-([\dA-Fa-f]{4})-([\dA-Fa-f]{4})([\dA-Fa-f]{8})', uuid) + (uuid1, uuid2, uuid3, uuid4, uuid5, uuid6) = map(lambda x: long(x, 16), matches.groups()) + uuid = pack('HHL', uuid4, uuid5, uuid6) + return uuid + +def stringver_to_bin(s): + (maj,min) = s.split('.') + return pack('