├── README ├── Webinject ├── .gitignore ├── Changes ├── LICENSE ├── MANIFEST.SKIP ├── Makefile.PL ├── bin │ └── webinject.pl ├── examples │ ├── config.xml │ └── testcases.xml ├── lib │ └── Webinject.pm └── t │ ├── 01-Webinject.t │ ├── 02-Test_Cases.t │ ├── 03-Report_Type_Nagios.t │ ├── 04-Timeouts.t │ ├── 05-Basic_Auth.t │ ├── 06-Proxy.t │ ├── 20-Full_Test_Case.t │ ├── 30-Nagios_Perf_Data.t │ ├── 97-Pod.t │ ├── 98-Pod-Coverage.t │ ├── 99-Perl-Critic.t │ ├── TestWebServer.pm │ ├── data │ ├── 01-response_codes.xml │ ├── 02-string_verification.xml │ ├── 03-parse_response.xml │ ├── 03-parse_response2.xml │ ├── 03-parse_response3.xml │ ├── 04-repeated_tests.xml │ ├── 05-report_types.xml │ ├── 06-thresholds.xml │ ├── 08-custom_var.xml │ ├── 09-fileupload.xml │ ├── 20-full_test.xml │ ├── 30-nagios_perf_data.xml │ ├── external.pm │ ├── fileup1.txt │ └── fileup2.png │ └── perlcriticrc └── WebinjectGui ├── .gitignore ├── Changes ├── MANIFEST ├── MANIFEST.SKIP ├── Makefile.PL ├── bin └── webinjectgui.pl ├── icon.gif ├── icon.ico ├── lib └── Webinject │ └── Gui.pm ├── logo.gif └── t ├── 01-Webinject-Gui.t ├── 97-Pod.t ├── 98-Pod-Coverage.t ├── 99-Perl-Critic.t └── perlcriticrc /README: -------------------------------------------------------------------------------- 1 | What is WebInject? 2 | 3 | WebInject is a free tool for automated testing of web applications and 4 | web services. It can be used to test individual system components that 5 | have HTTP interfaces (JSP, ASP, CGI, PHP, AJAX, Servlets, HTML Forms, 6 | XML/SOAP Web Services, REST, etc), and can be used as a test harness 7 | to create a suite of [HTTP level] automated functional, acceptance, 8 | and regression tests. A test harness allows you to run many test cases 9 | and collect/report your results. WebInject offers real-time results 10 | display and may also be used for monitoring system response times. 11 | 12 | WebInject can be used as a complete test framework that is controlled 13 | by the WebInject User Interface (GUI). Optionally, it can be used as a 14 | standalone test runner (text/console application) which can be 15 | integrated and called from other test frameworks or applications. 16 | 17 | Installation 18 | 19 | We need to install a few prerequisite Perl modules for the test runner: 20 | 21 | Module::Install 22 | Module::Install::ReadmeFromPod 23 | LWP::Protocol::https 24 | XML::Simple 25 | XML::Parser 26 | 27 | These can either be installed via CPAN or from your favourite package 28 | manager. For example, on Fedora Linux: 29 | 30 | dnf install perl-Module-Install perl-Module-Install-ReadmeFromPod \ 31 | perl-libwww-perl perl-LWP-Protocol-https perl-XML-Simple \ 32 | perl-XML-Parser 33 | 34 | For Debian based systems: 35 | 36 | apt install libmodule-install-perl libmodule-install-readmefrompod-perl \ 37 | libwww-perl liblwp-protocol-https-perl libxml-simple-perl \ 38 | libxml-parser-perl 39 | 40 | With those in place, the test runner can be installed: 41 | 42 | cd Webinject 43 | perl Makefile.PL 44 | make 45 | sudo make install 46 | -------------------------------------------------------------------------------- /Webinject/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | inc 3 | META.yml 4 | blib 5 | pm_to_blib 6 | MANIFEST 7 | Makefile.old 8 | http.log 9 | results.html 10 | results.xml 11 | testcases.xml.*.tmp 12 | check_webinject 13 | webinject.pl 14 | MANIFEST.bak 15 | MYMETA.json 16 | MYMETA.yml 17 | README 18 | -------------------------------------------------------------------------------- /Webinject/Changes: -------------------------------------------------------------------------------- 1 | WebInject 2 | 3 | Copyright 2010 Sven Nierlein (nierlein@cpan.org) 4 | Copyright 2004-2006 Corey Goldberg (corey@goldb.org) 5 | For information and documentation, visit the website at http://www.webinject.org 6 | 7 | --------------------------------- 8 | Release History: 9 | 10 | Version 1.96 - Thu 10 Oct 2019 09:16:08 AM CEST 11 | - migrate to Net::SSLeay and IO::Socket::SSL 12 | 13 | Version 1.94 - Tue Jul 25 11:26:20 CEST 2017 14 | - Use relative path handling for postbody files (#27) 15 | - Add support for DELETE (#23) 16 | 17 | Version 1.92 - Thu Dec 22 21:26:50 CET 2016 18 | - Support application/json Content-Type (#22) 19 | - Fix for uninitialized value $val (#21) 20 | 21 | Version 1.90 - Mon Feb 1 17:04:24 CET 2016 22 | - add new addcookie test case attribute 23 | - add readme file 24 | 25 | Version 1.88 - Wed Aug 19 23:13:41 CEST 2015 26 | - fix problem with tempfile in perl 5.20 27 | 28 | Version 1.86 - Mon Nov 18 16:57:42 CET 2013 29 | - add support for ssl proxy and proxy auth 30 | 31 | Version 1.84 - Fri Nov 1 11:01:23 CET 2013 32 | - add realserver support (Klapwijk) 33 | 34 | Version 1.82 - Fri Nov 1 11:04:23 CET 2013 35 | - remove temporary files also in nagios ePN mode 36 | 37 | Version 1.80 - Fri Sep 13 11:10:40 CEST 2013 38 | - remove temporary cookie file after test 39 | 40 | Version 1.78 - Thu Jan 3 22:49:56 CET 2013 41 | - replace parsedresult in xml input file 42 | - added fallback timeout for test cases 43 | 44 | Version 1.76 - Tue Nov 13 12:46:14 CET 2012 45 | - added new case option parsewarning 46 | 47 | Version 1.74 - Sat May 12 13:36:48 CEST 2012 48 | - changed html output into tables (Karsten Sievert) 49 | - support gzipped content (Simone Tiraboschi) 50 | 51 | Version 1.72 - Thu Feb 2 19:15:50 CET 2012 52 | - fixed using parsed results 53 | 54 | Version 1.71 - Tue Jan 3 09:38:27 CET 2012 55 | - fixed nagios epn support or check_webinject 56 | 57 | Version 1.70 - Sat Dec 10 12:40:03 CET 2011 58 | - variables with -s varname= are now case-insensitive 59 | 60 | Version 1.69 - Tue Jul 12 10:25:17 CEST 2011 61 | - better error message when LWP::protocol::https is missing 62 | - read break_on_errors setting from config file too 63 | - added reportmode 'nagios2' 64 | - fixed display of passed testcases 65 | - cleaner output for nagios report type 66 | 67 | Version 1.68 - Tue May 31 14:25:35 CEST 2011 68 | - add warning if parsed result does not match 69 | - made overwriting default options in check_webinject possible 70 | - fixed performance data for nagios report type 71 | 72 | Version 1.67 - Thu Apr 28 16:52:29 CEST 2011 73 | - make parsed respones available in the errormessage 74 | 75 | Version 1.66 - Tue Mar 8 19:18:04 CET 2011 76 | - fixed setting httpauth with -s 77 | 78 | Version 1.64 - Sun Feb 27 18:37:16 CET 2011 79 | - fixed file upload 80 | - fixed some warnings 81 | 82 | Version 1.62 - Sat Feb 19 16:24:56 CET 2011 83 | - fixed cpan package 84 | 85 | Version 1.60 - Sat Feb 12 15:10:09 CET 2011 86 | - fixed ssl proxy support 87 | - added tests for proxy support 88 | 89 | Version 1.58 - Tue Jan 25 20:15:35 CET 2011 90 | - really fixed problem with regular expression using whitespace (thanks Benoit Baron) 91 | 92 | Version 1.57 - Sat Jan 22 00:34:56 CET 2011 93 | - fixed problem with regular expression using whitespace (thanks Olivier Legras) 94 | 95 | Version 1.56 - Thu Jan 20 18:31:06 CET 2011 96 | - added support for verifypositive|negative1-9999 97 | - added lable to test case output when supplied 98 | - fixed error message when trying to start with invalid test files 99 | - webinject now exits with rc = 1 in case of failed tests ( not in reportmode nagios ) 100 | 101 | Version 1.55 - Sun Dec 19 11:39:30 CET 2010 102 | - fixed problem with xml post checks (thanks Frédéric Gicquel) 103 | - fixed problem with escaping form types 104 | 105 | Version 1.54 - Tue Sep 14 11:55:48 CEST 2010 106 | - fixed problem with "Return code of 13 for check of service ... on host ... was out of bounds" 107 | - fixed problem with error output 108 | - fixed problem with specifying testcases in the config.xml 109 | 110 | Version 1.53 - Aug 24, 2010 111 | - fixed package again 112 | 113 | Version 1.52 - Aug 23, 2010 114 | - fixed package (Makefile.PL) was missing 115 | - added make target for webinject.pl 116 | 117 | Version 1.51 - Jul 30, 2010 118 | - added EPN support for check_webinject 119 | - remove the long nagios output for non failed checks 120 | - fixed http authentication 121 | - fixed http.log with custom report types 122 | 123 | Version 1.50 - Jul 29, 2010 124 | - changed layout to common cpan module style 125 | - seperated module into gui and core 126 | - added timeout option 127 | - added report-type option 128 | - added break_on_errors option 129 | - added warning / critical threshold option 130 | - added max_redirect option 131 | - added generic option to set config.xml options 132 | - added label setting for nagios perf data 133 | - fixed nagios performance data 134 | 135 | Version 1.41 - Jan 4, 2006 136 | - Added ability to add multiple HTTP Headers within an 'addheader' testcase parameter 137 | - Added 'addheader' testcase parameter to GET requests (previously only supported POST) 138 | - Fixed GUI layout for high dpi displays 139 | - Bugfixes for 'verifyresponsecode' and 'errormessage' parameters 140 | 141 | 142 | Version 1.40 - Dec 6, 2005 143 | - Support for Web Services (SOAP/XML) 144 | - Added XML parser for parsing and verification of XML responses (web services) 145 | - Support for 'text/xml' and 'application/soap+xml' Content-Type (web services) 146 | - Added new 'addheader' testcase parameter so you can specify an additional HTTP Header field for requests 147 | - Support for setting variables/constants within test case files 148 | - Added ability to call generic external Perl plugins for easier integration and post-processing 149 | - More detail added to XML output 150 | - Code refactoring 151 | 152 | 153 | Version 1.35 - April 4, 2005 154 | - New command line option (-o) to specify location for writing output files (http.log, results.html, and results.xml) 155 | - Nagios plugin performance data support 156 | - Allows multiple 'httpauth' elements in config files to support multiple sets of HTTP Authentication credentials 157 | - New 'verifyresponsecode' test case parameter for HTTP Response Code verification 158 | - Additional 'baseurl' elements supported in the config file 159 | - Additional verification parameters supported in test cases 160 | - Added -V command line option (same as -v) to print version info (necessary for it to run with Moodss) 161 | - Code refactoring 162 | 163 | Version 1.34 - Feb 10, 2005 164 | - MRTG External Monitoring Script (Plugin) compatibility 165 | - Bugfix for using comment tags in config files 166 | - Suppress logging when running in plugin mode 167 | - Changed default standalone plot mode to OFF 168 | 169 | Version 1.33 - Jan 26, 2005 170 | - Nagios Plugin compatibility 171 | - Support for multipart/form-data encoded POSTs (file uploads) 172 | - Updated results.html output so it is valid XHTML 173 | 174 | Version 1.32 - Jan 14, 2005 175 | - Bugfix for erroneous dummy test case printing in GUI status 176 | - Bugfix for warning that appeared when running GUI with Perl in -w mode 177 | 178 | Version 1.31 - Jan 11, 2005 179 | - Bugfix for errors and broken status bar in GUI 180 | 181 | Version 1.30 - Jan 07, 2005 182 | - HTTP Basic Authentication support 183 | - No longer forced to have test cases in strict incremental numbered order 184 | - Source code compiles with the "use strict" pragma 185 | - Ability to run engine from a different directory using alternate test case and config files 186 | - Comments allowed in config file using tags 187 | - Other config.xml options are still used when you pass a test case filename as a command line argument 188 | - New config option to change response delay timeout 189 | - New test case parameter to add a custom error message 190 | - Added separators to http.log for readability 191 | - Enhanced command line options/switches 192 | - Nagios Plugin compatibility (beta) 193 | - More verbose error handling when running from command line 194 | - Ability to handle reserved XML character "<" within test cases by escaping it with a backslash "<" 195 | - Changed output when using XPath notation from command line 196 | - Bugfix for proxy support 197 | - Bugfix for sending a parsed value in a POST body 198 | - Bugfix for erroneous errors when running from command line 199 | - Bugfix for warnings that appeared when running with Perl in -w mode 200 | - Code refactoring 201 | 202 | Version 1.20 - Sept 27, 2004 203 | - Real-time response time monitoring (stats display and integration with gnuplot for plot/graph) 204 | - Added tabbed layout to GUI with 'Status' and 'Monitor' windows 205 | - Added 'Stop' button to GUI to halt execution 206 | - New testcase parameter 'sleep', to throttle execution 207 | - Added timer summary to HTML report 208 | - Removed HTML tags from STDOUT display and cleaned up formatting 209 | - GUI enhancements 210 | - Code refactoring 211 | 212 | Version 1.12 - July 28, 2004 213 | - New test case file parameter 'repeat', to run a test case file multiple times 214 | - Added GUI options for Minimal Output and Response Timer Output 215 | - New config.xml parameter to define a custom User-Agent string to be sent in HTTP headers 216 | - Added XPath Node selection to optional command line parameters 217 | - Bugfix for GUI Restart button 218 | 219 | Version 1.10 - June 23, 2004 220 | - Added XML formatted output (results.xml is created each run) 221 | - New config.xml parameter for HTTP logging 222 | - More detailed pass/fail status to HTML report 223 | - Redefined criteria for test case pass/pail 224 | - Results summary and additional formatting to STDOUT (for standalone mode) 225 | - Minor code refactoring 226 | 227 | Version 0.95 - May 17, 2004 228 | - Added Restart button to GUI 229 | - Added 5 additional parsing parameters/variables to use in test cases 230 | - Fixes to GUI positioning 231 | 232 | Version 0.94 - April 29, 2004 233 | - Bugfix for malformed HTTP Post 234 | - Added colors to status window text 235 | 236 | Version 0.93 - March 22, 2004 237 | - Dynamic response parsing support cookieless session handling 238 | - Added version number to GUI window title bar 239 | 240 | Version 0.92 - March 05, 2004 241 | - Minor bug fixes 242 | - Added status light to GUI 243 | - New config.xml parameter for HTTP proxy support 244 | - New config.xml parameter for Baseurl constant 245 | 246 | Version 0.91 - Feb 23, 2004 247 | - Decoupled GUI (webinjectgui) from Test Engine (webinject) so engine can run standalone 248 | - Testcase name can be passed on command line as well as via config.xml 249 | - Code cleanup 250 | - Output sent to STDOUT as well as reports (for standalone mode) 251 | 252 | Version 0.90 - Feb 19, 2004 253 | - Initial public beta release 254 | - Contains SSL/TLS support 255 | - Perl/Tk GUI 256 | - Automatic cookie handling 257 | 258 | --------------------------------- 259 | -------------------------------------------------------------------------------- /Webinject/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /Webinject/MANIFEST.SKIP: -------------------------------------------------------------------------------- 1 | ^blib 2 | .gitignore 3 | MANIFEST.bak 4 | check_webinject 5 | ^webinject.pl 6 | http.log 7 | results.html 8 | results.xml 9 | Makefile$ 10 | Makefile.old$ 11 | pm_to_blib 12 | MYMETA.json 13 | MYMETA.yml 14 | -------------------------------------------------------------------------------- /Webinject/Makefile.PL: -------------------------------------------------------------------------------- 1 | use inc::Module::Install; 2 | 3 | name 'Webinject'; 4 | all_from 'lib/Webinject.pm'; 5 | license 'gpl_2'; 6 | 7 | resources( 8 | 'homepage', => 'http://www.webinject.org', 9 | 'bugtracker' => 'http://github.com/sni/Webinject/issues', 10 | 'repository', => 'http://github.com/sni/Webinject', 11 | ); 12 | 13 | requires 'LWP' => 0; 14 | requires 'XML::Simple' => 0; 15 | requires 'HTTP::Request::Common' => 0; 16 | requires 'HTTP::Cookies' => 0; 17 | requires 'Time::HiRes' => 0; 18 | requires 'Getopt::Long' => 0; 19 | requires 'Net::SSLeay' => 0; 20 | requires 'IO::Socket::SSL' => 0; 21 | requires 'XML::Parser' => 0; 22 | requires 'Error' => 0; 23 | requires 'File::Temp' => 0; 24 | requires 'URI' => 0; 25 | 26 | install_script 'bin/webinject.pl'; 27 | 28 | if (!-f "README" || -M "lib/Webinject" < -M "README") { 29 | readme_from('lib/Webinject.pm'); 30 | } 31 | 32 | WriteAll; 33 | 34 | open(my $fh, '>>', 'Makefile') or die('cannot write to Makefile'); 35 | print $fh < ./check_webinject 38 | echo '# nagios: +epn' >> ./check_webinject 39 | echo '' >> ./check_webinject 40 | cat ./lib/Webinject.pm ./bin/webinject.pl | grep -v '^use Webinject' | grep -v '__END__' | sed -e 's/my \$\$webinject = Webinject->new\(\);/my \$\$webinject = Webinject->new(reporttype => \\"nagios\\", timeout => 30, break_on_errors => 1);/' >> ./check_webinject 41 | chmod 755 ./check_webinject 42 | 43 | webinject.pl :: 44 | echo '#!/usr/bin/perl' > ./webinject.pl 45 | echo '# nagios: +epn' >> ./webinject.pl 46 | echo '' >> ./webinject.pl 47 | cat ./lib/Webinject.pm ./bin/webinject.pl | grep -v '^use Webinject' | grep -v '__END__' >> ./webinject.pl 48 | chmod 755 ./webinject.pl 49 | EOT 50 | close($fh); 51 | -------------------------------------------------------------------------------- /Webinject/bin/webinject.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | # Copyright 2010 Sven Nierlein (nierlein@cpan.org) 4 | # Copyright 2004-2006 Corey Goldberg (corey@goldb.org) 5 | # 6 | # This file is part of WebInject. 7 | # 8 | # WebInject is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # WebInject is distributed in the hope that it will be useful, 14 | # but without any warranty; without even the implied warranty of 15 | # merchantability or fitness for a particular purpose. See the 16 | # GNU General Public License for more details. 17 | 18 | 19 | use warnings; 20 | use strict; 21 | use Webinject; 22 | 23 | my $webinject = Webinject->new(); 24 | my $rc = $webinject->engine(); 25 | exit $rc; 26 | -------------------------------------------------------------------------------- /Webinject/examples/config.xml: -------------------------------------------------------------------------------- 1 | testcases.xml 2 | onfail 3 | -------------------------------------------------------------------------------- /Webinject/examples/testcases.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 26 | 27 | 37 | 38 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Webinject/t/01-Webinject.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More tests => 4; 7 | use Data::Dumper; 8 | 9 | use_ok('Webinject'); 10 | 11 | my $webinject = Webinject->new(); 12 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 13 | 14 | ################################################## 15 | # test some internal functions 16 | my $teststring = '<äöüß>'; 17 | my $verify = '%3C%C3%A4%C3%B6%C3%BC%C3%9F%3E'; 18 | is($webinject->_url_escape($teststring), $verify, '_url_escape() in scalar context'); 19 | 20 | my @test = $webinject->_url_escape(qw'< ä ö ü ß >'); 21 | my @verify = qw'%3C %C3%A4 %C3%B6 %C3%BC %C3%9F %3E'; 22 | is_deeply(\@test, \@verify, '_url_escape() in list context'); -------------------------------------------------------------------------------- /Webinject/t/02-Test_Cases.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 50; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_01(); 37 | test_case_02(); 38 | test_case_03_1(); 39 | test_case_03_2(); 40 | test_case_03_3(); 41 | test_case_04(); 42 | test_case_05(); 43 | test_case_06(); 44 | test_case_07(); 45 | test_case_08(); 46 | test_case_09(); 47 | 48 | 49 | 50 | ################################################## 51 | # SUBs 52 | ################################################## 53 | 54 | ################################################## 55 | # Test File 01 56 | sub test_case_01 { 57 | @ARGV = ($Bin."/data/01-response_codes.xml"); 58 | my $webinject = Webinject->new(); 59 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 60 | my $rc = $webinject->engine(); 61 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '01-response_codes.xml - passed count'); 62 | is($webinject->{'result'}->{'totalfailedcount'}, 1, '01-response_codes.xml - fail count'); 63 | is($rc, 1, '01-response_codes.xml - return code'); 64 | } 65 | 66 | ################################################## 67 | # Test File 02 68 | sub test_case_02 { 69 | @ARGV = ($Bin."/data/02-string_verification.xml"); 70 | my $webinject = Webinject->new(); 71 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 72 | my $rc = $webinject->engine(); 73 | is($webinject->{'result'}->{'totalpassedcount'}, 9, '02-string_verification.xml - passed count'); 74 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '02-string_verification.xml - fail count'); 75 | is($rc, 0, '02-string_verification - return code'); 76 | } 77 | 78 | ################################################## 79 | # Test File 03 - 1 80 | sub test_case_03_1 { 81 | @ARGV = ($Bin."/data/03-parse_response.xml"); 82 | my $webinject = Webinject->new(); 83 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 84 | my $rc = $webinject->engine(); 85 | is($webinject->{'result'}->{'totalpassedcount'}, 3, '03-parse_response.xml - passed count'); 86 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '03-parse_response.xml - fail count'); 87 | is($rc, 0, '03-parse_response.xml - return code'); 88 | } 89 | 90 | ################################################## 91 | # Test File 03 - 2 92 | sub test_case_03_2 { 93 | @ARGV = ($Bin."/data/03-parse_response2.xml"); 94 | my $webinject = Webinject->new(); 95 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 96 | my $rc = $webinject->engine(); 97 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '03-parse_response2.xml - passed count'); 98 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '03-parse_response2.xml - fail count'); 99 | is($rc, 1, '03-parse_response.xml - return code'); 100 | } 101 | 102 | ################################################## 103 | # Test File 03 - 3 104 | sub test_case_03_3 { 105 | @ARGV = ($Bin."/data/03-parse_response3.xml"); 106 | my $webinject = Webinject->new(); 107 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 108 | my $rc = $webinject->engine(); 109 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '03-parse_response2.xml - passed count'); 110 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '03-parse_response2.xml - fail count'); 111 | is($rc, 0, '03-parse_response.xml - return code'); 112 | } 113 | 114 | ################################################## 115 | # Test File 04 116 | sub test_case_04 { 117 | @ARGV = ($Bin."/data/04-repeated_tests.xml"); 118 | my $webinject = Webinject->new(); 119 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 120 | my $rc = $webinject->engine(); 121 | is($webinject->{'result'}->{'totalpassedcount'}, 5, '04-repeated_tests.xml - passed count'); 122 | is($webinject->{'result'}->{'totalfailedcount'}, 5, '04-repeated_tests.xml - fail count'); 123 | is($rc, 1, '04-repeated_tests.xml - return code'); 124 | } 125 | 126 | ################################################## 127 | # Reporttypes 128 | sub test_case_05 { 129 | for my $type (qw/standard nagios mrtg external:t\/data\/external.pm/) { 130 | @ARGV = ( 131 | "-r", $type, 132 | $Bin."/data/05-report_types.xml" 133 | ); 134 | my $webinject = Webinject->new(); 135 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 136 | my $rc = $webinject->engine(); 137 | is($webinject->{'result'}->{'totalpassedcount'}, 1, 'reporttype: '.$type.' 05-report_types.xml - passed count'); 138 | is($webinject->{'result'}->{'totalfailedcount'}, 1, 'reporttype: '.$type.' 05-report_types.xml - fail count'); 139 | is($rc, 1, '05-report_types.xml - return code') if $type ne 'nagios'; 140 | is($rc, 2, '05-report_types.xml - return code') if $type eq 'nagios'; 141 | } 142 | } 143 | 144 | ################################################## 145 | # Test File 06 146 | sub test_case_06 { 147 | @ARGV = ('-r', 'nagios', $Bin."/data/06-thresholds.xml", "testcases/case[1]"); 148 | my $webinject = Webinject->new(); 149 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 150 | my $rc = $webinject->engine(); 151 | is($webinject->{'result'}->{'totalpassedcount'}, 3, '06-thresholds.xml [1] - passed count'); 152 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '06-thresholds.xml [1] - fail count'); 153 | is($rc, 0, '06-thresholds.xml [1] - return code'); 154 | 155 | @ARGV = ('-r', 'nagios', $Bin."/data/06-thresholds.xml", "testcases/case[2]"); 156 | $webinject = Webinject->new(); 157 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 158 | $rc = $webinject->engine(); 159 | is($webinject->{'result'}->{'totalpassedcount'}, 2, '06-thresholds.xml [2] - passed count'); 160 | is($webinject->{'result'}->{'totalfailedcount'}, 1, '06-thresholds.xml [2] - fail count'); 161 | is($rc, 1, '06-thresholds.xml [2] - return code'); 162 | 163 | @ARGV = ('-r', 'nagios', $Bin."/data/06-thresholds.xml", "testcases/case[3]"); 164 | $webinject = Webinject->new(); 165 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 166 | $rc = $webinject->engine(); 167 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '06-thresholds.xml [3] - passed count'); 168 | is($webinject->{'result'}->{'totalfailedcount'}, 2, '06-thresholds.xml [3] - fail count'); 169 | is($rc, 2, '06-thresholds.xml [3] - return code'); 170 | } 171 | 172 | ################################################## 173 | # Test Case 7 / File 01 174 | sub test_case_07 { 175 | @ARGV = ("-s", "baseurl=http://localhost:58080", $Bin."/data/01-response_codes.xml"); 176 | my $webinject = Webinject->new(); 177 | my $rc = $webinject->engine(); 178 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '01-response_codes.xml - passed count'); 179 | is($webinject->{'result'}->{'totalfailedcount'}, 1, '01-response_codes.xml - fail count'); 180 | is($rc, 1, '01-response_codes.xml - return code'); 181 | } 182 | 183 | 184 | ################################################## 185 | # Test Case 8 / File 08 186 | sub test_case_08 { 187 | @ARGV = ("-s", "baseurl=http://localhost:58080", "-s", "code1=200", "-s", "code_500=500", "-s", "method=get", $Bin."/data/08-custom_var.xml"); 188 | my $webinject = Webinject->new(); 189 | my $rc = $webinject->engine(); 190 | is($webinject->{'result'}->{'totalpassedcount'}, 1, '08-custom_var.xml - passed count'); 191 | is($webinject->{'result'}->{'totalfailedcount'}, 1, '08-custom_var.xml - fail count'); 192 | is($rc, 1, '01-response_codes.xml - return code'); 193 | } 194 | 195 | 196 | ################################################## 197 | # Test Case 9 / File 09 198 | sub test_case_09 { 199 | @ARGV = ($Bin."/data/09-fileupload.xml"); 200 | my $webinject = Webinject->new(); 201 | my $rc = $webinject->engine(); 202 | is($webinject->{'result'}->{'totalpassedcount'}, 4, '09-fileupload.xml - passed count'); 203 | is($webinject->{'result'}->{'totalfailedcount'}, 0, '09-fileupload.xml - fail count'); 204 | is($rc, 0, '09-fileupload.xml - return code'); 205 | } 206 | 207 | -------------------------------------------------------------------------------- /Webinject/t/03-Report_Type_Nagios.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 6; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_01(); 37 | test_case_02(); 38 | test_case_03(); 39 | test_case_04(); 40 | 41 | 42 | ################################################## 43 | # SUBs 44 | ################################################## 45 | 46 | ################################################## 47 | # Test File 01 48 | sub test_case_01 { 49 | @ARGV = ('-r', 'nagios', $Bin."/data/01-response_codes.xml"); 50 | my $webinject = Webinject->new(); 51 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 52 | my $rc = $webinject->engine(); 53 | is($rc, 2, '01-response_codes.xml - return code'); 54 | } 55 | 56 | ################################################## 57 | # Test File 02 58 | sub test_case_02 { 59 | @ARGV = ('-r', 'nagios', $Bin."/data/02-string_verification.xml"); 60 | my $webinject = Webinject->new(); 61 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 62 | my $rc = $webinject->engine(); 63 | is($rc, 0, '02-string_verification - return code'); 64 | } 65 | 66 | ################################################## 67 | # Test File 03 68 | sub test_case_03 { 69 | @ARGV = ('-r', 'nagios', $Bin."/data/03-parse_response.xml"); 70 | my $webinject = Webinject->new(); 71 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 72 | my $rc = $webinject->engine(); 73 | is($rc, 0, '03-parse_response.xml - return code'); 74 | } 75 | 76 | ################################################## 77 | # Test File 04 78 | sub test_case_04 { 79 | @ARGV = ('-r', 'nagios', $Bin."/data/04-repeated_tests.xml"); 80 | my $webinject = Webinject->new(); 81 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 82 | my $rc = $webinject->engine(); 83 | is($rc, 2, '04-repeated_tests.xml - return code'); 84 | } 85 | -------------------------------------------------------------------------------- /Webinject/t/04-Timeouts.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 14; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_01(); 37 | test_case_02(); 38 | test_case_03(); 39 | 40 | 41 | 42 | ################################################## 43 | # SUBs 44 | ################################################## 45 | 46 | ################################################## 47 | # Test 01 48 | sub test_case_01 { 49 | my $webinject = Webinject->new(); 50 | my $case = { 51 | 'url' => 'http://localhost:58080/sleep/2', 52 | }; 53 | my $expected = { 54 | 'id' => 1, 55 | 'passedcount' => 1, 56 | 'failedcount' => 0, 57 | 'url' => 'http://localhost:58080/sleep/2', 58 | 'iswarning' => 0, 59 | 'iscritical' => 0, 60 | }; 61 | my $result = $webinject->_run_test_case($case); 62 | is($result->{'latency'} > 2, 1, '01 - timeouts - latency'); 63 | delete $result->{'messages'}; 64 | delete $result->{'latency'}; 65 | delete $result->{'response'}; 66 | delete $result->{'request'}; 67 | is_deeply($result, $expected, '01 - timeouts - result') or BAIL_OUT("expected: \n".Dumper($expected)."\nresult: \n".Dumper($result)); 68 | is($webinject->{'result'}->{'iscritical'}, 0, '01 - timeouts - iscritical'); 69 | is($webinject->{'result'}->{'iswarning'}, 0, '01 - timeouts - iswarning'); 70 | } 71 | 72 | ################################################## 73 | # Test 02 74 | sub test_case_02 { 75 | my $webinject = Webinject->new(); 76 | my $case = { 77 | 'url' => 'http://localhost:58080/sleep/2', 78 | 'warning' => 1, 79 | }; 80 | my $expected = { 81 | 'id' => 1, 82 | 'passedcount' => 1, 83 | 'failedcount' => 1, 84 | 'url' => 'http://localhost:58080/sleep/2', 85 | 'warning' => 1, 86 | 'iswarning' => 1, 87 | 'iscritical' => 0, 88 | }; 89 | my $result = $webinject->_run_test_case($case); 90 | is($result->{'latency'} > 2, 1, '02 - timeouts - latency'); 91 | delete $result->{'messages'}; 92 | delete $result->{'latency'}; 93 | delete $result->{'response'}; 94 | delete $result->{'request'}; 95 | is_deeply($result, $expected, '02 - timeouts - result') or BAIL_OUT("expected: \n".Dumper($expected)."\nresult: \n".Dumper($result)); 96 | is($webinject->{'result'}->{'iscritical'}, 0, '02 - timeouts - iscritical'); 97 | is($webinject->{'result'}->{'iswarning'}, 1, '02 - timeouts - iswarning'); 98 | } 99 | 100 | 101 | ################################################## 102 | # Test 03 103 | sub test_case_03 { 104 | my $webinject = Webinject->new('timeout' => 1); 105 | my $case = { 106 | 'url' => 'http://localhost:58080/sleep/5', 107 | }; 108 | my $expected = { 109 | 'id' => 1, 110 | 'passedcount' => 0, 111 | 'failedcount' => 1, 112 | 'url' => 'http://localhost:58080/sleep/5', 113 | 'iswarning' => 0, 114 | 'iscritical' => 1, 115 | }; 116 | my $result = $webinject->_run_test_case($case); 117 | is($result->{'latency'} > 1, 1, '03 - timeouts - latency'); 118 | delete $result->{'messages'}; 119 | delete $result->{'latency'}; 120 | delete $result->{'response'}; 121 | delete $result->{'request'}; 122 | is_deeply($result, $expected, 'timeouts - result') or diag("expected: \n".Dumper($expected)."\nresult: \n".Dumper($result)); 123 | is($webinject->{'result'}->{'iscritical'}, 1, '03 - timeouts - iscritical'); 124 | is($webinject->{'result'}->{'iswarning'}, 0, '03 - timeouts - iswarning'); 125 | } 126 | -------------------------------------------------------------------------------- /Webinject/t/05-Basic_Auth.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 6; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_01(); 37 | 38 | 39 | 40 | ################################################## 41 | # SUBs 42 | ################################################## 43 | 44 | ################################################## 45 | # Test 01 46 | sub test_case_01 { 47 | my $webinject = Webinject->new("httpauth" => 'localhost:58080:my_realm:user:pass'); 48 | my $case = { 49 | 'logresponse' => 'yes', 50 | 'logrequest' => 'yes', 51 | 'verifyresponsecode' => 200, 52 | 'url' => 'http://localhost:58080/auth', 53 | }; 54 | my $expected = { 55 | 'id' => 1, 56 | 'passedcount' => 1, 57 | 'failedcount' => 0, 58 | 'url' => $case->{'url'}, 59 | 'logresponse' => 'yes', 60 | 'logrequest' => 'yes', 61 | 'verifyresponsecode' => 200, 62 | 'iswarning' => 0, 63 | 'iscritical' => 0, 64 | }; 65 | my $result = $webinject->_run_test_case($case); 66 | is($result->{'latency'} < 1, 1, '01 - auth - latency'); 67 | delete $result->{'messages'}; 68 | delete $result->{'latency'}; 69 | delete $result->{'response'}; 70 | delete $result->{'request'}; 71 | is_deeply($result, $expected, '01 - auth - result') or BAIL_OUT("expected: \n".Dumper($expected)."\nresult: \n".Dumper($result)); 72 | is($webinject->{'result'}->{'iscritical'}, 0, '01 - auth - iscritical'); 73 | is($webinject->{'result'}->{'iswarning'}, 0, '01 - auth - iswarning'); 74 | } 75 | -------------------------------------------------------------------------------- /Webinject/t/06-Proxy.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if(!$ENV{TEST_AUTHOR}) { 13 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 14 | } 15 | elsif(!$ENV{'TEST_PROXY'}) { 16 | plan skip_all => 'Author test. Set $ENV{TEST_PROXY} to run this test.'; 17 | } 18 | else{ 19 | plan tests => 8; 20 | } 21 | 22 | 23 | use_ok('Webinject'); 24 | 25 | my $webinject = Webinject->new(); 26 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 27 | 28 | # clean env 29 | for my $key (qw/http_proxy https_proxy HTTP_PROXY HTTPS_PROXY/) { 30 | delete($ENV{$key}); 31 | } 32 | 33 | ################################################## 34 | # start our test cases 35 | $webinject = Webinject->new("proxy" => $ENV{'TEST_PROXY'}); 36 | test_case($webinject, 'http://www.google.de'); 37 | test_case($webinject, 'https://encrypted.google.com/'); 38 | 39 | ################################################## 40 | # SUBs 41 | ################################################## 42 | 43 | ################################################## 44 | # Test Case 45 | sub test_case { 46 | my $webinject = shift; 47 | my $url = shift; 48 | my $case = { 49 | 'logresponse' => 'yes', 50 | 'logrequest' => 'yes', 51 | 'verifyresponsecode' => 200, 52 | 'verifypositive' => 'Google', 53 | 'url' => $url, 54 | 'warning' => 30, 55 | 'critical' => 30, 56 | }; 57 | my $expected = { 58 | 'id' => 1, 59 | 'passedcount' => 4, 60 | 'failedcount' => 0, 61 | 'url' => $case->{'url'}, 62 | 'logresponse' => 'yes', 63 | 'logrequest' => 'yes', 64 | 'verifyresponsecode' => 200, 65 | 'verifypositive' => $case->{'verifypositive'}, 66 | 'iscritical' => 0, 67 | 'iswarning' => 0, 68 | 'warning' => 30, 69 | 'critical' => 30, 70 | }; 71 | my $result = $webinject->_run_test_case($case); 72 | 73 | delete $result->{'messages'}; 74 | delete $result->{'latency'}; 75 | delete $result->{'response'}; 76 | delete $result->{'request'}; 77 | is_deeply($result, $expected, '01 - proxy '.$url.' - result') or BAIL_OUT("expected: \n".Dumper($expected)."\nresult: \n".Dumper($result)); 78 | is($webinject->{'result'}->{'iscritical'}, 0, '06 - proxy '.$url.' - iscritical'); 79 | is($webinject->{'result'}->{'iswarning'}, 0, '06 - proxy '.$url.' - iswarning'); 80 | } 81 | -------------------------------------------------------------------------------- /Webinject/t/20-Full_Test_Case.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 5; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_config(); 37 | 38 | 39 | ################################################## 40 | # SUBs 41 | ################################################## 42 | 43 | sub test_case_config { 44 | @ARGV = ($Bin."/data/20-full_test.xml"); 45 | my $expected = { 46 | 'addheader' => 'Blah: Blurbs', 47 | 'description1' => 'description', 48 | 'description2' => 'description2', 49 | 'errormessage' => 'in case of errors display this', 50 | 'id' => '1', 51 | 'logrequest' => 'yes', 52 | 'logresponse' => 'yes', 53 | 'method' => 'post', 54 | 'parseresponse' => 'Authorization:|\\n', 55 | 'parseresponse1' => 'HTTP|\\n', 56 | 'parseresponse2' => 'HTTP|\\n', 57 | 'parseresponse3' => 'HTTP|\\n', 58 | 'parseresponse4' => 'HTTP|\\n', 59 | 'parseresponse5' => 'HTTP|\\n', 60 | 'postbody' => 'a=1;b=2;c=3;c=4;test=postbodytestmessage;test2=teststring1', 61 | 'posttype' => 'application/x-www-form-urlencoded', 62 | 'sleep' => '1', 63 | 'url' => 'http://localhost:58080/post', 64 | 'verifynegative' => 'this should be not visible', 65 | 'verifynegative1' => 'this should be not visible', 66 | 'verifynegative2' => 'this should be not visible', 67 | 'verifynegative3' => 'this should be not visible', 68 | 'verifynegativenext' => 'this test is also not available', 69 | 'verifypositivenext' => 'bad path:', 70 | 'verifypositive' => 'postbodytestmessage', 71 | 'verifypositive2' => 'teststring1', 72 | 'verifypositive3' => 'Client\-Response\-Num:\ 1', 73 | 'verifyresponsecode' => 200, 74 | 'passedcount' => 8, 75 | 'failedcount' => 0, 76 | 'iswarning' => 1, 77 | 'iscritical' => 0, 78 | }; 79 | my $webinject = Webinject->new(); 80 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 81 | my $rc = $webinject->engine(); 82 | is($rc, 1, '07-config_options.xml - return code') or diag(Dumper($webinject)); 83 | my $firstcase = $webinject->{'result'}->{'files'}->[0]->{'cases'}->[0]; 84 | delete $firstcase->{'messages'}; 85 | delete $firstcase->{'latency'}; 86 | delete $firstcase->{'response'}; 87 | delete $firstcase->{'request'}; 88 | is_deeply($firstcase, $expected, '20-full_test.xml - first expected case'); 89 | 90 | my $expected2 = { 91 | 'description1' => 'description', 92 | 'failedcount' => 0, 93 | 'id' => '2', 94 | 'method' => 'get', 95 | 'passedcount' => 3, 96 | 'url' => 'http://localhost:58080/badpath', 97 | 'verifyresponsecode' => 400, 98 | 'iswarning' => 0, 99 | 'iscritical' => 0, 100 | }; 101 | my $secondcase = $webinject->{'result'}->{'files'}->[0]->{'cases'}->[1]; 102 | delete $secondcase->{'messages'}; 103 | delete $secondcase->{'latency'}; 104 | delete $secondcase->{'response'}; 105 | delete $secondcase->{'request'}; 106 | is_deeply($secondcase, $expected2, '20-full_test.xml - second expected case'); 107 | } 108 | -------------------------------------------------------------------------------- /Webinject/t/30-Nagios_Perf_Data.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More; 7 | use Data::Dumper; 8 | use FindBin qw($Bin); 9 | use lib 't'; 10 | 11 | 12 | if($ENV{TEST_AUTHOR}) { 13 | eval "use HTTP::Server::Simple::CGI"; 14 | if($@) { 15 | plan skip_all => 'HTTP::Server::Simple::CGI required'; 16 | } 17 | else{ 18 | plan tests => 6; 19 | } 20 | } 21 | else{ 22 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 23 | } 24 | 25 | 26 | use_ok('Webinject'); 27 | 28 | my $webinject = Webinject->new(); 29 | isa_ok($webinject, "Webinject", 'Object is a Webinject'); 30 | 31 | require TestWebServer; 32 | TestWebServer->start_webserver(); 33 | 34 | ################################################## 35 | # start our test cases 36 | test_case_01(); 37 | test_case_02(); 38 | 39 | 40 | ################################################## 41 | # SUBs 42 | ################################################## 43 | 44 | ################################################## 45 | # Test File 01 46 | sub test_case_01 { 47 | @ARGV = ('-r', 'nagios', $Bin."/data/30-nagios_perf_data.xml"); 48 | my $webinject = Webinject->new(); 49 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 50 | my $rc = $webinject->engine(); 51 | is($rc, 2, '30-nagios_perf_data.xml - return code'); 52 | like($webinject->{'result'}->{'perfdata'}, '/time=([\d\.]+)s;0;0;0;0 case1=([\d\.]+)s;0;0;0;0 case2=([\d\.]+)s;0;0;0;0 testlabel=([\d\.]+)s;0;0;0;0 case4=([\d\.]+)s;0;0;0;0/', 'performance data'); 53 | } 54 | 55 | ################################################## 56 | # Test File 02 57 | sub test_case_02 { 58 | @ARGV = ('-r', 'nagios', '-s', 'break_on_errors=1', $Bin."/data/30-nagios_perf_data.xml"); 59 | my $webinject = Webinject->new(); 60 | $webinject->{'config'}->{'baseurl'} = 'http://localhost:58080'; 61 | my $rc = $webinject->engine(); 62 | is($rc, 2, '30-nagios_perf_data.xml - return code'); 63 | like($webinject->{'result'}->{'perfdata'}, '/time=([\d\.]+)s;0;0;0;0 case1=([\d\.]+)s;0;0;0;0 case2=0s;0;0;0;0 case3=0s;0;0;0;0 case4=0s;0;0;0;0/', 'performance data'); 64 | } 65 | -------------------------------------------------------------------------------- /Webinject/t/97-Pod.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | eval "use Test::Pod 1.14"; 6 | plan skip_all => 'Test::Pod 1.14 required' if $@; 7 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.' unless $ENV{TEST_AUTHOR}; 8 | 9 | all_pod_files_ok(); 10 | -------------------------------------------------------------------------------- /Webinject/t/98-Pod-Coverage.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # $Id$ 4 | # 5 | use strict; 6 | use warnings; 7 | use File::Spec; 8 | use Test::More; 9 | use English qw(-no_match_vars); 10 | 11 | if ( not $ENV{TEST_AUTHOR} ) { 12 | my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 13 | plan( skip_all => $msg ); 14 | } 15 | 16 | eval { require Test::Pod::Coverage; }; 17 | 18 | if ( $EVAL_ERROR ) { 19 | my $msg = 'Test::Pod::Coverage required to criticise pod'; 20 | plan( skip_all => $msg ); 21 | } 22 | 23 | eval "use Test::Pod::Coverage 1.00"; 24 | all_pod_coverage_ok(); 25 | -------------------------------------------------------------------------------- /Webinject/t/99-Perl-Critic.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # $Id$ 4 | # 5 | use strict; 6 | use warnings; 7 | use File::Spec; 8 | use Test::More; 9 | use English qw(-no_match_vars); 10 | 11 | if ( not $ENV{TEST_AUTHOR} ) { 12 | my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 13 | plan( skip_all => $msg ); 14 | } 15 | 16 | eval { require Test::Perl::Critic; }; 17 | 18 | if ( $EVAL_ERROR ) { 19 | my $msg = 'Test::Perl::Critic required to criticise code'; 20 | plan( skip_all => $msg ); 21 | } 22 | 23 | my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); 24 | Test::Perl::Critic->import( -profile => $rcfile ); 25 | all_critic_ok(); 26 | -------------------------------------------------------------------------------- /Webinject/t/TestWebServer.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | package TestWebServer; 6 | 7 | use strict; 8 | use Test::More; 9 | use Data::Dumper; 10 | use FindBin qw($Bin); 11 | use base qw(HTTP::Server::Simple::CGI); 12 | 13 | my $webserverpid; 14 | 15 | # Fire up test webserver 16 | sub handle_request { 17 | my $self = shift; 18 | my $cgi = shift; 19 | my $path = $cgi->path_info(); 20 | my $method = $cgi->request_method(); 21 | 22 | # GET Requests 23 | if($method eq 'GET' and $path =~ m|/code/(\d+)|) { 24 | print "HTTP/1.0 $1\r\n\r\nrequest for response code $1\r\n"; 25 | } 26 | elsif($method eq 'GET' and $path =~ m|/teststring|) { 27 | print "HTTP/1.0 200 OK\r\n\r\nthis is just a teststring"; 28 | } 29 | elsif($method eq 'GET' and $path =~ m|/sleep/(\d+)|) { 30 | sleep($1); 31 | print "HTTP/1.0 200 OK\r\n\r\nsleeped $1 seconds"; 32 | } 33 | elsif($method eq 'GET' and $path =~ m|/auth|) { 34 | if(defined $ENV{'HTTP_AUTHORIZATION'} and $ENV{'HTTP_AUTHORIZATION'} eq 'Basic dXNlcjpwYXNz') { 35 | print "HTTP/1.0 200 OK\r\n\r\nauth successfull"; 36 | } 37 | elsif(defined $ENV{'HTTP_AUTHORIZATION'}) { 38 | print "HTTP/1.0 403 Forbidden\r\n\r\nyou are not authorized"; 39 | } else { 40 | print "HTTP/1.0 401 Authorization required\r\n"; 41 | print "WWW-Authenticate: Basic realm=\"my_realm\"\r\n"; 42 | print "\r\n"; 43 | print "got auth request with the following cgi object:\n"; 44 | } 45 | print Dumper($cgi); 46 | print Dumper(\%ENV); 47 | } 48 | 49 | # POST Requests 50 | elsif($method eq 'POST' and $path =~ m|/post|) { 51 | print "HTTP/1.0 200 OK\r\n\r\n"; 52 | print "got post request with the following cgi object:\n"; 53 | print Dumper($cgi); 54 | } else { 55 | print "HTTP/1.0 400 Bad Request\r\n\r\n"; 56 | print "bad path: '$path'\r\n"; 57 | } 58 | } 59 | 60 | sub start_webserver { 61 | # start the server on port 508080 62 | $webserverpid = TestWebServer->new(58080)->background(); 63 | $SIG{INT} = sub{ kill 2, $webserverpid if defined $webserverpid; undef $webserverpid; exit 1; }; 64 | } 65 | 66 | ################################################## 67 | # stop our test webserver 68 | END { 69 | kill 2, $webserverpid if defined $webserverpid; 70 | } 71 | 72 | 1; -------------------------------------------------------------------------------- /Webinject/t/data/01-response_codes.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /Webinject/t/data/02-string_verification.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | -------------------------------------------------------------------------------- /Webinject/t/data/03-parse_response.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 20 | 21 | -------------------------------------------------------------------------------- /Webinject/t/data/03-parse_response2.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /Webinject/t/data/03-parse_response3.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | -------------------------------------------------------------------------------- /Webinject/t/data/04-repeated_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /Webinject/t/data/05-report_types.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /Webinject/t/data/06-thresholds.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 20 | 29 | 30 | -------------------------------------------------------------------------------- /Webinject/t/data/08-custom_var.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /Webinject/t/data/09-fileupload.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Webinject/t/data/20-full_test.xml: -------------------------------------------------------------------------------- 1 | 2 | teststring1 3 | 33 | 40 | 41 | -------------------------------------------------------------------------------- /Webinject/t/data/30-nagios_perf_data.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 24 | 31 | 32 | -------------------------------------------------------------------------------- /Webinject/t/data/external.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use Data::Dumper; 4 | print Dumper($external); 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /Webinject/t/data/fileup1.txt: -------------------------------------------------------------------------------- 1 | test upload 2 | -------------------------------------------------------------------------------- /Webinject/t/data/fileup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sni/Webinject/c517639564bab7fc1b4ce2442b71f567e4df56d4/Webinject/t/data/fileup2.png -------------------------------------------------------------------------------- /Webinject/t/perlcriticrc: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # This Perl::Critic configuration file sets the Policy severity levels 3 | # according to Damian Conway's own personal recommendations. Feel free to 4 | # use this as your own, or make modifications. 5 | ############################################################################## 6 | 7 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitAccessOfPrivateData] 8 | severity = 3 9 | 10 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr] 11 | severity = 3 12 | 13 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock] 14 | severity = 1 15 | 16 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect] 17 | severity = 5 18 | 19 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval] 20 | severity = 5 21 | 22 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit] 23 | severity = 2 24 | 25 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan] 26 | severity = 4 27 | 28 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa] 29 | severity = 4 30 | 31 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep] 32 | severity = 3 33 | 34 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap] 35 | severity = 3 36 | 37 | [Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep] 38 | severity = 4 39 | 40 | [Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap] 41 | severity = 4 42 | 43 | [Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction] 44 | severity = 5 45 | 46 | [Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock] 47 | severity = 3 48 | 49 | [Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading] 50 | severity = 3 51 | 52 | [Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA] 53 | severity = 4 54 | 55 | [Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless] 56 | severity = 5 57 | 58 | [Perl::Critic::Policy::CodeLayout::ProhibitHardTabs] 59 | severity = 3 60 | 61 | [Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins] 62 | severity = 1 63 | 64 | [Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists] 65 | severity = 2 66 | 67 | [Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines] 68 | severity = 4 69 | 70 | [Perl::Critic::Policy::CodeLayout::RequireTidyCode] 71 | severity = 1 72 | 73 | [Perl::Critic::Policy::CodeLayout::RequireTrailingCommas] 74 | severity = 3 75 | 76 | [Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops] 77 | severity = 3 78 | 79 | [Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse] 80 | severity = 3 81 | 82 | [Perl::Critic::Policy::ControlStructures::ProhibitDeepNests] 83 | severity = 3 84 | 85 | [Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions] 86 | severity = 5 87 | 88 | [Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls] 89 | severity = 4 90 | 91 | [Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks] 92 | severity = 4 93 | 94 | [Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode] 95 | severity = 4 96 | 97 | [Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks] 98 | severity = 4 99 | 100 | [Perl::Critic::Policy::Documentation::RequirePodAtEnd] 101 | severity = 2 102 | 103 | [Perl::Critic::Policy::Documentation::RequirePodSections] 104 | severity = 2 105 | 106 | [Perl::Critic::Policy::ErrorHandling::RequireCarping] 107 | severity = 4 108 | 109 | [Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators] 110 | severity = 3 111 | 112 | [Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles] 113 | severity = 5 114 | 115 | [Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest] 116 | severity = 4 117 | 118 | [Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect] 119 | severity = 4 120 | 121 | [Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop] 122 | severity = 5 123 | 124 | [Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen] 125 | severity = 4 126 | 127 | [Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint] 128 | severity = 3 129 | 130 | [Perl::Critic::Policy::Miscellanea::ProhibitFormats] 131 | severity = 3 132 | 133 | [Perl::Critic::Policy::Miscellanea::ProhibitTies] 134 | severity = 4 135 | 136 | [-Perl::Critic::Policy::Miscellanea::RequireRcsKeywords] 137 | 138 | [Perl::Critic::Policy::Modules::ProhibitAutomaticExportation] 139 | severity = 4 140 | 141 | [Perl::Critic::Policy::Modules::ProhibitEvilModules] 142 | severity = 5 143 | 144 | [Perl::Critic::Policy::Modules::ProhibitMultiplePackages] 145 | severity = 4 146 | 147 | [Perl::Critic::Policy::Modules::RequireBarewordIncludes] 148 | severity = 5 149 | 150 | [Perl::Critic::Policy::Modules::RequireEndWithOne] 151 | severity = 4 152 | 153 | [Perl::Critic::Policy::Modules::RequireExplicitPackage] 154 | severity = 4 155 | 156 | [Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage] 157 | severity = 5 158 | 159 | [Perl::Critic::Policy::Modules::RequireVersionVar] 160 | severity = 4 161 | 162 | [Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames] 163 | severity = 3 164 | 165 | [Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs] 166 | severity = 1 167 | 168 | [Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseVars] 169 | severity = 1 170 | 171 | [Perl::Critic::Policy::References::ProhibitDoubleSigils] 172 | severity = 4 173 | 174 | [Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest] 175 | severity = 4 176 | 177 | [Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting] 178 | severity = 5 179 | 180 | [Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching] 181 | severity = 5 182 | 183 | [Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils] 184 | severity = 2 185 | 186 | [Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms] 187 | severity = 4 188 | 189 | [Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity] 190 | severity = 3 191 | 192 | [Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef] 193 | severity = 5 194 | 195 | [Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes] 196 | severity = 4 197 | 198 | [Perl::Critic::Policy::Subroutines::ProtectPrivateSubs] 199 | severity = 3 200 | 201 | [Perl::Critic::Policy::Subroutines::RequireFinalReturn] 202 | severity = 5 203 | 204 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict] 205 | severity = 5 206 | 207 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings] 208 | severity = 4 209 | 210 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride] 211 | severity = 4 212 | 213 | [Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels] 214 | severity = 3 215 | 216 | [Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict] 217 | severity = 5 218 | 219 | [Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings] 220 | severity = 4 221 | 222 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma] 223 | severity = 4 224 | 225 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes] 226 | severity = 2 227 | 228 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters] 229 | severity = 2 230 | 231 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals] 232 | severity = 1 233 | 234 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros] 235 | severity = 5 236 | 237 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators] 238 | severity = 2 239 | 240 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators] 241 | severity = 4 242 | 243 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes] 244 | severity = 2 245 | 246 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings] 247 | severity = 3 248 | 249 | [Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars] 250 | severity = 1 251 | 252 | [Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators] 253 | severity = 2 254 | 255 | [Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator] 256 | severity = 4 257 | 258 | [Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator] 259 | severity = 4 260 | 261 | [Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations] 262 | severity = 5 263 | 264 | [Perl::Critic::Policy::Variables::ProhibitLocalVars] 265 | severity = 2 266 | 267 | [Perl::Critic::Policy::Variables::ProhibitMatchVars] 268 | severity = 4 269 | 270 | [Perl::Critic::Policy::Variables::ProhibitPackageVars] 271 | severity = 3 272 | 273 | [Perl::Critic::Policy::Variables::ProhibitPunctuationVars] 274 | severity = 2 275 | 276 | [Perl::Critic::Policy::Variables::ProtectPrivateVars] 277 | severity = 3 278 | 279 | [Perl::Critic::Policy::Variables::RequireInitializationForLocalVars] 280 | severity = 5 281 | 282 | [Perl::Critic::Policy::Variables::RequireLexicalLoopIterators] 283 | severity = 5 284 | 285 | [Perl::Critic::Policy::Variables::RequireNegativeIndices] 286 | severity = 4 -------------------------------------------------------------------------------- /WebinjectGui/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | inc 3 | META.yml 4 | blib 5 | pm_to_blib 6 | Makefile.old 7 | http.log 8 | results.html 9 | results.xml 10 | testcases.xml.*.tmp 11 | plot.log 12 | plot.plt 13 | plot.png 14 | webinjectgui.pl 15 | *.gz 16 | MANIFEST.bak 17 | -------------------------------------------------------------------------------- /WebinjectGui/Changes: -------------------------------------------------------------------------------- 1 | WebInject 2 | 3 | Copyright 2004, 2005, 2006 Corey Goldberg (corey@goldb.org) 4 | For information and documentation, visit the website at http://www.webinject.org 5 | 6 | --------------------------------- 7 | Release History: 8 | 9 | Version 1.56 - Feb 21, 2011 10 | - fixed cpan package 11 | 12 | Version 1.54 - Feb 21, 2011 13 | - fixed cpan package 14 | 15 | Version 1.52 - Feb 19, 2011 16 | - fixed cpan package 17 | 18 | Version 1.50 - Jul 24, 2010 19 | - changed layout to common cpan module style 20 | - seperated module into gui and core 21 | - added make target for webinjectgui.pl 22 | 23 | Version 1.41 - Jan 4, 2006 24 | - Added ability to add multiple HTTP Headers within an 'addheader' testcase parameter 25 | - Added 'addheader' testcase parameter to GET requests (previously only supported POST) 26 | - Fixed GUI layout for high dpi displays 27 | - Bugfixes for 'verifyresponsecode' and 'errormessage' parameters 28 | 29 | 30 | Version 1.40 - Dec 6, 2005 31 | - Support for Web Services (SOAP/XML) 32 | - Added XML parser for parsing and verification of XML responses (web services) 33 | - Support for 'text/xml' and 'application/soap+xml' Content-Type (web services) 34 | - Added new 'addheader' testcase parameter so you can specify an additional HTTP Header field for requests 35 | - Support for setting variables/constants within test case files 36 | - Added ability to call generic external Perl plugins for easier integration and post-processing 37 | - More detail added to XML output 38 | - Code refactoring 39 | 40 | 41 | Version 1.35 - April 4, 2005 42 | - New command line option (-o) to specify location for writing output files (http.log, results.html, and results.xml) 43 | - Nagios plugin performance data support 44 | - Allows multiple 'httpauth' elements in config files to support multiple sets of HTTP Authentication credentials 45 | - New 'verifyresponsecode' test case parameter for HTTP Response Code verification 46 | - Additional 'baseurl' elements supported in the config file 47 | - Additional verification parameters supported in test cases 48 | - Added -V command line option (same as -v) to print version info (necessary for it to run with Moodss) 49 | - Code refactoring 50 | 51 | Version 1.34 - Feb 10, 2005 52 | - MRTG External Monitoring Script (Plugin) compatibility 53 | - Bugfix for using comment tags in config files 54 | - Suppress logging when running in plugin mode 55 | - Changed default standalone plot mode to OFF 56 | 57 | Version 1.33 - Jan 26, 2005 58 | - Nagios Plugin compatibility 59 | - Support for multipart/form-data encoded POSTs (file uploads) 60 | - Updated results.html output so it is valid XHTML 61 | 62 | Version 1.32 - Jan 14, 2005 63 | - Bugfix for erroneous dummy test case printing in GUI status 64 | - Bugfix for warning that appeared when running GUI with Perl in -w mode 65 | 66 | Version 1.31 - Jan 11, 2005 67 | - Bugfix for errors and broken status bar in GUI 68 | 69 | Version 1.30 - Jan 07, 2005 70 | - HTTP Basic Authentication support 71 | - No longer forced to have test cases in strict incremental numbered order 72 | - Source code compiles with the "use strict" pragma 73 | - Ability to run engine from a different directory using alternate test case and config files 74 | - Comments allowed in config file using tags 75 | - Other config.xml options are still used when you pass a test case filename as a command line argument 76 | - New config option to change response delay timeout 77 | - New test case parameter to add a custom error message 78 | - Added separators to http.log for readability 79 | - Enhanced command line options/switches 80 | - Nagios Plugin compatibility (beta) 81 | - More verbose error handling when running from command line 82 | - Ability to handle reserved XML character "<" within test cases by escaping it with a backslash "<" 83 | - Changed output when using XPath notation from command line 84 | - Bugfix for proxy support 85 | - Bugfix for sending a parsed value in a POST body 86 | - Bugfix for erroneous errors when running from command line 87 | - Bugfix for warnings that appeared when running with Perl in -w mode 88 | - Code refactoring 89 | 90 | Version 1.20 - Sept 27, 2004 91 | - Real-time response time monitoring (stats display and integration with gnuplot for plot/graph) 92 | - Added tabbed layout to GUI with 'Status' and 'Monitor' windows 93 | - Added 'Stop' button to GUI to halt execution 94 | - New testcase parameter 'sleep', to throttle execution 95 | - Added timer summary to HTML report 96 | - Removed HTML tags from STDOUT display and cleaned up formatting 97 | - GUI enhancements 98 | - Code refactoring 99 | 100 | Version 1.12 - July 28, 2004 101 | - New test case file parameter 'repeat', to run a test case file multiple times 102 | - Added GUI options for Minimal Output and Response Timer Output 103 | - New config.xml parameter to define a custom User-Agent string to be sent in HTTP headers 104 | - Added XPath Node selection to optional command line parameters 105 | - Bugfix for GUI Restart button 106 | 107 | Version 1.10 - June 23, 2004 108 | - Added XML formatted output (results.xml is created each run) 109 | - New config.xml parameter for HTTP logging 110 | - More detailed pass/fail status to HTML report 111 | - Redefined criteria for test case pass/pail 112 | - Results summary and additional formatting to STDOUT (for standalone mode) 113 | - Minor code refactoring 114 | 115 | Version 0.95 - May 17, 2004 116 | - Added Restart button to GUI 117 | - Added 5 additional parsing parameters/variables to use in test cases 118 | - Fixes to GUI positioning 119 | 120 | Version 0.94 - April 29, 2004 121 | - Bugfix for malformed HTTP Post 122 | - Added colors to status window text 123 | 124 | Version 0.93 - March 22, 2004 125 | - Dynamic response parsing support cookieless session handling 126 | - Added version number to GUI window title bar 127 | 128 | Version 0.92 - March 05, 2004 129 | - Minor bug fixes 130 | - Added status light to GUI 131 | - New config.xml parameter for HTTP proxy support 132 | - New config.xml parameter for Baseurl constant 133 | 134 | Version 0.91 - Feb 23, 2004 135 | - Decoupled GUI (webinjectgui) from Test Engine (webinject) so engine can run standalone 136 | - Testcase name can be passed on command line as well as via config.xml 137 | - Code cleanup 138 | - Output sent to STDOUT as well as reports (for standalone mode) 139 | 140 | Version 0.90 - Feb 19, 2004 141 | - Initial public beta release 142 | - Contains SSL/TLS support 143 | - Perl/Tk GUI 144 | - Automatic cookie handling 145 | 146 | --------------------------------- 147 | -------------------------------------------------------------------------------- /WebinjectGui/MANIFEST: -------------------------------------------------------------------------------- 1 | bin/webinjectgui.pl 2 | Changes 3 | icon.gif 4 | icon.ico 5 | inc/Module/AutoInstall.pm 6 | inc/Module/Install.pm 7 | inc/Module/Install/AutoInstall.pm 8 | inc/Module/Install/Base.pm 9 | inc/Module/Install/Can.pm 10 | inc/Module/Install/Fetch.pm 11 | inc/Module/Install/Include.pm 12 | inc/Module/Install/Makefile.pm 13 | inc/Module/Install/Metadata.pm 14 | inc/Module/Install/Scripts.pm 15 | inc/Module/Install/Win32.pm 16 | inc/Module/Install/WriteAll.pm 17 | lib/Webinject/Gui.pm 18 | logo.gif 19 | Makefile.PL 20 | MANIFEST This list of files 21 | MANIFEST.SKIP 22 | META.yml 23 | t/01-Webinject-Gui.t 24 | t/97-Pod.t 25 | t/98-Pod-Coverage.t 26 | t/99-Perl-Critic.t 27 | t/perlcriticrc 28 | -------------------------------------------------------------------------------- /WebinjectGui/MANIFEST.SKIP: -------------------------------------------------------------------------------- 1 | blib 2 | .gitignore 3 | MANIFEST.bak 4 | http.log 5 | results.html 6 | results.xml 7 | Makefile$ 8 | plot.log 9 | plot.plt 10 | plot.png 11 | .*.gz 12 | -------------------------------------------------------------------------------- /WebinjectGui/Makefile.PL: -------------------------------------------------------------------------------- 1 | use inc::Module::Install; 2 | 3 | name 'Webinject-Gui'; 4 | all_from 'lib/Webinject/Gui.pm'; 5 | license 'gpl2'; 6 | 7 | resources( 8 | 'homepage', => 'http://www.webinject.org', 9 | 'bugtracker' => 'http://github.com/sni/Webinject/issues', 10 | 'repository', => 'http://github.com/sni/Webinject', 11 | ); 12 | 13 | requires 'Webinject' => '1.50'; 14 | requires 'Tk' => 0; 15 | requires 'Tk::Stderr' => 0; 16 | requires 'Tk::ROText' => 0; 17 | requires 'Tk::Compound' => 0; 18 | requires 'Tk::ProgressBar::Mac' => 0; 19 | requires 'Tk::NoteBook' => 0; 20 | requires 'Tk::PNG' => 0; 21 | 22 | install_script 'bin/webinjectgui.pl'; 23 | 24 | auto_install; 25 | WriteAll; 26 | 27 | open(my $fh, '>>', 'Makefile') or die('cannot write to Makefile'); 28 | print $fh < ./webinjectgui.pl 31 | echo '# nagios: +epn' >> ./webinjectgui.pl 32 | echo '' >> ./webinjectgui.pl 33 | cat ../Webinject/lib/Webinject.pm lib/Webinject/Gui.pm ./bin/webinjectgui.pl | grep -v '^use Webinject' | grep -v '__END__' >> ./webinjectgui.pl 34 | chmod 755 ./webinjectgui.pl 35 | EOT 36 | close($fh); 37 | -------------------------------------------------------------------------------- /WebinjectGui/bin/webinjectgui.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | # Copyright 2004-2006 Corey Goldberg (corey@goldb.org) 4 | # 5 | # This file is part of WebInject. 6 | # 7 | # WebInject is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # WebInject is distributed in the hope that it will be useful, 13 | # but without any warranty; without even the implied warranty of 14 | # merchantability or fitness for a particular purpose. See the 15 | # GNU General Public License for more details. 16 | 17 | use warnings; 18 | use strict; 19 | use Webinject::Gui; 20 | 21 | my $webinjectgui = Webinject::Gui->new('stderrwindow' => 1); 22 | -------------------------------------------------------------------------------- /WebinjectGui/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sni/Webinject/c517639564bab7fc1b4ce2442b71f567e4df56d4/WebinjectGui/icon.gif -------------------------------------------------------------------------------- /WebinjectGui/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sni/Webinject/c517639564bab7fc1b4ce2442b71f567e4df56d4/WebinjectGui/icon.ico -------------------------------------------------------------------------------- /WebinjectGui/lib/Webinject/Gui.pm: -------------------------------------------------------------------------------- 1 | package Webinject::Gui; 2 | 3 | # Copyright 2004-2006 Corey Goldberg (corey@goldb.org) 4 | # 5 | # This file is part of WebInject. 6 | # 7 | # WebInject is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # WebInject is distributed in the hope that it will be useful, 13 | # but without any warranty; without even the implied warranty of 14 | # merchantability or fitness for a particular purpose. See the 15 | # GNU General Public License for more details. 16 | 17 | use 5.006; 18 | use strict; 19 | use warnings; 20 | use Tk; 21 | use Tk::Stderr; 22 | use Tk::ROText; 23 | use Tk::Compound; 24 | use Tk::ProgressBar::Mac; 25 | use Tk::NoteBook; 26 | use Tk::PNG; 27 | use base qw/Webinject/; 28 | 29 | our $VERSION = '1.56'; 30 | 31 | =head1 NAME 32 | 33 | Webinject::Gui - Gui part of Webinject 34 | 35 | =head1 SYNOPSIS 36 | 37 | use Webinject::Gui; 38 | my $webinjectgui = Webinject::Gui->new(); 39 | 40 | =head1 DESCRIPTION 41 | 42 | WebInject is a free tool for automated testing of web applications and web 43 | services. It can be used to test individual system components that have HTTP 44 | interfaces (JSP, ASP, CGI, PHP, AJAX, Servlets, HTML Forms, XML/SOAP Web 45 | Services, REST, etc), and can be used as a test harness to create a suite of 46 | [HTTP level] automated functional, acceptance, and regression tests. A test 47 | harness allows you to run many test cases and collect/report your results. 48 | WebInject offers real-time results display and may also be used for monitoring 49 | system response times. 50 | 51 | =head1 CONSTRUCTOR 52 | 53 | =head2 new ( [ARGS] ) 54 | 55 | Creates an C object. 56 | 57 | =cut 58 | 59 | sub new { 60 | my $class = shift; 61 | my (%options) = @_; 62 | $| = 1; # don't buffer output to STDOUT 63 | 64 | my $self = { 65 | 'mainloop' => 1, 66 | 'stderrwindow' => 1, 67 | }; 68 | 69 | for my $opt_key ( keys %options ) { 70 | if ( exists $self->{$opt_key} ) { 71 | $self->{$opt_key} = $options{$opt_key}; 72 | } 73 | else { 74 | croak("unknown option: $opt_key"); 75 | } 76 | } 77 | 78 | bless $self, $class; 79 | 80 | # save command line for later restarts 81 | $self->{'command_line'} = $0." ".join(" ", @ARGV); 82 | $self->{'gui'} = 1; 83 | 84 | $self->_set_defaults(); 85 | $self->_whackoldfiles(); 86 | $self->_init_main_window(); 87 | 88 | return $self; 89 | } 90 | 91 | ######################################## 92 | 93 | =head1 METHODS 94 | 95 | =cut 96 | 97 | sub _init_main_window { 98 | my $self = shift; 99 | 100 | $self->{'mainwindow'} = MainWindow->new( 101 | -title => 'WebInject - HTTP Test Tool (version '. $Webinject::Gui::VERSION . ')', 102 | -bg => '#666699', 103 | -takefocus => '1', #start on top 104 | ); 105 | 106 | $self->{'mainwindow'}->geometry("750x650+0+0"); # size and screen placement 107 | if($self->{'stderrwindow'}) { 108 | $self->{'mainwindow'}->InitStderr; # redirect all STDERR to a window 109 | } 110 | $self->{'mainwindow'}->raise; # put application in front at startup 111 | $self->{'mainwindow'}->bind( '' => sub { $self->engine(); } ); # F5 key makes it run 112 | 113 | if ( -e "icon.gif" ) { # if icon graphic exists, use it 114 | $self->{'mainwindow'}->update(); 115 | my $icon = $self->{'mainwindow'}->Photo( -file => 'icon.gif' ); 116 | $self->{'mainwindow'}->iconimage($icon); 117 | } 118 | 119 | if ( -e "logo.gif" ) { # if logo graphic exists, use it 120 | $self->{'mainwindow'}->Photo( 'logogif', -file => "logo.gif" ); 121 | $self->{'mainwindow'}->Label( 122 | -image => 'logogif', 123 | -bg => '#666699', 124 | )->place(qw/-x 305 -y 12/); 125 | $self->{'mainwindow'}->update(); 126 | } 127 | 128 | my $menubar = $self->{'mainwindow'}->Frame(qw/-relief flat -borderwidth 2/); 129 | $menubar->place(qw/-x 0 -y 0/); 130 | $menubar->configure( -background => '#666699' ); # menu outline 131 | 132 | my $filemenu = $menubar->Menubutton( 133 | -text => 'File', 134 | -foreground => 'white', 135 | -background => '#666699', 136 | -activebackground => '#666699', 137 | -activeforeground => 'black', 138 | -tearoff => '0', 139 | )->pack(qw/-side left/); 140 | 141 | $filemenu->command( 142 | -label => 'Restart', 143 | -background => '#666699', 144 | -activebackground => '#EFEFEF', 145 | -foreground => 'white', 146 | -activeforeground => 'black', 147 | -command => sub { $self->_gui_restart(); }, 148 | ); 149 | 150 | $filemenu->command( 151 | -label => 'Exit', 152 | -background => '#666699', 153 | -activebackground => '#EFEFEF', 154 | -foreground => 'white', 155 | -activeforeground => 'black', 156 | -command => sub { exit; } 157 | ); 158 | 159 | my $viewmenu = $menubar->Menubutton( 160 | -text => 'View', 161 | -foreground => 'white', 162 | -background => '#666699', 163 | -activebackground => '#666699', 164 | -activeforeground => 'black', 165 | -tearoff => '0', 166 | )->pack(qw/-side left/); 167 | 168 | $viewmenu->command( 169 | -label => 'config.xml', 170 | -background => '#666699', 171 | -activebackground => '#EFEFEF', 172 | -foreground => 'white', 173 | -activeforeground => 'black', 174 | -command => sub { $self->_viewconfig(); }, 175 | ); 176 | 177 | my $aboutmenu = $menubar->Menubutton( 178 | -text => 'About', 179 | -foreground => 'white', 180 | -background => '#666699', 181 | -activebackground => '#666699', 182 | -activeforeground => 'black', 183 | -tearoff => '0', 184 | )->pack(qw/-side left/); 185 | 186 | $aboutmenu->command( 187 | -label => 'About WebInject', 188 | -background => '#666699', 189 | -activebackground => '#EFEFEF', 190 | -foreground => 'white', 191 | -activeforeground => 'black', 192 | -command => sub { $self->_about() }, 193 | ); 194 | 195 | $self->{'mainwindow'}->Label( 196 | -text => 'Engine Status:', 197 | -bg => '#666699', 198 | -fg => '#FFFFFF', 199 | )->place(qw/-x 12 -y 100/); 200 | $self->{'mainwindow'}->update(); 201 | 202 | $self->{'out_window'} = $self->{'mainwindow'}->Scrolled( 203 | 'ROText', # engine status window 204 | -scrollbars => 'e', 205 | -background => '#EFEFEF', 206 | -width => '103', 207 | -height => '7', 208 | )->place(qw/-x 12 -y 118/); 209 | $self->{'mainwindow'}->update(); 210 | 211 | $self->{'tabs'} = $self->{'mainwindow'}->NoteBook( 212 | -backpagecolor => '#666699', 213 | -background => '#EFEFEF', # color for active tab 214 | -foreground => 'black', # text color for active tab 215 | -inactivebackground => '#BFBFBF', # color for inactive tabs 216 | )->place(qw/-x 12 -y 240/); # outer notebook object 217 | 218 | my $status_tab = $self->{'tabs'}->add( 'statustab', -label => 'Status' ); 219 | $self->{'mainwindow'}->update(); 220 | 221 | my $statustab_canvas = $status_tab->Canvas( 222 | -width => '719', 223 | -height => '365', 224 | -highlightcolor => '#CCCCCC', 225 | -background => '#EFEFEF', 226 | )->pack(); 227 | $self->{'mainwindow'}->update(); # canvas to fill tab (to place widgets into) 228 | 229 | my $statustab_buttoncanvas = $statustab_canvas->Canvas( 230 | -width => '700', 231 | -height => '24', 232 | -background => '#666699', 233 | )->place(qw/-x 10 -y 334/); 234 | $self->{'mainwindow'}->update(); # canvas to place buttons into 235 | 236 | $self->{'minimalcheckbx'} = 'minimal_off'; # give it a default value 237 | $statustab_buttoncanvas->Label( 238 | -text => 'Minimal Output', 239 | -bg => '#666699', 240 | -fg => 'white', 241 | )->place(qw/-x 49 -y 4/); 242 | $self->{'mainwindow'}->update(); 243 | $statustab_buttoncanvas->Checkbutton( 244 | -text => '', # using a text widget instead 245 | -onvalue => 'minimal_on', 246 | -offvalue => 'minimal_off', 247 | -variable => \$self->{'minimalcheckbx'}, 248 | -background => '#666699', 249 | -activebackground => '#666699', 250 | -highlightbackground => '#666699', 251 | )->place(qw/-x 20 -y 2/); 252 | $self->{'mainwindow'}->update(); 253 | 254 | $self->{'timercheckbx'} = 'timer_off'; # give it a default value 255 | $statustab_buttoncanvas->Label( 256 | -text => 'Response Timer Output', 257 | -bg => '#666699', 258 | -fg => 'white', 259 | )->place(qw/-x 199 -y 4/); 260 | $self->{'mainwindow'}->update(); 261 | $statustab_buttoncanvas->Checkbutton( 262 | -text => '', # using a text widget instead 263 | -onvalue => 'timer_on', 264 | -offvalue => 'timer_off', 265 | -variable => \$self->{'timercheckbx'}, 266 | -background => '#666699', 267 | -activebackground => '#666699', 268 | -highlightbackground => '#666699', 269 | )->place(qw/-x 170 -y 2/); 270 | $self->{'mainwindow'}->update(); 271 | 272 | $self->{'status_window'} = $statustab_canvas->Scrolled( 273 | 'ROText', # test case status monitor window 274 | -scrollbars => 'e', 275 | -background => '#EFEFEF', 276 | -width => '102', 277 | -height => '23', 278 | )->place(qw/-x 0 -y 0/); 279 | $self->{'mainwindow'}->update(); 280 | $self->{'status_window'}->tagConfigure( 'red', -foreground => '#FF3333' ) 281 | ; #define tag for font color 282 | $self->{'status_window'}->tagConfigure( 'green', -foreground => '#009900' ) 283 | ; #define tag for font color 284 | 285 | $self->{'monitorenabledchkbx'} = 'monitor_on'; #give it a default value 286 | $self->{'mainwindow'}->Label( 287 | -text => 'Disable Monitor', 288 | -bg => '#666699', 289 | -fg => 'white', 290 | )->place(qw/-x 189 -y 242/); 291 | $self->{'mainwindow'}->update(); 292 | $self->{'monitor_enabledchkbx'} = $self->{'mainwindow'}->Checkbutton( 293 | -text => '', #using a text widget instead 294 | -onvalue => 'monitor_off', 295 | -offvalue => 'monitor_on', 296 | -variable => \$self->{'monitorenabledchkbx'}, 297 | -background => '#666699', 298 | -activebackground => '#666699', 299 | -highlightbackground => '#666699', 300 | -command => sub { $self->_monitor_enable_disable(); }, 301 | )->place(qw/-x 160 -y 240/); 302 | $self->{'mainwindow'}->update(); 303 | $self->_monitor_enable_disable(); #call sub to enable and create monitor 304 | 305 | $self->{'stop_button'} = $self->{'mainwindow'}->Button->Compound; 306 | $self->{'stop_button'}->Text( -text => "Stop" ); 307 | $self->{'stop_button'} = $self->{'mainwindow'}->Button( 308 | -width => '50', 309 | -height => '13', 310 | -background => '#EFEFEF', 311 | -activebackground => '#666699', 312 | -foreground => '#000000', 313 | -activeforeground => '#FFFFFF', 314 | -borderwidth => '3', 315 | -image => $self->{'stop_button'}, 316 | -command => sub { $self->{'stop'} = 'yes'; }, 317 | )->place; 318 | $self->{'mainwindow'}->update(); #create this button but don't place it yet 319 | 320 | $self->{'rtc_button'} = $self->{'mainwindow'}->Button->Compound; 321 | $self->{'rtc_button'}->Text( -text => "Run" ); 322 | $self->{'rtc_button'} = $self->{'mainwindow'}->Button( 323 | -width => '50', 324 | -height => '13', 325 | -background => '#EFEFEF', 326 | -activebackground => '#666699', 327 | -foreground => '#000000', 328 | -activeforeground => '#FFFFFF', 329 | -borderwidth => '3', 330 | -image => $self->{'rtc_button'}, 331 | -command => sub { $self->engine(); }, 332 | )->place(qw/-x 110 -y 65/); 333 | $self->{'mainwindow'}->update(); 334 | $self->{'rtc_button'}->focus(); 335 | 336 | $self->{'progressbar'} = $self->{'mainwindow'}->ProgressBar( 337 | -width => '420', 338 | -bg => '#666699' 339 | )->place(qw/-x 176 -y 65/); 340 | $self->{'mainwindow'}->update(); 341 | 342 | $self->{'status_ind'} = $self->{'mainwindow'}->Canvas( 343 | -width => '28', #engine status indicator 344 | -height => '9', 345 | -background => '#666699', 346 | )->place(qw/-x 621 -y 69/); 347 | $self->{'mainwindow'}->update(); 348 | 349 | if($self->{'mainloop'}) { 350 | MainLoop; 351 | } 352 | return; 353 | } 354 | 355 | ######################################## 356 | sub _gui_initial { #this runs when engine is first loaded 357 | my $self = shift; 358 | 359 | $self->{'out_window'}->delete( '0.0', 'end' ); # clear window before starting 360 | $self->{'status_window'}->delete( '0.0', 'end' ); # clear window before starting 361 | 362 | # change status color amber while running 363 | $self->{'status_ind'}->configure( -background => '#FF9900' ); 364 | 365 | $self->{'rtc_button'}->placeForget; # remove the run button 366 | $self->{'stop_button'}->place(qw/-x 110 -y 65/); # place the stop button 367 | 368 | # disable button while running 369 | $self->{'monitor_enabledchkbx'}->configure( -state => 'disabled' ); 370 | 371 | $self->{'out_window'}->insert( "end", "Starting Webinject Engine... \n\n" ); 372 | $self->{'out_window'}->see("end"); 373 | 374 | return; 375 | } 376 | 377 | ######################################## 378 | sub _gui_restart { #kill the entire app and restart it 379 | my $self = shift; 380 | return exec $self->{'command_line'}; 381 | } 382 | 383 | ######################################## 384 | sub _gui_processing_msg { 385 | my $self = shift; 386 | my $file = shift; 387 | $self->{'out_window'}->insert( "end", "processing test case file:\n".$file."\n\n", 'bold' ); 388 | $self->{'out_window'}->see("end"); 389 | return; 390 | } 391 | 392 | ######################################## 393 | sub _gui_statusbar { 394 | my $self = shift; 395 | my $percentcomplete = ( $self->{'result'}->{'runcount'} / $self->{'result'}->{'casecount'} ) * 100; 396 | # update progressbar with current status 397 | $self->{'progressbar'}->set($percentcomplete); 398 | return; 399 | } 400 | 401 | ######################################## 402 | sub _gui_tc_descript { 403 | my $self = shift; 404 | my $case = shift; 405 | unless ( $self->{'minimalcheckbx'} eq "minimal_on" ) { 406 | $self->{'status_window'}->insert( "end", "- " . $case->{description1} . "\n" ); 407 | $self->{'status_window'}->see("end"); 408 | } 409 | return; 410 | } 411 | 412 | ######################################## 413 | sub _gui_status_passed { 414 | my $self = shift; 415 | $self->{'status_window'}->insert( "end", "PASSED\n", 'green' ); 416 | $self->{'status_window'}->see("end"); 417 | return; 418 | } 419 | 420 | ######################################## 421 | sub _gui_status_failed { 422 | my $self = shift; 423 | if ( $1 and $2 ) { 424 | $self->{'status_window'}->insert( "end", "FAILED ($1$2)\n", 'red' ); 425 | $self->{'status_window'}->see("end"); 426 | } 427 | else { 428 | $self->{'status_window'}->insert( "end", "FAILED\n", 'red' ); 429 | $self->{'status_window'}->see("end"); 430 | } 431 | return; 432 | } 433 | 434 | ######################################## 435 | sub _gui_timer_output { 436 | my $self = shift; 437 | my $latency = shift; 438 | if ( $self->{'timercheckbx'} eq "timer_on" ) { 439 | $self->{'status_window'}->insert( "end", $latency." s\n" ); 440 | $self->{'status_window'}->see("end"); 441 | } 442 | return; 443 | } 444 | 445 | ######################################## 446 | sub _gui_final { 447 | my $self = shift; 448 | 449 | $self->{'out_window'}->insert( "end", "Execution Finished... see results.html file for detailed output report"); 450 | $self->{'out_window'}->see("end"); 451 | 452 | $self->{'status_window'}->insert( "end", "\n\n------------------------------\nTotal Run Time: $self->{'result'}->{'totalruntime'} seconds\n"); 453 | $self->{'status_window'}->insert( "end", "\nTest Cases Run: $self->{'result'}->{'totalruncount'}\nTest Cases Passed: $self->{'result'}->{'totalcasespassedcount'}\nTest Cases Failed: $self->{'result'}->{'totalcasesfailedcount'}\nVerifications Passed: $self->{'result'}->{'totalpassedcount'}\nVerifications Failed: $self->{'result'}->{'totalfailedcount'}\n" ); 454 | $self->{'status_window'}->see("end"); 455 | 456 | # change status color to reflect failure or all tests passed 457 | if( $self->{'result'}->{'totalfailedcount'} > 0 ) { 458 | # red 459 | $self->{'status_ind'}->configure( -background => '#FF3333' ); 460 | } 461 | else { 462 | # green 463 | $self->{'status_ind'}->configure( -background => '#009900' ); 464 | } 465 | 466 | # re-enable button after finish 467 | $self->{'monitor_enabledchkbx'}->configure( -state => 'normal' ); 468 | 469 | return; 470 | } 471 | 472 | ######################################## 473 | sub _gui_updatemontab { 474 | my $self = shift; 475 | 476 | # don't try to update if monitor is disabled in gui 477 | if ( $self->{'monitorenabledchkbx'} ne 'monitor_off' ) { 478 | if ( 479 | ( -e $self->{'config'}->{'output_dir'}."plot.png" ) 480 | and ( ( $self->{'config'}->{'graphtype'} ne 'nograph' ) 481 | or ( $self->{'switches'}->{'plotclear'} ne 'yes' ) ) 482 | ) 483 | { 484 | # if plot graphic exists, put it in canvas 485 | $self->{'montab_plotcanvas'}->Photo( 'plotgraph', -file => $self->{'config'}->{'output_dir'}."plot.png" ); 486 | $self->{'montab_plotcanvas'}->Label( -image => 'plotgraph' )->place(qw/-x 7 -y 0/); 487 | } 488 | } 489 | return; 490 | } 491 | 492 | ######################################## 493 | sub _gui_updatemonstats { #update timers and counts in monitor tab 494 | my $self = shift; 495 | 496 | #don't try to update if monitor is disabled in gui 497 | if( $self->{'monitorenabledchkbx'} ne 'monitor_off' ) { 498 | 499 | $self->{'mintime_text'}->configure( -text => "Min: $self->{'result'}->{'minresponse'} sec" ); 500 | $self->{'maxtime_text'}->configure( -text => "Max: $self->{'result'}->{'maxresponse'} sec" ); 501 | $self->{'avgtime_text'}->configure( -text => "Avg: $self->{'result'}->{'avgresponse'} sec" ); 502 | $self->{'runcounttotal_text'}->configure( -text => "Total: $self->{'result'}->{'totalruncount'}" ); 503 | $self->{'runcountcasespassed_text'}->configure( -text => "Passed: $self->{'result'}->{'totalcasespassedcount'}" ); 504 | $self->{'runcountcasespfailed_text'}->configure( -text => "Failed: $self->{'result'}->{'totalcasesfailedcount'}" ); 505 | } 506 | return; 507 | } 508 | 509 | ######################################## 510 | # flip button and do cleanup when user clicks Stop 511 | sub _gui_stop { 512 | my $self = shift; 513 | 514 | $self->{'stop_button'}->placeForget; #remove the stop botton 515 | $self->{'rtc_button'}->place(qw/-x 110 -y 65/); #place the stop button 516 | 517 | $self->{'progressbar'}->set(-1); #update progressbar back to zero 518 | 519 | $self->{'mainwindow'}->update(); 520 | 521 | $self->_gui_final(); 522 | return; 523 | } 524 | 525 | ######################################## 526 | # remove graph 527 | sub _gui_cleargraph { 528 | my $self = shift; 529 | 530 | $self->_reset_result(); 531 | 532 | # delete a plot file if it exists so an old one is never rendered 533 | if ( -e $self->{'config'}->{'output_dir'}."plot.png" ) { 534 | unlink $self->{'config'}->{'output_dir'}."plot.png"; 535 | } 536 | 537 | $self->{'montab_plotcanvas'}->destroy; # destroy the canvas 538 | 539 | $self->{'montab_plotcanvas'} = $self->{'montab_canvas'}->Canvas( 540 | -width => '718', 541 | -height => '240', 542 | -background => '#EFEFEF', 543 | )->place(qw/-x 0 -y 0/); 544 | # canvas to place graph into 545 | $self->{'mainwindow'}->update(); 546 | return; 547 | } 548 | 549 | ######################################## 550 | # remove graph then set value to truncate log 551 | sub _gui_cleargraph_button { 552 | my $self = shift; 553 | 554 | $self->_gui_cleargraph(); 555 | 556 | # set value so engine knows to truncate plot log 557 | $self->{'switches'}->{'plotclear'} = 'yes'; 558 | return; 559 | } 560 | 561 | ######################################## 562 | sub _about { 563 | my $self = shift; 564 | 565 | $self->{'about'} = MainWindow->new( 566 | -title => 'About WebInject', 567 | -bg => '#666699', 568 | -takefocus => '1', #start on top 569 | ); 570 | $self->{'about'}->raise; #put in front 571 | $self->{'about'}->geometry("320x200+200+200"); #size and screen placement 572 | if ( -e "icon.gif" ) { #if icon graphic exists, use it 573 | $self->{'about'}->update(); 574 | my $icon = $self->{'about'}->Photo( -file => 'icon.gif' ); 575 | $self->{'about'}->iconimage($icon); 576 | } 577 | 578 | my $about_text = $self->{'about'}->ROText( 579 | -width => 580 | '100', #make these big. window size is controlled by geometry instead 581 | -height => '100', 582 | -background => '#666699', 583 | -foreground => 'white', 584 | )->pack; 585 | 586 | $about_text->insert( 587 | "end", qq| 588 | WebInject 589 | ©2004-2006 Corey Goldberg 590 | 591 | Please visit www.webinject.org 592 | for information and documentation. 593 | 594 | WebInject is Free and Open Source. 595 | Licensed under the terms of the GNU GPL. 596 | | 597 | ); 598 | 599 | return; 600 | } 601 | 602 | ######################################## 603 | sub _viewconfig { 604 | my $self = shift; 605 | 606 | $self->{'viewconfig'} = MainWindow->new( 607 | -title => 'config.xml', 608 | -bg => '#666699', 609 | -takefocus => '1', #start on top 610 | ); 611 | $self->{'viewconfig'}->raise; #put in front 612 | $self->{'viewconfig'}->geometry("500x400+200+200") 613 | ; #size and screen placement 614 | if ( -e "logo.gif" ) { #if icon graphic exists, use it 615 | $self->{'viewconfig'}->update(); 616 | my $icon = $self->{'viewconfig'}->Photo( -file => 'icon.gif' ); 617 | $self->{'viewconfig'}->iconimage($icon); 618 | } 619 | 620 | my $config_text = $self->{'viewconfig'}->ROText( 621 | -width => 622 | '100', #make these big. window size is controlled by geometry instead 623 | -height => '100', 624 | -background => '#666699', 625 | -foreground => 'white', 626 | )->pack; 627 | 628 | my $file; 629 | if($self->{'opt_configfile'} ) { 630 | $file = $self->{'opt_configfile'}; 631 | } elsif(-e "config.xml") { 632 | $file = "config.xml"; 633 | } 634 | if(defined $file) { 635 | # open file handle 636 | open( my $config, '<', $file ) 637 | or die "\nERROR: Failed to open ".$file." file: $!\n\n"; 638 | # read the file into an array 639 | my @configfile = <$config>; 640 | $config_text->insert( "end", @configfile ); 641 | close($config); 642 | } else { 643 | $config_text->insert( "end", "couldn't open default config file" ); 644 | } 645 | 646 | return; 647 | } 648 | 649 | ######################################## 650 | sub _monitor_enable_disable { 651 | my $self = shift; 652 | 653 | my $mon_tab; 654 | if ( !defined $self->{'monitorenabledchkbx'} 655 | or $self->{'monitorenabledchkbx'} eq 'monitor_on' ) 656 | { #create the monitor tab and all it's widgets 657 | 658 | $mon_tab = $self->{'tabs'}->add( 'montab', -label => 'Monitor' ); 659 | $self->{'mainwindow'}->update(); #add the notebook tab 660 | 661 | $self->{'montab_canvas'} = $mon_tab->Canvas( 662 | -width => '719', 663 | -height => '365', 664 | -background => '#EFEFEF', 665 | )->place(qw/-x 0 -y 0/); 666 | $self->{'mainwindow'}->update() 667 | ; #canvas to fill tab (to place widgets into) 668 | 669 | $self->{'montab_plotcanvas'} = $self->{'montab_canvas'}->Canvas( 670 | -width => '718', 671 | -height => '240', 672 | -background => '#EFEFEF', 673 | )->place(qw/-x 0 -y 0/); 674 | $self->{'mainwindow'}->update(); #canvas to place graph into 675 | 676 | my $clear_graph = $mon_tab->Button->Compound; 677 | $clear_graph->Text( -text => "Clear Graph" ); 678 | $clear_graph = $mon_tab->Button( 679 | -width => '70', 680 | -height => '13', 681 | -background => '#EFEFEF', 682 | -activebackground => '#666699', 683 | -foreground => '#000000', 684 | -activeforeground => '#FFFFFF', 685 | -borderwidth => '3', 686 | -image => $clear_graph, 687 | -command => sub { $self->_gui_cleargraph_button(); }, 688 | )->place(qw/-x 630 -y 310/); 689 | $self->{'mainwindow'}->update(); 690 | 691 | $self->{'montab_buttoncanvas'} = $self->{'montab_canvas'}->Canvas( 692 | -width => '700', 693 | -height => '26', 694 | -background => '#666699', 695 | )->place(qw/-x 10 -y 334/); 696 | $self->{'mainwindow'}->update(); #canvas to place buttons into 697 | 698 | $self->{'montab_buttoncanvas'}->Label( 699 | -text => 'Line Graph', 700 | -bg => '#666699', 701 | -fg => 'white', 702 | )->place(qw/-x 49 -y 4/); 703 | $self->{'mainwindow'}->update(); 704 | my $radiolinegraph = $self->{'montab_buttoncanvas'}->Radiobutton( 705 | -value => 'lines', 706 | -variable => \$self->{'graphtype'}, 707 | -indicatoron => 'true', 708 | -background => '#666699', 709 | -activebackground => '#666699', 710 | -highlightbackground => '#666699', 711 | )->place(qw/-x 20 -y 2/); 712 | $self->{'mainwindow'}->update(); 713 | 714 | $radiolinegraph->select; #select as default 715 | 716 | $self->{'montab_buttoncanvas'}->Label( 717 | -text => 'Impulse Graph', 718 | -bg => '#666699', 719 | -fg => 'white', 720 | )->place(qw/-x 199 -y 4/); 721 | $self->{'mainwindow'}->update(); 722 | $self->{'montab_buttoncanvas'}->Radiobutton( 723 | -value => 'impulses', 724 | -variable => \$self->{'graphtype'}, 725 | -background => '#666699', 726 | -activebackground => '#666699', 727 | -highlightbackground => '#666699', 728 | )->place(qw/-x 170 -y 2/); 729 | $self->{'mainwindow'}->update(); 730 | 731 | $self->{'montab_buttoncanvas'}->Label( 732 | -text => 'No Graph', 733 | -bg => '#666699', 734 | -fg => 'white', 735 | )->place(qw/-x 349 -y 4/); 736 | $self->{'mainwindow'}->update(); 737 | $self->{'montab_buttoncanvas'}->Radiobutton( 738 | -value => 'nograph', 739 | -variable => \$self->{'graphtype'}, 740 | -background => '#666699', 741 | -activebackground => '#666699', 742 | -highlightbackground => '#666699', 743 | -command => sub { $self->_gui_cleargraph(); } 744 | , #remove graph from view 745 | )->place(qw/-x 320 -y 2/); 746 | $self->{'mainwindow'}->update(); 747 | 748 | my $resptime_label = $self->{'montab_canvas'}->Label( 749 | -width => '25', 750 | -height => '1', 751 | -background => '#EFEFEF', 752 | -foreground => 'black', 753 | -relief => 'flat', 754 | -anchor => 'w', 755 | )->place(qw/-x 12 -y 245/); 756 | $self->{'mainwindow'}->update(); 757 | $resptime_label->configure( -text => 'Response Times:' ); 758 | 759 | $self->{'minresponse'} = 'N/A'; #set initial value for timer display 760 | $self->{'mintime_text'} = $self->{'montab_canvas'}->Label( 761 | -width => '25', 762 | -height => '1', 763 | -background => '#EFEFEF', 764 | -foreground => 'black', 765 | -relief => 'flat', 766 | -anchor => 'w', 767 | )->place(qw/-x 32 -y 265/); 768 | $self->{'mainwindow'}->update(); 769 | $self->{'mintime_text'} 770 | ->configure( -text => "Min: $self->{'minresponse'} sec" ); 771 | 772 | $self->{'maxresponse'} = 'N/A'; #set initial value for timer display 773 | $self->{'maxtime_text'} = $self->{'montab_canvas'}->Label( 774 | -width => '25', 775 | -height => '1', 776 | -background => '#EFEFEF', 777 | -foreground => 'black', 778 | -relief => 'flat', 779 | -anchor => 'w', 780 | )->place(qw/-x 32 -y 285/); 781 | $self->{'mainwindow'}->update(); 782 | $self->{'maxtime_text'} 783 | ->configure( -text => "Max: $self->{'maxresponse'} sec" ); 784 | 785 | $self->{'avgresponse'} = 'N/A'; #set initial value for timer display 786 | $self->{'avgtime_text'} = $self->{'montab_canvas'}->Label( 787 | -width => '25', 788 | -height => '1', 789 | -background => '#EFEFEF', 790 | -foreground => 'black', 791 | -relief => 'flat', 792 | -anchor => 'w', 793 | )->place(qw/-x 32 -y 305/); 794 | $self->{'mainwindow'}->update(); 795 | $self->{'avgtime_text'} 796 | ->configure( -text => "Avg: $self->{'avgresponse'} sec" ); 797 | 798 | $self->{'runcount_label'} = $self->{'montab_canvas'}->Label( 799 | -width => '25', 800 | -height => '1', 801 | -background => '#EFEFEF', 802 | -foreground => 'black', 803 | -relief => 'flat', 804 | -anchor => 'w', 805 | )->place(qw/-x 250 -y 245/); 806 | $self->{'mainwindow'}->update(); 807 | $self->{'runcount_label'}->configure( -text => 'Runtime Counts:' ); 808 | 809 | $self->{'totalruncount'} = 'N/A'; #set initial value for count display 810 | $self->{'runcounttotal_text'} = $self->{'montab_canvas'}->Label( 811 | -width => '25', 812 | -height => '1', 813 | -background => '#EFEFEF', 814 | -foreground => 'black', 815 | -relief => 'flat', 816 | -anchor => 'w', 817 | )->place(qw/-x 270 -y 265/); 818 | $self->{'mainwindow'}->update(); 819 | $self->{'runcounttotal_text'} 820 | ->configure( -text => "Total: $self->{'totalruncount'}" ); 821 | 822 | $self->{'casepassedcount'} = 'N/A'; #set initial value for count display 823 | $self->{'runcountcasespassed_text'} = $self->{'montab_canvas'}->Label( 824 | -width => '25', 825 | -height => '1', 826 | -background => '#EFEFEF', 827 | -foreground => 'black', 828 | -relief => 'flat', 829 | -anchor => 'w', 830 | )->place(qw/-x 270 -y 285/); 831 | $self->{'mainwindow'}->update(); 832 | $self->{'runcountcasespassed_text'} 833 | ->configure( -text => "Passed: $self->{'casepassedcount'}" ); 834 | 835 | $self->{'casefailedcount'} = 'N/A'; #set initial value for count display 836 | $self->{'runcountcasespfailed_text'} = $self->{'montab_canvas'}->Label( 837 | -width => '25', 838 | -height => '1', 839 | -background => '#EFEFEF', 840 | -foreground => 'black', 841 | -relief => 'flat', 842 | -anchor => 'w', 843 | )->place(qw/-x 270 -y 305/); 844 | $self->{'mainwindow'}->update(); 845 | $self->{'runcountcasespfailed_text'} 846 | ->configure( -text => "Failed: $self->{'casefailedcount'}" ); 847 | 848 | } #end monitor create 849 | 850 | if ( defined $self->{'monitorenabledchkbx'} 851 | and $self->{'monitorenabledchkbx'} eq 'monitor_off' ) 852 | { #delete the tab when disabled 853 | $mon_tab = $self->{'tabs'}->delete( 'montab', -label => 'Monitor' ); 854 | $self->{'mainwindow'}->update(); 855 | } 856 | 857 | return; 858 | } 859 | 860 | ######################################## 861 | sub _gui_no_plotter_found { #if gnuplot not specified, notify on gui 862 | my $self = shift; 863 | 864 | $self->{'montab_plotcanvas'}->Label( 865 | -text => 866 | "Sorry, I can't display the graph.\nMake sure you have gnuplot on your system and it's location is specified in config.xml. ", 867 | -bg => '#EFEFEF', 868 | -fg => 'black', 869 | )->place(qw/-x 95 -y 100/); 870 | $self->{'mainwindow'}->update(); 871 | return; 872 | } 873 | 874 | 875 | =head1 SEE ALSO 876 | 877 | For more information about webinject visit http://www.webinject.org 878 | 879 | =head1 AUTHOR 880 | 881 | Corey Goldberg, Ecorey@goldb.orgE 882 | 883 | Sven Nierlein, Enierlein@cpan.orgE 884 | 885 | =head1 COPYRIGHT AND LICENSE 886 | 887 | Copyright (C) 2010 by Sven Nierlein 888 | 889 | Copyright (C) 2004-2006 by Corey Goldberg 890 | 891 | This library is free software; you can redistribute it under the GPL2 license. 892 | 893 | =cut 894 | 895 | 1; 896 | __END__ 897 | -------------------------------------------------------------------------------- /WebinjectGui/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sni/Webinject/c517639564bab7fc1b4ce2442b71f567e4df56d4/WebinjectGui/logo.gif -------------------------------------------------------------------------------- /WebinjectGui/t/01-Webinject-Gui.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | ################################################## 4 | 5 | use strict; 6 | use Test::More tests => 2; 7 | use Data::Dumper; 8 | 9 | use_ok('Webinject::Gui'); 10 | 11 | my $webinjectgui = Webinject::Gui->new('mainloop' => 0, 'stderrwindow' => 0); 12 | isa_ok($webinjectgui, "Webinject::Gui", 'Object is a Webinject::Gui'); 13 | -------------------------------------------------------------------------------- /WebinjectGui/t/97-Pod.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | eval "use Test::Pod 1.14"; 6 | plan skip_all => 'Test::Pod 1.14 required' if $@; 7 | plan skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.' unless $ENV{TEST_AUTHOR}; 8 | 9 | all_pod_files_ok(); 10 | -------------------------------------------------------------------------------- /WebinjectGui/t/98-Pod-Coverage.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # $Id$ 4 | # 5 | use strict; 6 | use warnings; 7 | use File::Spec; 8 | use Test::More; 9 | use English qw(-no_match_vars); 10 | 11 | if ( not $ENV{TEST_AUTHOR} ) { 12 | my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 13 | plan( skip_all => $msg ); 14 | } 15 | 16 | eval { require Test::Pod::Coverage; }; 17 | 18 | if ( $EVAL_ERROR ) { 19 | my $msg = 'Test::Pod::Coverage required to criticise pod'; 20 | plan( skip_all => $msg ); 21 | } 22 | 23 | eval "use Test::Pod::Coverage 1.00"; 24 | all_pod_coverage_ok(); 25 | -------------------------------------------------------------------------------- /WebinjectGui/t/99-Perl-Critic.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # $Id$ 4 | # 5 | use strict; 6 | use warnings; 7 | use File::Spec; 8 | use Test::More; 9 | use English qw(-no_match_vars); 10 | 11 | if ( not $ENV{TEST_AUTHOR} ) { 12 | my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; 13 | plan( skip_all => $msg ); 14 | } 15 | 16 | eval { require Test::Perl::Critic; }; 17 | 18 | if ( $EVAL_ERROR ) { 19 | my $msg = 'Test::Perl::Critic required to criticise code'; 20 | plan( skip_all => $msg ); 21 | } 22 | 23 | my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); 24 | Test::Perl::Critic->import( -profile => $rcfile ); 25 | all_critic_ok(); 26 | -------------------------------------------------------------------------------- /WebinjectGui/t/perlcriticrc: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # This Perl::Critic configuration file sets the Policy severity levels 3 | # according to Damian Conway's own personal recommendations. Feel free to 4 | # use this as your own, or make modifications. 5 | ############################################################################## 6 | 7 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitAccessOfPrivateData] 8 | severity = 3 9 | 10 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr] 11 | severity = 3 12 | 13 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitReverseSortBlock] 14 | severity = 1 15 | 16 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect] 17 | severity = 5 18 | 19 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval] 20 | severity = 5 21 | 22 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit] 23 | severity = 2 24 | 25 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan] 26 | severity = 4 27 | 28 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa] 29 | severity = 4 30 | 31 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidGrep] 32 | severity = 3 33 | 34 | [Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap] 35 | severity = 3 36 | 37 | [Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep] 38 | severity = 4 39 | 40 | [Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap] 41 | severity = 4 42 | 43 | [Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction] 44 | severity = 5 45 | 46 | [Perl::Critic::Policy::BuiltinFunctions::RequireSimpleSortBlock] 47 | severity = 3 48 | 49 | [Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading] 50 | severity = 3 51 | 52 | [Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA] 53 | severity = 4 54 | 55 | [Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless] 56 | severity = 5 57 | 58 | [Perl::Critic::Policy::CodeLayout::ProhibitHardTabs] 59 | severity = 3 60 | 61 | [Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins] 62 | severity = 1 63 | 64 | [Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists] 65 | severity = 2 66 | 67 | [Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines] 68 | severity = 4 69 | 70 | [Perl::Critic::Policy::CodeLayout::RequireTidyCode] 71 | severity = 1 72 | 73 | [Perl::Critic::Policy::CodeLayout::RequireTrailingCommas] 74 | severity = 3 75 | 76 | [Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops] 77 | severity = 3 78 | 79 | [Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse] 80 | severity = 3 81 | 82 | [Perl::Critic::Policy::ControlStructures::ProhibitDeepNests] 83 | severity = 3 84 | 85 | [Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions] 86 | severity = 5 87 | 88 | [Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls] 89 | severity = 4 90 | 91 | [Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks] 92 | severity = 4 93 | 94 | [Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode] 95 | severity = 4 96 | 97 | [Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks] 98 | severity = 4 99 | 100 | [Perl::Critic::Policy::Documentation::RequirePodAtEnd] 101 | severity = 2 102 | 103 | [Perl::Critic::Policy::Documentation::RequirePodSections] 104 | severity = 2 105 | 106 | [Perl::Critic::Policy::ErrorHandling::RequireCarping] 107 | severity = 4 108 | 109 | [Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators] 110 | severity = 3 111 | 112 | [Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles] 113 | severity = 5 114 | 115 | [Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest] 116 | severity = 4 117 | 118 | [Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect] 119 | severity = 4 120 | 121 | [Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop] 122 | severity = 5 123 | 124 | [Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen] 125 | severity = 4 126 | 127 | [Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint] 128 | severity = 3 129 | 130 | [Perl::Critic::Policy::Miscellanea::ProhibitFormats] 131 | severity = 3 132 | 133 | [Perl::Critic::Policy::Miscellanea::ProhibitTies] 134 | severity = 4 135 | 136 | [-Perl::Critic::Policy::Miscellanea::RequireRcsKeywords] 137 | 138 | [Perl::Critic::Policy::Modules::ProhibitAutomaticExportation] 139 | severity = 4 140 | 141 | [Perl::Critic::Policy::Modules::ProhibitEvilModules] 142 | severity = 5 143 | 144 | [Perl::Critic::Policy::Modules::ProhibitMultiplePackages] 145 | severity = 4 146 | 147 | [Perl::Critic::Policy::Modules::RequireBarewordIncludes] 148 | severity = 5 149 | 150 | [Perl::Critic::Policy::Modules::RequireEndWithOne] 151 | severity = 4 152 | 153 | [Perl::Critic::Policy::Modules::RequireExplicitPackage] 154 | severity = 4 155 | 156 | [Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage] 157 | severity = 5 158 | 159 | [Perl::Critic::Policy::Modules::RequireVersionVar] 160 | severity = 4 161 | 162 | [Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames] 163 | severity = 3 164 | 165 | [Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs] 166 | severity = 1 167 | 168 | [Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseVars] 169 | severity = 1 170 | 171 | [Perl::Critic::Policy::References::ProhibitDoubleSigils] 172 | severity = 4 173 | 174 | [Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest] 175 | severity = 4 176 | 177 | [Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting] 178 | severity = 5 179 | 180 | [Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching] 181 | severity = 5 182 | 183 | [Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils] 184 | severity = 2 185 | 186 | [Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms] 187 | severity = 4 188 | 189 | [Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity] 190 | severity = 3 191 | 192 | [Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef] 193 | severity = 5 194 | 195 | [Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes] 196 | severity = 4 197 | 198 | [Perl::Critic::Policy::Subroutines::ProtectPrivateSubs] 199 | severity = 3 200 | 201 | [Perl::Critic::Policy::Subroutines::RequireFinalReturn] 202 | severity = 5 203 | 204 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict] 205 | severity = 5 206 | 207 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings] 208 | severity = 4 209 | 210 | [Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride] 211 | severity = 4 212 | 213 | [Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels] 214 | severity = 3 215 | 216 | [Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict] 217 | severity = 5 218 | 219 | [Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings] 220 | severity = 4 221 | 222 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma] 223 | severity = 4 224 | 225 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes] 226 | severity = 2 227 | 228 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters] 229 | severity = 2 230 | 231 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals] 232 | severity = 1 233 | 234 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros] 235 | severity = 5 236 | 237 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitMismatchedOperators] 238 | severity = 2 239 | 240 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators] 241 | severity = 4 242 | 243 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes] 244 | severity = 2 245 | 246 | [Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings] 247 | severity = 3 248 | 249 | [Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars] 250 | severity = 1 251 | 252 | [Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators] 253 | severity = 2 254 | 255 | [Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator] 256 | severity = 4 257 | 258 | [Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator] 259 | severity = 4 260 | 261 | [Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations] 262 | severity = 5 263 | 264 | [Perl::Critic::Policy::Variables::ProhibitLocalVars] 265 | severity = 2 266 | 267 | [Perl::Critic::Policy::Variables::ProhibitMatchVars] 268 | severity = 4 269 | 270 | [Perl::Critic::Policy::Variables::ProhibitPackageVars] 271 | severity = 3 272 | 273 | [Perl::Critic::Policy::Variables::ProhibitPunctuationVars] 274 | severity = 2 275 | 276 | [Perl::Critic::Policy::Variables::ProtectPrivateVars] 277 | severity = 3 278 | 279 | [Perl::Critic::Policy::Variables::RequireInitializationForLocalVars] 280 | severity = 5 281 | 282 | [Perl::Critic::Policy::Variables::RequireLexicalLoopIterators] 283 | severity = 5 284 | 285 | [Perl::Critic::Policy::Variables::RequireNegativeIndices] 286 | severity = 4 --------------------------------------------------------------------------------