Skip to content

Commit

Permalink
Merge 0576395 into 3a48a13
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdymond committed Jul 3, 2017
2 parents 3a48a13 + 0576395 commit abe479e
Show file tree
Hide file tree
Showing 19 changed files with 18,648 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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>
25 changes: 25 additions & 0 deletions tests/python_dependencies/impacket/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.
#
# Author: Alberto Solino (@agsolino)
#

# Set default logging handler to avoid "No handler found" warnings.
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass

# All modules inside this library MUST use this logger (impacket)
# It is up to the library consumer to do whatever is wanted
# with the logger output. By default it is forwarded to the
# upstream logger

LOG = logging.getLogger(__name__)
LOG.addHandler(NullHandler())
Loading

0 comments on commit abe479e

Please sign in to comment.