[
  {
    "path": "BappDescription.html",
    "content": "<p>This extension integrates Burp Suite with SQLMap.</p>\n\n<p>Requirements:</p>\n<ul>\n\t<li>Jython 2.7 beta, due to the use of json.</li>\n    <li>Java 1.7 or later (the beta version of Jython 2.7 requires this).</li>\n\t<li>A running instance of the SQLMap API server.</li>\n</ul>\n<p>SQLMap comes with a RESTful based server that will execute SQLMap scans. You can manually start the server \nwith: </p>\n<pre> python sqlmapapi.py -s -H &lt;ip&gt; -p &lt;port&gt;\n</pre>\n<p>Alternatively, you can use the SQLMap API tab to select the IP/Port on which to run, as well as the path to python and sqlmapapi.py on your system.\n\n</p>\n<p>Once the SQLMap API is running, you just need to right-click in the 'Request' \nsub tab of either the Target or Proxy main tabs and choose 'SQLiPy Scan' from \nthe context menu.\n\nThis will populate the SQLMap Scanner tab with information about that request.  Clicking the 'Start Scan' button will execute a scan.\n\nIf the page is vulnerable to SQL injection, then these will be added to the Scanner Results tab.\n</p>\n"
  },
  {
    "path": "BappManifest.bmf",
    "content": "Uuid: f154175126a04bfe8edc6056f340f52e\nExtensionType: 2\nName: SQLiPy Sqlmap Integration\nRepoName: sqli-py\nScreenVersion: 0.8.6\nSerialVersion: 19\nMinPlatformVersion: 0\nProOnly: False\nAuthor: Josh Berry @ CodeWatch\nShortDescription: Initiates SQLMap scans directly from within Burp.\nEntryPoint: SQLiPy.py\n"
  },
  {
    "path": "LICENSE",
    "content": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <http://unlicense.org>\n\n"
  },
  {
    "path": "LICENSE - sqlmap",
    "content": "COPYING -- Describes the terms under which sqlmap is distributed. A copy\nof the GNU General Public License (GPL) is appended to this file.\n\nsqlmap is (C) 2006-2017 Bernardo Damele Assumpcao Guimaraes, Miroslav Stampar.\n\nThis program is free software; you may redistribute and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; Version 2 (or later) with the clarifications and\nexceptions described below. This guarantees your right to use, modify, and\nredistribute this software under certain conditions. If you wish to embed\nsqlmap technology into proprietary software, we sell alternative licenses\n(contact sales@sqlmap.org).\n\nNote that the GPL places important restrictions on \"derived works\", yet it\ndoes not provide a detailed definition of that term. To avoid\nmisunderstandings, we interpret that term as broadly as copyright law\nallows. For example, we consider an application to constitute a \"derived\nwork\" for the purpose of this license if it does any of the following:\n* Integrates source code from sqlmap.\n* Reads or includes sqlmap copyrighted data files, such as xml/queries.xml\n* Executes sqlmap and parses the results (as opposed to typical shell or\n  execution-menu apps, which simply display raw sqlmap output and so are\n  not derivative works).\n* Integrates/includes/aggregates sqlmap into a proprietary executable\n  installer, such as those produced by InstallShield.\n* Links to a library or executes a program that does any of the above\n\nThe term \"sqlmap\" should be taken to also include any portions or derived\nworks of sqlmap. This list is not exclusive, but is meant to clarify our\ninterpretation of derived works with some common examples. Our\ninterpretation applies only to sqlmap - we do not speak for other people's\nGPL works.\n\nThis license does not apply to the third-party components. More details can\nbe found inside the file 'doc/THIRD-PARTY.md'.\n\nIf you have any questions about the GPL licensing restrictions on using\nsqlmap in non-GPL works, we would be happy to help. As mentioned above,\nwe also offer alternative license to integrate sqlmap into proprietary\napplications and appliances.\n\nIf you received these files with a written license agreement or contract\nstating terms other than the terms above, then that alternative license\nagreement takes precedence over these comments.\n\nSource is provided to this software because we believe users have a right\nto know exactly what a program is going to do before they run it.\n\nSource code also allows you to fix bugs and add new features. You are\nhighly encouraged to send your changes to dev@sqlmap.org for possible\nincorporation into the main distribution. By sending these changes to the\nsqlmap developers or via Git pull request, checking them into the sqlmap\nsource code repository, it is understood (unless you specify otherwise)\nthat you are offering the sqlmap project the unlimited, non-exclusive\nright to reuse, modify, and relicense the code. sqlmap will always be\navailable Open Source, but this is important because the inability to\nrelicense code has caused devastating problems for other Free Software\nprojects (such as KDE and NASM). If you wish to specify special license\nconditions of your contributions, just say so when you send them.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License v2.0 for more details at\nhttp://www.gnu.org/licenses/gpl-2.0.html, or below\n\n****************************************************************************\n\n                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n"
  },
  {
    "path": "README.md",
    "content": "sqlipy\n======\n\nSQLiPy is a Python plugin for Burp Suite that integrates SQLMap using the SQLMap API.\n\nSQLMap comes with a RESTful based server that will execute SQLMap scans.  This plugin can start the API for you or connect to an already running API to perform a scan.\n\nRequirements\n============\n\nJython 2.7 (up to 2.7.2) <b>DO NOT USE Jython 2.7.3, it has a bug that will cause the extension to fail</b>\nJava 1.7 or 1.8 (the beta version of Jython 2.7 requires this)\n\n  <b>Note:</b> Newer versions of Java do appear to work. Testing with jdk-11.0.7 works fine and newer versions are expected to work as well.\n\nUsage\n=====\n\nSQLiPy relies on a running instance of the SQLMap API server.  You can manually start the server with:\n<pre>\n  python sqlmapapi.py -s -H &lt;ip&gt; -p &lt;port&gt;\n</pre>\n\nOr, you can use the SQLMap API tab to select the IP/Port on which to run, as well as the path to python and sqlmapapi.py on your system.\n\nOnce the SQLMap API is running, it is just a matter of right mouse clicking in the 'Request' sub tab of either the Target or Proxy main tabs and choosing 'SQLiPy Scan'.\n\nThis will populate the SQLMap Scanner tab of the plugin with information about that request.  Clicking the 'Start Scan' button will execute a scan.\n\nIf the page is vulnerable to SQL injection, then a thread from the plugin will poll the results and add them to the Scanner Results tab.\n\nFor more information, see the post here: https://www.codewatch.org/blog/?p=402\n"
  },
  {
    "path": "SQLiPy.py",
    "content": "\"\"\"\r\nName:           SQLiPy\r\nVersion:        0.8.6\r\nDate:           9/3/2014\r\nAuthor:         Josh Berry - josh.berry@codewatch.org\r\nGithub:         https://github.com/codewatchorg/sqlipy\r\n\r\nDescription:    This plugin leverages the SQLMap API to initiate SQLMap scans against the target.\r\n\r\nThis plugin requires the beta version of Jython as it uses the JSON module.\r\n\r\nI used this blog post to quickly understand and leverage the SQLMap API (thrilled that someone figured this out for me):\r\nhttp://volatile-minds.blogspot.com/2013/04/unofficial-sqlmap-restful-api.html\r\n\r\nThe following Burp plugins were reviewed to help develop this:\r\n- Payload Parser: https://github.com/infodel\r\n- Burp SAMl: https://github.com/Meatballs1/burp_saml\r\n- ActiveScan++:\r\n- WCF Binary SOAP Handler: http://blog.securityps.com/2013/02/burp-suite-plugin-view-and-modify-wcf.html\r\n- WSDL Wizard: https://github.com/SmeegeSec/WSDLWizard/blob/master/WSDLWizard.py\r\n- co2: https://code.google.com/p/burp-co2/\r\n\r\n\"\"\"\r\n\r\nfrom burp import IBurpExtender\r\nfrom burp import IBurpExtenderCallbacks\r\nfrom burp import IContextMenuFactory\r\nfrom burp import IHttpRequestResponse\r\nfrom burp import IMessageEditorController\r\nfrom burp import IMessageEditorTabFactory\r\nfrom burp import ITab\r\nfrom burp import IMessageEditorTab\r\nfrom burp import IScannerCheck\r\nfrom burp import IScanIssue\r\nfrom burp import IExtensionStateListener\r\nfrom javax import swing\r\nfrom javax.swing.filechooser import FileNameExtensionFilter\r\nfrom java.awt import GridBagLayout\r\nfrom java.awt import Font\r\nfrom java.awt import Color\r\nfrom java import awt\r\nfrom java.lang import Runtime\r\nfrom java.lang import Process\r\nfrom java.lang import System\r\nfrom java.lang import Runnable\r\nfrom java.lang import Thread\r\nfrom java.io import File\r\nfrom java.io import Reader\r\nfrom java.io import BufferedReader\r\nfrom java.io import InputStreamReader\r\nimport subprocess\r\nimport re\r\nimport urllib2\r\nimport sys\r\nimport json\r\nimport threading\r\nimport time\r\nimport zipfile\r\nimport os\r\nimport traceback\r\n\r\nclass StreamGobbler(Runnable):\r\n\r\n    def __init__(self, inStream, outStream):\r\n        self.inStream = inStream\r\n        self.outStream = outStream\r\n        return\r\n\r\n    def run(self):\r\n        try:\r\n            while (self.inStream.read() != -1):\r\n                isr = InputStreamReader(self.inStream)\r\n                br = BufferedReader(isr)\r\n                print str(br.readLine())\r\n\r\n        except BaseException as ex:\r\n            print 'Could not read API input/output/error buffer\\n'\r\n\r\nclass SqlMapScanIssue(IScanIssue):\r\n\r\n    def __init__(self, httpService, url, httpMessages, name, detail, confidence, severity):\r\n        self.HttpService = httpService\r\n        self.vulnurl = url\r\n        self.HttpMessages = httpMessages\r\n        self.vulnname = name\r\n        self.vulndetail = detail\r\n        self.vulnsev = severity\r\n        self.vulnconf = confidence\r\n        return\r\n\r\n    def getUrl(self):\r\n        return self.vulnurl\r\n\r\n    def getIssueName(self):\r\n        return self.vulnname\r\n\r\n    def getIssueType(self):\r\n        return 0\r\n\r\n    def getSeverity(self):\r\n        return self.vulnsev\r\n\r\n    def getConfidence(self):\r\n        return self.vulnconf\r\n\r\n    def getIssueBackground(self):\r\n        return None\r\n\r\n    def getRemediationBackground(self):\r\n        return None\r\n\r\n    def getIssueDetail(self):\r\n        return self.vulndetail\r\n\r\n    def getRemediationDetail(self):\r\n        return None\r\n\r\n    def getHttpMessages(self):\r\n        return self.HttpMessages\r\n\r\n    def getHttpService(self):\r\n        return self.HttpService\r\n\r\nclass ThreadExtender(IBurpExtender, IContextMenuFactory, ITab, IScannerCheck):\r\n  def __init__(self, burpobject, sqlmapip, sqlmapport, sqlmaptask, url, httpmessage, cbacks):\r\n    self.burpobject = burpobject\r\n    self.sqlmapip = sqlmapip\r\n    self.sqlmapport = sqlmapport\r\n    self.sqlmaptask = sqlmaptask\r\n    self.url = url\r\n    self.httpmessage = httpmessage\r\n    self.cbacks = cbacks\r\n\r\n  def checkResults(self):\r\n    t = threading.currentThread()\r\n    time.sleep(5)\r\n    print 'Checking results on task: '+self.sqlmaptask+'\\n'\r\n\r\n    while getattr(t, \"keep_running\", True):\r\n\r\n      try:\r\n        req = urllib2.Request('http://' + str(self.sqlmapip) + ':' + str(self.sqlmapport) + '/scan/' + str(self.sqlmaptask) + '/status')\r\n        req.add_header('Content-Type', 'application/json')\r\n        resp = json.load(urllib2.urlopen(req, timeout=10))\r\n\r\n        if resp['status'] == \"running\":\r\n          print 'Scan for task '+self.sqlmaptask+' is still running.\\n'\r\n          time.sleep(30)\r\n        elif resp['status'] == \"terminated\":\r\n          if resp['returncode'] == 0:\r\n            print 'Scan for task '+self.sqlmaptask+' completed.  Gathering results.\\n'\r\n            vulnurl = ''\r\n            vulnparam = ''\r\n            dbtype = ''\r\n            payloads = ''\r\n            banner = ''\r\n            cu = ''\r\n            cdb = ''\r\n            hostname = ''\r\n            isdba = ''\r\n            lusers = ''\r\n            lprivs = ''\r\n            lroles = ''\r\n            ldbs = ''\r\n            lpswds = ''\r\n\r\n            try:\r\n              req = urllib2.Request('http://' + str(self.sqlmapip) + ':' + str(self.sqlmapport) + '/scan/' + str(self.sqlmaptask) + '/data')\r\n              req.add_header('Content-Type', 'application/json')\r\n              resp = json.load(urllib2.urlopen(req, timeout=10))\r\n              vulnerable = False\r\n\r\n              for findings in resp['data']:\r\n                vulnerable = True\r\n\r\n                # Get vulnerable URL and param\r\n                if findings['type'] == 0:\r\n                  vulnurl = findings['value']['url']\r\n                  vulnparam = findings['value']['query']\r\n                  vulndetails = '<ul><li>URL: '+str(vulnurl)+'</li><li>Parameter: '+str(vulnparam)+'</li></ul>'\r\n\r\n                # Get basic scan info\r\n                if findings['type'] == 1:\r\n                  if isinstance(findings['value'][0]['dbms'], list):\r\n                    for dbtypes in findings['value'][0]['dbms']:\r\n                      dbtype = dbtype + dbtypes + ', or '\r\n\r\n                    dbtype = dbtype[:-5]\r\n                  else:\r\n                    dbtype = findings['value'][0]['dbms']\r\n\r\n                  for items in findings['value']:\r\n                    firstpayload = True\r\n                    for k in items['data']:\r\n                      if firstpayload:\r\n                        payloads = '<li>'+items['data'][k]['payload']+'</li>'\r\n                        firstpayload = False\r\n                      else:\r\n                        payloads = payloads + '<li>'+items['data'][k]['payload']+'</li>'\r\n\r\n                    if firstpayload == False:\r\n                      payloads = '<ul>' + payloads + '</ul><BR>'\r\n\r\n                # Get banner info\r\n                if findings['type'] == 3:\r\n                  banner = findings['value']+'<BR>'\r\n\r\n                # Get Current Users\r\n                elif findings['type'] == 4:\r\n                  cu = 'Current User: '+findings['value']+'<BR>'\r\n\r\n                # Get Current Database\r\n                elif findings['type'] == 5:\r\n                  cdb = 'Current Database: '+findings['value']+'<BR>'\r\n\r\n                # Get Hostname\r\n                elif findings['type'] == 6:\r\n                  if findings['value'] is not None: \r\n                    hostname = 'Hostname: '+str(findings['value'])+'<BR>' \r\n                  else: \r\n                    hostname = 'Hostname: Enumeration failed.<BR>' \r\n\r\n\r\n                # Is the user a DBA?\r\n                elif findings['type'] == 7:\r\n                  if findings['value'] == True:\r\n                    isdba = 'Is a DBA: Yes'+'<BR>'\r\n                  else:\r\n                    isdba = 'Is a DBA: No'+'<BR>'\r\n\r\n                # Get list of users\r\n                elif findings['type'] == 8:\r\n                  firstuser = True\r\n                  for user in findings['value']:\r\n                    if firstuser:\r\n                      lusers = '<li>'+user+'</li>'\r\n                      firstuser = False\r\n                    else:\r\n                      lusers = lusers + '<li>'+user+'</li>'\r\n\r\n                  if firstuser == False:\r\n                    lusers = 'Users:<ul>' + lusers + '</ul><BR>'\r\n\r\n                # Get list of passwords\r\n                elif findings['type'] == 9:\r\n                  userdata = ''\r\n                  userpswds = ''\r\n                  firstuser = True\r\n\r\n                  for users in findings['value']:\r\n                    firstpswd = True\r\n\r\n                    if firstuser:\r\n                      firstuser = False\r\n                      userdata = '<li>'+users+'</li>'\r\n                    else:\r\n                      userdata = userdata + '<li>'+users+'</li>'\r\n\r\n                    for pswd in findings['value'][users]:\r\n                      if firstpswd:\r\n                        firstswd = False\r\n                        userpswds = '<li>'+pswd+'</li>'\r\n                      else:\r\n                        userpswds = userpswds + '<li>'+pswd+'</li>'\r\n\r\n                    lpswds = lpswds + userdata + '<ul>'+userpswds+'</ul>'\r\n                    userdata = ''\r\n                    userpswds = ''\r\n\r\n                  if firstuser == False:\r\n                    lpswds = 'Password Hashes per User:<ul>'+lpswds+'</ul><BR>'\r\n\r\n                # Get list of privileges\r\n                elif findings['type'] == 10:\r\n                  userdata = ''\r\n                  userprivs = ''\r\n                  firstuser = True\r\n\r\n                  for users in findings['value']:\r\n                    firstpriv = True\r\n\r\n                    if firstuser:\r\n                      firstuser = False\r\n                      userdata = '<li>'+users+'</li>'\r\n                    else:\r\n                      userdata = userdata + '<li>'+users+'</li>'\r\n\r\n                    if findings['value'][users] is not None:\r\n                      for priv in findings['value'][users]:\r\n                        if firstpriv:\r\n                          firstpriv = False\r\n                          userprivs = '<li>'+priv+'</li>'\r\n                        else:\r\n                          userprivs = userprivs + '<li>'+priv+'</li>'\r\n                    else:\r\n                      userprivs = '<li>Null</li>'\r\n\r\n                    lprivs = lprivs + userdata + '<ul>'+userprivs+'</ul>'\r\n                    userdata = ''\r\n                    userprivs = ''\r\n\r\n                  if firstuser == False:\r\n                    lprivs = 'Privileges per User:<ul>'+lprivs+'</ul><BR>'\r\n\r\n                # Get list of roles\r\n                elif findings['type'] == 11:\r\n                  userdata = ''\r\n                  userroles = ''\r\n                  firstuser = True\r\n\r\n                  for users in findings['value']:\r\n                    firstrole = True\r\n\r\n                    if firstuser:\r\n                      firstuser = False\r\n                      userdata = '<li>'+users+'</li>'\r\n                    else:\r\n                      userdata = userdata + '<li>'+users+'</li>'\r\n\r\n                    if findings['value'][users] is not None:\r\n                      for role in findings['value'][users]:\r\n                        if firstrole:\r\n                          firstrole = False\r\n                          userroles = '<li>'+role+'</li>'\r\n                        else:\r\n                          userroles = userroles + '<li>'+role+'</li>'\r\n                    else:\r\n                      userroles = '<li>Null</li>'\r\n\r\n                    lroles = lroles + userdata + '<ul>'+userroles+'</ul>'\r\n                    userdata = ''\r\n                    userroles = ''\r\n\r\n                  if firstuser == False:\r\n                    lroles = 'Roles per User:<ul>'+lroles+'</ul><BR>'\r\n\r\n                # Get list of DBs\r\n                elif findings['type'] == 12:\r\n                  firstdb = True\r\n                  for db in findings['value']:\r\n                    if firstdb:\r\n                      ldbs = '<li>'+str(db)+'</li>'\r\n                      firstdb = False\r\n                    else:\r\n                      ldbs = ldbs + '<li>'+str(db)+'</li>'\r\n\r\n                  if firstdb == False:\r\n                    ldbs = 'Databases:<ul>' + ldbs + '</ul><BR>'\r\n\r\n              if vulnerable:\r\n                if re.search('Free', self.cbacks.getBurpVersion()[0], re.IGNORECASE) is not None:\r\n                  findings = open(self.sqlmaptask + '.html', 'w')\r\n                  findings.write('<html><head><title>SQLMap Scan - ' + self.sqlmaptask + '</title></head><body>')\r\n                  findings.write('<h1>SQLMap Scan Finding</h1><br><p>The application has been found to be vulnerable to SQL injection by SQLMap.</p><br>')\r\n                  findings.write('<p>Vulnerable URL and Parameter:</p><p>'+vulndetails+'</p>')\r\n                  findings.write('<p>The following payloads successfully identified SQL injection vulnerabilities:</p><p>'+payloads+'</p><p>Enumerated Data:</p><BR><p>'+dbtype+': '+banner+'</p><p>'+cu+'</p><p>'+cdb+'</p><p>'+hostname+'</p><p>'+isdba+'</p><p>'+lusers+'</p><p>'+lpswds+'</p><p>'+lprivs+'</p><p>'+lroles+'</p><p>'+ldbs+'</p>')\r\n                  findings.write('</body></html>')\r\n                  findings.close()\r\n                  print 'Wrote scan file ' + self.sqlmaptask + '.html\\n'\r\n                else:\r\n                  scanIssue = SqlMapScanIssue(self.httpmessage.getHttpService(), self.url, [self.httpmessage], 'SQLMap Scan Finding',\r\n                      'The application has been found to be vulnerable to SQL injection by SQLMap.  <BR><BR>Vulnerable URL and Parameter:<p>'+vulndetails+'</p><BR>The following payloads successfully identified SQL injection vulnerabilities:<p>'+payloads+'</p><p>Enumerated Data:</p><BR><p>'+dbtype+': '+banner+'</p><p>'+cu+'</p><p>'+cdb+'</p><p>'+hostname+'</p><p>'+isdba+'</p><p>'+lusers+'</p><p>'+lpswds+'</p><p>'+lprivs+'</p><p>'+lroles+'</p><p>'+ldbs+'</p>', 'Certain', 'High')\r\n                  self.cbacks.addScanIssue(scanIssue)\r\n\r\n                print 'SQLi vulnerabilities were found for task '+self.sqlmaptask+' and have been reported.\\n'\r\n              else:\r\n                print 'Scan completed for task '+self.sqlmaptask+' but SQLi vulnerabilities were not found.\\n'\r\n\r\n              break\r\n\r\n            except:\r\n              print 'No results for SQLMap task: '+self.sqlmaptask+'\\n'\r\n              break\r\n\r\n          else:\r\n            print 'SQLMap scan failed for task: '+self.sqlmaptask+'\\n'\r\n            break\r\n\r\n        else:\r\n          print 'SQLMap scan failed for task: '+self.sqlmaptask+'\\n'\r\n          break\r\n\r\n      except:\r\n        print 'Thread failed to get results for SQLMap task: ' + self.sqlmaptask+'\\n'\r\n        break\r\n\r\nclass BurpExtender(IBurpExtender, IContextMenuFactory, ITab, IExtensionStateListener):\r\n  pythonfile = ''\r\n  apifile = ''\r\n  apiprocess = Process\r\n  apistatus = 0\r\n  threads = []\r\n  scanMessage = ''\r\n  scantasks = []\r\n  scancmds = {}\r\n\r\n  # Implement IBurpExtender\r\n  def registerExtenderCallbacks(self, callbacks):\r\n    # Print information about the plugin, set extension name, setup basic stuff\r\n    self.printHeader()\r\n    callbacks.setExtensionName(\"SQLiPy Sqlmap Integration\")\r\n    callbacks.registerExtensionStateListener(self)\r\n    self._callbacks = callbacks\r\n    self._helpers = callbacks.getHelpers()\r\n    callbacks.registerContextMenuFactory(self)\r\n\r\n    # Create SQLMap API configuration JPanel\r\n    self._jPanel = swing.JPanel()\r\n    self._jPanel.setLayout(awt.GridBagLayout())\r\n    self._jPanelConstraints = awt.GridBagConstraints()\r\n\r\n    # Create first blank space\r\n    self._jLabelAPISpace1 = swing.JLabel(\" \")\r\n    self._jLabelAPISpace1.setFont(Font(\"Courier New\", Font.BOLD, 30))\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 2\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jLabelAPISpace1, self._jPanelConstraints)\r\n\r\n    # Create second blank space\r\n    self._jLabelAPISpace2 = swing.JLabel(\" \")\r\n    self._jLabelAPISpace2.setFont(Font(\"Courier New\", Font.BOLD, 30))\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 3\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jLabelAPISpace2, self._jPanelConstraints)\r\n\r\n    # Create panel to show API status\r\n    self._jLabelAPIStatus = swing.JLabel(\"SQLMap API is NOT running!\")\r\n    self._jLabelAPIStatus.setFont(Font(\"Courier New\", Font.BOLD, 24))\r\n    self._jLabelAPIStatus.setForeground(Color.RED)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 4\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jLabelAPIStatus, self._jPanelConstraints)\r\n\r\n    # Create third blank space\r\n    self._jLabelAPISpace3 = swing.JLabel(\" \")\r\n    self._jLabelAPISpace3.setFont(Font(\"Courier New\", Font.BOLD, 30))\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 5\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jLabelAPISpace3, self._jPanelConstraints)\r\n\r\n    # Create panel for IP info\r\n    self._jLabelIPListen = swing.JLabel(\"Listen on IP:\")\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 6\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jLabelIPListen, self._jPanelConstraints)\r\n\r\n    self._jTextFieldIPListen = swing.JTextField(\"127.0.0.1\",15)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 1\r\n    self._jPanelConstraints.gridy = 6\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jTextFieldIPListen, self._jPanelConstraints)\r\n\r\n    # Create panel for Port info\r\n    self._jLabelPortListen = swing.JLabel(\"Listen on Port:\")\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 7\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jLabelPortListen, self._jPanelConstraints)\r\n\r\n    self._jTextFieldPortListen = swing.JTextField(\"9090\",3)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 1\r\n    self._jPanelConstraints.gridy = 7\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jTextFieldPortListen, self._jPanelConstraints)\r\n\r\n    # Create panel to contain Python button\r\n    self._jLabelPython = swing.JLabel(\"Select Python:\")\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 8\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jLabelPython, self._jPanelConstraints)\r\n\r\n    self._jButtonSetPython = swing.JButton('Python', actionPerformed=self.setPython)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 1\r\n    self._jPanelConstraints.gridy = 8\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jButtonSetPython, self._jPanelConstraints)\r\n\r\n    # Create panel to contain API button\r\n    self._jLabelAPI = swing.JLabel(\"Select API:\")\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 9\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jLabelAPI, self._jPanelConstraints)\r\n\r\n    self._jButtonSetAPI = swing.JButton('SQLMap API', actionPerformed=self.setAPI)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 1\r\n    self._jPanelConstraints.gridy = 9\r\n    self._jPanelConstraints.gridwidth = 1\r\n    self._jPanel.add(self._jButtonSetAPI, self._jPanelConstraints)\r\n\r\n    # Create panel to execute API\r\n    self._jButtonStartAPI = swing.JButton('Start API', actionPerformed=self.startAPI)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 10\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jButtonStartAPI, self._jPanelConstraints)\r\n\r\n    # Create panel to stop API\r\n    self._jButtonStopAPI = swing.JButton('Stop API', actionPerformed=self.stopAPI)\r\n    self._jPanelConstraints.fill = awt.GridBagConstraints.HORIZONTAL\r\n    self._jPanelConstraints.gridx = 0\r\n    self._jPanelConstraints.gridy = 11\r\n    self._jPanelConstraints.gridwidth = 2\r\n    self._jPanel.add(self._jButtonStopAPI, self._jPanelConstraints)\r\n\r\n    # Create SQLMap scanner panel\r\n    # Combobox Values\r\n    httpMethodValues = ['Default', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH']\r\n    levelValues = [1,2,3,4,5]\r\n    riskValues = [0,1,2,3]\r\n    threadValues = [1,2,3,4,5,6,7,8,9,10]\r\n    delayValues = [0,1,2,3,4,5]\r\n    timeoutValues = [1,5,10,15,20,25,30,35,40,45,50,55,60]\r\n    retryValues = [1,2,3,4,5,6,7,8,9,10]\r\n    dbmsValues = ['Any', 'MySQL', 'Oracle', 'PostgreSQL', 'Microsoft SQL Server', 'Microsoft Access', 'SQLite', 'Firebird', 'Sybase', 'SAP MaxDB', 'DB2', 'Informix', 'MariaDB', 'Percona', 'MemSQL', 'TiDB', 'CockroachDB', 'HSQLDB', 'H2', 'MonetDB', 'Apache Derby', 'Amazon Redshift', 'Vertica', 'Mckoi', 'Presto', 'Altibase', 'MimerSQL', 'CrateDB', 'Greenplum', 'Drizzle', 'Apache Ignite', 'Cubrid', 'InterSystems Cache', 'IRIS', 'eXtremeDB', 'FrontBase']\r\n    authTypes = ['None', 'Basic', 'Digest', 'NTLM']\r\n    osValues = ['Any', 'Linux', 'Windows']\r\n    timeSecValues = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]\r\n    torTypes = ['HTTP', 'SOCKS4', 'SOCKS5']\r\n\r\n    # GUI components\r\n    self._jLabelScanText = swing.JLabel()\r\n    self._jLabelScanIPListen = swing.JLabel()\r\n    self._jLabelScanPortListen = swing.JLabel()\r\n    self._jTextFieldScanIPListen = swing.JTextField()\r\n    self._jTextFieldScanPortListen = swing.JTextField()\r\n    self._jSeparator1 = swing.JSeparator()\r\n    self._jLabelHttpMethod = swing.JLabel()\r\n    self._jLabelIgnoreCode = swing.JLabel()\r\n    self._jComboHttpMethod = swing.JComboBox(httpMethodValues)\r\n    self._jTextFieldIgnoreCode = swing.JTextField()\r\n    self._jLabelURL = swing.JLabel()\r\n    self._jTextFieldURL = swing.JTextField()\r\n    self._jLabelData = swing.JLabel()\r\n    self._jTextData = swing.JTextArea()\r\n    self._jScrollPaneData = swing.JScrollPane(self._jTextData)\r\n    self._jLabelCookie = swing.JLabel()\r\n    self._jTextFieldCookie = swing.JTextField()\r\n    self._jLabelReferer = swing.JLabel()\r\n    self._jTextFieldReferer = swing.JTextField()\r\n    self._jLabelUA = swing.JLabel()\r\n    self._jTextFieldUA = swing.JTextField()\r\n    self._jLabelCustHeader = swing.JLabel()\r\n    self._jTextFieldCustHeader = swing.JTextField()\r\n    self._jCustHeadCheckParam = swing.JCheckBox()\r\n    self._jSeparator2 = swing.JSeparator()\r\n    self._jLabelParam = swing.JLabel()\r\n    self._jTextFieldParam = swing.JTextField()\r\n    self._jCheckTO = swing.JCheckBox()\r\n    self._jSeparator3 = swing.JSeparator()\r\n    self._jComboLevel = swing.JComboBox(levelValues)\r\n    self._jLabelLevel = swing.JLabel()\r\n    self._jLabelRisk = swing.JLabel()\r\n    self._jComboRisk = swing.JComboBox(riskValues)\r\n    self._jSeparator4 = swing.JSeparator()\r\n    self._jCheckHPP = swing.JCheckBox('Param Pollution')\r\n    self._jCheckCU = swing.JCheckBox('Current User')\r\n    self._jCheckDB = swing.JCheckBox('Current DB')\r\n    self._jCheckHost = swing.JCheckBox('Hostname')\r\n    self._jCheckDBA = swing.JCheckBox('Is DBA?')\r\n    self._jCheckUsers = swing.JCheckBox('List Users')\r\n    self._jCheckPrivs = swing.JCheckBox('List Privs')\r\n    self._jCheckPswds = swing.JCheckBox('List Passwords')\r\n    self._jCheckRoles = swing.JCheckBox('List Roles')\r\n    self._jCheckDBs = swing.JCheckBox('List DBs')\r\n    self._jSeparator5 = swing.JSeparator()\r\n    self._jLabelThreads = swing.JLabel()\r\n    self._jLabelDelay = swing.JLabel()\r\n    self._jLabelTimeout = swing.JLabel()\r\n    self._jLabelRetry = swing.JLabel()\r\n    self._jLabelTimeSec = swing.JLabel()\r\n    self._jComboThreads = swing.JComboBox(threadValues)\r\n    self._jComboDelay = swing.JComboBox(delayValues)\r\n    self._jComboTimeout = swing.JComboBox(timeoutValues)\r\n    self._jComboRetry = swing.JComboBox(retryValues)\r\n    self._jComboTimeSec = swing.JComboBox(timeSecValues)\r\n    self._jSeparator6 = swing.JSeparator()\r\n    self._jLabelDBMS = swing.JLabel()\r\n    self._jComboDBMS = swing.JComboBox(dbmsValues)\r\n    self._jLabelOS = swing.JLabel()\r\n    self._jComboOS = swing.JComboBox(osValues)\r\n    self._jSeparator7 = swing.JSeparator()\r\n    self._jLabelProxy = swing.JLabel()\r\n    self._jTextFieldProxy = swing.JTextField()\r\n    self._jSeparator8 = swing.JSeparator()\r\n    self._jLabelTamper = swing.JLabel()\r\n    self._jTextFieldTamper = swing.JTextField()\r\n    self._jButtonStartScan = swing.JButton('Start Scan', actionPerformed=self.startScan)\r\n    self._jLabelScanAPI = swing.JLabel()\r\n    self._jLabelScanAPI.setText('SQLMap API is NOT running!')\r\n    self._jLabelScanAPI.setForeground(Color.RED)\r\n    self._jSeparator9 = swing.JSeparator()\r\n    self._jSeparator10 = swing.JSeparator()\r\n    self._jCheckTor = swing.JCheckBox('Enable Tor')\r\n    self._jLabelTorType = swing.JLabel()\r\n    self._jComboTorType = swing.JComboBox(torTypes)\r\n    self._jLabelTorPort = swing.JLabel()\r\n    self._jTextFieldTorPort = swing.JTextField()\r\n    self._jSeparator11 = swing.JSeparator()\r\n    self._jLabelAuthType = swing.JLabel()\r\n    self._jComboAuthType = swing.JComboBox(authTypes)\r\n    self._jLabelAuthUser = swing.JLabel()\r\n    self._jTextFieldAuthUser = swing.JTextField()\r\n    self._jLabelAuthPass = swing.JLabel()\r\n    self._jTextFieldAuthPass = swing.JTextField()\r\n    self._jLabelTechnique = swing.JLabel()\r\n    self._jTextFieldTechnique = swing.JTextField()\r\n\r\n    # Configure GUI\r\n    self._jLabelScanText.setText('API Listening On:')\r\n    self._jLabelScanIPListen.setText('SQLMap API IP:')\r\n    self._jLabelScanPortListen.setText('SQLMap API Port:')\r\n    self._jLabelHttpMethod.setText('HTTP Method:')\r\n    self._jLabelIgnoreCode.setText('Ignore Error Code:')\r\n    self._jComboHttpMethod.setSelectedIndex(0)\r\n    self._jLabelURL.setText('URL:')\r\n    self._jLabelData.setText('Post Data:')\r\n    self._jTextData.setLineWrap(True)\r\n    self._jScrollPaneData.setVerticalScrollBarPolicy(swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)\r\n    self._jLabelCookie.setText('Cookies:')\r\n    self._jLabelReferer.setText('Referer:')\r\n    self._jLabelUA.setText('User-Agent:')\r\n    self._jLabelCustHeader.setText('Extra Headers:')\r\n    self._jLabelParam.setText('Test Parameter(s):')\r\n    self._jCustHeadCheckParam.setText('Add Headers')\r\n    self._jCheckTO.setText('Text Only')\r\n    self._jLabelLevel.setText('Level:')\r\n    self._jLabelRisk.setText('Risk:')\r\n    self._jComboLevel.setSelectedIndex(2)\r\n    self._jComboRisk.setSelectedIndex(1)\r\n    self._jComboThreads.setSelectedIndex(0)\r\n    self._jComboDelay.setSelectedIndex(0)\r\n    self._jComboTimeout.setSelectedIndex(6)\r\n    self._jComboRetry.setSelectedIndex(2)\r\n    self._jComboTimeSec.setSelectedIndex(4)\r\n    self._jComboDBMS.setSelectedIndex(0)\r\n    self._jComboOS.setSelectedIndex(0)\r\n    self._jComboTorType.setSelectedIndex(2)\r\n    self._jLabelThreads.setText('Threads:')\r\n    self._jLabelDelay.setText('Delay:')\r\n    self._jLabelTimeout.setText('Timeout:')\r\n    self._jLabelRetry.setText('Retries:')\r\n    self._jLabelTimeSec.setText('Time-Sec:')\r\n    self._jLabelDBMS.setText('DBMS Backend:')\r\n    self._jLabelOS.setText('Operating System:')\r\n    self._jLabelProxy.setText('Proxy (HTTP://IP:Port):')\r\n    self._jLabelTamper.setText('Tamper Scripts:')\r\n    self._jLabelTorType.setText('Tor Type:')\r\n    self._jLabelTorPort.setText('Tor Port:')\r\n    self._jTextFieldTorPort.setText('9050')\r\n    self._jLabelAuthType.setText('Auth Type:')\r\n    self._jLabelAuthUser.setText('Auth User:')\r\n    self._jLabelAuthPass.setText('Auth Pass:')\r\n    self._jComboAuthType.setSelectedIndex(0)\r\n    self._jLabelTechnique.setText('Technique (BEUSTQ):')\r\n    self._jTextFieldTechnique.setText('BEUSTQ')\r\n\r\n    # Configure locations\r\n    self._jLabelScanText.setBounds(15, 16, 126, 20)\r\n    self._jLabelScanIPListen.setBounds(15, 58, 115, 20)\r\n    self._jLabelScanPortListen.setBounds(402, 55, 129, 20)\r\n    self._jTextFieldScanIPListen.setBounds(167, 52, 206, 26)\r\n    self._jTextFieldScanPortListen.setBounds(546, 52, 63, 26)\r\n    self._jSeparator1.setBounds(15, 96, 790, 10)\r\n    self._jLabelHttpMethod.setBounds(15, 117, 100, 26)\r\n    self._jLabelIgnoreCode.setBounds(402, 117, 129, 26)\r\n    self._jComboHttpMethod.setBounds(166, 117, 150, 26)\r\n    self._jTextFieldIgnoreCode.setBounds(546, 117, 63, 26)\r\n    self._jLabelURL.setBounds(15, 193, 35, 20)\r\n    self._jTextFieldURL.setBounds(166, 190, 535, 26)\r\n    self._jLabelData.setBounds(15, 232, 73, 20)\r\n    self._jScrollPaneData.setBounds(166, 232, 535, 96)\r\n    self._jLabelCookie.setBounds(15, 347, 61, 20)\r\n    self._jTextFieldCookie.setBounds(166, 347, 535, 26)\r\n    self._jLabelReferer.setBounds(15, 396, 57, 20)\r\n    self._jTextFieldReferer.setBounds(166, 396, 535, 26)\r\n    self._jLabelUA.setBounds(15, 445, 86, 20)\r\n    self._jTextFieldUA.setBounds(166, 445, 535, 26)\r\n    self._jLabelCustHeader.setBounds(15, 494, 132, 20)\r\n    self._jTextFieldCustHeader.setBounds(166, 494, 366, 26)\r\n    self._jCustHeadCheckParam.setBounds(584, 494, 101, 29)\r\n    self._jSeparator2.setBounds(15, 535, 790, 10)\r\n    self._jLabelParam.setBounds(15, 559, 132, 20)\r\n    self._jTextFieldParam.setBounds(165, 556, 366, 26)\r\n    self._jCheckTO.setBounds(584, 555, 101, 29)\r\n    self._jSeparator3.setBounds(15, 602, 790, 10)\r\n    self._jLabelLevel.setBounds(15, 623, 120, 20)\r\n    self._jComboLevel.setBounds(65, 620, 120, 26)\r\n    self._jLabelRisk.setBounds(205, 623, 120, 20)\r\n    self._jComboRisk.setBounds(245, 620, 120, 26)\r\n    self._jLabelTechnique.setBounds(375, 620, 140, 26)\r\n    self._jTextFieldTechnique.setBounds(510, 620, 120, 26)\r\n    self._jSeparator4.setBounds(15, 664, 790, 10)\r\n    self._jCheckHPP.setBounds(15, 684, 145, 29)\r\n    self._jCheckCU.setBounds(191, 684, 123, 29)\r\n    self._jCheckDB.setBounds(340, 684, 111, 29)\r\n    self._jCheckHost.setBounds(469, 684, 103, 29)\r\n    self._jCheckDBA.setBounds(599, 684, 105, 29)\r\n    self._jCheckUsers.setBounds(15, 731, 101, 29)\r\n    self._jCheckPswds.setBounds(191, 731, 135, 29)\r\n    self._jCheckPrivs.setBounds(344, 731, 95, 29)\r\n    self._jCheckRoles.setBounds(469, 731, 99, 29)\r\n    self._jCheckDBs.setBounds(599, 731, 89, 29)\r\n    self._jSeparator5.setBounds(15, 772, 790, 10)\r\n    self._jLabelThreads.setBounds(15, 795, 63, 20)\r\n    self._jLabelDelay.setBounds(173, 795, 45, 20)\r\n    self._jLabelTimeout.setBounds(326, 795, 65, 20)\r\n    self._jLabelRetry.setBounds(484, 795, 48, 20)\r\n    self._jLabelTimeSec.setBounds(642, 795, 65, 20)\r\n    self._jComboThreads.setBounds(80, 792, 78, 26)\r\n    self._jComboDelay.setBounds(233, 792, 78, 26)\r\n    self._jComboTimeout.setBounds(391, 792, 78, 26)\r\n    self._jComboRetry.setBounds(549, 792, 78, 26)\r\n    self._jComboTimeSec.setBounds(717, 792, 78, 26)\r\n    self._jSeparator6.setBounds(15, 834, 790, 10)\r\n    self._jLabelDBMS.setBounds(15, 857, 110, 20)\r\n    self._jComboDBMS.setBounds(143, 854, 191, 26)\r\n    self._jLabelOS.setBounds(352, 857, 132, 20)\r\n    self._jComboOS.setBounds(502, 854, 191, 26)\r\n    self._jSeparator7.setBounds(15, 896, 790, 10)\r\n    self._jLabelProxy.setBounds(15, 920, 171, 20)\r\n    self._jTextFieldProxy.setBounds(204, 917, 256, 26)\r\n    self._jSeparator8.setBounds(15, 963, 790, 10)\r\n    self._jCheckTor.setBounds(15, 987, 171, 20)\r\n    self._jLabelTorType.setBounds(206, 984, 65, 26)\r\n    self._jComboTorType.setBounds(291, 984, 100, 26)\r\n    self._jLabelTorPort.setBounds(460, 984, 129, 26)\r\n    self._jTextFieldTorPort.setBounds(545, 984, 65, 26)\r\n    self._jSeparator9.setBounds(15, 1030, 790, 10)\r\n    self._jLabelTamper.setBounds(15, 1055, 171, 20)\r\n    self._jTextFieldTamper.setBounds(204, 1052, 256, 26)\r\n    self._jSeparator10.setBounds(15, 1098, 790, 10)\r\n    self._jLabelAuthType.setBounds(15, 1123, 171, 20)\r\n    self._jComboAuthType.setBounds(204, 1123, 100, 26)\r\n    self._jLabelAuthUser.setBounds(15, 1172, 171, 20)\r\n    self._jTextFieldAuthUser.setBounds(204, 1172, 256, 26)\r\n    self._jLabelAuthPass.setBounds(15, 1221, 171, 20)\r\n    self._jTextFieldAuthPass.setBounds(204, 1221, 256, 26)\r\n    self._jSeparator11.setBounds(15, 1267, 790, 10)\r\n    self._jButtonStartScan.setBounds(346, 1292, 103, 29)\r\n    self._jLabelScanAPI.setBounds(167, 16, 275, 20)\r\n\r\n    # Create main panel\r\n    self._jScanPanel = swing.JPanel()\r\n    self._jScanPanel.setLayout(None)\r\n    self._jScanPanel.setPreferredSize(awt.Dimension(1368,1368))\r\n    self._jScanPanel.add(self._jLabelScanText)\r\n    self._jScanPanel.add(self._jLabelScanIPListen)\r\n    self._jScanPanel.add(self._jLabelScanPortListen)\r\n    self._jScanPanel.add(self._jTextFieldScanIPListen)\r\n    self._jScanPanel.add(self._jTextFieldScanPortListen)\r\n    self._jScanPanel.add(self._jSeparator1)\r\n    self._jScanPanel.add(self._jLabelURL)\r\n    self._jScanPanel.add(self._jTextFieldURL)\r\n    self._jScanPanel.add(self._jLabelData)\r\n    self._jScanPanel.add(self._jScrollPaneData)\r\n    self._jScanPanel.add(self._jLabelCookie)\r\n    self._jScanPanel.add(self._jTextFieldCookie)\r\n    self._jScanPanel.add(self._jLabelReferer)\r\n    self._jScanPanel.add(self._jTextFieldReferer)\r\n    self._jScanPanel.add(self._jLabelHttpMethod)\r\n    self._jScanPanel.add(self._jLabelIgnoreCode)\r\n    self._jScanPanel.add(self._jComboHttpMethod)\r\n    self._jScanPanel.add(self._jTextFieldIgnoreCode)\r\n    self._jScanPanel.add(self._jLabelUA)\r\n    self._jScanPanel.add(self._jTextFieldUA)\r\n    self._jScanPanel.add(self._jLabelCustHeader)\r\n    self._jScanPanel.add(self._jTextFieldCustHeader)\r\n    self._jScanPanel.add(self._jCustHeadCheckParam)\r\n    self._jScanPanel.add(self._jSeparator2)\r\n    self._jScanPanel.add(self._jLabelParam)\r\n    self._jScanPanel.add(self._jTextFieldParam)\r\n    self._jScanPanel.add(self._jCheckTO)\r\n    self._jScanPanel.add(self._jSeparator3)\r\n    self._jScanPanel.add(self._jComboLevel)\r\n    self._jScanPanel.add(self._jLabelLevel)\r\n    self._jScanPanel.add(self._jLabelRisk)\r\n    self._jScanPanel.add(self._jComboRisk)\r\n    self._jScanPanel.add(self._jSeparator4)\r\n    self._jScanPanel.add(self._jCheckHPP)\r\n    self._jScanPanel.add(self._jCheckCU)\r\n    self._jScanPanel.add(self._jCheckDB)\r\n    self._jScanPanel.add(self._jCheckHost)\r\n    self._jScanPanel.add(self._jCheckDBA)\r\n    self._jScanPanel.add(self._jCheckUsers)\r\n    self._jScanPanel.add(self._jCheckPswds)\r\n    self._jScanPanel.add(self._jCheckPrivs)\r\n    self._jScanPanel.add(self._jCheckRoles)\r\n    self._jScanPanel.add(self._jCheckDBs)\r\n    self._jScanPanel.add(self._jSeparator5)\r\n    self._jScanPanel.add(self._jLabelThreads)\r\n    self._jScanPanel.add(self._jLabelDelay)\r\n    self._jScanPanel.add(self._jLabelTimeout)\r\n    self._jScanPanel.add(self._jLabelRetry)\r\n    self._jScanPanel.add(self._jLabelTimeSec)\r\n    self._jScanPanel.add(self._jComboThreads)\r\n    self._jScanPanel.add(self._jComboDelay)\r\n    self._jScanPanel.add(self._jComboTimeout)\r\n    self._jScanPanel.add(self._jComboRetry)\r\n    self._jScanPanel.add(self._jComboTimeSec)\r\n    self._jScanPanel.add(self._jSeparator6)\r\n    self._jScanPanel.add(self._jLabelDBMS)\r\n    self._jScanPanel.add(self._jComboDBMS)\r\n    self._jScanPanel.add(self._jLabelOS)\r\n    self._jScanPanel.add(self._jComboOS)\r\n    self._jScanPanel.add(self._jSeparator7)\r\n    self._jScanPanel.add(self._jLabelProxy)\r\n    self._jScanPanel.add(self._jTextFieldProxy)\r\n    self._jScanPanel.add(self._jSeparator8)\r\n    self._jScanPanel.add(self._jCheckTor)\r\n    self._jScanPanel.add(self._jLabelTorType)\r\n    self._jScanPanel.add(self._jComboTorType)\r\n    self._jScanPanel.add(self._jLabelTorPort)\r\n    self._jScanPanel.add(self._jTextFieldTorPort)\r\n    self._jScanPanel.add(self._jSeparator9)\r\n    self._jScanPanel.add(self._jLabelTamper)\r\n    self._jScanPanel.add(self._jTextFieldTamper)\r\n    self._jScanPanel.add(self._jSeparator10)\r\n    self._jScanPanel.add(self._jLabelAuthType)\r\n    self._jScanPanel.add(self._jComboAuthType)\r\n    self._jScanPanel.add(self._jLabelAuthUser)\r\n    self._jScanPanel.add(self._jTextFieldAuthUser)\r\n    self._jScanPanel.add(self._jLabelAuthPass)\r\n    self._jScanPanel.add(self._jTextFieldAuthPass)\r\n    self._jScanPanel.add(self._jSeparator11)\r\n    self._jScanPanel.add(self._jButtonStartScan)\r\n    self._jScanPanel.add(self._jLabelScanAPI)\r\n    self._jScrollPaneMain = swing.JScrollPane(self._jScanPanel)\r\n    self._jScanPanel.add(self._jLabelTechnique)\r\n    self._jScanPanel.add(self._jTextFieldTechnique)\r\n    self._jScrollPaneMain.setViewportView(self._jScanPanel)\r\n    self._jScrollPaneMain.setPreferredSize(awt.Dimension(1357,1357))\r\n\r\n    # Create SQLMap log JPanel\r\n    self._jLogPanel = swing.JPanel()\r\n    self._jLogPanel.setLayout(None)\r\n\r\n    # Create label, combobox, and button to get logs and textarea to display them\r\n    self._jLabelLog = swing.JLabel(\"Logs for Scan ID:\")\r\n    self._jComboLogs = swing.JComboBox(self.scantasks)\r\n    self._jButtonGetLogs = swing.JButton('Get', actionPerformed=self.getLogs)\r\n    self._jButtonRemoveLogs = swing.JButton('Remove', actionPerformed=self.removeLogs)\r\n    self._jTextLogs = swing.JTextArea()\r\n    self._jTextLogs.setColumns(50)\r\n    self._jTextLogs.setRows(50)\r\n    self._jTextLogs.setLineWrap(True)\r\n    self._jTextLogs.setEditable(False)\r\n    self._jScrollPaneLogs = swing.JScrollPane(self._jTextLogs)\r\n    self._jScrollPaneLogs.setVerticalScrollBarPolicy(swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)\r\n\r\n    self._jLabelLog.setBounds(15, 16, 126, 20)\r\n    self._jComboLogs.setBounds(167, 16, 535, 20)\r\n    self._jButtonGetLogs.setBounds(718, 16, 50, 20)\r\n    self._jButtonRemoveLogs.setBounds(783, 16, 80, 20)\r\n    self._jScrollPaneLogs.setBounds(15, 58, 846, 400)\r\n\r\n    self._jLogPanel.add(self._jLabelLog)\r\n    self._jLogPanel.add(self._jComboLogs)\r\n    self._jLogPanel.add(self._jButtonGetLogs)\r\n    self._jLogPanel.add(self._jButtonRemoveLogs)\r\n    self._jLogPanel.add(self._jScrollPaneLogs)\r\n\r\n    # Create SQLMap stop scan JPanel\r\n    self._jStopScanPanel = swing.JPanel()\r\n    self._jStopScanPanel.setLayout(None)\r\n\r\n    # Create label, combobox, and button to stop scans and textfield to display success\r\n    self._jLabelStopScan = swing.JLabel(\"Stop Scan ID:\")\r\n    self._jComboStopScan = swing.JComboBox(self.scantasks)\r\n    self._jButtonStopScan = swing.JButton('Stop', actionPerformed=self.stopScan)\r\n    self._jButtonRemoveScan = swing.JButton('Remove', actionPerformed=self.removeScan)\r\n    self._jLabelStopStatus = swing.JLabel()\r\n\r\n    self._jLabelStopScan.setBounds(15, 16, 126, 20)\r\n    self._jComboStopScan.setBounds(167, 16, 535, 20)\r\n    self._jButtonStopScan.setBounds(718, 16, 55, 20)\r\n    self._jButtonRemoveScan.setBounds(783, 16, 80, 20)\r\n    self._jLabelStopStatus.setBounds(167, 58, 846, 20)\r\n\r\n    self._jStopScanPanel.add(self._jLabelStopScan)\r\n    self._jStopScanPanel.add(self._jComboStopScan)\r\n    self._jStopScanPanel.add(self._jButtonStopScan)\r\n    self._jStopScanPanel.add(self._jButtonRemoveScan)\r\n    self._jStopScanPanel.add(self._jLabelStopStatus)\r\n\r\n    # Setup Tabs\r\n    self._jConfigTab = swing.JTabbedPane()\r\n    self._jConfigTab.addTab(\"SQLMap API\", self._jPanel)\r\n    self._jConfigTab.addTab(\"SQLMap Scanner\", self._jScrollPaneMain)\r\n    self._jConfigTab.addTab(\"SQLMap Logs\", self._jLogPanel)\r\n    self._jConfigTab.addTab(\"SQLMap Scan Stop\", self._jStopScanPanel)\r\n\r\n    # Automatically get and set the Python path if we can find it\r\n    pythonpath = ''\r\n    pythonregpath1 = ''\r\n    pythonregpath2 = ''\r\n    pathpart1 = ''\r\n    pathpart2 = ''\r\n    drivepart1 = ''\r\n    drivepart2 = ''\r\n    pythonaltpath1 = ''\r\n    pythonaltpath2 = ''\r\n    path_delim = ''\r\n    ostype = System.getProperty('os.name')\r\n\r\n    try:\r\n      if 'Windows' in ostype:\r\n        path_delim = '\\\\'\r\n\r\n        try:\r\n          pythonpath = subprocess.check_output(['where', 'python']).split('\\n')[0].rstrip('\\n\\r')\r\n        except:\r\n          print 'Could not find python.exe in path.\\n'\r\n\r\n        try:\r\n          pythonregpath1 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\2.7\\\\InstallPath\" /ve')\r\n          pathpart1 = pythonregpath1.rsplit(':', 1)[1].rstrip('\\n\\r')\r\n          drivepart1 = pythonregpath1.rsplit(':', 1)[0][-1]\r\n        except:\r\n          print 'Could not find python path in registry at: HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\2.7\\\\InstallPath.\\n'\r\n\r\n        try:\r\n          pythonregpath2 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\\\\2.7\\InstallPath\" /ve')\r\n          pathpart2 = pythonregpath2.rsplit(':', 1)[1].rstrip('\\n\\r')\r\n          drivepart2 = pythonregpath2.rsplit(':', 1)[0][-1]\r\n        except:\r\n          print 'Could not find python path in registry at: HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\\\\2.7\\InstallPath.\\n'\r\n\r\n        if re.search('[pP]ython', pathpart1):\r\n          pythonaltpath1 = drivepart1 + ':' + pathpart1 + path_delim + 'python.exe'\r\n        else:\r\n          try:\r\n            pythonregpath1 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\" /se #')\r\n            match = re.findall(\"3\\.\\d\", str(pythonregpath1))\r\n            pythonregpath1 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\' + match[0] + '\\\\InstallPath\" /v ExecutablePath')\r\n            pathpart1 = str(pythonregpath1).rsplit(':', 1)[1].rstrip('\\n\\r')[:-9]\r\n            drivepart1 = str(pythonregpath1).rsplit(':', 1)[0][-1]\r\n          except:\r\n            print 'Could not find python path in registry at: HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\3.x\\\\InstallPath\\\\ExecutablePath.\\n'\r\n\r\n          if re.search('[pP]ython', pathpart1):\r\n            pythonaltpath1 = drivepart1 + ':' + pathpart1\r\n\r\n        if re.search('[pP]ython', pathpart2):\r\n          pythonaltpath2 = drivepart2 + ':' + pathpart2 + path_delim + 'python.exe'\r\n        else:\r\n          try:\r\n            pythonregpath2 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\" /se #')\r\n            match = re.findall(\"3\\.\\d\", str(pythonregpath1))\r\n            pythonregpath2 = subprocess.check_output('reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\\\\' + match[0] + '\\\\InstallPath\" /v ExecutablePath')\r\n            pathpart2 = str(pythonregpath1).rsplit(':', 1)[1].rstrip('\\n\\r')[:-9]\r\n            drivepart2 = str(pythonregpath1).rsplit(':', 1)[0][-1]\r\n          except:\r\n            print 'Could not find python path in registry at: HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\\\\3.x\\\\InstallPath\\\\ExecutablePath.\\n'\r\n\r\n          if re.search('[pP]ython', pathpart2):\r\n            pythonaltpath2 = drivepart2 + ':' + pathpart2\r\n      else:\r\n        path_delim = '/'\r\n\r\n        try:\r\n          pythonpath = subprocess.check_output(['which', 'python2.7']).split('\\n')[0].rstrip('\\n\\r')\r\n        except:\r\n          print 'Could not find python2 in path.\\n'\r\n\r\n        if re.search('\\/python2.7$', pythonpath) is None:\r\n          try:\r\n            pythonpath = subprocess.check_output(['which', 'python3']).split('\\n')[0].rstrip('\\n\\r')\r\n          except:\r\n            print 'Could not find python3 in path.\\n'\r\n\r\n    except:\r\n      print 'Could not get OS version, therefore could not find Python path\\n'\r\n\r\n    # Set python variables\r\n    if re.search('python.exe', pythonpath) or re.search('\\/python2.7$', pythonpath) or re.search('\\/python3', pythonpath):\r\n      self.pythonfile = pythonpath\r\n      print 'Python found in system path at: ' + pythonpath + '\\n'\r\n    elif re.search('python.exe', pythonaltpath1):\r\n      self.pythonfile = pythonaltpath1\r\n      print 'Python found in registry under HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\2.7 or 3.x\\\\InstallPath at: ' + pythonaltpath1 + '\\n'\r\n    elif re.search('python.exe', pythonaltpath2):\r\n      self.pythonfile = pythonaltpath2\r\n      print 'Python found in registry under HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\WOW6432Node\\\\Python\\\\PythonCore\\\\2.7 or 3.x\\InstallPath at: ' + pythonaltpath2 + '\\n'\r\n    else:\r\n      print 'Could not set the correct Python path.\\n'\r\n\r\n    # Get Python version to confirm 2.7.x or 3.x\r\n    if 'Windows' in ostype and re.search('python.exe', self.pythonfile):\r\n      try:\r\n        pythonver = subprocess.check_output(self.pythonfile + ' -c \"import sys; print(str(sys.version_info[0]) + str(sys.version_info[1]))\"')\r\n        if str(pythonver[:-2]) == '27' or re.search('3\\d', str(pythonver[:-2])):\r\n          self._jLabelPython.setText('Python set to: ' + self.pythonfile)\r\n        else:\r\n          self.pythonfile = ''\r\n          print 'Wrong version of Python: ' + pythonver[0] + '.' + pythonver[1] + '\\n'\r\n      except:\r\n        print 'Could not get Python version\\n'\r\n    elif re.search('python2.7', self.pythonfile) or re.search('python3', self.pythonfile):\r\n      self._jLabelPython.setText('Python set to: ' + self.pythonfile)\r\n    else:\r\n      print 'Wrong version of Python or something went wrong.\\n'\r\n\r\n    # Automatically set the sqlmapapi, first unzip if the extension has never run\r\n    if os.path.isfile(os.getcwd() + path_delim + 'sqlmap.zip'):\r\n\r\n      # Extract sqlmap\r\n      try:\r\n        with zipfile.ZipFile(os.getcwd() + path_delim + 'sqlmap.zip') as sqlmapzip:\r\n          sqlmapzip.extractall(os.getcwd() + path_delim)\r\n\r\n        # Remove sqlmap zip file\r\n        os.remove(os.getcwd() + path_delim + 'sqlmap.zip')\r\n\r\n        # Set API\r\n        if os.path.isfile(os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py'):\r\n          self._jLabelAPI.setText('API set to: ' + os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py')\r\n          self.apifile = os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py'\r\n          print 'SQLMap API found at: ' + self.apifile + '\\n'\r\n        else:\r\n          print 'Could not find SQLMap API file.\\n'\r\n      except:\r\n        print 'Failed to extract sqlmap.zip\\n'\r\n    else:\r\n      # Set API\r\n      if os.path.isfile(os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py'):\r\n        self._jLabelAPI.setText('API set to: ' + os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py')\r\n        self.apifile = os.getcwd() + path_delim + 'sqlmap' + path_delim + 'sqlmapapi.py'\r\n        print 'SQLMap API found at: ' + self.apifile + '\\n'\r\n      else:\r\n        print 'Could not find SQLMap API file.\\n'\r\n\r\n    callbacks.customizeUiComponent(self._jConfigTab)\r\n    callbacks.addSuiteTab(self)\r\n    return\r\n\r\n    # Create a menu item if the appropriate section of the UI is selected\r\n  def createMenuItems(self, invocation):\r\n    menu = []\r\n\r\n    # Which part of the interface the user selects\r\n    ctx = invocation.getInvocationContext()\r\n\r\n    # Message Viewer Req will show menu item if selected by the user\r\n    if ctx == 0 or ctx == 2:\r\n      menu.append(swing.JMenuItem(\"SQLiPy Scan\", None, actionPerformed=lambda x, inv=invocation: self.sqlMapScan(inv)))\r\n\r\n    return menu if menu else None\r\n\r\n  def getTabCaption(self):\r\n    return 'SQLiPy'\r\n\r\n  def getUiComponent(self):\r\n    return self._jConfigTab\r\n\r\n  def sqlMapScan(self, invocation):\r\n\r\n    # Check initial message for proper request/response and set variables - Burp will not return valid info otherwise\r\n      try:\r\n        invMessage = invocation.getSelectedMessages()\r\n        message = invMessage[0]\r\n        reqInfo = self._helpers.analyzeRequest(message)\r\n        reqUrl = str(reqInfo.getUrl())\r\n        reqBody = message.getRequest()\r\n        bodyData = self._helpers.bytesToString(reqBody[reqInfo.getBodyOffset():])\r\n        reqHeaders = newHeaders = list(reqInfo.getHeaders())\r\n        referer = ''\r\n        ua = ''\r\n        cookie = ''\r\n        headerString = ''\r\n\r\n        for header in reqHeaders:\r\n          if re.search('^Referer', header, re.IGNORECASE) is not None:\r\n            referer = re.sub('^Referer\\:\\s+', '', header, re.IGNORECASE)\r\n          elif re.search('^User-Agent', header, re.IGNORECASE) is not None:\r\n            ua = re.sub('^User-Agent\\:\\s+', '', header, re.IGNORECASE)\r\n          elif re.search('^Cookie', header, re.IGNORECASE) is not None:\r\n            cookie = re.sub('^Cookie\\:\\s+', '', header, re.IGNORECASE)\r\n          elif ':' in header:\r\n            headerString += (\"\\\\n\" if headerString != \"\" else \"\") + header\r\n\r\n        self._jTextFieldURL.setText(reqUrl)\r\n        self._jTextData.setText(bodyData)\r\n        self._jTextFieldCookie.setText(cookie)\r\n        self._jTextFieldUA.setText(ua)\r\n        self._jTextFieldReferer.setText(referer)\r\n        self._jTextFieldCustHeader.setText(headerString)\r\n        self._jConfigTab.setSelectedComponent(self._jScrollPaneMain)\r\n        self.scanMessage = message\r\n        self.scanUrl = reqInfo.getUrl()\r\n        parentTab = self._jConfigTab.getParent()\r\n        parentTab.setSelectedComponent(self._jConfigTab)\r\n      except:\r\n        print 'Failed to add data to scan tab.'\r\n\r\n  def printHeader(self):\r\n    print 'SQLiPy - 0.8.6\\nBurp interface to SQLMap via the SQLMap API\\njosh.berry@codewatch.org\\n\\n'\r\n\r\n  def setAPI(self, e):\r\n    selectFile = swing.JFileChooser()\r\n    filter = swing.filechooser.FileNameExtensionFilter(\"python files\", [\"py\"])\r\n    selectFile.addChoosableFileFilter(filter)\r\n\r\n    returnedFile = selectFile.showDialog(self._jPanel, \"SQLMap API\")\r\n\r\n    if returnedFile == swing.JFileChooser.APPROVE_OPTION:\r\n      file = selectFile.getSelectedFile()\r\n      self.apifile = file.getPath()\r\n      print 'Selected API at ' + file.getPath()\r\n      self._jLabelAPI.setText('API set to: ' + file.getPath())\r\n\r\n  def setPython(self, e):\r\n    selectFile = swing.JFileChooser()\r\n\r\n    returnedFile = selectFile.showDialog(self._jPanel, \"Python EXE\")\r\n\r\n    if returnedFile == swing.JFileChooser.APPROVE_OPTION:\r\n      file = selectFile.getSelectedFile()\r\n      self.pythonfile = file.getPath()\r\n      print 'Selected Python at ' + file.getPath()\r\n      self._jLabelPython.setText('Python set to: ' + file.getPath())\r\n\r\n  def startAPI(self, button):\r\n    if self.apistatus == 0:\r\n      try:\r\n        print 'Calling: ' + self.pythonfile + ' ' + self.apifile + ' -s -H ' + self._jTextFieldIPListen.getText() + ' -p ' + self._jTextFieldPortListen.getText() + '\\n'\r\n        sqlmapdir = ''\r\n\r\n        if re.search('^[a-zA-Z]\\:', self.apifile) is not None:\r\n          sqlmapdir = self.apifile.rsplit('\\\\', 1)[0]\r\n        else:\r\n          sqlmapdir = self.apifile.rsplit('/', 1)[0]\r\n\r\n        javaexec = getattr(Runtime.getRuntime(), \"exec\")\r\n        cmd = [self.pythonfile, self.apifile, \"-s\", \"-H\", self._jTextFieldIPListen.getText(), \"-p\", self._jTextFieldPortListen.getText()]\r\n\r\n        self.apiprocess = javaexec(cmd, None, File(sqlmapdir))\r\n\r\n        self.errorGobbler = Thread(StreamGobbler(self.apiprocess.getErrorStream(), System.err))\r\n        self.outputGobbler = Thread(StreamGobbler(self.apiprocess.getInputStream(), System.out))\r\n\r\n        self.errorGobbler.start()\r\n        self.outputGobbler.start()\r\n\r\n        # Final validation the API is running\r\n        try:\r\n          time.sleep(5)\r\n          req = urllib2.Request('http://' + str(self._jTextFieldIPListen.getText()) + ':' + str(self._jTextFieldPortListen.getText()) + '/scan/0/status')\r\n          req.add_header('Content-Type', 'application/json')\r\n          resp = json.load(urllib2.urlopen(req, timeout=10))\r\n\r\n          if resp['message'] == \"Invalid task ID\":\r\n            self._jLabelScanAPI.setText(self._jTextFieldIPListen.getText() + ':' + self._jTextFieldPortListen.getText())\r\n            self._jLabelScanAPI.setForeground(Color.GREEN)\r\n            self._jTextFieldScanIPListen.setText(self._jTextFieldIPListen.getText())\r\n            self._jTextFieldScanPortListen.setText(self._jTextFieldPortListen.getText())\r\n            self._jLabelAPIStatus.setText('SQLMap API IS CURRENTLY RUNNING!')\r\n            self._jLabelAPIStatus.setForeground(Color.GREEN)\r\n            self.apistatus = 1\r\n\r\n            print 'SQLMap API started.\\n'\r\n        except:\r\n          self.apiprocess.destroy()\r\n          self.errorGobbler.join()\r\n          self.outputGobbler.join()\r\n          print 'Failed to start the SQLMap API\\n'\r\n\r\n      except:\r\n        print 'Failed to start the SQLMap API\\n'\r\n    else:\r\n      print 'The SQLMap API process has already been started\\n'\r\n\r\n  def stopAPI(self, button):\r\n    if self.apistatus == 1:\r\n      try:\r\n        if self._jComboStopScan.getItemCount() is not 0:\r\n          for item in range(0, self._jComboStopScan.getItemCount()):\r\n            req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/scan/' + str(self._jComboStopScan.getItemAt(item).split('-')[0]) + '/kill')\r\n            resp = json.load(urllib2.urlopen(req, timeout=3))\r\n\r\n            if resp['success'] == True:\r\n              print 'Scan stopped for ID: '+ self._jComboStopScan.getItemAt(item).split('-')[0]+'\\n'\r\n            else:\r\n              print 'Failed to stop scan on ID: '+self._jComboStopScan.getItemAt(item).split('-')[0]+', likely already completed\\n'\r\n        \r\n      except:\r\n        print 'Failed to stop currently running SQLMap scans or no scans were still running\\n'\r\n\r\n      try:\r\n        totalThreads = 1\r\n\r\n        for thread in self.threads:\r\n          print 'Stopping running scan check thread: ' + str(totalThreads) + '\\n'\r\n          totalThreads += 1\r\n          thread.keep_running = False\r\n          thread.join()\r\n\r\n        i = 0\r\n        while i < len(self.threads):\r\n          self.threads.pop(0)\r\n          i += 1\r\n\r\n      except:\r\n        print 'Could not stop running threads\\n'\r\n\r\n      try:\r\n        self.apiprocess.destroy()\r\n        self._jComboLogs.removeAllItems()\r\n        self._jComboStopScan.removeAllItems()\r\n        self._jLabelScanAPI.setText('SQLMap API is NOT running!')\r\n        self._jLabelScanAPI.setForeground(Color.RED)\r\n        self._jLabelAPIStatus.setText('SQLMap API is NOT running!')\r\n        self._jLabelAPIStatus.setForeground(Color.RED)\r\n        self.apistatus = 0\r\n\r\n        print 'Stopping the SQLMap API\\n'\r\n      except:\r\n        print 'Failed to stop the SQLMap API\\n'\r\n\r\n      try:\r\n          self.errorGobbler.join()\r\n          self.outputGobbler.join()\r\n\r\n          print 'Stopping API input/output/error buffers threads\\n'\r\n      except:\r\n          print 'Failed to stop API input/output/error buffers threads\\n'\r\n\r\n  def extensionUnloaded(self):\r\n    if self.apistatus == 1:\r\n      try:\r\n        if self._jComboStopScan.getItemCount() is not 0:\r\n          for item in range(0, self._jComboStopScan.getItemCount()):\r\n            req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/scan/' + str(self._jComboStopScan.getItemAt(item).split('-')[0]) + '/kill')\r\n            resp = json.load(urllib2.urlopen(req, timeout=3))\r\n\r\n            if resp['success'] == True:\r\n              print 'Scan stopped for ID: '+ self._jComboStopScan.getItemAt(item).split('-')[0]+'\\n'\r\n            else:\r\n              print 'Failed to stop scan on ID: '+self._jComboStopScan.getItemAt(item).split('-')[0]+', likely already completed\\n'\r\n        \r\n      except:\r\n        print 'Failed to stop currently running SQLMap scans or no scans were still running\\n'\r\n\r\n      try:\r\n        totalThreads = 1\r\n\r\n        for thread in self.threads:\r\n          print 'Stopping running scan check thread: ' + str(totalThreads) + '\\n'\r\n          totalThreads += 1\r\n          thread.keep_running = False\r\n          thread.join()\r\n\r\n      except:\r\n        print 'Could not stop running threads\\n'\r\n\r\n      try:\r\n        self.apiprocess.destroy()\r\n        print 'Stopping the SQLMap API...\\n'\r\n      except:\r\n        print 'Failed to stop the SQLMap API\\n'\r\n\r\n      try:\r\n          self.errorGobbler.join()\r\n          self.outputGobbler.join()\r\n\r\n          print 'Stopping API input/output/error buffers threads\\n'\r\n      except:\r\n          print 'Failed to stop API input/output/error buffers threads\\n'\r\n\r\n  def getLogs(self, button):\r\n    try:\r\n      req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/scan/' + str(self._jComboLogs.getSelectedItem().split('-')[0]) + '/log')\r\n      resp = json.load(urllib2.urlopen(req, timeout=10))\r\n\r\n      if resp['success'] == True:\r\n        logdata = ''\r\n        for logs in resp['log']:\r\n          logdata = logdata + logs['level'] + ': ' + logs['time'] + ' - ' + logs['message'] + '\\n'\r\n\r\n        self._jTextLogs.setText('Log results for: ' + self.scancmds[self._jComboLogs.getSelectedItem().split('-')[0]] + logdata)\r\n      else:\r\n        print 'Failed to get logs for: '+self._jComboLogs.getSelectedItem().split('-')[0]+'\\n'\r\n    except:\r\n      print 'Failed to get logs for: '+self._jComboLogs.getSelectedItem().split('-')[0]+'\\n'\r\n\r\n  def removeLogs(self, button):\r\n    print 'Removing Log Entry for ID: '+ self._jComboLogs.getSelectedItem().split('-')[0]+'\\n'\r\n    self._jComboLogs.removeItem(self._jComboLogs.getSelectedItem())\r\n\r\n  def stopScan(self, button):\r\n    try:\r\n      req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/scan/' + str(self._jComboStopScan.getSelectedItem().split('-')[0]) + '/kill')\r\n      resp = json.load(urllib2.urlopen(req, timeout=10))\r\n\r\n      if resp['success'] == True:\r\n        print 'Scan stopped for ID: '+ self._jComboStopScan.getSelectedItem().split('-')[0]+'\\n'\r\n        self._jLabelStopStatus.setText('Scan stopped for ID: ' + self._jComboStopScan.getSelectedItem().split('-')[0])\r\n        self._jComboStopScan.removeItem(self._jComboStopScan.getSelectedItem())\r\n      else:\r\n        print 'Failed to stop scan on ID: '+self._jComboStopScan.getSelectedItem().split('-')[0]+', likely already completed\\n'\r\n        self._jLabelStopStatus.setText('Failed to stop scan on ID: '+self._jComboStopScan.getSelectedItem().split('-')[0]+', likely already completed')\r\n    except:\r\n      print 'Failed to stop scan on ID: '+self._jComboStopScan.getSelectedItem().split('-')[0]+', likely already completed\\n'\r\n      self._jLabelStopStatus.setText('Failed to stop scan on ID: '+self._jComboStopScan.getSelectedItem().split('-')[0]+', likely already completed')\r\n\r\n  def removeScan(self, button):\r\n    print 'Removing Scan Stop Entry for ID: '+ self._jComboStopScan.getSelectedItem().split('-')[0]+'\\n'\r\n    self._jLabelStopStatus.setText('Scan removed from stop tab for ID: ' + self._jComboStopScan.getSelectedItem().split('-')[0])\r\n    self._jComboStopScan.removeItem(self._jComboStopScan.getSelectedItem())\r\n\r\n  def startScan(self, button):\r\n    hpp = ''\r\n    cu = ''\r\n    cdb = ''\r\n    hostname = ''\r\n    isdba = ''\r\n    lusers = ''\r\n    lpswds = ''\r\n    lprivs = ''\r\n    lroles = ''\r\n    ldbs = ''\r\n    textonly = ''\r\n    postdata = None\r\n    datacmd = ''\r\n    cookiedata = None\r\n    cookiecmd = ''\r\n    uadata = None\r\n    uacmd = ''\r\n    ignorecodedata = None\r\n    ignorecodecmd = ''\r\n    custheaderdata = None\r\n    custheadercmd = ''\r\n    headerdata = None\r\n    headercmd = ''\r\n    refererdata = None\r\n    referercmd = ''\r\n    proxy = None\r\n    proxycmd = ''\r\n    dbms = None\r\n    dbmscmd = ''\r\n    os = None\r\n    oscmd = ''\r\n    tampercmd = ''\r\n    tamperdata = None\r\n    paramcmd = ''\r\n    paramdata = None\r\n    csrfurl = None\r\n    csrftoken = None\r\n    torcmd = ''\r\n    tortypecmd = ''\r\n    torportcmd = ''\r\n    httpmethod = None\r\n    httpmethodcmd = ''\r\n    authtype = None\r\n    authtypecmd = ''\r\n    authcred = None\r\n    authcredcmd = ''\r\n    livecookies = None\r\n    skipheuristics = None\r\n    proxyfreq = None\r\n\r\n    if self._jCheckTO.isSelected():\r\n      textonly = ' --text-only'\r\n      textonlystatus = True\r\n    else:\r\n      textonlystatus = False\r\n\r\n    if self._jCheckHPP.isSelected():\r\n      hpp = ' --hpp'\r\n      hppstatus = True\r\n    else:\r\n      hppstatus = False\r\n\r\n    if self._jCheckCU.isSelected():\r\n      cu = ' --current-user'\r\n      custatus = True\r\n    else:\r\n      custatus = False\r\n\r\n    if self._jCheckDB.isSelected():\r\n      cdb = ' --current-db'\r\n      cdbstatus = True\r\n    else:\r\n      cdbstatus = False\r\n\r\n    if self._jCheckHost.isSelected():\r\n      hostname = ' --hostname'\r\n      hostnamestatus = True\r\n    else:\r\n      hostnamestatus = False\r\n\r\n    if self._jCheckDBA.isSelected():\r\n      isdba = ' --is-dba'\r\n      isdbastatus = True\r\n    else:\r\n      isdbastatus = False\r\n\r\n    if self._jCheckUsers.isSelected():\r\n      lusers = ' --users'\r\n      lusersstatus = True\r\n    else:\r\n      lusersstatus = False\r\n\r\n    if self._jCheckPswds.isSelected():\r\n      lpswds = ' --passwords'\r\n      lpswdsstatus = True\r\n    else:\r\n      lpswdsstatus = False\r\n\r\n    if self._jCheckPrivs.isSelected():\r\n      lprivs = ' --privileges'\r\n      lprivsstatus = True\r\n    else:\r\n      lprivsstatus = False\r\n\r\n    if self._jCheckRoles.isSelected():\r\n      lroles = ' --roles'\r\n      lrolesstatus = True\r\n    else:\r\n      lrolesstatus = False\r\n\r\n    if self._jCheckDBs.isSelected():\r\n      ldbs = ' --dbs'\r\n      ldbsstatus = True\r\n    else:\r\n      ldbsstatus = False\r\n\r\n    if self._jCheckTor.isSelected():\r\n      torstatus = True\r\n      torcmd = ' --tor'\r\n      tortype = self._jComboTorType.getSelectedItem()\r\n      tortypecmd = ' --tor-type=' + self._jComboTorType.getSelectedItem()\r\n      torport = self._jTextFieldTorPort.getText()\r\n      torportcmd = ' --tor-port=' + self._jTextFieldTorPort.getText()\r\n    else:\r\n      torstatus = False\r\n      tortype = 'HTTP'\r\n      torport = None\r\n\r\n    if not re.search('^None$', self._jComboAuthType.getSelectedItem()) is not None and re.search('[a-zA-Z0-9]', self._jTextFieldAuthUser.getText()) is not None:\r\n      authtype = self._jComboAuthType.getSelectedItem()\r\n      authtypecmd = ' --auth-type=' + self._jComboAuthType.getSelectedItem()\r\n      authuser = self._jTextFieldAuthUser.getText()\r\n      authpass = self._jTextFieldAuthPass.getText()\r\n      authcred = authuser + ':' + authpass\r\n      authcredcmd = ' --auth-cred=\"' + authuser + ':' + authpass + '\"'\r\n    else:\r\n      authtype = None\r\n      authtypecmd = ''\r\n      authuser = ''\r\n      authpass = ''\r\n      authcred = None\r\n      authcredcmd = ''  \r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldIgnoreCode.getText()) is not None:\r\n      ignorecodedata = self._jTextFieldIgnoreCode.getText()\r\n      ignorecodecmd = ' --ignore-code=' + self._jTextFieldIgnoreCode.getText()\r\n\r\n    if re.search('(http|https)\\://', self._jTextFieldProxy.getText()) is not None:\r\n      proxy = self._jTextFieldProxy.getText()\r\n      proxycmd = ' --proxy=' + self._jTextFieldProxy.getText()\r\n\r\n    if not re.search('^Default$', self._jComboHttpMethod.getSelectedItem()) is not None:\r\n      httpmethod = self._jComboHttpMethod.getSelectedItem()\r\n      httpmethodcmd = ' --method=\"' + self._jComboHttpMethod.getSelectedItem()+'\"'\r\n\r\n    if not re.search('^Any$', self._jComboDBMS.getSelectedItem()) is not None:\r\n      dbms = self._jComboDBMS.getSelectedItem()\r\n      dbmscmd = ' --dbms=\"' + self._jComboDBMS.getSelectedItem()+'\"'\r\n\r\n    if not re.search('^Any$', self._jComboOS.getSelectedItem()) is not None:\r\n      os = self._jComboOS.getSelectedItem()\r\n      oscmd = ' --os=' + self._jComboOS.getSelectedItem()\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldTamper.getText()) is not None:\r\n      tampercmd = ' --tamper=\"' + self._jTextFieldTamper.getText() + '\"'\r\n      tamperdata = self._jTextFieldTamper.getText()\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextData.getText()) is not None:\r\n      postdata = self._jTextData.getText()\r\n      datacmd = ' --data=\"' + self._jTextData.getText() + '\"'\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldCookie.getText()) is not None:\r\n      cookiedata = self._jTextFieldCookie.getText()\r\n      cookiecmd = ' --cookie=\"' + self._jTextFieldCookie.getText() + '\"'\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldUA.getText()) is not None:\r\n      uadata = self._jTextFieldUA.getText()\r\n      uacmd = ' --user-agent=\"' + self._jTextFieldUA.getText() + '\"'\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldCustHeader.getText()) is not None and self._jCustHeadCheckParam.isSelected():\r\n      custheaderdata = self._jTextFieldCustHeader.getText()\r\n      custheadercmd = ' --headers=\"' + self._jTextFieldCustHeader.getText() + '\"'\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldReferer.getText()) is not None:\r\n      refererdata = self._jTextFieldReferer.getText()\r\n      referercmd = ' --referer=\"' + self._jTextFieldReferer.getText() + '\"'\r\n\r\n    if re.search('[a-zA-Z0-9]', self._jTextFieldParam.getText()) is not None:\r\n      paramdata = self._jTextFieldParam.getText()\r\n      paramcmd = ' -p \"' + self._jTextFieldParam.getText() + '\"'\r\n\r\n    try:\r\n      sqlmapcmd = 'sqlmap.py -u \"' + self._jTextFieldURL.getText() + '\"' + datacmd + httpmethodcmd + cookiecmd + uacmd + referercmd + custheadercmd + authtypecmd + authcredcmd + ignorecodecmd + proxycmd + torcmd + tortypecmd + torportcmd + ' --delay=' + str(self._jComboDelay.getSelectedItem()) + ' --timeout=' + str(self._jComboTimeout.getSelectedItem()) + ' --retries=' + str(self._jComboDelay.getSelectedItem()) + paramcmd + dbmscmd + oscmd + tampercmd + ' --level=' + str(self._jComboLevel.getSelectedItem()) + ' --risk=' + str(self._jComboRisk.getSelectedItem()) + textonly + hpp + ' --threads=' + str(self._jComboThreads.getSelectedItem()) + ' --time-sec=' + str(self._jComboTimeSec.getSelectedItem()) + ' --technique=' + str(self._jTextFieldTechnique.getText()) + ' -b' + cu + cdb + hostname + isdba + lusers + lpswds + lprivs + lroles + ldbs + ' --batch --answers=\"crack=N,dict=N,continue=Y,quit=N\"\\n\\n'\r\n      print 'SQLMap Command: ' + sqlmapcmd\r\n      url = 'http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/task/new'\r\n      req = urllib2.urlopen(url, timeout=10)\r\n      resp = json.loads(req.read())\r\n\r\n      if resp['success'] == True and resp['taskid']:\r\n        sqlitask = str(resp['taskid'])\r\n        sqliopts = {'authType': authtype, 'csrfUrl': csrfurl, 'csrfToken': csrftoken, 'liveCookies': livecookies, 'skipHeuristics': skipheuristics, 'proxyFreq': proxyfreq, 'getUsers': lusersstatus, 'getPasswordHashes': lpswdsstatus, 'delay': self._jComboDelay.getSelectedItem(), 'isDba': isdbastatus, 'risk': self._jComboRisk.getSelectedItem(), 'getCurrentUser': custatus, 'getRoles': lrolesstatus, 'getPrivileges': lprivsstatus, 'testParameter': paramdata, 'timeout': self._jComboTimeout.getSelectedItem(), 'ignoreCode': ignorecodedata, 'torPort': torport, 'level': self._jComboLevel.getSelectedItem(), 'technique': self._jTextFieldTechnique.getText(), 'getCurrentDb': cdbstatus, 'answers': 'crack=N,dict=N,continue=Y,quit=N', 'method': httpmethod, 'cookie': cookiedata, 'proxy': proxy, 'os': os, 'threads': self._jComboThreads.getSelectedItem(), 'url': self._jTextFieldURL.getText(), 'getDbs': ldbsstatus, 'tor': torstatus, 'torType': tortype, 'referer': refererdata, 'retries': self._jComboRetry.getSelectedItem(), 'headers': custheaderdata, 'authCred': authcred, 'timeSec': self._jComboTimeSec.getSelectedItem(), 'getHostname': hostnamestatus, 'agent': uadata, 'dbms': dbms, 'tamper': tamperdata, 'hpp': hppstatus, 'getBanner': 'true', 'data': postdata, 'textOnly': textonlystatus}\r\n\r\n        print 'Created SQLMap Task: ' + sqlitask + '\\n'\r\n\r\n        try:\r\n          req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/option/' + sqlitask + '/set')\r\n          req.add_header('Content-Type', 'application/json')\r\n          resp = json.load(urllib2.urlopen(req, json.dumps(sqliopts), timeout=10))\r\n\r\n          if resp['success'] == True:\r\n            print 'SQLMap options set on Task ' + sqlitask + ': ' + json.dumps(sqliopts) + '\\n'\r\n            sqliopts = {'url': self._jTextFieldURL.getText()}\r\n\r\n            try:\r\n              checkreq = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/option/' + sqlitask + '/list')\r\n              checkresp = json.load(urllib2.urlopen(checkreq, timeout=10))\r\n              print 'SQLMap options returned: ' + json.dumps(checkresp) + '\\n'\r\n            except:\r\n              print 'Failed to get list of options from SQLMap API\\n'\r\n\r\n            try:\r\n              req = urllib2.Request('http://' + str(self._jTextFieldScanIPListen.getText()) + ':' + str(self._jTextFieldScanPortListen.getText()) + '/scan/' + sqlitask + '/start')\r\n              req.add_header('Content-Type', 'application/json')\r\n              resp = json.load(urllib2.urlopen(req, json.dumps(sqliopts), timeout=10))\r\n\r\n              if resp['success'] == True:\r\n                findings = ThreadExtender(self, self._jTextFieldScanIPListen.getText(), self._jTextFieldScanPortListen.getText(), sqlitask, self.scanUrl, self.scanMessage, self._callbacks)\r\n                t = threading.Thread(target=findings.checkResults)\r\n                self.threads.append(t)\r\n                t.start()\r\n                self._jComboLogs.addItem(sqlitask + '-' + self._jTextFieldURL.getText())\r\n                self._jComboStopScan.addItem(sqlitask + '-' + self._jTextFieldURL.getText())\r\n                self.scancmds[sqlitask] = sqlmapcmd\r\n                print 'Started SQLMap Scan on Task ' + sqlitask +' with Engine ID: ' + str(resp['engineid']) + ' - ' + self._jTextFieldURL.getText() + '\\n'\r\n              else:\r\n                print 'Failed to start SQLMap Scan for Task: ' + sqlitask + '\\n'\r\n\r\n            except:\r\n              print 'Failed to start SQLMap Scan for Task: ' + sqlitask + '\\n'\r\n\r\n          else:\r\n            print 'Failed to set options on SQLMap Task: ' + sqlitask + '\\n'\r\n\r\n        except:\r\n          print 'Failed to set options on SQLMap Task: ' + sqlitask + '\\n'\r\n\r\n      else:\r\n        print(traceback.format_exc())\r\n        print 'SQLMap task creation failed\\n'\r\n\r\n    except:\r\n      print(traceback.format_exc())\r\n      print 'SQLMap task creation failed\\n'"
  }
]