Skip to content

Commit

Permalink
Merge a571c30 into d24838d
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdymond committed Jun 30, 2017
2 parents d24838d + a571c30 commit e069d72
Show file tree
Hide file tree
Showing 100 changed files with 85,187 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@
*.o
*.obj
*.pdb
*.pyc
*~
.*.sw?
.cproject
Expand All @@ -18,6 +19,7 @@
.settings
/build/
/builds/
__pycache__
CHANGES.dist
Debug
INSTALL
Expand Down
56 changes: 56 additions & 0 deletions tests/curl_test_data.py
@@ -0,0 +1,56 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
"""Module for extracting test data from the test data folder"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import xml.etree.ElementTree as ET
import logging

log = logging.getLogger(__name__)


class TestData(object):
def __init__(self, data_folder):
self.data_folder = data_folder

def get_test_data(self, test_number):
# Create the test file name
filename = os.path.join(self.data_folder,
"test{0}".format(test_number))

# The user should handle the exception from failing to find the file.
tree = ET.parse(filename)

# We need the <reply><data> text.
reply = tree.find("reply")
data = reply.find("data")

# Return the text contents of the data
return data.text


if __name__ == '__main__':
td = TestData("./data")
data = td.get_test_data(1)
print(data)
2 changes: 1 addition & 1 deletion tests/data/Makefile.inc
Expand Up @@ -154,7 +154,7 @@ test1416 test1417 test1418 test1419 test1420 test1421 test1422 test1423 \
test1424 test1425 test1426 \
test1428 test1429 test1430 test1431 test1432 test1433 test1434 test1435 \
test1436 test1437 test1438 test1439 test1440 test1441 test1442 test1443 \
test1444 test1445 test1446 test1450 \
test1444 test1445 test1446 test1450 test1451 \
\
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \
Expand Down
36 changes: 36 additions & 0 deletions tests/data/test1451
@@ -0,0 +1,36 @@
<testcase>
<info>
<keywords>
SMB
</keywords>
</info>

#
# Server-side
<reply>
<data>Basic SMB test complete</data>
</reply>

#
# Client-side
<client>
<server>
smb
</server>
<features>
smb
</features>
<name>
Basic SMB request
</name>
<command>
-u 'curltest:curltest' smb://%HOSTIP:%SMBPORT/TESTS/1451
</command>
</client>

#
# Verify data after the test has been "shot"
<verify>
<stdout>Basic SMB test complete</stdout>
</verify>
</testcase>
34 changes: 34 additions & 0 deletions tests/python_dependencies/impacket/Dot11Crypto.py
@@ -0,0 +1,34 @@
# 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:
# IEEE 802.11 Network packet codecs.
#
# Author:
# Gustavo Moreira

class RC4():
def __init__(self, key):
j = 0
self.state = range(256)
for i in range(256):
j = (j + self.state[i] + ord(key[i % len(key)])) & 0xff
self.state[i],self.state[j] = self.state[j],self.state[i] # SSWAP(i,j)

def encrypt(self, data):
i = j = 0
out=''
for char in data:
i = (i+1) & 0xff
j = (j+self.state[i]) & 0xff
self.state[i],self.state[j] = self.state[j],self.state[i] # SSWAP(i,j)
out+=chr(ord(char) ^ self.state[(self.state[i] + self.state[j]) & 0xff])

return out

def decrypt(self, data):
# It's symmetric
return self.encrypt(data)
54 changes: 54 additions & 0 deletions tests/python_dependencies/impacket/Dot11KeyManager.py
@@ -0,0 +1,54 @@
# 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:
# IEEE 802.11 Network packet codecs.
#
# Author:
# Gustavo Moreira

from array import array
class KeyManager:
def __init__(self):
self.keys = {}

def __get_bssid_hasheable_type(self, bssid):
# List is an unhashable type
if not isinstance(bssid, (list,tuple,array)):
raise Exception('BSSID datatype must be a tuple, list or array')
return tuple(bssid)

def add_key(self, bssid, key):
bssid=self.__get_bssid_hasheable_type(bssid)
if not bssid in self.keys:
self.keys[bssid] = key
return True
else:
return False

def replace_key(self, bssid, key):
bssid=self.__get_bssid_hasheable_type(bssid)
self.keys[bssid] = key

return True

def get_key(self, bssid):
bssid=self.__get_bssid_hasheable_type(bssid)
if self.keys.has_key(bssid):
return self.keys[bssid]
else:
return False

def delete_key(self, bssid):
bssid=self.__get_bssid_hasheable_type(bssid)
if not isinstance(bssid, list):
raise Exception('BSSID datatype must be a list')

if self.keys.has_key(bssid):
del self.keys[bssid]
return True

return False

0 comments on commit e069d72

Please sign in to comment.