-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
18,648 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
Oops, something went wrong.