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
100 changed files
with
85,187 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,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) |
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,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 |
Oops, something went wrong.