[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: irsdl # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\nlfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": "Generic Codes/web_request_socket.py",
    "content": "#!/usr/bin/python\nimport re\nimport socket\nimport urlparse\nimport ssl\nimport urllib\nimport time\n\n# See HTTPPipelineTest() for a simple usage\n# Example:\n# RequestObject('POST', 'https://soroush.secproject.com/?q1=q2','var=val',{'cookie':'x=2;r=5','connection':'close','Content-Type': 'application/x-www-form-urlencoded'}, True)\nclass RequestObject(object):\n    url = ''\n    _path = ''\n    _CRLF = '\\r\\n'\n    qs = ''\n    cookie = ''\n    body = ''\n    headers = None\n    autoContentLength = True\n    autoHOSTHeader = True\n    useAbsolutePath = False\n    isSSL = False\n    HTTPVersion = ''\n    targetName = ''\n    targetPort = ''\n    targetProtocol = ''\n    # The class \"constructor\" - It's actually an initializer\n    def __init__(self, method='GET', url='', body='', headers={}, autoContentLength=True, autoHOSTHeader=True, useAbsolutePath=False, HTTPVersion='HTTP/1.1'):\n        self.method = method\n        self.url = url\n        self.body = body\n        self.headers = headers\n        self.autoContentLength = autoContentLength\n        self.autoHOSTHeader = autoHOSTHeader\n        self.useAbsolutePath = useAbsolutePath\n        self.HTTPVersion = HTTPVersion\n        self._setParams()\n\n    def _setParams(self):\n        parsedURL = urlparse.urlparse(self.url)\n        # setting the path\n        if self.useAbsolutePath == True:\n            self._path = self.url\n        else:\n            self._path = parsedURL.path\n            self.qs = parsedURL.query\n\n        if self._path == '':\n            self._path = '/'\n\n        # fix the body if it is in dict format\n        if isinstance(self.body,dict):\n            self.body = urllib.urlencode(self.body)\n\n        # set other necessary parameters\n        self.targetName = parsedURL.hostname\n        self.targetPort = parsedURL.port\n        self.targetProtocol = (parsedURL.scheme).lower()\n        if self.targetProtocol == 'https':\n            self.isSSL = True\n            if self.targetPort == None: self.targetPort = 443\n        elif self.targetPort == None:\n            self.targetPort = 80\n\n    def rawRequest(self):\n        self._setParams()\n\n        #building the raw request\n        queryString = ''\n        hostHeader = ''\n        contentLengthHeader = ''\n        incomingHeaders = ''\n        if self.autoHOSTHeader:\n            hostHeader = self._CRLF + \"Host: \" + self.targetName + self._CRLF\n        if self.headers != None and len(self.headers)>0:\n            for key, value in self.headers.iteritems():\n                incomingHeaders = incomingHeaders + str(key) + \": \" + str(value) + self._CRLF\n        if incomingHeaders.endswith(self._CRLF):\n            incomingHeaders = incomingHeaders[:-2]\n        if self.autoContentLength:\n            contentLengthHeader = self._CRLF + \"Content-Length: \" + str(len(self.body))\n        if self.qs != '':\n            queryString = '?' + self.qs\n        httpdata = self.method + \" \" + self._path + queryString + \" \" + self.HTTPVersion + hostHeader + incomingHeaders + \\\n                   contentLengthHeader + self._CRLF + self._CRLF + self.body\n\n        return httpdata\n\n\ndef SendHTTPRequestBySocket(rawHTTPRequest = '', targetName='127.0.0.1', targetPort=80, isSSL = False, timeout=1,\n                            includeTimeoutErr=False, isRateLimited=False, sendInitialChars=0, sendBodyCharRate=1, delayInBetween=0.2):\n    if len(rawHTTPRequest) == 0: return\n\n    # create an INET, STREAMing socket\n    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n    if isSSL:\n        s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) # Perhaps this needs to be changed when other protocols should be used\n\n    s.settimeout(timeout)\n\n    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n\n    s.connect((targetName, targetPort))\n\n    # s.send(unicode(rawHTTPRequest, 'utf-8'))\n    if isRateLimited is False or sendBodyCharRate <= 0 or sendBodyCharRate <= 0 or delayInBetween < 0:\n        s.send(rawHTTPRequest)\n    else:\n        if sendInitialChars > 0:\n            s.send(rawHTTPRequest[:sendInitialChars])\n            rawHTTPRequest = rawHTTPRequest[sendInitialChars:]\n\n        for i in range(0, len(rawHTTPRequest), sendBodyCharRate):\n            time.sleep(delayInBetween)\n            s.send(rawHTTPRequest[i:i + sendBodyCharRate])\n\n\n    response = b''\n\n    while True:\n        try:\n            buf = s.recv(1024)\n            if not buf: break\n            response = response + buf\n        except socket.timeout, e:\n            err = e.args[0]\n            if err == 'timed out' and includeTimeoutErr:\n                if response != '':\n                    response = response + '\\nErr: last part was timed out'\n                else:\n                    response = 'Err: timed out'\n            break\n    s.close()\n    return response\n\ndef RequestObjectsToHTTPPipeline(RequestObjects):\n    result = ''\n    if len(RequestObjects) <= 0: raise ValueError('less_than_two_elements_received_by_RequestObjectsToHTTPPipeline()')\n    CRLF = '\\r\\n'\n    mainTarget = ''\n    mainPort = ''\n    lastElement = True\n    for reqObjects in reversed(RequestObjects):\n        if mainTarget == '':\n            mainTarget = reqObjects.targetName\n            mainPort = reqObjects.targetPort\n        IsConnectionSet = False\n        if reqObjects.headers != None:\n            for key, value in reqObjects.headers.iteritems():\n                if re.search(r'(connection:\\s*close)|(connection:\\s*keep\\-alive)', str(key) +\":\" + str(value),\n                             flags=re.IGNORECASE) != None:\n                    IsConnectionSet = True\n                    reqObjects.headers[key] = 'keep-alive'\n\n        if IsConnectionSet == False:\n            if lastElement:\n                reqObjects.headers['Connection'] = 'close'\n            else:\n                reqObjects.headers['Connection'] = 'keep-alive'\n\n        lastElement = False\n        result = reqObjects.rawRequest() + CRLF + result\n    result = result + CRLF\n    #result = result + \"GET /IDontExist HTTP/1.1\" + CRLF + \"Host: \" + mainTarget + \":\" + str(mainPort) +\\\n             #CRLF + \"connection: close\" + CRLF + CRLF\n    return result\n\n# TEST CODE #\ndef HTTPPipelineTest():\n    result = False\n    testReq1 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=2222&b=2','',\n                             {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',\n                              'Referer': 'https://www.google.com/',\n                              'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n                              'Accept-Language': 'en-GB,en;q=0.5',\n                              'Max-Forwards': '0',\n                              'Connection': 'close'})\n    testReq2 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=3333&b=3','',\n                             {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',\n                              'Max-Forwards': '0','connection':'close'})\n    testRequests = [testReq1,testReq2]\n    pipelineResult = RequestObjectsToHTTPPipeline(testRequests)\n    #print pipelineResult\n\n    try:\n        reqResult = SendHTTPRequestBySocket(pipelineResult, testReq1.targetName, testReq1.targetPort, testReq1.isSSL, 20)\n    except:\n        reqResult = ''\n    #print reqResult\n    if reqResult.find('4444') > 0 and reqResult.find('9999') > 0:\n        result = True\n    return result\n\ndef AnotherPipelineExample():\n    req1 = RequestObject('GET', 'http://asitename.com:8080/sum.jsp?a=1&b=1&c=2&d=2')\n    req2 = RequestObject('POST', 'http://asitename.com:8080/sum.jsp?a=3&b=3', 'c=4&d=4',\n                         {'Content-Type': 'application/x-www-form-urlencoded'}, autoContentLength=True,\n                         HTTPVersion=\"HTTP/1.0\")\n    req3 = RequestObject('POST', 'http://asitename.com:8080/sum.jsp?a=5&b=5', 'c=6&d=6',\n                         {'Content-Type': 'application/x-www-form-urlencoded'}, autoContentLength=True)\n    joinedReqs = [req1, req2, req3]\n    pipelineResult = RequestObjectsToHTTPPipeline(joinedReqs)\n    print SendHTTPRequestBySocket(pipelineResult, req1.targetName, req1.targetPort)\n\n\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# HTTP.ninja\nFuture of something cool; stay tuned!\n\nDraft results: https://drive.google.com/file/d/0B5Tqp73kQStQU1diV1Y0dzd1QU0/view\n\nIt has now been uploaded here in [Results_v0.1.xlsx](Results_v0.1.xlsx) as apparently this is against Google Drive's policy to share useful security related documents with everyone.\n"
  },
  {
    "path": "Sample Pages/sample.asp",
    "content": "Test Page (at least vulnerable to xss - don't use on live)<br/>\n<%\nOn Error Resume Next\nResponse.write(\"<br/>GET input0:<br/>\")\nResponse.write(\"<br/>input0=\"&(Request.querystring(\"input0\"))&\"<br/>\")\nResponse.write(\"Len(input0)=\"&Len(Request.querystring(\"input0\"))&\"<br/>\")\nResponse.write(\"LenB(input0)=\"&LenB(Request.querystring(\"input0\"))&\"<br/><br/>\")\n\nResponse.write(\"<br/>POST input1:<br/>\")\nResponse.write(\"<br/>input1=\"&(Request.form(\"input1\"))&\"<br/>\")\nResponse.write(\"Len(input1)=\"&Len(Request.form(\"input1\"))&\"<br/>\")\nResponse.write(\"LenB(input1)=\"&LenB(Request.form(\"input1\"))&\"<br/><br/>\")\n\nResponse.write(\"<br/>COOKIE input2:<br/>\")\nResponse.write(\"<br/>input2=\"&(Request.Cookies(\"input2\"))&\"<br/>\")\nResponse.write(\"Len(input2)=\"&Len(Request.Cookies(\"input2\"))&\"<br/>\")\nResponse.write(\"LenB(input2)=\"&LenB(Request.Cookies(\"input2\"))&\"<br/><br/>\")\n\nResponse.write(\"<br/>All GET:<br/><br/>\")\nFor each item in request.querystring\n\tResponse.write(\"<br/>\" & item & \"=\"&request.querystring(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>All POST:<br/>\")\nFor each item in request.form\n\tResponse.write(\"<br/>\" & item & \"=\"&request.form(item)&\"<br/>\")\nNext\n\nResponse.write(\"<br/>All COOKIES:<br/><br/>\")\nFor each item in request.Cookies\n\tResponse.write(\"<br/>\" & item & \"=\"&request.Cookies(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>Server Variables:<br/><br/>\")\nFor each item in Request.ServerVariables\n\tResponse.write(\"<br/>\" & item & \"=\"&Request.ServerVariables(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>generic parameter ( REQUEST(\"\"input\"\") ) input:<br/>\")\nResponse.write(\"<br/>input=\"&(Request(\"input\"))&\"<br/>\")\nResponse.write(\"Len(input)=\"&Len(Request(\"input\"))&\"<br/>\")\nResponse.write(\"LenB(input)=\"&LenB(Request(\"input\"))&\"<br/><br/>\")\n%>"
  },
  {
    "path": "Sample Pages/sample.aspx",
    "content": "Test Page (at least vulnerable to xss - don't use on live)<br/>\n<%\nOn Error Resume Next\nResponse.write(\"<br/>GET input0:<br/>\")\nResponse.write(\"<br/>input0=\"&(Request.querystring(\"input0\"))&\"<br/>\")\nResponse.write(\"Len(input0)=\"&Len(Request.querystring(\"input0\"))&\"<br/>\")\nResponse.write(\"System.Text.Encoding.Unicode.GetByteCount(input0)=\"&System.Text.Encoding.Unicode.GetByteCount(Request.querystring(\"input0\"))&\"<br/><br/>\")\n\nResponse.write(\"<br/>POST input1:<br/>\")\nResponse.write(\"<br/>input1=\"&(Request.form(\"input1\"))&\"<br/>\")\nResponse.write(\"Len(input1)=\"&Len(Request.form(\"input1\"))&\"<br/>\")\nResponse.write(\"System.Text.Encoding.Unicode.GetByteCount(input1)=\"&System.Text.Encoding.Unicode.GetByteCount(Request.form(\"input1\"))&\"<br/><br/>\")\n\nResponse.write(\"<br/>COOKIE input2:<br/>\")\nResponse.write(\"<br/>input2=\"&(Request.Cookies(\"input2\").Value)&\"<br/>\")\nResponse.write(\"Len(input2)=\"&Len(Request.Cookies(\"input2\").Value)&\"<br/>\")\nResponse.write(\"System.Text.Encoding.Unicode.GetByteCount(input2)=\"&System.Text.Encoding.Unicode.GetByteCount(Request.Cookies(\"input2\").Value)&\"<br/><br/>\")\n\nResponse.write(\"<br/>All GET:<br/><br/>\")\nFor each item in request.querystring\n\tResponse.write(\"<br/>\" & item & \"=\"&request.querystring(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>All POST:<br/>\")\nFor each item in request.form\n\tResponse.write(\"<br/>\" & item & \"=\"&request.form(item)&\"<br/>\")\nNext\n\nResponse.write(\"<br/>All COOKIES:<br/><br/>\")\nFor each item in request.Cookies\n\tResponse.write(\"<br/>\" & item & \"=\"&request.Cookies(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>Server Variables:<br/><br/>\")\nFor each item in Request.ServerVariables\n\tResponse.write(\"<br/>\" & item & \"=\"&Request.ServerVariables(item)&\"<br/>\")\n\tResponse.write(\"<br/>\")\nNext\n\nResponse.write(\"<br/>generic parameter ( REQUEST(\"\"input\"\") ) input:<br/>\")\nResponse.write(\"<br/>input=\"&(Request(\"input\"))&\"<br/>\")\nResponse.write(\"Len(input)=\"&Len(Request(\"input\"))&\"<br/>\")\nResponse.write(\"System.Text.Encoding.Unicode.GetByteCount(input)=\"&System.Text.Encoding.Unicode.GetByteCount(Request(\"input\"))&\"<br/><br/>\")\n%>"
  },
  {
    "path": "Sample Pages/sample.jsp",
    "content": "<%@page pageEncoding=\"utf-8\"%>\n<%@page import=\"java.util.*\"%>\nTest Page (at least vulnerable to xss - don't use on live)<br/>\n<%\nout.println(\"<br/>Parameters:<br/><br/>\");\nEnumeration parameterList = request.getParameterNames();\nwhile( parameterList.hasMoreElements())\n{\n\tString sName = parameterList.nextElement().toString();\n\tString[] sMultiple = request.getParameterValues( sName );\n\tif( 1 >= sMultiple.length ){\n\t\t// parameter has a single value. print it.\n\t\tout.println(\"<br/>\" + sName + \"=\" + request.getParameter( sName ) + \"<br/>\");\n\t\tout.println(\"-> Value Length: \" + request.getParameter( sName ).length() +\"<br/>\" );\n    out.println(\"-> Byte Value Length: \" + request.getParameter( sName ).getBytes(\"UTF-8\").length +\"<br/>\" );\n\t}else{\n\t\tfor( int i=0; i<sMultiple.length; i++ ){\n\t\t  // if a paramater contains multiple values, print all of them\n\t\t  out.println(\"<br/>\" + sName + \"[\" + i + \"]=\" + sMultiple[i] + \"<br/>\" );\n\t\t  out.println(\"-> Value Length: \" + sMultiple[i].length() +\"<br/>\" );\n      out.println(\"-> Byte Value Length: \" + sMultiple[i].getBytes(\"UTF-8\").length +\"<br/>\" );\n    }\n  }\n}\n\nout.println(\"<br/>COOKIE input2:<br/><br/>\");\nCookie cookie = null;\nCookie[] cookies = null;\ncookies = request.getCookies();\nif( cookies != null)\n {\n        for (int i = 0; i < cookies.length; i++){\n                cookie = cookies[i];\n                if (cookie.getName().equals(\"input2\"))\n                        out.println(\"<br/>input2=\"+cookie.getValue()+\"<br/>\");\n        }\n}\nout.println(\"<br/>\");\n\nout.println(\"<br/>Headers:<br/><br/>\");\njava.util.Enumeration names=request.getHeaderNames();\nwhile (names.hasMoreElements()) {\n\tString name = (String) names.nextElement();\n\tString value = request.getHeader(name);\n\tout.println(\"<br/>\"+name + \"=\" + value+\"<br/>\");\n}\n\nout.println(\"<br/>\");\nout.println(\"<br/>Servlet Equivalent of Standard CGI Variables:<br/><br/>\");\n%>\n<pre>\nAUTH_TYPE:       <%= request.getAuthType() %>\nCONTENT_LENGTH:  <%= request.getContentLength() %>\nCONTENT_TYPE:    <%= request.getContentType() %>\nPATH_INFO:       <%= request.getPathInfo() %>\nPATH_TRANSLATED: <%= request.getPathTranslated() %>\nQUERY_STRING:    <%= request.getQueryString() %>\nREMOTE_ADDR:     <%= request.getRemoteAddr() %>\nREMOTE_HOST:     <%= request.getRemoteHost() %>\nREMOTE_USER:     <%= request.getRemoteUser() %>\nREQUEST_METHOD:  <%= request.getMethod() %>\nSCRIPT_NAME:     <%= request.getServletPath() %>\nSERVER_NAME:     <%= request.getServerName() %>\nSERVER_PORT:     <%= request.getServerPort() %>\nSERVER_PROTOCOL: <%= request.getProtocol() %>\nSERVER_SOFTWARE: <%= getServletContext().getServerInfo() %>\nRequest URI:          <%= request.getRequestURI() %>\nRequest URL:          <%= request.getRequestURL() %>\nRequest Context Path: <%= request.getContextPath() %>\nReal Path:            <%= getServletContext().getRealPath(\"/\") %>\n</pre>"
  },
  {
    "path": "Sample Pages/sample.php",
    "content": "Test Page (at least vulnerable to xss - don't use on live)<br/>\n<?php\necho \"<br/>GET input0:<br/>\";\necho \"<br/>input0=\".($_GET[\"input0\"]).\"<br/>\";\necho \"strlen(input0)=\".strlen($_GET[\"input0\"]).\"<br/>\";\necho \"mb_strlen(input0)=\".mb_strlen($_GET[\"input0\"], '8bit').\"<br/><br/>\";\n\necho \"<br/>POST input1:<br/>\";\necho \"<br/>input1=\".($_POST[\"input1\"]).\"<br/>\";\necho \"strlen(input1)=\".strlen($_POST[\"input1\"]).\"<br/>\";\necho \"mb_strlen(input1)=\".mb_strlen($_POST[\"input1\"], '8bit').\"<br/><br/>\";\n\necho \"<br/>COOKIE input2:<br/>\";\necho \"<br/>input2=\".($_COOKIE[\"input2\"]).\"<br/>\";\necho \"strlen(input2)=\".strlen($_COOKIE[\"input2\"]).\"<br/>\";\necho \"mb_strlen(input2)=\".mb_strlen($_COOKIE[\"input2\"], '8bit').\"<br/><br/>\";\n?>\n<?php\nparse_str(file_get_contents(\"php://input\"), $_POST_RAW);\n\n$req_dump=str_repeat(\"-=\", 20).\"\\r\\n\\$_SERVER:\\r\\n\".print_r($_SERVER,true).\"\\r\\n\\$_POST:\\r\\n\".print_r($_POST,true).\"\\r\\n\\$_GET:\\r\\n\".print_r($_GET,true).\"\\r\\n\\$_FILES:\\r\\n\".print_r($_FILES,true).\"\\r\\n\\$_POST_RAW:\\r\\n\".print_r($_POST_RAW,true).\"\\r\\n\\$_COOKIE:\\r\\n\".print_r($_COOKIE,true).\"\\r\\n\";\n\necho \"<pre>\".$req_dump.\"</pre>\";\n\necho \"<br/>generic parameter ( \\$_REQUEST[\\\"input\\\"] ) input:<br/>\";\necho \"<br/>input=\".($_REQUEST[\"input\"]).\"<br/>\";\necho \"strlen(input)=\".strlen($_REQUEST[\"input\"]).\"<br/>\";\necho \"mb_strlen(input)=\".mb_strlen($_REQUEST[\"input\"], '8bit').\"<br/><br/>\"; \n?>\n\n"
  },
  {
    "path": "Sample Pages/sample.py",
    "content": "from django.http import HttpResponse\nimport re\nimport os\n\ndef index(request):\n\tresult = \"Test Page (at least vulnerable to xss - don't use on live)<br/>\\n\"\n\ttry:\n\t\tresult += \"<br/>GET input0:<br/><br/>\"\n\t\tresult += \"input0=\"+request.GET['input0']+\"<br/>\"\n\t\tresult += \"len(input0)=\"+str(len(request.GET['input0']))+\"<br/>\"\n\t\tresult += \"s.encode('utf-8')(input0)=\"+str(utf8len(request.GET['input0']))+\"<br/><br/>\"\n\texcept:\n\t\tpass\n\n\ttry:    \n\t\tresult += \"<br/>POST input1:<br/><br/>\"\n\t\tresult += \"input1=\"+request.POST['input1']+\"<br/>\"\n\t\tresult += \"len(input1)=\"+str(len(request.POST['input1']))+\"<br/>\"\n\t\tresult += \"s.encode('utf-8')(input1)=\"+str(utf8len(request.POST['input1']))+\"<br/><br/>\"\n\texcept:\n\t\tpass\n\n\ttry:    \n\t\tresult += \"<br/>COOKIE input2:<br/><br/>\"\n\t\tresult += \"input2=\"+request.COOKIES.get('input2')+\"<br/>\"\n\t\tresult += \"len(input2)=\"+str(len(request.COOKIES.get('input2')))+\"<br/>\"\n\t\tresult += \"s.encode('utf-8')(input2)=\"+str(utf8len(request.COOKIES.get('input2')))+\"<br/><br/>\"\n\texcept:\n\t\tpass\n\n\t\t\n\tresult += \"<br/>\\nGET:\\n<br/>\"\n\tfor key, values in request.GET.lists():\n\t\tresult += key + \"=\" + ', '.join(values) + \"<br/>\\n<br/>\"     \n\tresult += \"\\n<br/>POST:\\n<br/>\"\n\tfor key, values in request.POST.lists():\n\t\tresult += key + \"=\" + ', '.join(values) + \"<br/>\\n<br/>\" \n\tresult += \"\\n<br/>HEADERS:\\n<br/>\"\n\t#regex_headers = re.compile(r'^(HTTP_.+|CONTENT_TYPE|CONTENT_LENGTH)$')\n\t#request_headers = {}\n\tfor header in request.META:\n\t\t#if regex_headers.match(header):\n\t\t\tresult +=   \"{header}:{value}<br/>\\n<br/>\".format(header=header,value=request.META[header])\n\t\n\tfor key in os.environ.keys():\n\t\tresult = result + \"%30s: %s <br/>\\n\" % (key,os.environ[key])\n\n\treturn HttpResponse(result)\n\n\ndef utf8len(s):\n  return len(s.encode('utf-8'))"
  },
  {
    "path": "Testing/HTTPRequestHolder.py",
    "content": "class HTTPRequestHolder(object):\n    rawHTTPRequest = ''\n    additionalInfo = ''\n\n    # The class \"constructor\" - It's actually an initializer\n    def __init__(self, rawHTTPRequest='', additionalInfo=''):\n        self.rawHTTPRequest = rawHTTPRequest\n        self.additionalInfo = additionalInfo\n\n"
  },
  {
    "path": "Testing/box_definition.py",
    "content": "class BoxObject(object):\n    ip = ''\n    port = ''\n    path = ''\n    hostname = ''\n    isSSL = False\n    description = ''\n    isEnabled = True\n    # The class \"constructor\" - It's actually an initializer\n    def __init__(self, ip='127.0.0.1',port='',path='',hostname='',isSSL=False,description='',isEnabled=True):\n        self.ip = ip\n        self.port = port\n        self.path = path\n        self.hostname = hostname\n        self.isSSL = isSSL\n        self.description = description\n        self.isEnabled = isEnabled\n        self._setParams()\n\n    def _setParams(self):\n        if self.hostname == '':\n            self.hostname = self.ip\n\n        if self.port == '':\n            if self.isSSL:\n                self.port = '443'\n            else:\n                self.port = '80'\n\n        if self.path == '':\n            self.path = '/'\n"
  },
  {
    "path": "Testing/config.py",
    "content": "import box_definition\nimport testcase_definition\n\nlog_file = 'logs.txt'\nresult_file = 'results.txt'\n\ntimeout = 3\nsniper_mode = False # This will only use the sniper_box settings\n\ntarget_boxes = []\n# we can have multiple targets\ntarget_boxes.append(box_definition.BoxObject(ip='192.168.1.1',port='80',path='/sample.mypy',hostname='test.com',isSSL=False,description='Nginx-django-py3',isEnabled=False))\ntarget_boxes.append(box_definition.BoxObject(ip='192.168.1.2',port='80',path='/sample.php',hostname='victim.com',isSSL=False,description='Apache-php5-mod_php behind WAF'))\ntarget_boxes.append(box_definition.BoxObject(ip='192.168.1.3',port='80',path='/sample.jsp',hostname='',isSSL=False,description='Apache Tomcat7 Java 1.6 behind squid',isEnabled=True))\ntarget_boxes.append(box_definition.BoxObject(ip='192.168.1.4',port='80',path='/sample.asp',hostname='',isSSL=False,description='IIS10-ASP Classic'))\ntarget_boxes.append(box_definition.BoxObject(ip='192.168.1.5',port='80',path='/sample.aspx',hostname='',isSSL=False,description='IIS10-ASPX (v4.x)'))\n\n# we can only have one sniper box\nsniper_box = box_definition.BoxObject(ip='127.0.0.1',port='443',path='/specifictarget',hostname='mytest.com',isSSL=True,description='something')\n\ntemplates = []\n# we can have multiple templates\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test0 HTTP/1.1\nHOST: $ip\nConnection: Close\n\n\"\"\", description='Normal GET', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Normal POST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST as GET', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"XXX $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='XXX as POST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"[]'{}$&*() $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='[]\\'{}$&*() as POST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 0\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-Multiple Content-Length - Wrong First', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nContent-Length: 0\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-Multiple Content-Length - Wrong Second', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-No Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent_Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-Content_Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 10\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-Smaller Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 100\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.1)-Larger Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 0\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-Multiple Content-Length - Wrong First', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nContent-Length: 0\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-Multiple Content-Length - Wrong Second', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-No Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent_Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-Content_Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 10\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-Smaller Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 100\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST (HTTP/1.0)-Larger Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test31337 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 0\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test31337', description='GET (HTTP/1.0)-Multiple Content-Length - Wrong First', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test31337 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nContent-Length: 0\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test31337', description='GET (HTTP/1.0)-Multiple Content-Length - Wrong Second', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test31337 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 10\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test31337', description='GET (HTTP/1.0)-Smaller Content-Length', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test31337 HTTP/1.0\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 100\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test31337', description='GET (HTTP/1.0)-Larger Content-Length', isEnabled=False))\n\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $ip\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 25\nConnection: Close\n\ninput1=test1337AAAAAAAAAA\"\"\", flagRegExStrInResponse='test1337', description='Content-Length with Slow Completion by Socket',\n                    timeout=100, isRateLimited=True, sendInitialChars=145, sendBodyCharRate=1, delayInBetween=0.2, isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Multiple HOST (both the same)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nHOST: foobar.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Multiple HOST (first one valid)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: foobar.com\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Multiple HOST (second one valid)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://foobar.com$path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Different invalid HOST Name in Path valid in header', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname$path?input0=test0 HTTP/1.1\nHOST: foobar.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Different valid HOST Name in Path invalid in header', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: []'{}$&*() as HOST\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='[]\\'{}$&*() as HOST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: {}'$&(^_-.`)#!~\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='{}\\'$&(^_-.`)#!~ as HOST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: foobar.com@$hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='invalid@valid as HOST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://foobar.com@$hostname$path?input0=test0 HTTP/1.1\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='invalid@valid as HOST in PATH with no HOST - HTTP1.1', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://foobar.com@$hostname$path?input0=test0 HTTP/1.0\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='invalid@valid as HOST in PATH with no HOST - HTTP1.0', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: \nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Empty HOST', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://invalid@$path?input0=test0 HTTP/1.1\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='invalid@empty as HOST in PATH with no HOST  - HTTP1.1', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://invalid@$path?input0=test0 HTTP/1.0\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='invalid@empty as HOST in PATH with no HOST  - HTTP1.0', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http$asciiChar://$hostname$path?input0=test0 HTTP/1.1\nHost: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='http+asciiChar as protocol', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHost: $hostname:45678\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='45678', description='HOST Port Manipulation in header', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname:45678$path?input0=test0 HTTP/1.1\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='45678', description='HOST Port Manipulation in path with no HOST header on HTTP/1.1', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname:45678$path?input0=test0 HTTP/1.0\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='45678', description='HOST Port Manipulation in path with no HOST header on HTTP/1.0', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname:45670$path?input0=test0 HTTP/1.1\nHost: $hostname:45679\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='4567', description='HOST Port Manipulation in header and path', isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET $path?input0=test1337\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1234\"\"\", flagRegExStrInResponse='test1337', description='GET with HTTP v0.9 with relative path', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1234\"\"\", flagRegExStrInResponse='test1337', description='GET with HTTP v0.9 with absolute path', isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST with HTTP v0.9 with relative path', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname$path?input0=test0\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 15\nConnection: Close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='POST with HTTP v0.9 with absolute path', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/0.123\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/0.123)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/1.10000000\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with GET with invalid HTTP version (HTTP/1.10000000)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/00000001.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/00000001.1)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/1.10\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/1.10)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/1.19\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/1.19)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/2.0\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/2.0)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/.9\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/.9)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/0.99\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/0.99)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP/9.9\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/9.9)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 HTTP${asciiChar}1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (HTTP/9.9)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 XXXX/0.123\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (XXXX/1.1)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"GET http://$hostname$path?input0=test1337000 XXXX\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337000', description='GET with invalid HTTP version (XXXX)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname$path?input0=test1337000 HTTP/0.9\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337111', description='POST with invalid HTTP version (HTTP/0.9)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://$hostname$path?input0=test1337000 XXXX\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337111', description='POST with invalid HTTP version (XXXX)', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337000 HTTP/1.1\nHOST: $hostname$asciiChar\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 37\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337111', description='valid  characters in host header', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337000 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 36\nConnection: Close\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337222', description='Additional character after final character (based on length) - connection: close', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337000 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 36\nConnection: keep-alive\n\ninput1=test1337111&input0=test1337222\"\"\", flagRegExStrInResponse='test1337222', description='Additional character after final character (based on length) - connection: keep-alive', isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nCont${asciiChar}ent-Length: 15\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Ignored characters in the middle of valid header names such as content-length', isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 1${asciiChar}5\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Ignored characters in the middle of valid header names such as content-length', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\n${asciiChar}Content-Length: 15\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Valid characters before headers', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: application/x-www-form-urlencoded\nContent-Length${asciiChar}: 15\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Valid characters after headers before colon', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname${asciiChar}Content-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Valid header separators', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15${asciiChar}\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='test1337', description='Valid characters after content-length values', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 17\nContent-Type: application/x-www-form-urlencoded${asciiChar}\nConnection: close\n\ninput1=test133%37\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters after content-type values', timeout=1, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length:${asciiChar} 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters before headers values after colon before space in content-length', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type:${asciiChar} application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters before headers values after colon before space in content-type', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nTEST\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Empty header without colon', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: ${asciiChar}application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters before headers values after colon before space in content-type (POST)', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: appli${asciiChar}cation/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters in the middle of \"application\" in in \"Content-Type: application/x-www-form-urlencoded\"', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-fo${asciiChar}rm-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Valid characters in the middle of \"form\" in in \"Content-Type: application/x-www-form-urlencoded\"', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $filename${asciiChar}.$extension?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Ignored characters after file path before extension', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path${asciiChar}?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Ignored characters after file path', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST /${asciiChar}$filename.$extension?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Ignored characters before file path', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST %2F$path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Start path with %2F rather than /', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST /%2F/$path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Start path with /%2F/', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST /%2E/$path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='Start path with /%2E/', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST /$filename%u002e$extension?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input1=test1337', description='. character replacement before extension with %u002e', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123\\r\\nContent-Disposition: form-data; name=\"input1\"\\r\\n\\r\\ntest1337\\r\\n----------deilim123--\"\"\",\nflagRegExStrInResponse='input1=test1337', description='Converting \"application/x-www-form-urlencoded\" to \"multipart/form-data\" in normal POST (CR LF between multiparts)', timeout=10, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123\\r\\nContent-Disposition: form-data; name=\"input1\"\\r\\n\\r\\ntest1337\"\"\",\nflagRegExStrInResponse='>input1=test1337', description='Converting \"application/x-www-form-urlencoded\" to \"multipart/form-data\" in normal POST (CR LF between multiparts) - Missing last boundary', timeout=10, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123\\nContent-Disposition: form-data; name=\"input1\"\\n\\ntest1337\\n----------deilim123--\"\"\",\nflagRegExStrInResponse='input1=test1337', description='Converting \"application/x-www-form-urlencoded\" to \"multipart/form-data\" in normal POST (LF between multiparts)', timeout=10, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123\\r\\nContent-Disposition: name=\"input1\"\\r\\n\\r\\ntest1337\\r\\n----------deilim123--\"\"\",\nflagRegExStrInResponse='>input1=test1337', description='\"multipart/form-data\" in normal POST (CR LF between multiparts) - Missing form-data in Content-Disposition', timeout=10, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123Content-Disposition: form-data; name=\"input1\"\\r\\n\\r\\ntest1337\\r\\n----------deilim123--\"\"\",\nflagRegExStrInResponse='>input1=test1337', description='\"multipart/form-data\" in normal POST (CR LF between multiparts) - No character between Content-Disposition and the boundary', timeout=10, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Type: multipart/form-data; boundary=--------deilim123\nConnection: close\nContent-Length: 0\n\n----------deilim123\\r\\nContent-Disposition: name=\"input1\"; form-data;\\r\\n\\r\\ntest1337\\r\\n----------deilim123--\"\"\",\nflagRegExStrInResponse='>input1=test1337', description='\"multipart/form-data\" in normal POST (CR LF between multiparts) - name before form-data in Content-Disposition', timeout=10, autoContentLength=True, isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=testGET HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nCOOKIE: input0=testCOOKIE\ninput0: testHEADER\nConnection: close\n\ninput0=testPOST\"\"\", flagRegExStrInResponse='input0=', description='One parameter in GET/POST/COOKIES/HEADER - reading GET', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input1=testGET HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nCOOKIE: input1=testCOOKIE\ninput1: testHEADER\nConnection: close\n\ninput1=testPOST\"\"\", flagRegExStrInResponse='input1=', description='One parameter in GET/POST/COOKIES/HEADER - reading POST', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test111&input0=test222&input0=test333 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input0=', description='Multiple GET Parameters with the same name', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 0\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test111&input1=test222&input1=test333\"\"\", flagRegExStrInResponse='input0=', description='Multiple POST Parameters with the same name', timeout=3, autoContentLength=True, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test0 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nCookie: input2=test111;input2=test222;input2=test333;\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='input2=', description='Multiple Cookie Parameters with the same name', timeout=3, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0${asciiChar}=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='input0=test1337', description='Ignored characters after parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0%${asciiHex}=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='input0=test1337', description='Ignored url-encoded characters after parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?${asciiChar}input0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='[^>]>input0=test1337', description='Ignored characters before parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?%${asciiHex}input0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='[^>]>input0=test1337', description='Ignored url-encoded characters before parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?inp${asciiChar}ut0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='input0=test1337', description='Ignored characters in the middle of parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?inp%${asciiHex}ut0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='input0=test1337', description='Ignored url-encoded characters in the middle of parameter name (GET) - before = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: foo=bar${asciiChar}input2=test1337;\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337', description='; character replacement in Cookie', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: input2${asciiChar}test1337;\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337', description='; character replacement in Cookie', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: inp${asciiChar}ut2=test1337;\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337', description='Ignored characters in Cookie name', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: input2=test${asciiChar}1337;\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337', description='Ignored characters in Cookie value', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?foo=bar${asciiChar}input0=test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337', description='& character replacement in GET', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?foo=bar%${asciiHex}input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337', description='& character replacement in GET (url-encoded)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0${asciiChar}test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337', description='= character replacement in GET', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0%${asciiHex}test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337', description='= character replacement in GET (url-encoded)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337${asciiChar} HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored characters after parameter value (GET)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test1337%${asciiHex} HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored url-encoded characters after parameter value (GET)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=${asciiChar}test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored characters before parameter value (GET) - after = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=%${asciiHex}test1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored url-encoded characters before parameter value (GET) - after = sign', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test${asciiChar}1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored characters in the middle of parameter value (GET)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test%${asciiHex}1337 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input0=test1337<[^<\\s]', description='Ignored url-encoded characters in the middle of parameter value (GET)', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=1 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: inpu%742=test1337\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337<[^<\\s]', description='URL Encoding in Cookie parameter name', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=1 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: input2=tes%741337\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337<[^<\\s]', description='URL Encoding in Cookie parameter value', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=1 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: inpu%u00742=test1337\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337<[^<\\s]', description='utf-8 Encoding (%uHHHH) in Cookie parameter name', timeout=5, isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=1 HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nCookie: input2=tes%u00741337\nContent-Type: application/x-www-form-urlencoded\nConnection: close\n\ninput1=test1\"\"\", flagRegExStrInResponse='>input2=test1337<[^<\\s]', description='utf-8 Encoding (%uHHHH) in Cookie parameter value', timeout=5, isEnabled=False))\n\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=1 HTTP/1.1\nHOST: $hostname\nContent-Length: 15\nContent-Type: application/x-www-form-urlencoded; charset=${charset}\nConnection: close\n\ninput1=test1337\"\"\", flagRegExStrInResponse='(^i|>i)nput1=test1337<[^<\\s]', inverseFlag=True, description='utf-8 Encoding (%uHHHH) in Cookie parameter value', timeout=5, isEnabled=False))\n\n\n\n\n\n\n\n\n# perhaps for sniper use\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST $path?input0=test HTTP/1.1\nHOST: $hostname\nContent-Length: 12\nContent-Type: application/x-www-form-urlencoded\nCookie: input2${asciiChar}=test2\nConnection: close\n\ninput1=test1\"\"\", selectRegExFromRequest='input2([^=]|=)', flagRegExStrInResponse='\\[{selected_response}\\]',\ninverseFlag=True, description='Normal ASCII character conversion in GET (URL) paramater name', timeout=5, isEnabled=False))\n\ntemplates.append(testcase_definition.TestcaseObject(rawTemplate=\n\"\"\"POST http://0me.me/calc.php?a=2222&b=2 HTTP/1.0\nHost: 0me.me\nConnection: keep-alive\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 10\n\nc=3333&d=3POST http://0me.me/calc.php?a=1111&b=1 HTTP/1.1\nHost: 0me.me\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 9\n\nc=7&d=191\"\"\", flagRegExStrInResponse='test1337', description='Sniper Related - HTTP Pipelining, 1 character every 200 milisec',\n                    timeout=100, isRateLimited=False, sendInitialChars=1, sendBodyCharRate=1, delayInBetween=0.2, isEnabled=False))"
  },
  {
    "path": "Testing/run.py",
    "content": "import config\nimport web_request_socket\nfrom datetime import datetime\nimport codecs\nimport re\nimport testcase_mutation\nimport HTTPRequestHolder\nimport uuid\n\ndef logThis(message,type='log'):\n    if type=='log':\n        message = u\"{delim}{time}{delim} {message}\".format(delim=\"~\"*30, time=datetime.now(),message=unicode(message, errors='ignore'))\n        log_file = config.log_file\n        print message\n    else:\n        log_file = config.result_file\n\n    with codecs.open(log_file, \"a\",\"utf-8\") as myfile:\n        myfile.write(message+'\\n')\n\n\ndef runTestcaseOnTarget(req_template,target_BoxObject):\n    HTTPRequestHolderObjs = []\n    initHTTPRequest = req_template.ReqBuilder(target_BoxObject)\n\n    HTTPRequestHolderObjs.append(HTTPRequestHolder.HTTPRequestHolder(initHTTPRequest))\n\n    if '$asciiChar' in initHTTPRequest or '${asciiChar}' in initHTTPRequest:\n        HTTPRequestHolderObjs = testcase_mutation.asciiChar(HTTPRequestHolderObjs)\n\n    if '$asciiHex' in initHTTPRequest or '${asciiHex}' in initHTTPRequest:\n        HTTPRequestHolderObjs = testcase_mutation.asciiHex(HTTPRequestHolderObjs)\n\n    if '$charset' in initHTTPRequest or '${charset}' in initHTTPRequest:\n        HTTPRequestHolderObjs = testcase_mutation.encodingList(HTTPRequestHolderObjs)\n\n    for HTTPRequestHolderObj in HTTPRequestHolderObjs:\n        testUUID = str(uuid.uuid4())\n        rawHTTPRequest = HTTPRequestHolderObj.rawHTTPRequest\n        additionalInfo = HTTPRequestHolderObj.additionalInfo\n        logThis(\"\\n==Request to {ip} ({msgDesc}) - Template: {tempDesc} - TestID: {testID} - Additional Info:[{info}]==\\n{message}\".format(ip=target_BoxObject.ip,\n                                                                                             msgDesc=target_BoxObject.description,\n                                                                                             tempDesc=req_template.description,\n                                                                                             testID=testUUID,\n                                                                                             info=additionalInfo,\n                                                                                             message=rawHTTPRequest),'log')\n        timeout = config.timeout\n        if req_template.timeout > 0:\n            timeout = req_template.timeout\n\n        result = web_request_socket.SendHTTPRequestBySocket(rawHTTPRequest=rawHTTPRequest,\n                                                            targetName=target_BoxObject.ip,\n                                                            targetPort=int(target_BoxObject.port),\n                                                            isSSL=target_BoxObject.isSSL,\n                                                            timeout=timeout,\n                                                            includeTimeoutErr=False,\n                                                            isRateLimited=req_template.isRateLimited,\n                                                            sendInitialChars=req_template.sendInitialChars,\n                                                            sendBodyCharRate=req_template.sendBodyCharRate,\n                                                            delayInBetween=req_template.delayInBetween)\n\n        statusCode = 'Unknown (HTTP v0.9?)'\n        try:\n            statusCode = re.search('HTTP/\\d\\.\\d\\s(\\d+)', result).group(1)\n        except:\n            pass\n\n\n        flagInResponseStringResult = ''\n        if req_template.flagRegExStrInResponse != '':\n            searchForRegexInResponse = req_template.flagRegExStrInResponse\n            if req_template.selectRegExFromRequest != '' and '{selected_response}' in searchForRegexInResponse:\n                requestPatternMatch = re.search(req_template.selectRegExFromRequest,rawHTTPRequest,re.MULTILINE)\n                if requestPatternMatch is not None:\n                    selected_response = re.escape(requestPatternMatch.group(0))\n                    print selected_response\n                    searchForRegexInResponse = searchForRegexInResponse.format(selected_response=selected_response)\n\n            flagInResponseStringResult = ' - Flag ({flag}) result: '.format(flag=searchForRegexInResponse)\n            searchForPattern = re.compile(searchForRegexInResponse)\n            if (searchForPattern.search(result,re.MULTILINE) and not req_template.inverseFlag) or (not searchForPattern.search(result,re.MULTILINE) and req_template.inverseFlag):\n                flagInResponseStringResult = flagInResponseStringResult + 'Flagged!'\n                logThis(\"Success: [{tempDesc}] from [{ip}] ([{msgDesc}]) - Status code: [{statusCode}] - TestID: {testID} - Additional Info:[{info}]\\n\\n\".format(\n                    ip=target_BoxObject.ip,\n                    msgDesc=target_BoxObject.description,\n                    tempDesc=req_template.description,\n                    statusCode=statusCode,\n                    testID=testUUID,\n                    info=additionalInfo), 'result')\n            else:\n                flagInResponseStringResult = flagInResponseStringResult + 'NotFlagged!'\n\n        logThis(\"\\n==Response from {ip} ({msgDesc}) - Template: {tempDesc}{flagInResponse} - TestID: {testID} - Additional Info:[{info}]==\\n{message}\".format(\n            ip=target_BoxObject.ip,\n            msgDesc=target_BoxObject.description,\n            tempDesc=req_template.description,\n            flagInResponse=flagInResponseStringResult,\n            testID=testUUID,\n            info=additionalInfo,\n            message=result),'log')\n\n\nif __name__=='__main__':\n    for req_template in config.templates:\n        if req_template.isEnabled:\n            if config.sniper_mode is False:\n                for target_BoxObject in config.target_boxes:\n                    if target_BoxObject.isEnabled:\n                        runTestcaseOnTarget(req_template, target_BoxObject)\n            else:\n                runTestcaseOnTarget(req_template, config.sniper_box)\n"
  },
  {
    "path": "Testing/testcase_definition.py",
    "content": "from string import Template\nimport os\nimport re\n\nclass TestcaseObject(object):\n    _rawTemplate = ''\n    templateRequest = Template('')\n    selectRegExFromRequest = ''\n    flagRegExStrInResponse = ''\n    inverseFlag = False\n    description = ''\n    timeout = 0\n    isEnabled = True\n    isRateLimited = False\n    sendInitialChars = 0\n    sendBodyCharRate = 1\n    delayInBetween = 0\n    autoContentLength = False\n\n    # The class \"constructor\" - It's actually an initializer\n    def __init__(self, rawTemplate='',selectRegExFromRequest='',flagRegExStrInResponse='', inverseFlag=False,description='' ,isEnabled=True,timeout=0,\n                 isRateLimited=False, sendInitialChars=0, sendBodyCharRate=1, delayInBetween=0, autoContentLength=False):\n\n        self._rawTemplate = rawTemplate\n        self.selectRegExFromRequest = selectRegExFromRequest\n        self.flagRegExStrInResponse = flagRegExStrInResponse\n        self.inverseFlag = inverseFlag\n        self.description = description\n        self.isEnabled = isEnabled\n        self.timeout = timeout\n        self.isRateLimited = isRateLimited\n        self.sendInitialChars = sendInitialChars\n        self.sendBodyCharRate = sendBodyCharRate\n        self.delayInBetween = delayInBetween\n        self.autoContentLength = autoContentLength\n        self._setParams()\n\n    def _setParams(self):\n        self.templateRequest = Template(self._rawTemplate)\n\n    def ReqBuilder(self, target_BoxObject):\n        filename, extension = os.path.splitext(target_BoxObject.path)\n        extension = extension[1:] # removing the dot character before the extension\n        result = self.templateRequest.safe_substitute(ip=target_BoxObject.ip,\n                                                    port=target_BoxObject.port,\n                                                    path=target_BoxObject.path,\n                                                    filename=filename,\n                                                    extension=extension,\n                                                    hostname=target_BoxObject.hostname,\n                                                    description=target_BoxObject.description)\n\n        if self.autoContentLength:\n            bodylength = len(result) - re.search(\"(\\r\\n\\r\\n)|(\\n\\n)\", result).end()\n            if re.search(\"content\\\\-length\", result, re.IGNORECASE):\n                result = re.sub(r\"(?i)content\\-length:\\s*\\d+\", \"Content-Length: \" + str(bodylength),\n                                result, 1)\n            else:\n                result = re.sub(r\"(\\r\\n\\r\\n)|(\\n\\n)\", \"\\r\\nContent-Length: \" + str(bodylength) + \"\\r\\n\\r\\n\",\n                                result, 1)\n\n        return result\n"
  },
  {
    "path": "Testing/testcase_mutation.py",
    "content": "from string import Template\nimport HTTPRequestHolder\nimport codecs\nimport binascii\n\ndef int2bytes(i):\n    hex_string = '%x' % i\n    n = len(hex_string)\n    return binascii.unhexlify(hex_string.zfill(n + (n & 1)))\n\ndef asciiChar(HTTPRequestHolderObjs):\n    result = []\n    for HTTPRequestHolderObj in HTTPRequestHolderObjs:\n        initHTTPReq = HTTPRequestHolderObj.rawHTTPRequest\n        initAdditionalInfo = HTTPRequestHolderObj.additionalInfo\n        for c in range(0, 256):\n            asciiChar = chr(c)\n            additionalInfo = 'ASCII [Code: {} - Char: {}]'.format(c, codecs.escape_encode(asciiChar))\n            if initAdditionalInfo != '':\n                additionalInfo = initAdditionalInfo + ' - ' + additionalInfo\n            HTTPRequestHolderObjTemp = HTTPRequestHolder.HTTPRequestHolder(Template(initHTTPReq).safe_substitute(asciiChar=asciiChar),additionalInfo)\n            result.append(HTTPRequestHolderObjTemp)\n    return result\n\ndef asciiHex(HTTPRequestHolderObjs):\n    result = []\n    for HTTPRequestHolderObj in HTTPRequestHolderObjs:\n        initHTTPReq = HTTPRequestHolderObj.rawHTTPRequest\n        initAdditionalInfo = HTTPRequestHolderObj.additionalInfo\n        for c in range(0, 256):\n            asciiChar = chr(c)\n            asciiHex = \"{:02x}\".format(c)\n            additionalInfo = 'ASCII [Code: {} - Char: {} - Hex: {}]'.format(c, codecs.escape_encode(asciiChar), asciiHex)\n            if initAdditionalInfo != '':\n                additionalInfo = initAdditionalInfo + ' - ' + additionalInfo\n            HTTPRequestHolderObjTemp = HTTPRequestHolder.HTTPRequestHolder(Template(initHTTPReq).safe_substitute(asciiHex=asciiHex),additionalInfo)\n            result.append(HTTPRequestHolderObjTemp)\n    return result\n\n\ndef unicodeChar(HTTPRequestHolderObjs):\n    result = []\n    for HTTPRequestHolderObj in HTTPRequestHolderObjs:\n        initHTTPReq = HTTPRequestHolderObj.rawHTTPRequest\n        initAdditionalInfo = HTTPRequestHolderObj.additionalInfo\n        for u in range(0, 65535):\n            unicodeChar = int2bytes(u)\n            additionalInfo = 'UNICODE [Code: {} - Char: {}]'.format(u, codecs.escape_encode(unicodeChar))\n            if initAdditionalInfo != '':\n                additionalInfo = initAdditionalInfo + ' - ' + additionalInfo\n            HTTPRequestHolderObjTemp = HTTPRequestHolder.HTTPRequestHolder(Template(initHTTPReq).safe_substitute(asciiChar=asciiChar),additionalInfo)\n            result.append(HTTPRequestHolderObjTemp)\n    return result\n\ndef encodingList(HTTPRequestHolderObjs):\n    result = []\n    charList = \"IBM037,IBM437,IBM500,ASMO-708,DOS-720,ibm737,ibm775,ibm850,ibm852,IBM855,ibm857,IBM00858,IBM860,ibm861,DOS-862,IBM863,IBM864,IBM865,cp866,ibm869,IBM870,windows-874,cp875,shift_jis,gb2312,ks_c_5601-1987,big5,IBM1026,IBM01047,IBM01140,IBM01141,IBM01142,IBM01143,IBM01144,IBM01145,IBM01146,IBM01147,IBM01148,IBM01149,utf-16,unicodeFFFE,windows-1250,windows-1251,Windows-1252,windows-1253,windows-1254,windows-1255,windows-1256,windows-1257,windows-1258,Johab,macintosh,x-mac-japanese,x-mac-chinesetrad,x-mac-korean,x-mac-arabic,x-mac-hebrew,x-mac-greek,x-mac-cyrillic,x-mac-chinesesimp,x-mac-romanian,x-mac-ukrainian,x-mac-thai,x-mac-ce,x-mac-icelandic,x-mac-turkish,x-mac-croatian,utf-32,utf-32BE,x-Chinese-CNS,x-cp20001,x-Chinese-Eten,x-cp20003,x-cp20004,x-cp20005,x-IA5,x-IA5-German,x-IA5-Swedish,x-IA5-Norwegian,us-ascii,x-cp20261,x-cp20269,IBM273,IBM277,IBM278,IBM280,IBM284,IBM285,IBM290,IBM297,IBM420,IBM423,IBM424,x-EBCDIC-KoreanExtended,IBM-Thai,koi8-r,IBM871,IBM880,IBM905,IBM00924,EUC-JP,x-cp20936,x-cp20949,cp1025,koi8-u,iso-8859-1,iso-8859-2,iso-8859-3,iso-8859-4,iso-8859-5,iso-8859-6,iso-8859-7,iso-8859-8,iso-8859-9,iso-8859-13,iso-8859-15,x-Europa,iso-8859-8-i,iso-2022-jp,csISO2022JP,iso-2022-jp,iso-2022-kr,x-cp50227,euc-jp,EUC-CN,euc-kr,hz-gb-2312,GB18030,x-iscii-de,x-iscii-be,x-iscii-ta,x-iscii-te,x-iscii-as,x-iscii-or,x-iscii-ka,x-iscii-ma,x-iscii-gu,x-iscii-pa,utf-7,utf-8\"\n    charList = charList.split(\",\")\n    for HTTPRequestHolderObj in HTTPRequestHolderObjs:\n        initHTTPReq = HTTPRequestHolderObj.rawHTTPRequest\n        initAdditionalInfo = HTTPRequestHolderObj.additionalInfo\n        for charset in charList:\n            additionalInfo = 'UNICODE [Charset: {}]'.format(charset)\n            if initAdditionalInfo != '':\n                additionalInfo = initAdditionalInfo + ' - ' + additionalInfo\n            HTTPRequestHolderObjTemp = HTTPRequestHolder.HTTPRequestHolder(Template(initHTTPReq).safe_substitute(charset=charset),additionalInfo)\n            result.append(HTTPRequestHolderObjTemp)\n    return result\n\n\n\n\n"
  },
  {
    "path": "Testing/web_request_socket.py",
    "content": "#!/usr/bin/python\nimport re\nimport socket\nimport urlparse\nimport ssl\nimport urllib\nimport time\n\n# See HTTPPipelineTest() for a simple usage\n# Example:\n# RequestObject('POST', 'https://soroush.secproject.com/?q1=q2','var=val',{'cookie':'x=2;r=5','connection':'close','Content-Type': 'application/x-www-form-urlencoded'}, True)\nclass RequestObject(object):\n    url = ''\n    _path = ''\n    _CRLF = '\\r\\n'\n    qs = ''\n    cookie = ''\n    body = ''\n    headers = None\n    autoContentLength = True\n    autoHOSTHeader = True\n    useAbsolutePath = False\n    isSSL = False\n    HTTPVersion = ''\n    targetName = ''\n    targetPort = ''\n    targetProtocol = ''\n    # The class \"constructor\" - It's actually an initializer\n    def __init__(self, method='GET', url='', body='', headers=None, autoContentLength=True, autoHOSTHeader=True, useAbsolutePath=False, HTTPVersion='HTTP/1.1'):\n        self.method = method\n        self.url = url\n        self.body = body\n        self.headers = headers\n        self.autoContentLength = autoContentLength\n        self.autoHOSTHeader = autoHOSTHeader\n        self.useAbsolutePath = useAbsolutePath\n        self.HTTPVersion = HTTPVersion\n        self._setParams()\n\n    def _setParams(self):\n        parsedURL = urlparse.urlparse(self.url)\n        # setting the path\n        if self.useAbsolutePath == True:\n            self._path = self.url\n        else:\n            self._path = parsedURL.path\n            self.qs = parsedURL.query\n\n        if self._path == '':\n            self._path = '/'\n\n        # fix the body if it is in dict format\n        if isinstance(self.body,dict):\n            self.body = urllib.urlencode(self.body)\n\n        # set other necessary parameters\n        self.targetName = parsedURL.netloc\n        self.targetPort = parsedURL.port\n        self.targetProtocol = (parsedURL.scheme).lower()\n        if self.targetProtocol == 'https':\n            self.isSSL = True\n            if self.targetPort == None: self.targetPort = 443\n        elif self.targetPort == None:\n            self.targetPort = 80\n\n    def rawRequest(self):\n        self._setParams()\n\n        #building the raw request\n        queryString = ''\n        hostHeader = ''\n        contentLengthHeader = ''\n        incomingHeaders = ''\n        if self.autoHOSTHeader:\n            hostHeader = self._CRLF + \"Host: \" + self.targetName + self._CRLF\n        if self.headers != None:\n            for key, value in self.headers.iteritems():\n                incomingHeaders = incomingHeaders + str(key) + \": \" + str(value) + self._CRLF\n        if incomingHeaders.endswith(self._CRLF):\n            incomingHeaders = incomingHeaders[:-2]\n        if self.autoContentLength:\n            contentLengthHeader = self._CRLF + \"Content-Length: \" + str(len(self.body))\n        if self.qs != '':\n            queryString = '?' + self.qs\n        httpdata = self.method + \" \" + self._path + queryString + \" \" + self.HTTPVersion + hostHeader + incomingHeaders + \\\n                   contentLengthHeader + self._CRLF + self._CRLF + self.body\n\n        return httpdata\n\n\ndef SendHTTPRequestBySocket(rawHTTPRequest = '', targetName='127.0.0.1', targetPort=80, isSSL = False, timeout=1,\n                            includeTimeoutErr=False, isRateLimited=False, sendInitialChars=0, sendBodyCharRate=1, delayInBetween=0.2):\n    if len(rawHTTPRequest) == 0: return\n\n    # create an INET, STREAMing socket\n    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n    if isSSL:\n        s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) # Perhaps this needs to be changed when other protocols should be used\n\n    s.settimeout(timeout)\n\n    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n\n    s.connect((targetName, targetPort))\n\n    # s.send(unicode(rawHTTPRequest, 'utf-8'))\n    if isRateLimited is False or sendBodyCharRate <= 0 or sendBodyCharRate <= 0 or delayInBetween < 0:\n        s.send(rawHTTPRequest)\n    else:\n        if sendInitialChars > 0:\n            s.send(rawHTTPRequest[:sendInitialChars])\n            rawHTTPRequest = rawHTTPRequest[sendInitialChars:]\n\n        for i in range(0, len(rawHTTPRequest), sendBodyCharRate):\n            time.sleep(delayInBetween)\n            s.send(rawHTTPRequest[i:i + sendBodyCharRate])\n\n\n    response = b''\n\n    while True:\n        try:\n            buf = s.recv(1024)\n            if not buf: break\n            response = response + buf\n        except socket.timeout, e:\n            err = e.args[0]\n            if err == 'timed out' and includeTimeoutErr:\n                if response != '':\n                    response = response + '\\nErr: last part was timed out'\n                else:\n                    response = 'Err: timed out'\n            break\n    s.close()\n    return response\n\ndef RequestObjectsToHTTPPipeline(RequestObjects):\n    result = ''\n    if len(RequestObjects) <= 0: raise ValueError('less_than_two_elements_received_by_RequestObjectsToHTTPPipeline()')\n    CRLF = '\\r\\n'\n    mainTarget = ''\n    mainPort = ''\n    lastElement = True\n    for reqObjects in reversed(RequestObjects):\n        if mainTarget == '':\n            mainTarget = reqObjects.targetName\n            mainPort = reqObjects.targetPort\n        IsConnectionSet = False\n        if reqObjects.headers != None:\n            for key, value in reqObjects.headers.iteritems():\n                if re.search(r'(connection:\\s*close)|(connection:\\s*keep\\-alive)', str(key) +\":\" + str(value),\n                             flags=re.IGNORECASE) != None:\n                    IsConnectionSet = True\n                    reqObjects.headers[key] = 'keep-alive'\n\n        if IsConnectionSet == False:\n            if lastElement:\n                reqObjects.headers['Connection'] = 'close'\n            else:\n                reqObjects.headers['Connection'] = 'keep-alive'\n\n        lastElement = False\n        result = reqObjects.rawRequest() + CRLF + result\n    result = result + CRLF\n    #result = result + \"GET /IDontExist HTTP/1.1\" + CRLF + \"Host: \" + mainTarget + \":\" + str(mainPort) +\\\n             #CRLF + \"connection: close\" + CRLF + CRLF\n    return result\n\ndef HTTPPipelineTest():\n    result = False\n    testReq1 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=2222&b=2','',\n                             {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',\n                              'Referer': 'https://www.google.com/',\n                              'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n                              'Accept-Language': 'en-GB,en;q=0.5',\n                              'Max-Forwards': '0',\n                              'Connection': 'close'})\n    testReq2 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=3333&b=3','',\n                             {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',\n                              'Max-Forwards': '0','connection':'close'})\n    testRequests = [testReq1,testReq2]\n    pipelineResult = RequestObjectsToHTTPPipeline(testRequests)\n    #print pipelineResult\n\n    try:\n        reqResult = SendHTTPRequestBySocket(pipelineResult, testReq1.targetName, testReq1.targetPort, testReq1.isSSL, 20)\n        #reqResult = SendHTTPRequestBySocket(pipelineResult, 'localhost', 8081, False, 5)\n    except:\n        reqResult = ''\n    #print reqResult\n    if reqResult.find('4444') > 0 and reqResult.find('9999') > 0:\n        result = True\n    return result\n\n\n\n"
  }
]