Full Code of robocoder/rips-scanner for AI

community 41d23237883f cached
48 files
509.8 KB
151.6k tokens
110 symbols
1 requests
Download .txt
Showing preview only (530K chars total). Download the full file or copy to clipboard to get everything.
Repository: robocoder/rips-scanner
Branch: community
Commit: 41d23237883f
Files: 48
Total size: 509.8 KB

Directory structure:
gitextract_ssjddytk/

├── .gitattributes
├── CHANGELOG
├── LICENSE
├── README.md
├── config/
│   ├── general.php
│   ├── help.php
│   ├── info.php
│   ├── securing.php
│   ├── sinks.php
│   ├── sources.php
│   └── tokens.php
├── css/
│   ├── ayti.css
│   ├── barf.css
│   ├── code-dark.css
│   ├── espresso.css
│   ├── notepad++.css
│   ├── phps.css
│   ├── print.css
│   ├── rips.css
│   ├── term.css
│   └── twilight.css
├── index.php
├── js/
│   ├── exploit.js
│   ├── hotpatch.js
│   ├── netron.js
│   └── script.js
├── lib/
│   ├── analyzer.php
│   ├── constructer.php
│   ├── filer.php
│   ├── printer.php
│   ├── scanner.php
│   ├── searcher.php
│   └── tokenizer.php
├── main.php
├── papers/
│   ├── LCA 2012_ PHP Static Code Analysis.html
│   ├── LCA 2012_ PHP Static Code Analysis_files/
│   │   ├── a.html
│   │   ├── css.css
│   │   ├── prettify.txt
│   │   ├── slides.txt
│   │   └── styles.css
│   └── README.md
├── rips_stats.py
└── windows/
    ├── code.php
    ├── exploit.php
    ├── function.php
    ├── help.php
    ├── hotpatch.php
    └── leakscan.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

*.css text eol=lf
*.js text eol=lf
*.php text eol=lf
*.py text eol=lf

# Denote all files that are truly binary and should not be modified.
*.gif binary
*.jpg binary
*.png binary


================================================
FILE: CHANGELOG
================================================
RIPS CHANGELOG
===============

RIPS 0.55
----------
	- updated configuration (sources, sinks, sanitization)
	- added session fixation detection
	- seperated reflection injection from code injection
	- changed defaults (subdirs, vuln type)
	- referenced user survey

RIPS 0.54
----------
	- fixed Javascript errors
	- fixed bug with false negatives in non-OOP code after OOP code (thanks to Gareth Heyes)
	- improved handling of parse_str() function
	- added new taintable $_SERVER parameters to sources (thanks to Mike Brooks)
	- added new sinks

RIPS 0.53
----------
	- fixed bug with includes (thanks to Ryan Dewhurst)

RIPS 0.52
----------
	Code analysis:
	- fixed bug where RIPS hangs on includes building a loop 1->2->3->1->2->3->1... (thanks to Michael Hoffmann)
	- fixed bug where RIPS string analyzer hangs on certain array keys coming from foreach statements (thanks to Ricky-Lee Birtles)
	- fixed bug where RIPS hangs on certain switch statements (thanks to Jay Bonci)
	- fixed bug with wrong brace wrapping for "case x;" instead of "case x:" statements
	- fixed bug with wrong brace wrapping when if-clause contains only 1 token or in a try/catch block
	- fixed bug with parameter count in interprocedural analysis
	- fixed bug with register_globals implementation and constants
	- fixed bug with tokenizing a do-while in a do-while
	- fixed bug with wrong boundary detection when a function is declared in another function
	- fixed bug with wrong file pointer of included files, improved include rate
	- added auto_prepend/append_file support, improved include_path support (thanks to Jay Bonci)
	- added support for func_get_args() and func_get_arg()
	- added support for alternative syntax for control structures (while(): ... endwhile;)
	- added new sensitive sinks
	- added experimental option SCAN_REGISTER_GLOBALS (/config/general.php)
	- added parsing errors to verbosity level = debug, improved code stability

	Interface:
	- added stylesheet "print" (thanks to Kurt Payne)
	- added scrollbars to function code on mouseover
	- disabled graphs for large projects (>50 files) due to performance
	- improved output when a vulnerability is found multiple times (e.g. by multiple inclusion of a vulnerable file)
	- fixed bug with style of multiline comments in code viewer
	- optimized code viewer with file preview window

RIPS 0.51
----------
	- fixed bug with apache_setenv() for non-Apache webservers
	- fixed bug in leakscan preloader

RIPS 0.50
----------
	Code analysis:
	- added about 30 new sensitive sinks and some new userinput functions
	- RIPS now traces codeblocks, not lines anymore
		-> code in one line without whitespaces ("obfuscated") is now possible to analyse
		-> this also fixes several known bugs
	- RIPS now handles arrays and its keys a lot more accurate
		-> arrays are handled as variables with saved keys
		-> dynamic key values are resolved
		-> this also fixes several known bugs
	- RIPS is now recoded object oriented
		-> structure is better
		-> code easier to understand
	- fixes bug when an old define is overwritten by a new one
	- ignores "@" for correct detection of connected tokens
	- added leakscan: trace if return value of tainted sensitive sink is echo'd (non-blind/blind exploitation)
	- fixed lots of securing detection bugs
	- automatically scans for register_globals implementation (extract, parse_str, $$key = $value, import_request_variables, etc.)
	- lots of new testcases added and fixed
	- improved reconstruction of file names to be included
	- set_time_limit is set to 0 now

	Interface:
	- included SaveGraph patch
	- added preloader information about current scanning status (thanks for the input, Michael Hoffmann)
	- added links to the stats window to other windows
	- fixed bug with color highlighting in regex search results
	- improved jumping between functions in scan result
	- moved http response splitting to clientside vulnerability list

RIPS 0.40 SaveGraph Patch:
----------
	- added option to save HTML5 canvas graph as image (feature request by ksaok)

RIPS 0.40:
----------
	Code analysis:
	- fixed bug with vartrace and different dependencies (if(condition) $var=1; else $var=2;)
	- fixed bug with string reconstruction of included files (include("/foo/$var/bar");)
	- improved file inclusion rate (name reconstruction, consider include_path, try to guess file)
	- fixed bug with usage of defined CONSTANTs (thanks to Dawid)
	- fixed bug with successful inclusion and FI vulnerability within one inclusion
	- fixed bug with FI vulnerability and function call (require urldecode($_GET['a']))
	- fixed bug with overwritten parameter vars in user-defined function
	- fixed bug with two sensitive sinks in one userdefined functions affected by different parameters
	- improved ternary operator handling
	- added quote analysis for more precise securing detection (mysql_query("SELECT ".addslashes($id)); =vuln)
		(still some bugs with quote analysis, TBD)
	- added vulnerability type 'Unserialize' to scan for POP gadgets

	Interface:
	- fixed bug with exploit creator and error_reporting=on (thanks Gregory and others)
	- moved info gathering to seperate verbosity level, removed info about program exits
	- added maximize button to code viewer
	- added graph for file inclusion visualization
	- added graph for function call and vulnerability flow visualization
	- added pie chart for result
	- grouped vulnerable lines for each vulnerability
	- added new color schema 'ayti' and improved other color schemas
	- fixed bug with vulnerable functions in the result that have not been called with userinput
	- fixed bug with multiline comments in the code viewer
	- added link to stats to show only vulns of specific type (click on vulnerability type)
	- added color highlighting for regex search results
	- changed stylesheet is now tracked permanently by cookie

RIPS 0.35:
----------
	- added ini_set("auto_detect_line_endings", true) to support MAC OSX newlines
	- added preg_match(_all) support with $matches array
	- prevented getmultiline() funtion to recursively loop for more than 10 rows (tracker ID: 3075359, thanks to lexak)
	- added vulnerability type 'LDAP Injection'
	- fixed bug with wrong detection of user defined securing functions using for-loops
	- fixed critical bug with wrong detection of securing during inter-procedual analysis
	- fixed bug with not detected function calls in included files and case-sensitive function names
	- fixed bug with userinput returned by user-defined functions

RIPS 0.34:
----------
	- fixed false positive when userinput is overwritten: $_GET['c']=1; exec($_GET['c']);
	- fixed critical bug with missing scan results
	- added more database securing and tainting functions (thanks to Yasuo Ohgaki)

RIPS 0.33:
----------
	Code analysis:
	- added vulnerability type 'XPath Injection'
	- implemented $F_INSECURING_STRING (list of functions like urldecode() that can re-taint already sanitized data)
	- fixed bug with $GLOBALS[] (ignore previous local vars, accept only global vars)
	- improved tainted $_SESSION (=global var) handling
	- fixed bug with tainting functions not displayed in the result tree
	- fixed bug with differently used quotes in array['"parameter'"] during traceback
	- added compact() support
	- ignore upper/lowercase in function names because PHP does not (sYsTem())
	- scan for dynamic function calls $variable() (possible code exec)

	Interface:
	- added missing taint-highlighting in the first line of PVF tree
	- added file list: listing all scanned files and includes
	- added list of function calls to each list item of user-defined functions
	- added help button for simple visualization, description, example, PoC, patch and securing function list in a new window
	- RIPS warns you when scan may last very long (counts files to scan)
	- added AJAX interface with scan animation
	- added scan result statistics and graphs
	- highlight variables onMouseOver in code viewer and scan result. persistent highlight onClick.
	- code viewer now supports active jumping between function calls and declarations
		(click on function call to jump to declaration, click "return" to jump back to the call)
	- added regex search function
	- windows are now resizeable
	- added curl headers for all tainting $_SERVER parameters in the exploit creator

RIPS 0.32:
----------
	Code analysis:
	- rebuild PVF config (FILE, CODE and SYSTEM PVF into FILE_READ, FILE_AFFECT, FILE_INCLUDE and EXEC PVF)
	- added $_SERVER parameters that are tainting to the config (example: $_SERVER['PHP_SELF'];)
	- fixed bug with securing detection of global string securing functions (example: md5($a.$b);)
	- fixed bug where the first token of an included file was ignored

	Interface:
	- added a little howto to the welcome page
	- added more detailed vulnerability types to scan for
	- added vulnerability name to each find (name still present during minimization of output block)
	- added .phps-tainted-var for highlighting tainting vars in the trace output
	- added explaination to inter-procedual analysis results
	- added RIPS logo (created by Gareth Heyes, thank you)
	- added a option to change the output tree from bottom-up to top-down (requested by Joel, thank you)
	- fixed bug with missing link by inter-procedual analysis when function name appeared in the "requires" list

RIPS 0.31:
----------
	Code analysis:
	- improved RIPS code + performance
		(http://code.google.com/speed/articles/optimizing-php.html)
		(http://www.wmtips.com/php/tips-optimizing-php-code.htm)
	- improved securing detection by detecting automatic type casts
	- added connection poisoning PVFs
	- added support for $arrays{'a'} with curly braces
	- added missing support for tainted OO function with XSS
	- added a missing class-to-variable association when using a constructor call instead the keyword 'new'
	- fixed bug where successful file inclusions were scanned again for a file inclusion vulnerability
	- fixed bugs with detecting commands written over several code lines (reported by Stefan Esser & Pragmatk)
		(patch does not solve all multi-line bugs)
	- corrected analysis of variables marked as 'global'

	Interface:
	- better arranged user input list
	- added option to highlight variables in the CodeViewer by click
	- added vulnerability type "All" to scan client- and server-side vulns simultaneously
	- added missing exploit button for direct-tainted XSS vulnerabilities


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: README.md
================================================
# RIPS
A static source code analyser for vulnerabilities in PHP scripts

## Requirements
* web server: Apache or Nginx recommended
* PHP: latest version recommended
* browser: Firefox recommended

## Installation
1. Download the latest release
2. Extract the files to your local web server's document root
3. Make sure your web server has file permissions
4. Make sure your installation is protected from unauthorized access
5. Open your browser at http://localhost/rips-xx/

## Usage
Follow the instructions on the main page.

## Command Line Interface - CLI

#### Usage

See original php-rips scan html form (index.php) for more options.

```
  php index.php [option=value]
```

| Options | Value |
| --- | --- |
| loc | target scan file/folder <path> |
| subdir | recurse subdirs \[0\|1] |
| ignore_warning | \[0\|1] |
| vector | scan vectors \[all\|...] |
| verbosity | log verbosity \[0-9] |
| treestyle | html output style \[0\|1] |
| stylesheet | html output stylesheet \[ayti\|...] |

Example: recursively scan ./code for all vuln. classes
```
  php index.php loc=./code subdirs=1 vector=all verbosity=2
```

Note: in cli-mode argv wil be parsed into `$_POST` therefore allowing you to set any POST variables.

#### Jenkins-CI Integration Notes

1. install the [html publisher plugin](https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin)
2. configure (multiple) scm to clone both this repository and the source you want to scan to distinct folders
3. add build step: execute shell

	```bash
	# config - remove this if you configure it via jenkins parameterized builds
	PATH_RIPS=rips-scanner
	PATH_REPORT=report
	FILE_REPORT=report.html
	PATH_TARGET=code
	RIPS_RECURSE_SUBDIR=1
	RIPS_VECTOR=all
	RIPS_VERBOSITY=2
	# copy dependencies
	mkdir -p report
	cp -r rips-scanner/css report
	cp -r rips-scanner/js report
	# run analysis
	echo "========================================================="
	echo "[**] running scan ... $PATH_TARGET"
	echo "========================================================="
	php $PATH_RIPS/index.php ignore_warning=1 loc=$PATH_TARGET subdirs=$RIPS_RECURSE_SUBDIR vector=$RIPS_VECTOR verbosity=$RIPS_VERBOSITY treestyle=1 stylesheet=ayti > $PATH_REPORT/$FILE_REPORT
	echo "========================================================="
	echo "[**] scan done ... check out $PATH_REPORT/$FILE_REPORT"
	echo "========================================================="
	```

4. add build step: execute python

	```python
	import os, sys
	import rips_stats as rips
	if __name__=="__main__":
	    report = os.path.join(os.environ.get("PATH_REPORT","report"),os.environ.get("FILE_REPORT","report.html"))
	    sys.exit(rips.main([report]))
	```

5. add post-build step: publish html, select folder 'report' name 'vulnerability-report'. A new clickable action icon 'vulnerability-report' will appear that points at the archived scan result.

## Development
The `community` branch of RIPS is forked from version 0.55 and is not officially supported by RIPS Technologies.

A completely rebuilt solution is available from RIPS Technologies that overcomes fundamental limitations in the open source version and performs state-of-the-art security analysis.

| Compared Feature | RIPS 0.5 | Next Generation |
| --- | --- | --- |
| Supported PHP Language | PHP 3-4, no OOP | all, PHP 3-7 |
| Static Code Analysis | Only Token-based | Full |
| Analysis Precision | Low | Very High |
| PHP Version Specific Analysis | No | Yes |
| Scales to Large Codesizes | No | Yes |
| API / CLI Support | No | Yes |
| Continuous Integration | No | Yes |
| Compliance / Standards | No | Yes |
| Store Analysis Results | No | Yes |
| Export Analysis Results | No | Yes |
| Issue Review System | No | Yes |
| Realtime Results | No | Yes |
| Vulnerability Trends | No | Yes |
| Detects Latest Risks | No | Yes |
| Detects Complex Vulnerabilities | Limited | Yes |
| Supported Issue Types | 15 | >140 |
| Speed | Fast | Fast |

Learn more about the next generation of RIPS at https://www.ripstech.com/product/datasheets/.


================================================
FILE: config/general.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/
	if (php_sapi_name() === 'cli')
		define("MODE_CLI",1);

	#error_reporting(E_ALL);
	error_reporting(E_ERROR | E_PARSE);
	// various settings making flush() work correctly
	if(function_exists('apache_setenv'))
		apache_setenv('no-gzip', 1);
	if (!defined("MODE_CLI"))
	    ini_set('zlib.output_compression', 0);
	ini_set('zlib.output_compression', 0);
	ini_set('implicit_flush', 0);
	ini_set('output_buffering', 0);

	ini_set('short_open_tag', 1);			// who knows if I use them ;)
	ini_set('auto_detect_line_endings', 1);	// detect newlines in MAC files
	ini_set("memory_limit","1000M");		// set memory size to 1G
	set_time_limit(0);						// 5 minutes

	if (extension_loaded('tokenizer') === false)
	{
		echo 'Please enable the PHP tokenizer extension to run RIPS.';
		exit;
	}

	define('VERSION', '0.55');				// RIPS version to be displayed
	define('MAXTRACE', 30);					// maximum of parameter traces per sensitive sink
	if (!defined("MODE_CLI"))
		define('WARNFILES', 50);			// warn user if amount of files to scan is higher than this value, also limits the graphs so they dont get too confusing and prevents browser hanging
	else
		define('WARNFILES', 500000);		// only warn if more than 500k files
	define('BASEDIR', '');					// default directory shown
	define('PHPDOC', 'http://php.net/');	// PHP documentation link
	define('MAX_ARRAY_ELEMENTS', 50);		// maximum array(1,2,3,4,...) elements to be indexed
	define('MAX_ARRAY_KEYS', 10);			// maximum array key $array[1][2][3][4]..
	define('PRELOAD_SHOW_LINE', 500);		// every X line a preloader information is added

	define('SCAN_REGISTER_GLOBALS', false);	// EXPERIMENTAL: scan as if register_globals=on

	$FILETYPES = array(						// filetypes to scan
		'.php',
		'.inc',
		'.phps',
		'.php4',
		'.php5',
		//'.html',
		//'.htm',
		//'.txt',
		'.phtml',
		'.tpl',
		'.cgi',
		'.test',
		'.module',
		'.plugin'
	);

	// available stylesheets (filename without .css ending)
	// more colors at http://wiki.macromates.com/Themes/UserSubmittedThemes
	$stylesheets = array(
		'print',
		'phps',
		'code-dark',
		'twilight',
		'espresso',
		'term',
		'barf',
		'notepad++',
		'ayti'
	);

	// track chosen stylesheet permanently
	if(isset($_POST['stylesheet']) && $_POST['stylesheet'] !== $_COOKIE['stylesheet'])
		$_COOKIE['stylesheet'] = $_POST['stylesheet'];
	$default_stylesheet = isset($_COOKIE['stylesheet']) ? $_COOKIE['stylesheet'] : 'ayti';
	setcookie("stylesheet", $default_stylesheet);

	$default_vector = 'all';


================================================
FILE: config/help.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

$HELP_XSS = array(
'description' => 'An attacker might execute arbitrary HTML/JavaScript Code in the clients browser context with this security vulnerability. User tainted data is embedded into the HTML output by the application and rendered by the users browser, thus allowing an attacker to embed and render malicious code. Preparing a malicious link will lead to an execution of this malicious code in another users browser context when clicking the link. This can lead to local website defacement, phishing or cookie stealing and session hijacking.',
'link' => 'https://www.owasp.org/index.php/XSS',
'code' => '<?php print("Hello " . $_GET["name"]); ?>',
'poc' => '/index.php?name=<script>alert(1)</script>',
'patchtext' => 'Encode all user tainted data with PHP buildin functions before embedding the data into the output. Make sure to set the parameter ENT_QUOTES to avoid an eventhandler injections to existing HTML attributes and specify the correct charset.',
'patch' => '<?php print("Hello " . htmlentities($_GET["name"], ENT_QUOTES, "utf-8"); ?>'
);

$HELP_HTTP_HEADER = array(
'description' => 'An attacker can inject arbitrary headers to the HTTP response header. This can be abused for a redirect when injecting a "Location:" header or help within a session fixation attack when the "Set-Cookie:" header is added. Additionally, the HTTP response can be overwritten and JavaScript can be injected leading to Cross-Site Scripting attacks. In PHP version below 4.4.2 or 5.1.2 the characters \n\r (LF CR) can be used for header line termination (cross-browser). In PHP below 5.4 the character \r (CR) can still be used for header line termination (Chrome, IE).',
'link' => 'https://www.owasp.org/index.php/HTTP_Response_Splitting',
'code' => '<?php header("Location: ".$_GET["url"]); ?>',
'poc' => '/index.php?url=a%0a%0dContent-Type:%20text/html%0a%0d%0a%0d<script>alert(1)</script>',
'patchtext' => 'Update PHP to prevent header injection or implement a whitelist.',
'patch' => '<?php if(!in_array($_GET["url"], $whitelist)) exit; ?>'
);

$HELP_SESSION_FIXATION = array(
'description' => 'An attacker can force a user to use a specific session id. Once the user logs in, the attacker can use the previously fixated session id to access the account.',
'link' => 'https://www.owasp.org/index.php/Session_fixation',
'code' => '<?php setcookie("PHPSESSID", $_GET["sessid"]); ?>',
'poc' => '/index.php?sessid=1f3870be274f6c49b3e31a0c6728957f',
'patchtext' => 'Do not use a session token supplied by the user.',
'patch' => 'No code.'
);

$HELP_CODE = array(
'description' => 'An attacker might execute arbitrary PHP code with this vulnerability. User tainted data is embedded into a function that compiles PHP code on the run and executes it thus allowing an attacker to inject own PHP code that will be executed. This vulnerability can lead to full server compromise.',
'link' => 'https://www.owasp.org/index.php/Code_Injection',
'code' => '<?php eval("\$color = \'" . $_GET["color"] . "\';"); ?>',
'poc' => '/index.php?color=\';phpinfo();//',
'patchtext' => 'Build a whitelist for positive code with regular expressions (e.g. alphanumeric only) or arrays. Do not try to blacklist for evil PHP code.',
'patch' => '<?php $colors = array("blue", "red"); if(!in_array($_GET["color"], $colors)) exit; ?>'
);

$HELP_REFLECTION = array(
'description' => 'An attacker might execute arbitrary functions with this vulnerability. User tainted data is used as a function name. This can lead to unexpected behaviour of the application.',
'link' => 'https://www.owasp.org/index.php/Reflection_injection',
'code' => '<?php call_user_func($_GET["func"]); ?>',
'poc' => '/index.php?func=phpinfo',
'patchtext' => 'Build a whitelist for allowed functions.',
'patch' => '<?php $funcs = array("test1", "test2"); if(!in_array($_GET["func"], $funcs)) exit; ?>'
);

$HELP_FILE_INCLUDE = array(
'description' => 'An attacker might include local or remote PHP files or read non-PHP files with this vulnerability. User tainted data is used when creating the file name that will be included into the current file. PHP code in this file will be evaluated, non-PHP code will be embedded to the output. This vulnerability can lead to full server compromise.',
'link' => 'http://websec.wordpress.com/2010/02/22/exploiting-php-file-inclusion-overview/',
'code' => '<?php include("includes/" . $_GET["file"]); ?>',
'poc' => '/index.php?file=../../../../../../../etc/passwd',
'patchtext' => 'Build a whitelist for positive file names. Do not only limit the file name to specific paths or extensions.',
'patch' => '<?php $files = array("index.php", "main.php"); if(!in_array($_GET["file"], $files)) exit; ?>'
);

$HELP_FILE_READ = array(
'description' => 'An attacker might read local files with this vulnerability. User tainted data is used when creating the file name that will be opened and read, thus allowing an attacker to read source code and other arbitrary files on the webserver that might lead to new attack vectors. In example the attacker can detect new vulnerabilities in source code files or read user credentials.',
'link' => '',
'code' => '<?php echo file_get_contents("files/" . $_GET["file"]); ?>',
'poc' => '/index.php?file=../../../../../../../etc/passwd',
'patchtext' => 'Build a whitelist for positive file names. Do not only limit the file name to specific paths or extensions.',
'patch' => '<?php $files = array("index.php", "main.php"); if(!in_array($_GET["file"], $files)) exit; ?>'
);

$HELP_FILE_AFFECT = array(
'description' => 'An attacker might write to arbitrary files or inject arbitrary code into a file with this vulnerability. User tainted data is used when creating the file name that will be opened or when creating the string that will be written to the file. An attacker can try to write arbitrary PHP code in a PHP file allowing to fully compromise the server.',
'link' => '',
'code' => '<?php $h = fopen($_GET["file"], "w"); fwrite($h, $_GET["data"]); ?>',
'poc' => '/index.php?file=shell.php&data=<?php phpinfo();?>',
'patchtext' => 'Build a whitelist for positive file names. Do not only limit the file name to specific paths or extensions. If you write into PHP files make sure an attacker can not write own PHP code. Use a whitelist with arrays or regular expressions (e.g. alphanumeric only).',
'patch' => '<?php $files = array("index.php", "main.php"); if(!in_array($_GET["file"], $files)) exit; ?>'
);

$HELP_EXEC = array(
'description' => 'An attacker might execute arbitrary system commands with this vulnerability. User tainted data is used when creating the command that will be executed on the underlying operating system. This vulnerability can lead to full server compromise.',
'link' => '',
'code' => '<?php exec("./crypto -mode " . $_GET["mode"]); ?>',
'poc' => '/index.php?mode=1;sleep 10;',
'patchtext' => 'Limit the code to a very strict character subset or build a whitelist of allowed commands. Do not try to filter for evil commands. Try to avoid the usage of system command executing functions if possible.',
'patch' => '<?php $modes = array("r", "w", "a"); if(!in_array($_GET["mode"], $modes)) exit; ?>'
);

$HELP_DATABASE = array(
'description' => 'An attacker might execute arbitrary SQL commands on the database server with this vulnerability. User tainted data is used when creating the database query that will be executed on the database management system (DBMS). An attacker can inject own SQL syntax thus initiate reading, inserting or deleting database entries or attacking the underlying operating system depending on the query, DBMS and configuration.',
'link' => 'https://www.owasp.org/index.php/SQL_Injection',
'code' => '<?php mysql_query("SELECT * FROM users WHERE id = " . $_GET["id"]); ?>',
'poc' => '/index.php?id=1 OR 1=1-- -',
'patchtext' => 'Always embed expected strings into quotes and escape the string with a PHP buildin function before embedding it to the query. Always embed expected integers without quotes and typecast the data to integer before embedding it to the query. Escaping data but embedding it without quotes is not safe.',
'patch' => '<?php mysql_query("SELECT * FROM users WHERE id = " . (int)$_GET["id"]); '."\n".' mysql_query("SELECT * FROM users WHERE name = \'" . mysql_real_escape_string($_GET["name"]) . "\'"); ?>'
);

$HELP_XPATH = array(
'description' => 'An attacker might execute arbitrary XPath expressions with this vulnerability. User tainted data is used when creating the XPath expression that will be executed on a XML resource. An attacker can inject own XPath syntax to read arbitrary XML entries.',
'link' => 'http://packetstormsecurity.org/files/view/33380/Blind_XPath_Injection_20040518.pdf',
'code' => '<?php $ctx->xpath_eval("//user[name/text()=\'" . $_GET["name"] . "\']/account/text()"); ?>',
'poc' => '/index.php?name=\' or \'\'=\'',
'patchtext' => 'Always embed expected strings into quotes and escape the string with a PHP buildin function before embedding it to the expression. Always embed expected integers without quotes and typecast the data to integer before embedding it to the expression. Escaping data but embedding it without quotes is not safe.',
'patch' => '<?php $ctx->xpath_eval("//user[name/text()=\'" . addslashes($_GET["name"]) . "\']/account/text()"); ?>'
);

$HELP_LDAP = array(
'description' => 'An attacker might execute arbitrary LDAP expressions with this vulnerability. User tainted data is used when creating a LDAP filter that will be executed on a LDAP server. An attacker can inject own LDAP syntax to read arbitrary LDAP entries.',
'link' => 'http://www.blackhat.com/presentations/bh-europe-08/Alonso-Parada/Whitepaper/bh-eu-08-alonso-parada-WP.pdf',
'code' => '<?php ldap_search($ds, $dn, "(&(sn=person)(person=".$_GET["person"]."))"); ?>',
'poc' => '/index.php?person=*',
'patchtext' => 'Expected strings are not embedded into quotes in LDAP. Limit the input character set to alphanumeric (if possible) to prevent an injection of filter syntax.',
'patch' => '<?php if(!preg_match(\'/^[a-z0-9]+$/\', $_GET["person"])) exit; ?>'
);

$HELP_CONNECT = array(
'description' => 'An attacker might change connection handling parameters or data that is being transfered with this vulnerability. User tainted data is used when selecting parameters or creating data that will be transfered thus allowing an attacker to change them. Depending on the type of connection this might lead to further attacks.',
'link' => '',
'code' => 'Can not be generalized.',
'poc' => 'Can not be generalized.',
'patchtext' => 'Can not be generalized.',
'patch' => 'Can not be generalized.'
);

$HELP_POP = array(
'description' => 'When userinput is parsed by the unserialize() function an attacker may abuse this by supplying serialized objects that will be used in the current application scope. These objects can only be instances of classes of this application. Several gadgets such as __wakeup() or __destruct() functions of those classes will be automatically called when the object is resurrected during the unserialization and object variables specified by the attacker may lead to vulnerabilities in those gadgets.',
'link' => 'https://media.blackhat.com/bh-us-10/presentations/Esser/BlackHat-USA-2010-Esser-Utilizing-Code-Reuse-Or-Return-Oriented-Programming-In-PHP-Application-Exploits-slides.pdf',
'code' => '<?php
class foo {
	public $file = "test.txt";
	public $data = "text";
	function __destruct()
	{
		file_put_contents($this->file, $this->data);
	}
}
$a = unserialize($_GET["s"]);
?>',
'poc' => '/index.php?s=O:3:"foo":2:{s:4:"file";s:9:"shell.php";s:4:"data";s:29:"<?php passthru($_GET["c"]);?>";}',
'patchtext' => 'Prevent using unserialize because it contains much more flaws.',
'patch' => 'No code.'
);


================================================
FILE: config/info.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

final class Info
{
	// interesting functions, output and comment them if seen
	public static $F_INTEREST = array(
		'phpinfo'						=> 'phpinfo() detected',
		'registerPHPFunctions'			=> 'registerPHPFunctions() allows code exec in XML',
		'session_start'					=> 'uses sessions',
		#'session_destroy'				=> 'session_destroy(), delete arbitrary file in PHP 5.1.2',
		'dbase_open' 					=> 'using DBMS dBase',
		'dbplus_open' 					=> 'using DBMS DB++',
		'dbplus_ropen' 					=> 'using DBMS DB++',
		'fbsql_connect' 				=> 'using DBMS FrontBase' ,
		'ifx_connect'					=> 'using DBMS Informix',
		'db2_connect'					=> 'using DBMS IBM DB2',
		'db2_pconnect'					=> 'using DBMS IBM DB2',
		'ftp_connect'					=> 'using FTP server',
		'ftp_ssl_connect' 				=> 'using FTP server',
		'ingres_connect'				=> 'using DBMS Ingres',
		'ingres_pconnect'				=> 'using DBMS Ingres',
		'ldap_connect'					=> 'using LDAP server',
		'msession_connect'	 			=> 'using msession server',
		'msql_connect'					=> 'using DBMS mSQL',
		'msql_pconnect'					=> 'using DBMS mSQL',
		'mssql_connect'					=> 'using DBMS MS SQL',
		'mssql_pconnect'				=> 'using DBMS MS SQL',
		'mysql_connect'					=> 'using DBMS MySQL',
		#'mysql_escape_string'			=> 'insecure mysql_escape_string',
		'mysql_pconnect'				=> 'using DBMS MySQL',
		'mysqli'						=> 'using DBMS MySQL, MySQLi Extension',
		'mysqli_connect'				=> 'using DBMS MySQL, MySQLi Extension',
		'mysqli_real_connect'			=> 'using DBMS MySQL, MySQLi Extension',
		'oci_connect'					=> 'using DBMS Oracle OCI8',
		'oci_new_connect'				=> 'using DBMS Oracle OCI8',
		'oci_pconnect'					=> 'using DBMS Oracle OCI8',
		'ocilogon'						=> 'using DBMS Oracle OCI8',
		'ocinlogon'						=> 'using DBMS Oracle OCI8',
		'ociplogon'						=> 'using DBMS Oracle OCI8',
		'ora_connect'					=> 'using DBMS Oracle',
		'ora_pconnect'					=> 'using DBMS Oracle',
		'ovrimos_connect'				=> 'using DBMS Ovrimos SQL',
		'pg_connect'					=> 'using DBMS PostgreSQL',
		'pg_pconnect'					=> 'using DBMS PostgreSQL',
		'sqlite_open'					=> 'using DBMS SQLite',
		'sqlite_popen'					=> 'using DBMS SQLite',
		'SQLite3'						=> 'using DBMS SQLite3',
		'sybase_connect'				=> 'using DBMS Sybase',
		'sybase_pconnect'				=> 'using DBMS Sybase',
		'TokyoTyrant'					=> 'using DBMS TokyoTyrant',
		'xptr_new_context'				=> 'using XML document',
		'xpath_new_context'				=> 'using XML document'
	);

	// interesting functions for POP/Unserialze
	public static $F_INTEREST_POP = array(
		'__autoload'					=> 'function __autoload',
		'__destruct'					=> 'POP gagdet __destruct',
		'__wakeup'						=> 'POP gagdet __wakeup',
		'__toString'					=> 'POP gagdet __toString',
		'__call'						=> 'POP gagdet __call',
		'__callStatic'					=> 'POP gagdet __callStatic',
		'__get'							=> 'POP gagdet __get',
		'__set'							=> 'POP gagdet __set',
		'__isset'						=> 'POP gagdet __isset',
		'__unset'						=> 'POP gagdet __unset'
	);

}


================================================
FILE: config/securing.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

	// securing functions in if-clause
	// list not used, all if clause dependencies detected anyway
	$F_SECURING_BOOL = array(
		'is_bool',
		'is_double',
		'is_float',
		'is_real',
		'is_long',
		'is_int',
		'is_integer',
		'is_null',
		'is_numeric',
		'is_finite',
		'is_infinite',
		'ctype_alnum',
		'ctype_alpha',
		'ctype_cntrl',
		'ctype_digit',
		'ctype_xdigit',
		'ctype_upper',
		'ctype_lower',
		'ctype_space',
		'in_array',
		'preg_match',
		'preg_match_all',
		'fnmatch',
		'ereg',
		'eregi'
	);

	// securing functions for every vulnerability
	$F_SECURING_STRING = array(
		'intval',
		'floatval',
		'doubleval',
		'filter_input',
		'urlencode',
		'rawurlencode',
		'round',
		'floor',
		'strlen',
		'strrpos',
		'strpos',
		'strftime',
		'strtotime',
		'md5',
		'md5_file',
		'sha1',
		'sha1_file',
		'crypt',
		'crc32',
		'hash',
		'mhash',
		'hash_hmac',
		'password_hash',
		'mcrypt_encrypt',
		'mcrypt_generic',
		'base64_encode',
		'ord',
		'sizeof',
		'count',
		'bin2hex',
		'levenshtein',
		'abs',
		'bindec',
		'decbin',
		'dechex',
		'decoct',
		'hexdec',
		'rand',
		'max',
		'min',
		'metaphone',
		'tempnam',
		'soundex',
		'money_format',
		'number_format',
		'date_format',
		'filetype',
		'nl_langinfo',
		'bzcompress',
		'convert_uuencode',
		'gzdeflate',
		'gzencode',
		'gzcompress',
		'http_build_query',
		'lzf_compress',
		'zlib_encode',
		'imap_binary',
		'iconv_mime_encode',
		'bson_encode',
		'sqlite_udf_encode_binary',
		'session_name',
		'readlink',
		'getservbyport',
		'getprotobynumber',
		'gethostname',
		'gethostbynamel',
		'gethostbyname',
	);

	// functions that insecures the string again
	$F_INSECURING_STRING = array(
		'base64_decode',
		'htmlspecialchars_decode',
		'html_entity_decode',
		'bzdecompress',
		'chr',
		'convert_uudecode',
		'gzdecode',
		'gzinflate',
		'gzuncompress',
		'lzf_decompress',
		'rawurldecode',
		'urldecode',
		'zlib_decode',
		'imap_base64',
		'imap_utf7_decode',
		'imap_mime_header_decode',
		'iconv_mime_decode',
		'iconv_mime_decode_headers',
		'hex2bin',
		'quoted_printable_decode',
		'imap_qprint',
		'mb_decode_mimeheader',
		'bson_decode',
		'sqlite_udf_decode_binary',
		'utf8_decode',
		'recode_string',
		'recode'
	);

	// securing functions for XSS
	$F_SECURING_XSS = array(
		'htmlentities',
		'htmlspecialchars',
		'highlight_string',
	);

	// securing functions for SQLi
	$F_SECURING_SQL = array(
		'addslashes',
		'dbx_escape_string',
		'db2_escape_string',
		'ingres_escape_string',
		'maxdb_escape_string',
		'maxdb_real_escape_string',
		'mysql_escape_string',
		'mysql_real_escape_string',
		'mysqli_escape_string',
		'mysqli_real_escape_string',
		'pg_escape_string',
		'pg_escape_bytea',
		'sqlite_escape_string',
		'sqlite_udf_encode_binary',
		'cubrid_real_escape_string',
	);

	// securing functions for RCE with e-modifier in preg_**
	$F_SECURING_PREG = array(
		'preg_quote'
	);

	// securing functions for file handling
	$F_SECURING_FILE = array(
		'basename',
		'dirname',
		'pathinfo'
	);

	// securing functions for OS command execution
	$F_SECURING_SYSTEM = array(
		'escapeshellarg',
		'escapeshellcmd'
	);

	// securing XPath injection
	$F_SECURING_XPATH = array(
		'addslashes'
	);

	// securing LDAP injection
	$F_SECURING_LDAP = array(
	);

	// all specific securings
	$F_SECURES_ALL = array_merge(
		$F_SECURING_XSS,
		$F_SECURING_SQL,
		$F_SECURING_PREG,
		$F_SECURING_FILE,
		$F_SECURING_SYSTEM,
		$F_SECURING_XPATH
	);

	// securing functions that work only when embedded in quotes
	$F_QUOTE_ANALYSIS = $F_SECURING_SQL;


================================================
FILE: config/sinks.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/


	// cross-site scripting affected functions
	// parameter = 0 means, all parameters will be traced
	$NAME_XSS = 'Cross-Site Scripting';
	$F_XSS = array(
		'echo'							=> array(array(0), $F_SECURING_XSS),
		'print'							=> array(array(1), $F_SECURING_XSS),
		'print_r'						=> array(array(1), $F_SECURING_XSS),
		'exit'							=> array(array(1), $F_SECURING_XSS),
		'die'							=> array(array(1), $F_SECURING_XSS),
		'printf'						=> array(array(0), $F_SECURING_XSS),
		'vprintf'						=> array(array(0), $F_SECURING_XSS),
		'trigger_error'					=> array(array(1), $F_SECURING_XSS),
		'user_error'					=> array(array(1), $F_SECURING_XSS),
		'odbc_result_all'				=> array(array(2), $F_SECURING_XSS),
		'ovrimos_result_all'			=> array(array(2), $F_SECURING_XSS),
		'ifx_htmltbl_result'			=> array(array(2), $F_SECURING_XSS)
	);

	// HTTP header injections
	$NAME_HTTP_HEADER = 'HTTP Response Splitting';
    $F_HTTP_HEADER = array(
		'header' 						=> array(array(1), array())
	);

	// session fixation
	$NAME_SESSION_FIXATION = 'Session Fixation';
    $F_SESSION_FIXATION = array(
		'setcookie' 					=> array(array(2), array()),
		'setrawcookie' 					=> array(array(2), array()),
		'session_id' 					=> array(array(1), array())
	);

	// code evaluating functions  => (parameters to scan, securing functions)
	// example parameter array(1,3) will trace only first and third parameter
	$NAME_CODE = 'Code Execution';
	$F_CODE = array(
		'assert' 						=> array(array(1), array()),
		'create_function' 				=> array(array(1,2), array()),
		'eval' 							=> array(array(1), array()),
		'mb_ereg_replace'				=> array(array(1,2), $F_SECURING_PREG),
		'mb_eregi_replace'				=> array(array(1,2), $F_SECURING_PREG),
		'preg_filter'					=> array(array(1,2), $F_SECURING_PREG),
		'preg_replace'					=> array(array(1,2), $F_SECURING_PREG),
		'preg_replace_callback'			=> array(array(1), $F_SECURING_PREG),
	);

	// reflection injection
	$NAME_REFLECTION = 'Reflection Injection';
	$F_REFLECTION = array(
		'event_buffer_new'				=> array(array(2,3,4), array()),
		'event_set'						=> array(array(4), array()),
		'iterator_apply'				=> array(array(2), array()),
		'forward_static_call'			=> array(array(1), array()),
		'forward_static_call_array'		=> array(array(1), array()),
		'call_user_func'				=> array(array(1), array()),
		'call_user_func_array'			=> array(array(1), array()),
		'array_diff_uassoc'				=> array(array(3), array()),
		'array_diff_ukey'				=> array(array(3), array()),
		'array_filter'					=> array(array(2), array()),
		'array_intersect_uassoc'		=> array(array(3), array()),
		'array_intersect_ukey'			=> array(array(3), array()),
		'array_map'						=> array(array(1), array()),
		'array_reduce'					=> array(array(2), array()),
		'array_udiff'					=> array(array(3), array()),
		'array_udiff_assoc'				=> array(array(3), array()),
		'array_udiff_uassoc'			=> array(array(3,4), array()),
		'array_uintersect'				=> array(array(3), array()),
		'array_uintersect_assoc'		=> array(array(3), array()),
		'array_uintersect_uassoc'		=> array(array(3,4), array()),
		'array_walk'					=> array(array(2), array()),
		'array_walk_recursive'			=> array(array(2), array()),
		'assert_options'				=> array(array(2), array()),
		'ob_start'						=> array(array(1), array()),
		'register_shutdown_function'	=> array(array(1), array()),
		'register_tick_function'		=> array(array(1), array()),
		'runkit_method_add'				=> array(array(1,2,3,4), array()),
		'runkit_method_copy'			=> array(array(1,2,3), array()),
		'runkit_method_redefine'		=> array(array(1,2,3,4), array()),
		'runkit_method_rename'			=> array(array(1,2,3), array()),
		'runkit_function_add'			=> array(array(1,2,3), array()),
		'runkit_function_copy'			=> array(array(1,2), array()),
		'runkit_function_redefine'		=> array(array(1,2,3), array()),
		'runkit_function_rename'		=> array(array(1,2), array()),
		'session_set_save_handler'		=> array(array(1,2,3,4,5), array()),
		'set_error_handler'				=> array(array(1), array()),
		'set_exception_handler'			=> array(array(1), array()),
		'spl_autoload'					=> array(array(1), array()),
		'spl_autoload_register'			=> array(array(1), array()),
		'sqlite_create_aggregate'		=> array(array(2,3,4), array()),
		'sqlite_create_function'		=> array(array(2,3), array()),
		'stream_wrapper_register'		=> array(array(2), array()),
		'uasort'						=> array(array(2), array()),
		'uksort'						=> array(array(2), array()),
		'usort'							=> array(array(2), array()),
		'yaml_parse'					=> array(array(4), array()),
		'yaml_parse_file'				=> array(array(4), array()),
		'yaml_parse_url'				=> array(array(4), array()),
		'eio_busy'						=> array(array(3), array()),
		'eio_chmod'						=> array(array(4), array()),
		'eio_chown'						=> array(array(5), array()),
		'eio_close'						=> array(array(3), array()),
		'eio_custom'					=> array(array(1,2), array()),
		'eio_dup2'						=> array(array(4), array()),
		'eio_fallocate'					=> array(array(6), array()),
		'eio_fchmod'					=> array(array(4), array()),
		'eio_fchown'					=> array(array(5), array()),
		'eio_fdatasync'					=> array(array(3), array()),
		'eio_fstat'						=> array(array(3), array()),
		'eio_fstatvfs'					=> array(array(3), array()),
		'preg_replace_callback'			=> array(array(2), array()),
		'dotnet_load'					=> array(array(1), array()),
	);

	// file inclusion functions => (parameters to scan, securing functions)
	$NAME_FILE_INCLUDE = 'File Inclusion';
	$F_FILE_INCLUDE = array(
		'include' 						=> array(array(1), $F_SECURING_FILE),
		'include_once' 					=> array(array(1), $F_SECURING_FILE),
		'parsekit_compile_file'			=> array(array(1), $F_SECURING_FILE),
		'php_check_syntax' 				=> array(array(1), $F_SECURING_FILE),
		'require' 						=> array(array(1), $F_SECURING_FILE),
		'require_once' 					=> array(array(1), $F_SECURING_FILE),
		'runkit_import'					=> array(array(1), $F_SECURING_FILE),
		'set_include_path' 				=> array(array(1), $F_SECURING_FILE),
		'virtual' 						=> array(array(1), $F_SECURING_FILE)
	);

	// file affecting functions  => (parameters to scan, securing functions)
	// file handler functions like fopen() are added as parameter
	// for functions that use them like fread() and fwrite()
	$NAME_FILE_READ = 'File Disclosure';
	$F_FILE_READ = array(
		'bzread'						=> array(array(1), $F_SECURING_FILE),
		'bzflush'						=> array(array(1), $F_SECURING_FILE),
		'dio_read'						=> array(array(1), $F_SECURING_FILE),
		'eio_readdir'					=> array(array(1), $F_SECURING_FILE),
		'fdf_open'						=> array(array(1), $F_SECURING_FILE),
		'file'							=> array(array(1), $F_SECURING_FILE),
		'file_get_contents'				=> array(array(1), $F_SECURING_FILE),
		'finfo_file'					=> array(array(1,2), array()),
		'fflush'						=> array(array(1), $F_SECURING_FILE),
		'fgetc'							=> array(array(1), $F_SECURING_FILE),
		'fgetcsv'						=> array(array(1), $F_SECURING_FILE),
		'fgets'							=> array(array(1), $F_SECURING_FILE),
		'fgetss'						=> array(array(1), $F_SECURING_FILE),
		'fread'							=> array(array(1), $F_SECURING_FILE),
		'fpassthru'						=> array(array(1,2), array()),
		'fscanf'						=> array(array(1), $F_SECURING_FILE),
		'ftok'							=> array(array(1), $F_SECURING_FILE),
		'get_meta_tags'					=> array(array(1), $F_SECURING_FILE),
		'glob'							=> array(array(1), array()),
		'gzfile'						=> array(array(1), $F_SECURING_FILE),
		'gzgetc'						=> array(array(1), $F_SECURING_FILE),
		'gzgets'						=> array(array(1), $F_SECURING_FILE),
		'gzgetss'						=> array(array(1), $F_SECURING_FILE),
		'gzread'						=> array(array(1), $F_SECURING_FILE),
		'gzpassthru'					=> array(array(1), $F_SECURING_FILE),
		'highlight_file'				=> array(array(1), $F_SECURING_FILE),
		'imagecreatefrompng'			=> array(array(1), $F_SECURING_FILE),
		'imagecreatefromjpg'			=> array(array(1), $F_SECURING_FILE),
		'imagecreatefromgif'			=> array(array(1), $F_SECURING_FILE),
		'imagecreatefromgd2'			=> array(array(1), $F_SECURING_FILE),
		'imagecreatefromgd2part'		=> array(array(1), $F_SECURING_FILE),
		'imagecreatefromgd'				=> array(array(1), $F_SECURING_FILE),
		'opendir'						=> array(array(1), $F_SECURING_FILE),
		'parse_ini_file' 				=> array(array(1), $F_SECURING_FILE),
		'php_strip_whitespace'			=> array(array(1), $F_SECURING_FILE),
		'readfile'						=> array(array(1), $F_SECURING_FILE),
		'readgzfile'					=> array(array(1), $F_SECURING_FILE),
		'readlink'						=> array(array(1), $F_SECURING_FILE),
		//'stat'						=> array(array(1), array()),
		'scandir'						=> array(array(1), $F_SECURING_FILE),
		'show_source'					=> array(array(1), $F_SECURING_FILE),
		'simplexml_load_file'			=> array(array(1), $F_SECURING_FILE),
		'stream_get_contents'			=> array(array(1), $F_SECURING_FILE),
		'stream_get_line'				=> array(array(1), $F_SECURING_FILE),
		'xdiff_file_bdiff'				=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_bpatch'				=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_diff_binary'		=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_diff'				=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_merge3'				=> array(array(1,2,3), $F_SECURING_FILE),
		'xdiff_file_patch_binary'		=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_patch'				=> array(array(1,2), $F_SECURING_FILE),
		'xdiff_file_rabdiff'			=> array(array(1,2), $F_SECURING_FILE),
		'yaml_parse_file'				=> array(array(1), $F_SECURING_FILE),
		'zip_open'						=> array(array(1), $F_SECURING_FILE)
	);

	// file or file system affecting functions
	$NAME_FILE_AFFECT = 'File Manipulation';
	$F_FILE_AFFECT = array(
		'bzwrite'						=> array(array(2), array()),
		'chmod'							=> array(array(1), $F_SECURING_FILE),
		'chgrp'							=> array(array(1), $F_SECURING_FILE),
		'chown'							=> array(array(1), $F_SECURING_FILE),
		'copy'							=> array(array(1), array()),
		'dio_write'						=> array(array(1,2), array()),
		'eio_chmod'						=> array(array(1), $F_SECURING_FILE),
		'eio_chown'						=> array(array(1), $F_SECURING_FILE),
		'eio_mkdir'						=> array(array(1), $F_SECURING_FILE),
		'eio_mknod'						=> array(array(1), $F_SECURING_FILE),
		'eio_rmdir'						=> array(array(1), $F_SECURING_FILE),
		'eio_write'						=> array(array(1,2), array()),
		'eio_unlink'					=> array(array(1), $F_SECURING_FILE),
		'error_log'						=> array(array(3), $F_SECURING_FILE),
		'event_buffer_write'			=> array(array(2), array()),
		'file_put_contents'				=> array(array(1,2), $F_SECURING_FILE),
		'fputcsv'						=> array(array(1,2), $F_SECURING_FILE),
		'fputs'							=> array(array(1,2), $F_SECURING_FILE),
		'fprintf'						=> array(array(0), array()),
		'ftruncate'						=> array(array(1), $F_SECURING_FILE),
		'fwrite'						=> array(array(1,2), $F_SECURING_FILE),
		'gzwrite'						=> array(array(1,2), array()),
		'gzputs'						=> array(array(1,2), array()),
		'loadXML'						=> array(array(1), array()),
		'mkdir'							=> array(array(1), array()),
		'move_uploaded_file'			=> array(array(1,2), $F_SECURING_FILE),
		'posix_mknod'					=> array(array(1), $F_SECURING_FILE),
		'recode_file'					=> array(array(2,3), $F_SECURING_FILE),
		'rename'						=> array(array(1,2), $F_SECURING_FILE),
		'rmdir'							=> array(array(1), $F_SECURING_FILE),
		'shmop_write'					=> array(array(2), array()),
		'touch'							=> array(array(1), $F_SECURING_FILE),
		'unlink'						=> array(array(1), $F_SECURING_FILE),
		'vfprintf'						=> array(array(0), array()),
		'xdiff_file_bdiff'				=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_bpatch'				=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_diff_binary'		=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_diff'				=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_merge3'				=> array(array(4), $F_SECURING_FILE),
		'xdiff_file_patch_binary'		=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_patch'				=> array(array(3), $F_SECURING_FILE),
		'xdiff_file_rabdiff'			=> array(array(3), $F_SECURING_FILE),
		'yaml_emit_file'				=> array(array(1,2), $F_SECURING_FILE),
	);

	// OS Command executing functions => (parameters to scan, securing functions)
	$NAME_EXEC = 'Command Execution';
	$F_EXEC = array(
		'backticks'						=> array(array(1), $F_SECURING_SYSTEM), # transformed during parsing
		'exec'							=> array(array(1), $F_SECURING_SYSTEM),
		'expect_popen'					=> array(array(1), $F_SECURING_SYSTEM),
		'passthru'						=> array(array(1), $F_SECURING_SYSTEM),
		'pcntl_exec'					=> array(array(1), $F_SECURING_SYSTEM),
		'popen'							=> array(array(1), $F_SECURING_SYSTEM),
		'proc_open'						=> array(array(1), $F_SECURING_SYSTEM),
		'shell_exec'					=> array(array(1), $F_SECURING_SYSTEM),
		'system'						=> array(array(1), $F_SECURING_SYSTEM),
		'mail'							=> array(array(5), array()), // http://esec-pentest.sogeti.com/web/using-mail-remote-code-execution
		'mb_send_mail'					=> array(array(5), array()),
		'w32api_invoke_function'		=> array(array(1), array()),
		'w32api_register_function'		=> array(array(2), array()),
	);

	// SQL executing functions => (parameters to scan, securing functions)
	$NAME_DATABASE = 'SQL Injection';
	$F_DATABASE = array(
	// Abstraction Layers
		'dba_open'						=> array(array(1), array()),
		'dba_popen'						=> array(array(1), array()),
		'dba_insert'					=> array(array(1,2), array()),
		'dba_fetch'						=> array(array(1), array()),
		'dba_delete'					=> array(array(1), array()),
		'dbx_query'						=> array(array(2), $F_SECURING_SQL),
		'odbc_do'						=> array(array(2), $F_SECURING_SQL),
		'odbc_exec'						=> array(array(2), $F_SECURING_SQL),
		'odbc_execute'					=> array(array(2), $F_SECURING_SQL),
	// Vendor Specific
		'db2_exec' 						=> array(array(2), $F_SECURING_SQL),
		'db2_execute'					=> array(array(2), $F_SECURING_SQL),
		'fbsql_db_query'				=> array(array(2), $F_SECURING_SQL),
		'fbsql_query'					=> array(array(1), $F_SECURING_SQL),
		'ibase_query'					=> array(array(2), $F_SECURING_SQL),
		'ibase_execute'					=> array(array(1), $F_SECURING_SQL),
		'ifx_query'						=> array(array(1), $F_SECURING_SQL),
		'ifx_do'						=> array(array(1), $F_SECURING_SQL),
		'ingres_query'					=> array(array(2), $F_SECURING_SQL),
		'ingres_execute'				=> array(array(2), $F_SECURING_SQL),
		'ingres_unbuffered_query'		=> array(array(2), $F_SECURING_SQL),
		'msql_db_query'					=> array(array(2), $F_SECURING_SQL),
		'msql_query'					=> array(array(1), $F_SECURING_SQL),
		'msql'							=> array(array(2), $F_SECURING_SQL),
		'mssql_query'					=> array(array(1), $F_SECURING_SQL),
		'mssql_execute'					=> array(array(1), $F_SECURING_SQL),
		'mysql_db_query'				=> array(array(2), $F_SECURING_SQL),
		'mysql_query'					=> array(array(1), $F_SECURING_SQL),
		'mysql_unbuffered_query'		=> array(array(1), $F_SECURING_SQL),
		'mysqli_stmt_execute'			=> array(array(1), $F_SECURING_SQL),
		'mysqli_query'					=> array(array(2), $F_SECURING_SQL),
		'mysqli_real_query'				=> array(array(1), $F_SECURING_SQL),
		'mysqli_master_query'			=> array(array(2), $F_SECURING_SQL),
		'oci_execute'					=> array(array(1), array()),
		'ociexecute'					=> array(array(1), array()),
		'ovrimos_exec'					=> array(array(2), $F_SECURING_SQL),
		'ovrimos_execute'				=> array(array(2), $F_SECURING_SQL),
		'ora_do'						=> array(array(2), array()),
		'ora_exec'						=> array(array(1), array()),
		'pg_query'						=> array(array(2), $F_SECURING_SQL),
		'pg_send_query'					=> array(array(2), $F_SECURING_SQL),
		'pg_send_query_params'			=> array(array(2), $F_SECURING_SQL),
		'pg_send_prepare'				=> array(array(3), $F_SECURING_SQL),
		'pg_prepare'					=> array(array(3), $F_SECURING_SQL),
		'sqlite_open'					=> array(array(1), $F_SECURING_SQL),
		'sqlite_popen'					=> array(array(1), $F_SECURING_SQL),
		'sqlite_array_query'			=> array(array(1,2), $F_SECURING_SQL),
		'arrayQuery'					=> array(array(1,2), $F_SECURING_SQL),
		'singleQuery'					=> array(array(1), $F_SECURING_SQL),
		'sqlite_query'					=> array(array(1,2), $F_SECURING_SQL),
		'sqlite_exec'					=> array(array(1,2), $F_SECURING_SQL),
		'sqlite_single_query'			=> array(array(2), $F_SECURING_SQL),
		'sqlite_unbuffered_query'		=> array(array(1,2), $F_SECURING_SQL),
		'sybase_query'					=> array(array(1), $F_SECURING_SQL),
		'sybase_unbuffered_query'		=> array(array(1), $F_SECURING_SQL)
	);

	// xpath injection
	$NAME_XPATH = 'XPath Injection';
	$F_XPATH = array(
		'xpath_eval'					=> array(array(2), $F_SECURING_XPATH),
		'xpath_eval_expression'			=> array(array(2), $F_SECURING_XPATH),
		'xptr_eval'						=> array(array(2), $F_SECURING_XPATH)
	);

	// ldap injection
	$NAME_LDAP = 'LDAP Injection';
	$F_LDAP = array(
		'ldap_add'						=> array(array(2,3), $F_SECURING_LDAP),
		'ldap_delete'					=> array(array(2), $F_SECURING_LDAP),
		'ldap_list'						=> array(array(3), $F_SECURING_LDAP),
		'ldap_read'						=> array(array(3), $F_SECURING_LDAP),
		'ldap_search'					=> array(array(3), $F_SECURING_LDAP)
	);

	// connection handling functions
	$NAME_CONNECT = 'Protocol Injection';
    $F_CONNECT = array(
		'curl_setopt'					=> array(array(2,3), array()),
		'curl_setopt_array' 			=> array(array(2), array()),
		'cyrus_query' 					=> array(array(2), array()),
		'error_log'						=> array(array(3), array()),
		'fsockopen'						=> array(array(1), array()),
		'ftp_chmod' 					=> array(array(2,3), array()),
		'ftp_exec'						=> array(array(2), array()),
		'ftp_delete' 					=> array(array(2), array()),
		'ftp_fget' 						=> array(array(3), array()),
		'ftp_get'						=> array(array(2,3), array()),
		'ftp_nlist' 					=> array(array(2), array()),
		'ftp_nb_fget' 					=> array(array(3), array()),
		'ftp_nb_get' 					=> array(array(2,3), array()),
		'ftp_nb_put'					=> array(array(2), array()),
		'ftp_put'						=> array(array(2,3), array()),
		'get_headers'					=> array(array(1), array()),
		'imap_open'						=> array(array(1), array()),
		'imap_mail'						=> array(array(1), array()),
		'mail' 							=> array(array(1,4), array()),
		'mb_send_mail'					=> array(array(1,4), array()),
		'ldap_connect'					=> array(array(1), array()),
		'msession_connect'				=> array(array(1), array()),
		'pfsockopen'					=> array(array(1), array()),
		'session_register'				=> array(array(0), array()),
		'socket_bind'					=> array(array(2), array()),
		'socket_connect'				=> array(array(2), array()),
		'socket_send'					=> array(array(2), array()),
		'socket_write'					=> array(array(2), array()),
		'stream_socket_client'			=> array(array(1), array()),
		'stream_socket_server'			=> array(array(1), array()),
		'printer_open'					=> array(array(1), array())
	);

	// other critical functions
	$NAME_OTHER = 'Possible Flow Control'; // :X
	$F_OTHER = array(
		'dl' 							=> array(array(1), array()),
		'ereg'							=> array(array(2), array()), # nullbyte injection affected
		'eregi'							=> array(array(2), array()), # nullbyte injection affected
		'ini_set' 						=> array(array(1,2), array()),
		'ini_restore'					=> array(array(1), array()),
		'runkit_constant_redefine'		=> array(array(1,2), array()),
		'runkit_method_rename'			=> array(array(1,2,3), array()),
		'sleep'							=> array(array(1), array()),
		'usleep'						=> array(array(1), array()),
		'extract'						=> array(array(1), array()),
		'mb_parse_str'					=> array(array(1), array()),
		'parse_str'						=> array(array(1), array()),
		'putenv'						=> array(array(1), array()),
		'set_include_path'				=> array(array(1), array()),
		'apache_setenv'					=> array(array(1,2), array()),
		'define'						=> array(array(1), array()),
		'is_a'							=> array(array(1), array()) // calls __autoload()
	);

	// property oriented programming with unserialize
	$NAME_POP = 'PHP Object Injection';
	$F_POP = array(
		'unserialize'					=> array(array(1), array()), // calls gadgets
		'yaml_parse'					=> array(array(1), array())	 // calls unserialize
	);

	// XML
	//simplexml_load_string


	# interruption vulnerabilities
	# trim(), rtrim(), ltrim(), explode(), strchr(), strstr(), substr(), chunk_split(), strtok(), addcslashes(), str_repeat() htmlentities() htmlspecialchars(), unset()


================================================
FILE: config/sources.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

final class Sources
{
	// userinput variables
	public static $V_USERINPUT = array(
		'$_GET',
		'$_POST',
		'$_COOKIE',
		'$_REQUEST',
		'$_FILES',
		'$_SERVER',
		'$HTTP_GET_VARS',
		'$HTTP_POST_VARS',
		'$HTTP_COOKIE_VARS',
		'$HTTP_REQUEST_VARS',
		'$HTTP_POST_FILES',
		'$HTTP_SERVER_VARS',
		'$HTTP_RAW_POST_DATA',
		'$argc',
		'$argv'
	);

	public static $V_SERVER_PARAMS = array(
		'HTTP_ACCEPT',
		'HTTP_ACCEPT_LANGUAGE',
		'HTTP_ACCEPT_ENCODING',
		'HTTP_ACCEPT_CHARSET',
		'HTTP_CONNECTION',
		'HTTP_HOST',
		'HTTP_KEEP_ALIVE',
		'HTTP_REFERER',
		'HTTP_USER_AGENT',
		'HTTP_X_FORWARDED_FOR',
		// all HTTP_ headers can be tainted
		'PHP_AUTH_DIGEST',
		'PHP_AUTH_USER',
		'PHP_AUTH_PW',
		'AUTH_TYPE',
		'QUERY_STRING',
		'REQUEST_METHOD',
		'REQUEST_URI', // partly urlencoded
		'PATH_INFO',
		'ORIG_PATH_INFO',
		'PATH_TRANSLATED',
		'REMOTE_HOSTNAME',
		'PHP_SELF'
	);

	// file content as input
	public static $F_FILE_INPUT = array(
		'bzread',
		'dio_read',
		'exif_imagetype',
		'exif_read_data',
		'exif_thumbnail',
		'fgets',
		'fgetss',
		'file',
		'file_get_contents',
		'fread',
		'get_meta_tags',
		'glob',
		'gzread',
		'readdir',
		'read_exif_data',
		'scandir',
		'zip_read'
	);

	// database content as input
	public static $F_DATABASE_INPUT = array(
		'mysql_fetch_array',
		'mysql_fetch_assoc',
		'mysql_fetch_field',
		'mysql_fetch_object',
		'mysql_fetch_row',
		'pg_fetch_all',
		'pg_fetch_array',
		'pg_fetch_assoc',
		'pg_fetch_object',
		'pg_fetch_result',
		'pg_fetch_row',
		'sqlite_fetch_all',
		'sqlite_fetch_array',
		'sqlite_fetch_object',
		'sqlite_fetch_single',
		'sqlite_fetch_string'
	);

	// other functions as input
	public static $F_OTHER_INPUT = array(
		'get_headers',
		'getallheaders',
		'get_browser',
		'getenv',
		'gethostbyaddr',
		'runkit_superglobals',
		'import_request_variables'
	);

	//	'getenv' and 'apache_getenv'
	// will be automatically added if 'putenv' or 'apache_setenv' with userinput is found
}


================================================
FILE: config/tokens.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

// define own token for include ending
define('T_INCLUDE_END', 10000);

// added in php 5.3
if ( ! defined('T_GOTO'))                                     define('T_GOTO', 10001);
if ( ! defined('T_NAMESPACE'))                                define('T_NAMESPACE', 10002);
if ( ! defined('T_NS_C'))                                     define('T_NS_C', 10003);
if ( ! defined('T_NS_SEPARATOR'))                             define('T_NS_SEPARATOR', 10004);
if ( ! defined('T_USE'))                                      define('T_USE', 10005);

// added in php 5.4
if ( ! defined('T_INSTEADOF'))                                define('T_INSTEADOF', 10006);
if ( ! defined('T_TRAIT'))                                    define('T_TRAIT', 10007);
if ( ! defined('T_TRAIT_C'))                                  define('T_TRAIT_C', 10008);

// added in php 5.5
if ( ! defined('T_FINALLY'))                                  define('T_FINALLY', 10009);
if ( ! defined('T_YIELD'))                                    define('T_YIELD', 10010);
if ( ! defined('T_YIELD_FROM'))                               define('T_YIELD_FROM', 10011);

// added in php 5.6
if ( ! defined('T_ELLIPSIS'))                                 define('T_ELLIPSIS', 10012);
if ( ! defined('T_POW'))                                      define('T_POW', 10013);
if ( ! defined('T_POW_EQUAL'))                                define('T_POW_EQUAL', 10014);

// added in php 7.0
if ( ! defined('T_COALESCE'))                                 define('T_COALESCE', 10015);
if ( ! defined('T_SPACESHIP'))                                define('T_SPACESHIP', 10016);

// added in php 7.4
if ( ! defined('T_COALESCE_EQUAL'))                           define('T_COALESCE_EQUAL', 10017);
if ( ! defined('T_FN'))                                       define('T_FN', 10018);

// added in php 8.0
if ( ! defined('T_ATTRIBUTE'))                                define('T_ATTRIBUTE', 10019);
if ( ! defined('T_MATCH'))                                    define('T_MATCH', 10020);
if ( ! defined('T_NAME_FULLY_QUALIFIED'))                     define('T_NAME_FULLY_QUALIFIED', 10021);
if ( ! defined('T_NAME_QUALIFIED'))                           define('T_NAME_QUALIFIED', 10022);
if ( ! defined('T_NAME_RELATIVE'))                            define('T_NAME_RELATIVE', 10023);
if ( ! defined('T_NULLSAFE_OBJECT_OPERATOR'))                 define('T_NULLSAFE_OBJECT_OPERATOR', 10024);

// added in php 8.1
if ( ! defined('T_ENUM'))                                     define('T_ENUM', 10025);
if ( ! defined('T_READONLY'))                                 define('T_READONLY', 10026);
if ( ! defined('T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG'))  define('T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG', 10027);
if ( ! defined('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG'))      define('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG', 10028);

final class Tokens
{
	// tokens to ignore while scanning
	public static $T_IGNORE = array(
		T_BAD_CHARACTER,
		T_DOC_COMMENT,
		T_COMMENT,
		//T_ML_COMMENT,
		T_INLINE_HTML,
		T_WHITESPACE,
		T_OPEN_TAG,
		//T_CLOSE_TAG,
	);

	// code blocks that should be ignored as requirement
	public static $T_LOOP_CONTROL = array(
		//T_DO, // removed, because DO..WHILE is rewritten to WHILE
		T_WHILE,
		T_FOR,
		T_FOREACH,
	);

	// control structures
	public static $T_FLOW_CONTROL = array(
		T_IF,
		T_SWITCH,
		T_CASE,
		T_ELSE,
		T_ELSEIF,
	);

	// variable assignment tokens
	public static $T_ASSIGNMENT = array(
		T_AND_EQUAL,
		T_CONCAT_EQUAL,
		T_DIV_EQUAL,
		T_MINUS_EQUAL,
		T_MOD_EQUAL,
		T_MUL_EQUAL,
		T_OR_EQUAL,
		T_PLUS_EQUAL,
		T_POW_EQUAL,
		T_SL_EQUAL,
		T_SR_EQUAL,
		T_XOR_EQUAL,
		T_COALESCE_EQUAL,
	);

	// variable assignment tokens that prevent tainting
	public static $T_ASSIGNMENT_SECURE = array(
		T_DIV_EQUAL,
		T_MINUS_EQUAL,
		T_MOD_EQUAL,
		T_MUL_EQUAL,
		T_OR_EQUAL,
		T_PLUS_EQUAL,
		T_POW_EQUAL,
		T_SL_EQUAL,
		T_SR_EQUAL,
		T_XOR_EQUAL,
	);

	// condition operators
	public static $T_OPERATOR = array(
		T_IS_EQUAL,
		T_IS_GREATER_OR_EQUAL,
		T_IS_IDENTICAL,
		T_IS_NOT_EQUAL,
		T_IS_NOT_IDENTICAL,
		T_IS_SMALLER_OR_EQUAL,
		T_SPACESHIP,
		T_COALESCE,
	);

	// all function call tokens
	public static $T_FUNCTIONS = array(
		T_STRING, // all functions
		T_EVAL,
		T_INCLUDE,
		T_INCLUDE_ONCE,
		T_REQUIRE,
		T_REQUIRE_ONCE,
	);

	// including operation tokens
	public static $T_INCLUDES = array(
		T_INCLUDE,
		T_INCLUDE_ONCE,
		T_REQUIRE,
		T_REQUIRE_ONCE,
	);

	// XSS affected operation tokens
	public static $T_XSS = array(
		T_PRINT,
		T_ECHO,
		T_OPEN_TAG_WITH_ECHO,
		T_EXIT,
	);

	// securing operation tokens
	public static $T_CASTS = array(
		T_BOOL_CAST,
		T_DOUBLE_CAST,
		T_INT_CAST,
		T_UNSET_CAST,
		T_UNSET,
	);

	// tokens that will have a space before and after in the output, besides $T_OPERATOR and $T_ASSIGNMENT
	public static $T_SPACE_WRAP = array(
		T_AS,
		T_BOOLEAN_AND,
		T_BOOLEAN_OR,
		T_LOGICAL_AND,
		T_LOGICAL_OR,
		T_LOGICAL_XOR,
		T_SL,
		T_SR,
		T_CASE,
		T_ELSE,
		T_GLOBAL,
		T_NEW,
	);

	// arithmetical operators to detect automatic typecasts
	public static $T_ARITHMETIC = array(
		T_INC,
		T_DEC,
	);

	// arithmetical operators to detect automatic typecasts
	public static $S_ARITHMETIC = array(
		'+',
		'-',
		'*',
		'/',
		'%',
		T_POW,
	);

	// strings that will have a space before and after in the output besides $S_ARITHMETIC
	public static $S_SPACE_WRAP = array(
		'.',
		'=',
		'>',
		'<',
		':',
		'?',
	);
}


================================================
FILE: css/ayti.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.vulnblock {
	background-color:#223344;
	color:#FFCC44;
	font-weight:bold;
}

.codebox {
	margin-bottom: 10px;
	background-color: #101820;
}

.windowcontent, .filecanvas, #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #101820;
}

.markline {
	background-color: #334455;
}

.requires
	{color: #D2A8A1; font-weight:bold;}

.linenr
	{color: #888;}

.link
	{color: #6262F0; font-weight:bold;}

.vulntitle, .code {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: white;  }

.phps-t-string,
.phps-t-eval,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-try,
.phps-t-catch,
.phps-t-exit,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc
	{color: #FFFFFF;}
/*E1E1F9*/

.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-if,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-else,
.phps-t-elseif,
.phps-t-switch,
.phps-t-use,
.phps-t-var,
.phps-t-inc,
.phps-t-dec,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c, .phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #9467FC;}

.phps-t-const
	{color: #CF6A4C;}

.phps-t-variable,
.phps-t-variable-marked,
.phps-t-string-varname,
.funclistline
	{color: #768FEB;}

.phps-t-variable-marked
	{background-color:darkred;}

.phps-tainted-var
	{color: #AAC8FD;}

.phps-t-lnumber
	{color: #CF6A4C}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #FFCE42;}
/* FFCE42 */
.phps-t-inline-html
	{color: #FFCE42;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #3F4852}


================================================
FILE: css/barf.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.menu {
	background-color: #1D261B;
}

input[type="text"],select {
	color: #000 !important;
	background: #99A298 !important;
}


.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.codebox {
	margin-bottom: 10px;
	background-color: #0D1219;
}

.vulnblock {
	background-color:#283325;
	color:#94F877;
	font-weight:bold;
}

.windowcontent, #funccodecontent, #funccodetitle, .funclistcontent  {
	background-color: #0D1219;
}

.markline {
	background-color: #243245;
}

.requires
	{color: #697B8F; font-weight:bold;}

.linenr
	{color: #888;}

.link
	{color: #EEF2F7; font-weight:bold;}

.code, .vulntitle {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: #EEF2F7; }

.phps-t-string,
.phps-t-eval,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-exit,
.phps-t-try,
.phps-t-catch,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc,
.phps-t-if,
.phps-t-for,
.phps-t-foreach,
.phps-t-else,
.phps-t-elseif,
.phps-t-switch,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c, .phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #EFF3F8;}

.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-inc,
.phps-t-dec,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-exclaim,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-use,
.phps-t-var
	{color: #697A8E;}

.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-const,
.phps-t-return
	{color: #94F877;}

.phps-t-variable, .phps-t-string-varname, .funclistline, .phps-t-variable-marked
	{color: #708E67;}

.phps-t-variable-marked
	{background-color:darkred;}

.phps-tainted-var
	{color: #7FC16B;}

.phps-t-lnumber
	{color: #EEF2F7}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #5C81B3;}

.phps-t-inline-html
	{color: #F9EE98;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #6E6E6E;}


================================================
FILE: css/code-dark.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.menu {
	background-color:#010101;
}


input[type="text"],select {
	color: #000 !important;
	background-color:#797979 !important;
}

.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.codebox {
	margin-bottom: 10px;
	background-color: #222222;
}

.vulnblock {
	background-color:#111111;
	color:#FBFB97;
	font-weight:bold;
}

.windowcontent , #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #222222;
}


.code, .vulntitle
	{font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace; font-size:9pt; }

.markline {
	background-color: #531107;
}

.requires,
.linenr
	{color: #888888;}

.link
	{color:#D78787; font-weight:bold; text-decoration:underline;}

.code,
.phps-code,
.phps-t-dollar-open-curly-braces,
.phps-t-curly-open,
.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-inc,
.phps-t-dec,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim
	{color: #D78787;}

.phps-t-if,
.phps-t-while,
.phps-t-do,
.phps-t-exit,
.phps-t-try,
.phps-t-catch,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-logical-or,
.phps-t-logical-and,
.phps-t-xor,
.phps-t-global,
.phps-t-and,
.phps-t-isset,
.phps-t-empty,
.phps-t-unset,
.phps-t-else,
.phps-t-elseif,
.phps-t-switch,
.phps-t-array,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c, .phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #87AFD7;}

.phps-t-variable, .phps-t-string-varname, .funclistline, .phps-t-variable-marked
	{color: #AFAFD7;}

.phps-t-variable-marked
	{background-color:darkred;}

.phps-tainted-var
	{color: #5959E2;}

.phps-t-string,
.phps-t-eval,
.phps-t-const
	{color: #D7AFD7;}

.phps-t-lnumber
	{color: #D7AF87;}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #FFFFAF;}

.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-use
	{color: #AFD787;}

.phps-t-inline-html
	{color: #D0D0D0;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #808080}


================================================
FILE: css/espresso.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.menu {
	background-color: #351F12;
}


input[type="text"],select {
	color: #000 !important;
	background: #968B85 !important;
}


.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.codebox {
	margin-bottom: 10px;
	background-color: #2A211C;
}

.vulnblock {
	background-color:#23150D;
	color:#049B0A;
	font-weight:bold;
}

.windowcontent , #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #2A211C;
}

.markline {
	background-color: #1E3F06;
}

.requires
	{color: #43A8ED; font-weight:bold;}

.linenr
	{color: #888;}

.link
	{color: #2F5FE0; font-weight:bold;}

.code, .vulntitle {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: #BDAE9D; }

.phps-t-string,
.phps-t-eval,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-exit,
.phps-t-try,
.phps-t-catch,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc
	{color: #FFCE42;}


.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-inc,
.phps-t-dec,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-if,
.phps-t-switch,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-else,
.phps-t-elseif,
.phps-t-use,
.phps-t-var,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c, .phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #43A8ED; font-weight: bold; }

.phps-t-const
	{color: #C5656B;}

.phps-t-variable, .phps-t-string-varname, .funclistline, .phps-tainted-var
	{color: #0066FF;}

.phps-t-variable-marked
	{background-color:darkred;color:#4B91FB;}

.phps-tainted-var
	{color: #4B91FB;}

.phps-t-lnumber
	{color: #C4BDA1;}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #EEEEEE;}

.phps-t-inline-html
	{color: #F9EE98;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #534A44; font-style: italic;}


================================================
FILE: css/notepad++.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

body, html {
	color: #111111;
}

.textcolor {
	color: #ffffff;
}

.darkcolor {
	color: black;
}

.userinput, .persistent {
	list-style-type: disc;
	color:grey;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.vulnblock {
	background-color:#D4D0C8;
	color:black;
	font-weight:bold;
}

.codebox {
	margin-bottom: 10px;
	background-color: #ffffff;
}

.windowcontent, #funccodecontent, #funccodetitle, .funclistcontent  {
	background-color: #ffffff;
	opacity:0.95;
}

.markline {
	background-color: #EF9486;
}

.requires
	{color: #000000; font-weight:bold;}

.linenr
	{color: #808080;}

.link
	{color: #0000FF; font-weight:bold;}


.code, .vulntitle {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: #8000FF;  font-weight: bold;}

.phps-t-string,
.phps-t-eval
	{color: #000000; font-weight: bold;}

.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-inc,
.phps-t-dec,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-double-arrow,
.phps-t-boolean-or,
.phps-t-boolean-and
	{color: #8000FF;}

.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-exit,
.phps-t-try,
.phps-t-catch,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-if,
.phps-t-switch,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-as,
.phps-t-or,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-else,
.phps-t-elseif,
.phps-t-use,
.phps-t-var,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c,
.phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #0000FF; font-weight:bold;}

.phps-t-open-tag,
.phps-t-close-tag
	{color: #FF0000;  font-weight:bold;}

.phps-t-const
	{color: #000000;}

.phps-t-variable, .phps-t-string-varname, .funclistline, .phps-t-variable-marked
	{color: #000080;}

.phps-t-variable-marked
	{background-color:#F5A69A;}

.phps-tainted-var
	{color: #0606Ed;}

.phps-t-lnumber
	{color: #FF8000}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string,
.phps-t-start-heredoc,
.phps-t-end-heredoc
	{color: #4A4A4A;}

.phps-t-inline-html
	{color: #000000; font-weight:bold;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #63C763; font-weight:normal;}


================================================
FILE: css/phps.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

body, html {
	color: #111111;
}

.textcolor {
	color: #ffffff;
}

.darkcolor {
	color: black;
}

.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.codebox {
	margin-bottom: 10px;
	background-color: #C4CDD1;
}

.vulnblock {
	background-color:#ABBBC3;
	color:black;
	font-weight:bold;
}

.windowcontent , #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #C4CDD1;
	opacity:0.92;
}

.markline {
	background-color: #F98888;
}

.code, .vulntitle  {
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
	font-size:9pt;
	color: #007700;
}

.requires,
.linenr
	{color: black; font-weight:bold;}

.link
	{font-weight:bold; color: #0000BB;}

.phps-code,
.phps-t-dollar-open-curly-braces,
.phps-t-curly-open,
.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-inc,
.phps-t-dec,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-if,
.phps-t-switch,
.phps-t-while,
.phps-t-do,
.phps-t-exit,
.phps-t-try,
.phps-t-catch,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-empty,
.phps-t-unset,
.phps-t-else,
.phps-t-elseif,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-use,
.phps-t-var,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c,
.phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #007700;}

.phps-t-const,
.phps-t-variable,
.phps-t-string-varname,
.phps-t-string,
.phps-t-eval,
.phps-t-lnumber,
.funclistline,
.phps-t-variable-marked,
.phps-tainted-var
	{color: #0000BB;}

.phps-t-variable-marked
	{background-color:#F5A69A;}

.phps-tainted-var
	{font-weight:bold;}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #DD0000;}

.phps-t-inline-html
	{color: #000000;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #FF8000}


================================================
FILE: css/print.css
================================================
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	background-color: white;
	color: black;
}

#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

div.menu {
	background-color: white;
	border: 0px;
}

div.stats {
	background-color: white;
	color: black;
	position: relative;
	margin-bottom: 15px;
}
div#window1,
div#window2,
div#window3,
div#window4,
div#window5 {
	display: none;
}
div.vulnblock {
	background-color: white !important;
	color: white;
}
div.codebox {
	margin-bottom: 1px;
	background-color: white;
}
div.vulnblock span {
	color: black;
}
div.vulnblock span.phps-t-constant-encapsed-string,
div.vulnblock span.phps-t-encapsed-and-whitespace,
div.vulnblock span.phps-t-comment,
div.vulnblock span.phps-t-ml-comment,
div.vulnblock span.phps-t-doc-comment {
	color: #999999;
}
div.buttonbox {
	display: none;
}
div.help,
div.fileico,
div.minusico,
div.exploit,
div.dataleak {
	display: none;
}
input.button[value=x] {
	display: none;
}


================================================
FILE: css/rips.css
================================================
body, html {
	font-family: helvetica;
	background-color: #DFDFDF;
	padding: 0;
	margin: 0;
	color: #DFDFDF;
}

.menu {
	background-color: #223344;
	padding: 8px;
	padding-bottom: 0px;
	border: 1px solid black;
}

.logo {
	margin-top:5px;
	background-image: url(rips.png);
	background-repeat: no-repeat;
	height: 52px;
	width: 150px;
	text-align: right;
	font-size: 12px;
	display:table-cell;
	vertical-align:bottom;
}

a#logo {
	color:#FFCC44;
	text-decoration: none;
}

.scanning, .stats {
	margin-left:35%;
	border:3px solid black;
	position:absolute;
	opacity: .94;
	background-color: #223344;
	color:white;
}

.stats {
	width:290px;
	font-size: 12px;
	padding:5px;
}

.scanning {
	height:200px;
	width:300px;
	margin-top:100px;
	display:none;
	text-align:center;
	font-size: 22px;
	font-weight:bold;
	background-image: url(scanning.gif);
	background-repeat: no-repeat;
	background-position: 105px 60px;
}

.scanned {
	position: absolute;
	background-color: #FFCC44;
	height:5px;
	width:75px;
	margin-left:113px;
	margin-top:70px;
	opacity: .50;
}

.scanfile, .scantimeleft {
	font-size: 10px;
	font-weight:normal;
	text-align:center;
	position:absolute;
}

.scanprogress {
	position:absolute;
	margin-top:80px;
	width:100%;
	text-align:center;
	font-size: 12px;
	color:black;
}

.scantimeleft {
	bottom:5px;
	width:100%;
}

.scanfile {
	margin-right:5px;
	margin-left:5px;
}

.diagram {
	height:70px;
	width:80px;
}

.warning {
	font-size:12px;
}

.chart {
	background-color: #FFCC44;
	height:10px;
	float:left;
	margin-right:5px;
}

.menushade {
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAJCAYAAAGEQXZyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAAO0lEQVR42mJgYGBYCxBAQMzAAhBAIMIJIIBARA1AAIEIaYAAAhHTAAKIGUgIAQQQiPgHEEAg4jtAgAEARKoEMfjevaIAAAAASUVORK5CYII=');
	height: 9px;
}

.menushade {
	margin-top:0px;
	margin-bottom: 30px;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.fileico {
	height: 13px;
	width: 14px;
	background-position: 2px 0px;
	background-repeat: no-repeat;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAANCAYAAACQN/8FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAA00lEQVR42mJkYGD4z4AF/P//nxGZDxBATFBBFAwC8vLy/ydMmAA3BCCAoOpQAUzs8ePH//v7+8FCAAHECBVEsZaRkZHh0aNHDL9+/WK4ceMGw+3btxkAAginiTDMxsYGpgECCG7ilStXGFhYWMAmcnJywjzEoKCgALYBIICwWo0OQAoBAogFmYMjmMA0QADBFYIczczMjKLo379/cDZAAMGt5uXlZWBnZ4ebDBL7/fs3w8ePH8FiAAEEN/HkyZNwz2AzESCAiPYMQAAx4oprdAAQYABoKoXcYicJaAAAAABJRU5ErkJggg==');
}

.minusico {
	height: 13px;
	width: 14px;
	background-position: 2px 1px;
	background-repeat: no-repeat;
	background-image: url('data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAA0klEQVR42mJMS0v7z0AEYGRkZAAIIBYQMXXqVAZmZmYMBX///gXTILn09HQGgAACK8amEAQ+fPgApgUEBMA0QAAxMZAAAAKI5ffv3zglhYWFUfgAAcTCysrK8OfPH4a8vDywAEgzBwcHw/fv3+HOmzFjBpgGCCCWf//+MbCwsDBMmzYNw+T////DQwIEAAII7OZv376BTQdh9OCCKQQBgAAiyYMAAcTCxMTEwMbGxvDr1y+IANBJuMIbIIDAbs7NzWUA0XDrgAaAPAryPLLbAQIMAKuVPnnja7mZAAAAAElFTkSuQmCC');
}

.plusico {
	height: 11px;
	width: 14px;
	background-position: 2px 1px;
	background-repeat: no-repeat;
	background-image: url('data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAA3ElEQVR42mJMS0v7z0AEYGRkZAAIIBYQMXXqVAZmZmYMBX///gXTILn09HQGgABiAilGV5iamgqmP3z4AMYwTQABxMRAAgAIIJbfv3/jlBQWFkbhAwQQCysrK8OfP38Y8vLywAIgzRwcHAwpKSlw582YMQNMAwQQy79//xhYWFgYpk2bhuLmOXPmMPz//x8eEiAAEEBgN3/79g1sOgijBxdMIQgABBBJHgQIIBYmJiYGNjY2hl+/fkEEgE6aPXs21vAGCCCwm3NzcxlANNw6oAEgj4I8DwIwtwMEGACwW0hYY16C/gAAAABJRU5ErkJggg==');
}

.exploit {
	height: 13px;
	width: 13px;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAACfElEQVR42mL8//8/AzJ4kl/8/9PRYwyM7BwMf//8YWBiYWEQjgxhEM/JZoSpAQggFmQN1wzM/v/5/p1BrCCHgdPQkOHXhw8Mr9ZtZLjb2sXw/cXr/wotDWCNAAHEBNNwxdH1P7eVBYP2qSMMjP/+M7zq7Wf4sHY9g0RCPIPmsYMMD1evZrjX3Q92FkAAMYCcB8KXLOxAtvx/mJX7/wwD+/8L+ib/T4jJ/d/PyPb/wZr1/69PnPJ/j6zCf5BagAACa7jiH/L/fmPz/1cr1/w/wcDy/0Fb5/83p8/9f7J9x/9jppb/94lJ/b+7fef/HTKK/x/OX/QGIIDAzvty8xoDi4wMw8uFixlYjYwZOE2MGO5FRDK83rqDQbqrg+HH63cMP56/ZOAyNWR4ffggA0AAgTWxcnMz/AF68cf79wws0jIMn67fYnhz9ybDhzNnGRhExRgYeLgY/nz7ysDIxQ1U84kBIIDAmhhFpRgYmVgY2LQ0Gd6fOMrAoq7GIDdlJoNkVSXDu9VrGf58/sTwj5+P4dudewyCmuoMAAEE1sSuJM/w8dIlBtHMDIafHz4xPO/sYWCXl2P4ce0qw6OWJgYOC1OgInaGr9euMWi1NosABBAjLHIPaOj+11i/muHDsRMMD8rKGf7+/AYMJCYGNnV1BulJkxhezZ8LjMirDI7HjzECBBA8cqVjohjOmVkxKE+bzKC6eyfDzxcvGf6xsTAwcfIyvJgzi+HXsWMMHjevgSMXIIAYkZPR+bS0/w9nz2UQiYhiYJKVYfj15i3D+x3bGf69fccQ/PMrPBkBBBAjetoDgXOp6Z+/PXzM8PfzZwZ+CzMGg/5eXmR5gAADAJdYBF9ow6CbAAAAAElFTkSuQmCC');
}

.help {
	height: 14px;
	width: 14px;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAC8klEQVR42mL8//8/AwwcvfNL+d///1H//v2PA9IS//79Y/j77/8LIL0ISC/zNuC/C1MLEECMMI0Hbn4PBmqYLC/MIsn4/y/D379/weJMTEwMv4DMa0++Pf/7719umKXYWpA4QACBNe65+jUYKLhQXYKV++OX7wzXH39lePT2K8g2BjF+NgZtaT4GIQEOhmM3Pnz9+/dffLKL3FqAAGLceuGjEtAph7Wk2aVevv/GsPvKawZJflYGT0Mphv9AeObOe4az998x2KuLMEiLcDPsufjqGVCzLUAAMf34+StGUZRV6sPnnww7Lrxk+PblJ0O0rTyDEA8bgzAPO4O7gTgDG+N/hoPXXjK8A6oxVOSX+vr9ZwxAAAA5AMb/Avb4+10FAv8A0d/wAPf4+gD7/v0A7vP6AL/T6ADK2+sAAQAAAD4rFADw9PUAzt/sABAMBAD19/pdAgio8Zc0I9BJD15/YvgDDJBff34xdKy9wMDE+I9BX0GQ4dO33wyPXn1h+PvnH8OD5+8ZWICB9eX7T2mAAGL59v0nAyhg/wDxrz9ANjBAQHwbLQmG90Bn96w+z/Dj1x8GUNj/ARr2H+hsoI0MAAHEAiSe/vr7V0UaGGqfPn9j+PfvDwMo/kpmHQVHx9/ffxiApoEDSlJCmOH7z98MQMueAgQQE9Daxc9ef2UwUBRkYGWEKPz/9x9DW6IFQ0uCOcMfoEF/gBpBcWuqLs5w6+F7BqD3FgMEEBPQxiUbj91/xsLEwOBpIsPAysLI8OfPb4YV+28wrDpwE5II/v1mcDdXZWBlZmJYsOPqM2CALgEIIHACSOjaF/wHmAAy/XS4fwNtO3blCcOjF+8Z/gEDRFqcn8FKW5qBhYWZoWnBia/AhBJ/aGLYWoAAgie5oPptoNQzOdReRVJdXoiBnY0ZLP79xx+GK3dfM8zbfuU5MEnmHp8aCU5yAAHEiJzIXUvXKQOTGTCR/4sDpg5gIv8PTHb/XgAT/CIge9mZmTHwRA4QYABQyY5ecbnnNAAAAABJRU5ErkJggg==');
}

.hotpatch {
	height: 15px;
	width: 15px;
	margin-top: -1px;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAFM0aXcAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAACw0lEQVR42mL8//8/AwgABBDTxxcv97/vZvsPEECMMBGAAGL536Py/8P/RwwAAcTwZdWcQ3+iVf+/9mP8/86S5T9AAIGVfJ4j+/+vkDbDw9VnvwAEEFwPDAAEEMv/XJP/bx+dA3N4ijYfAAggFgb5DwzMcixgAQ57b0eAAGJheCjAwGgmwMDALQIWBAggBpAZIPzj2ukGoG0Nl5xMP/ytd/9wVI774c8fPxMAAgAhAN7/BPjBtb/6679A/cqOAP3zAAAVgIsA5CUyACouAA/37+9iAogBqGrOh+cv/n+aLfP//eGk/w+f7wOzQRhkMkAAwa0ACnwAKn4D48MwQABh+AMZAAQQC4zxfXJxw4/lkwL4lBQVrj0XYODQMZ4CEECM/3KM//97/4nh/ec7cB3fJ2xk4IkOYgAIIKbfPcfggl+11Bi+zdzL8J+Th+Gv6F8GgAAC6wSFzodX9xg+F+1l4F3sDlcMEEBgnR+VVICeZWFg/P6FgdEyFoxZBMUZAAIIrPOjGQMD88+XDH/ZxSFBKSbNcC165V2AAAL751ZexlNg8H1A9ydAAOH1JyEAEEAsQP/v4Lh10P2/sAjDFx0dBp4rV+CS/+/cY/h07z6c/3bpAQbhaAcwm61wxlmAAGJh1HNi/3dyMwMDMKz+ftsF9JQRAyyhgIEogsnO8A4cRKAgk9DR/wwQQCyMYuIMTIJ8DJ/tHRi4fdsY7j47DUlhT04w/AKmBN4+Z6ghLAw80/0ZGNQZGPj+3mJgVNJ7DxBALECCDRRD3Bs2MTA92MAgLvCT4c/7l2D1v1R3MrCoSYP5oOD9b+gHFmd8/4CBjZ0tCCCAwAEGStOg4P6hEMnwRcaCQeTpPAbmG7sgQY8MFPUZGO5fBDMFYs8wAgQQWPNlZ7NTQL6pluQHhm8O38GSsDh7PPUdg1JG+hvu0GRR9NAGCDAAI6Y+qpsRI6MAAAAASUVORK5CYII=');
}

.dataleak {
	height: 15px;
	width: 13px;
	margin-top: -1px;
	margin-left: 3px;
	background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAACBklEQVR42mL4//8/Azq+fevW/4WLFvzHJgcQQAzYBJubm/6zsrJg1QAQQEwMWMCOa7cZftsEYJNiAAggrDYwzDzwn+He//+7163GsAUggDBsuHRk/38mG3sGFRYGhmUHj2JYABBAKLo3b9r4n6F73f+ar///LwUJrLvz3zk0/P/fn9/hNgEEEMKG37/+zz97jYHBzJVBnYuB4R9ITEOZYa+EEcOUvh64MoAAgpsuZu/+n/Hw+/+5QNOXAwUqvwAFzwHxdSBec/X/p7evwbYABBATTNcrh1gGA3UBBkug6cc+MTDMuA8UZwTiH0Csr8XQ0dEOVgoQQGANB3ZsZeAMjWTw5mVg+AUMpGn3GBje/0Ly6DcGhslXHjPcvHjuP0AAMf7/9++/Z2AQg8DC9Qxa7AwMddehJsMAiP0TiC8eYki5sIoBIICYGBgZGcVFRRi+An157B0D1LdIAOSGF0D86R0DLwc7A0AAMYI88vDmtf8Kn9UYGDiBgf8bOcyB+DIQ/2VgEF3iyXBjyWwGgAAC+0FeXYuRaXotA8PnjwwMbEhOeQC1QfgTQ0eYL4OQpAwjQAChRNzeHdv+Szj5/GfYdPc/w44n/xnKJv238fX7f+7oIXjEAQQQ2EnI4Om92/8zqxoYfv/7x+BspMtQUFDAwMLBBQ8GgADC0ICITaDvmZgZ0aUAAgwA5489hLuadr8AAAAASUVORK5CYII=');
}

.fileico, .minusico, .plusico, .exploit, .help, .hotpatch, .dataleak {
	margin-left: 2px;
	cursor:pointer;
	float:left;
}


.vulntitle {
	margin-left: 20px;
}

#window1, #window2, #window3, #window4, #window5 {
	display:none;
	position:absolute;
	top:200px;
	right:200px;
}

#funccode {
	display:none;
	position:absolute;
}

#funccodecontent {
	border: 1px solid #888;
	opacity: .96;
	max-height: 250px;
	overflow-y: scroll;
}

#funccodetitle {
	border: 1px solid #888;
	padding: 4px;
}

.windowtitlebar, .funclisttitlebar {
	background: #364C63;
	height:30px;
	border: 2px solid black;
	color: #FFFFFF;
	z-index:3;
	cursor: move;
	white-space:nowrap;
	width:100%;
}

.windowtitle, .funclisttitle {
	margin-left:20px;
	height:30px;
	color: #DFDFDF;
	font-weight:bold;
	font-size:14px;
	padding-top:7px;
	margin-bottom:-7px;
	overflow:hidden;
	white-space:nowrap;
}

#scrolldiv {
	border-left: 2px solid black;
	width:84px;
	height:100%;
	position:relative;
	float:left;
	background-color: black;
}

#scrollwindow {
	height:50px;
	width:100%;
	position:absolute;
}

#scrollcode {
	width:85px;
	height:100%;
	overflow:hidden;
}

#scrollcode table {
	font-size:.15em;
}
#scrollcode td {
	padding: 0px;
	margin: 0px;
	line-height:0.02;
	height:0.02em;
}

.closebutton, .maxbutton {
	height:15px;
	width:15px;
	top:10px;
	position:absolute;
}

.maxbutton {
	right:40px;
}

.closebutton {
	right:20px;
}

.windowcontent, .funclistcontent {
	overflow:auto;
	opacity: .98;
	border-left: 2px solid black;
	border-right: 2px solid black;
	height: 100%;
	width:100%;
}

#windowcontent1 {
	float:left;
	margin-left:84px;
	position:absolute;
	width:516px;
}

.return {
	display:none;
	position:absolute;
	margin-top:-2px;
	margin-left:20px;
	font-size:16px;
	font-family: monospace;
	font-weight:bold;
	cursor:pointer;
}

.windowfooter , .funclistfooter {
	cursor:se-resize;
	background: #364C63;
	height:15px;
	border: 2px solid black;
	width:100%;
}

.funclistline {
	cursor: pointer;
}

.exploittitlebox {
	background-color: black;
	padding-left: 10px;
	margin-top: 10px;
	font-weight: bold;
	width: 390px;
}

.exploittitle {
	color:white;
	font-weight: bold;
	white-space: nowrap;
	width: 350px;
	float: left;
}

.exploitbox {
	width: 400px;
}

.exploitcontentbox {
	border: 2px solid black;
	background-color: #333333;
	padding: 3px;
}

.helptitle, .helpbox {
	border:1px solid black;
	padding-left:10px;
	padding-right:10px
}

.helptitle {
	background-color: #364C63;
}

.helpbox {
	background-color: #333333;
}

.linenrcolumn {
	text-align:right;
}

.filebox {
	margin-left: 20px;
	margin-right: 20px;
	color: black;
}

table {
	font-size: 14;
}


.menutable {
	color: #C0C0C0;
}

input[type="text"],select {
	color: #000 !important;
	background: #989FA2 !important;
	font-size:12px;
	padding:2px;
	border:1px solid #000;
}

.closebutton,.maxbutton,
.Button {
	background-color:#454545;
	color:#fff;
	border:1px solid #000;
}

.Defined {
	text-decoration: none;
	color:#0000FF;
}

label {
	padding:10px;
	margin:10px;
}

img {
	border:0;
}

ul {
	list-style-type:none;
}

hr {
	border:1px solid black;
}

a {
	color: #DFDFDF;
}

.filename
{
	text-decoration:underline;
	font-weight:bold;
}

.codebox {
	margin-bottom: 10px;
	background-color: #DFDFDF;
}

.vulnblocktitle {
	margin-left: 20px;
	font-size: 10pt;
	padding:5px;
	width:200px;
}

.vulnblock {
	border:1px solid black;
}

#filecanvas , #functioncanvas{
	display:none;
}

.jumplink {
	position:absolute;
	margin-top:-40px;
}


================================================
FILE: css/term.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.vulnblock {
	background-color:#223344;
	color:#FFF;
	font-weight:bold;
}

.codebox {
	margin-bottom: 10px;
	background-color: #101820;
}

.windowcontent, .filecanvas, #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #101820;
}

.markline {
	background-color: #0A212C;
}

.requires
	{color: #D2A8A1; font-weight:bold;}

.linenr
	{color: #444;}

.link
	{color: #DC578C; font-weight:bold;}

.code, .vulntitle {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: #B5C9C9; }

.phps-t-string,
.phps-t-eval,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-try,
.phps-t-catch,
.phps-t-exit,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc
	{color: #FFFFFF;}
/*E1E1F9*/

.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-if,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-else,
.phps-t-elseif,
.phps-t-switch,
.phps-t-use,
.phps-t-var,
.phps-t-inc,
.phps-t-dec,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,
.phps-t-line,
.phps-t-dir,
.phps-t-func-c, .phps-t-class-c,
.phps-t-method-c,
.phps-t-ns-c
	{color: #CF628D;}

.phps-t-const
	{color: #CF628D;}

.phps-t-variable,
.phps-t-variable-marked,
.phps-t-string-varname,
.funclistline
	{color: #1487BD;}

.phps-t-variable-marked
	{background-color:#132F3C;}

.phps-tainted-var
	{color: #1AA9EC;}

.phps-t-lnumber
	{color: #CF6A4C}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #6C8EB7;}
/* FFCE42 */
.phps-t-inline-html
	{color: #FFCE42;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #2C425D}


================================================
FILE: css/twilight.css
================================================
#scrollwindow {
	background-color: grey;
	opacity:0.22;
}

.userinput, .persistent {
	list-style-type: disc;
	color:white;
}
.validated {
	list-style-type: disc;
	color:red;
}
.functioninput {
	list-style-type: disc;
	color:yellow;
}

.codebox {
	margin-bottom: 10px;
	background-color: #141414;
}

.vulnblock {
	background-color:#151D24;
	color:#FFCC44;
	font-weight:bold;
}

.windowcontent, .filecanvas, #funccodecontent, #funccodetitle, .funclistcontent {
	background-color: #141414;
}

.markline {
	background-color: #531107;
}

.requires
	{color: #D2A8A1; font-weight:bold;}

.linenr
	{color: #888;}

.link
	{color: #CF6A4C; font-weight:bold;}

.code, .vulntitle {
	font-size:9pt;
	font-family: "Bitstream Vera Sans Mono", "Monaco", "Courier New", monospace;
}

.code,
.phps-code, .phps-t-curly-open, .phps-t-dollar-open-curly-braces, .vulntitle
	{color: white;  }

.phps-t-string,
.phps-t-eval,
.phps-t-print,
.phps-t-include,
.phps-t-include-once,
.phps-t-require,
.phps-t-require-once,
.phps-t-isset,
.phps-t-empty,
.phps-t-while,
.phps-t-do,
.phps-t-try,
.phps-t-catch,
.phps-t-exit,
.phps-t-unset,
.phps-t-list,
.phps-t-array,
.phps-t-echo,
.phps-t-start-heredoc,
.phps-t-end-heredoc
	{color: #DAD085;}


.phps-t-open-tag,
.phps-t-close-tag,
.phps-t-and-equal,
.phps-t-concat-equal,
.phps-t-div-equal,
.phps-t-minus-equal,
.phps-t-mod-equal,
.phps-t-mul-equal,
.phps-t-or-equal,
.phps-t-plus-equal,
.phps-t-sl-equal,
.phps-t-sr-equal,
.phps-t-xor-equal,
.phps-t-is-equal,
.phps-t-is-greater-or-equal,
.phps-t-is-identical,
.phps-t-is-not-equal,
.phps-t-is-not-identical,
.phps-t-object-operator,
.phps-t-double-colon,
.phps-t-paamayim-nekudotayim,
.phps-t-if,
.phps-t-isset,
.phps-t-exclaim,
.phps-t-for,
.phps-t-foreach,
.phps-t-return,
.phps-t-double-arrow,
.phps-t-as,
.phps-t-or,
.phps-t-case,
.phps-t-default,
.phps-t-break,
.phps-t-continue,
.phps-t-goto,
.phps-t-and,
.phps-t-xor,
.phps-t-global,
.phps-t-logical-and,
.phps-t-logical-or,
.phps-t-boolean-or,
.phps-t-boolean-and,
.phps-t-else,
.phps-t-elseif,
.phps-t-switch,
.phps-t-use,
.phps-t-var,
.phps-t-inc,
.phps-t-dec,
.phps-t-function,
.phps-t-public,
.phps-t-private,
.phps-t-protected,
.phps-t-static,
.phps-t-class,
.phps-t-new,
.phps-t-bool-cast,
.phps-t-double-cast,
.phps-t-int-cast,
.phps-t-unset-cast,
.phps-t-file,

.phps-t-line,

.phps-t-dir,

.phps-t-func-c,

.phps-t-class-c,

.phps-t-method-c,

.phps-t-ns-c
	{color: #9B703F;}

.phps-t-const
	{color: #CF6A4C;}

.phps-t-variable,
.phps-t-variable-marked,
.phps-t-string-varname,
.funclistline
	{color: #7587A6;}

.phps-t-variable-marked
	{background-color:darkred;}

.phps-tainted-var
	{color: #9ABDFB;}

.phps-t-lnumber
	{color: #CF6A4C}

.phps-t-encapsed-and-whitespace,
.phps-t-constant-encapsed-string
	{color: #8F9D6A;}

.phps-t-inline-html
	{color: #F9EE98;}

.phps-t-comment,
.phps-t-ml-comment,
.phps-t-doc-comment
	{color: #5F5A60}


================================================
FILE: index.php
================================================
<?php
/**

RIPS - A static source code analyser for vulnerabilities in PHP scripts
	by Johannes Dahse (johannes.dahse@rub.de)


Copyright (C) 2012 Johannes Dahse

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

**/

include 'config/general.php';
if (defined("MODE_CLI"))
	parse_str(implode('&', array_slice($argv, 1)), $_POST);				// parse commandline into $_POST

?><html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="css/rips.css" />
	<?php

	foreach($stylesheets as $stylesheet)
	{
		echo "\t<link type=\"text/css\" href=\"css/$stylesheet.css\" rel=\"";
		if($stylesheet != $default_stylesheet) echo "alternate ";
		echo "stylesheet\" title=\"$stylesheet\" />\n";
	}
	?>
	<script src="js/script.js"></script>
	<script src="js/exploit.js"></script>
	<script src="js/hotpatch.js"></script>
	<script src="js/netron.js"></script>
	<title>RIPS - A static source code analyser for vulnerabilities in PHP scripts</title>
</head>
<body>

<div class="menu">
	<div style="float:left; width:100%;">
	<table width="100%">
	<tr><td width="75%" nowrap>
		<table class="menutable" width="50%" style="float:left;">
		<tr>
			<td nowrap><b>path / file:</b></td>
			<td colspan="3" nowrap><input type="text" size=80 id="location" value="<?php echo BASEDIR; ?>" title="enter path to PHP file(s)" placeholder="/var/www/">
			</td>
			<td nowrap><input type="checkbox" id="subdirs" value="1" title="check to scan subdirectories" checked/>subdirs
			</td>
		</tr>
		<tr>
			<td nowrap>verbosity level:</td>
			<td nowrap>
				<select id="verbosity" style="width:100%" title="select verbosity level">
					<?php

						$verbosities = array(
							1 => '1. user tainted only',
							2 => '2. file/DB tainted +1',
							3 => '3. show secured +1,2',
							4 => '4. untainted +1,2,3',
							5 => '5. debug mode'
						);

						foreach($verbosities as $level=>$description)
						{
							echo "<option value=\"$level\">$description</option>\n";
						}
					?>
				</select>
			</td>
			<td align="right" nowrap>
			vuln type:
			</td>
			<td>
				<select id="vector" style="width:100%" title="select vulnerability type to scan">
					<?php

						$vectors = array(
							'all' 			=> 'All',
							'server' 		=> 'All server-side',
							'code' 			=> '- Code Execution',
							'exec' 			=> '- Command Execution',
							'file_read' 	=> '- File Disclosure',
							'file_include' 	=> '- File Inclusion',
							'file_affect' 	=> '- File Manipulation',
							'ldap' 			=> '- LDAP Injection',
							'unserialize' 	=> '- PHP Object Injection',
							'connect'		=> '- Protocol Injection',
							'ri'		 	=> '- Reflection Injection',
							'database' 		=> '- SQL Injection',
							'xpath' 		=> '- XPath Injection',
							'other' 		=> '- other',
							'client' 		=> 'All client-side',
							'xss' 			=> '- Cross-Site Scripting',
							'httpheader'	=> '- HTTP Response Splitting',
							'fixation'		=> '- Session Fixation',
							//'crypto'		=> 'Crypto hints'
						);

						foreach($vectors as $vector=>$description)
						{
							echo "<option value=\"$vector\" ";
							if($vector == $default_vector) echo 'selected';
							echo ">$description</option>\n";
						}
					?>
				</select>
			</td>
			<td><input type="button" value="scan" style="width:100%" class="Button" onClick="scan(false);" title="start scan" /></td>
		</tr>
		<tr>
			<td nowrap>code style:</td>
			<td nowrap>
				<select name="stylesheet" id="css" onChange="setActiveStyleSheet(this.value);" style="width:49%" title="select color schema for scan result">
					<?php
						foreach($stylesheets as $stylesheet)
						{
							echo "<option value=\"$stylesheet\" ";
							if($stylesheet == $default_stylesheet) echo 'selected';
							echo ">$stylesheet</option>\n";
						}
					?>
				</select>
				<select id="treestyle" style="width:49%" title="select direction of code flow in scan result">
					<option value="1">bottom-up</option>
					<option value="2">top-down</option>
				</select>
			</td>
			<td align="right">
				/regex/:
			</td>
			<td>
				<input type="text" id="search" style="width:100%" />
			</td>
			<td>
				<input type="button" class="Button" style="width:100%" value="search" onClick="search()" title="search code by regular expression" />
			</td>
		</tr>
		</table>
		<div id="options" style="margin-top:-10px; display:none; text-align:center;" >
			<p class="textcolor">windows</p>
			<input type="button" class="Button" style="width:50px" value="files" onClick="openWindow(5);eval(document.getElementById('filegraph_code').innerHTML);" title="show list of scanned files" />
			<input type="button" class="Button" style="width:80px" value="user input" onClick="openWindow(4)" title="show list of user input" /><br />
			<input type="button" class="Button" style="width:50px" value="stats" onClick="document.getElementById('stats').style.display='block';" title="show scan statistics" />
			<input type="button" class="Button" style="width:80px" value="functions" onClick="openWindow(3);eval(document.getElementById('functiongraph_code').innerHTML);" title="show list of user-defined functions" />
		</div>
	</td>
	<td width="25%" align="center" valign="center" nowrap>
		<!-- Logo by Gareth Heyes -->
		<div class="logo"><a id="logo" href="https://www.ripstech.com/latest/" target="_blank" title="get the latest version"><?php echo VERSION ?></a></div>
	</td></tr>
	</table>
	</div>

	<div style="clear:left;"></div>
</div>
<div class="menushade"></div>

<div class="scanning" id="scanning">scanning ...
<div class="scanned" id="scanned"></div>
</div>

<div id="result">

<?php
if(defined("MODE_CLI") && !empty($_POST['loc'])){
	require("main.php");
}
else {
?>
	<div style="margin-left:30px;color:#000000;font-size:14px">
		<h3>Quickstart:</h3>
		<p>Locate your local PHP source code <b>path/file</b> (e.g. <em>/var/www/project1/</em> or <em>/var/www/index.php</em>), choose the <b>vulnerability type</b> you are looking for and click <u>scan</u>!<br />
		Check <b>subdirs</b> to include all subdirectories into the scan. It is recommended to scan only the root directory of your project. Files in subdirectories will be automatically scanned by RIPS when included by the PHP code. However enabling <b>subdirs</b> can improve the scan result and the include success rate (shown in the result).</p>
		<h3>Advanced:</h3>
		<p>Debug errors or improve your scan result by choosing a different <b>verbosity level</b> (default level 1 is recommended).<br />
		After the scan finished 4 new button will appear in the upper right. You can select between different types of vulnerabilities that have been found by clicking on their name in the <b>stats</b> window. You can click <b>user input</b> in the upper right to get a list of entry points, <b>functions</b> for a list and graph of all user defined functions or <b>files</b> for a list and graph of all scanned files and their includes. All lists are referenced to the Code Viewer.</p>
		<h3>Style:</h3>
		<p>Change the syntax highlighting schema on-the-fly by selecting a different <b>code style</b>.<br />
		Before scanning you can choose which way the code flow should be displayed: <b>bottom-up</b> or <b>top-down</b>.</p>
		<h3>Icons:</h3>
		<ul>
		<li class="userinput"><font color="black"><b>User input</b> has been found in this line. Potential entry point for vulnerability exploitation.</font></li>
		<li class="functioninput"><font color="black">Vulnerability exploitation depends on the <b>parameters</b> passed to the function declared in this line. Have a look at the calls in the scan result.<br />Click <b>&uArr;</b> or <b>&dArr;</b> to jump to the next declaration or call of this function.</font></li>
		<li class="validated"><font color="black">User-implemented <b>securing</b> has been detected in this line. This may prevent exploitation.</font></li>
		</ul>
		<h3>Options:</h3>
		<ul>
		<li><div class="fileico"></div>&nbsp;Click the file icon to open the <b>Code Viewer</b> to review the original code. A new window will be opened with all relevant lines highlighted.<br />
		Highlight variables temporarily by mouseover or persistently by clicking on the variable. Jump into the code of a user-defined function by clicking on the call. Click <u>return</u> on the bottom of the code viewer to jump back. This also works for nested function calls.</li>
		<li><div class="minusico"></div>&nbsp;Click the minimize icon to <b>hide</b> a specific code trace. You may display it later by clicking the icon again.</li>
		<li><div class="exploit"></div>&nbsp;Click the target icon to open the <b>Exploit Creator</b>. A new window will open where you can enter exploit details and create PHP Curl exploit code.</li>
		<li><div class="help"></div>&nbsp;Click the help icon to get a <b>description</b>, example code, example exploitation, patch and related securing functions for this vulnerability type.</li>
		<li><div class="dataleak"></div>&nbsp;Click the data leak icon to check if the output of the tainted sink <b>leaks</b> somewhere (is embedded to the HTTP response via echo/print).</li>
		</ul>
		<h3>Hints:</h3>
		<ul>
		<li>RIPS implements <i>static</i> source code analysis. It only scans source code files and will not execute the code.</li>
		<li>Object-oriented code (classes) is not supported in this version.</li>
		<li>Make sure RIPS has file permissions on the files to be scanned.</li>
		<li>Don't leave the webinterface of RIPS open to the public internet. Use it on your <b>local</b> webserver only.</li>
		<li>Only tested with Firefox.</li>
		</ul>
	</div>

<?php
}
?>
</div>

</body>
</html>


================================================
FILE: js/exploit.js
================================================
/**
	RIPS - A static source code analyser for vulnerabilities in PHP scripts
		by Johannes Dahse (johannes.dahse@rub.de)
**/

function editExploit()
{
	document.getElementById('exploitcode').style.display = "none";
	document.getElementById('exploitbuild').style.display = "block";
}

function deleteMethod(method)
{
	document.getElementById(method+'box').style.display = "none";
}

function getQuery(method)
{
	var query = "";
	var elements = document.getElementById(method).elements;
	for(var i=0;i<elements.length;i++)
	{
		query = query + elements[i].name + '=' + encodeURIComponent(elements[i].value);
		if(i != elements.length-1)
			query = query + '&';
	}
	return query;
}

function createExploit()
{
	var name = "";
	if(document.getElementById('$_GET') != undefined)
		name = name + 'GET, ';
	if(document.getElementById('$_POST') != undefined)
		name = name + 'POST, ';
	if(document.getElementById('$_FILES') != undefined)
		name = name + 'FILES, ';
	if(document.getElementById('$_COOKIE') != undefined)
		name = name + 'COOKIE, ';
	if(document.getElementById('$_SERVER') != undefined)
		name = name + 'SERVER, ';

	var output = "//<br>// HTTP "+name+" <input type=button class='Button' value='edit' onClick='editExploit()'>";
	output = output + "<br>//<br><br>$target = $argv[1];<br><br>";

	var target = document.getElementById('target').value;
	var cookiejar = document.getElementById('cookiejar').value;
	var exectime = document.getElementById('exectime').value;
	var ssl = document.getElementById('ssl').checked
	var auth = document.getElementById('auth').checked

	if(document.getElementById('$_FILES') != undefined)
		output = output + "$postData = array();<br>$postData[ 'file' ] = \"@" + document.getElementById('$_FILES').elements[0].value + "\";<br><br>";

	if(auth)
	{
		output = output + "$username = \"\";<br>$password = \"\";<br><br>";
	}

	output = output + "$ch = curl_init();<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);<br>";

	if(document.getElementById('$_GET') != undefined)
	{
		var getquery = getQuery('$_GET');
		output = output + "curl_setopt($ch, CURLOPT_URL, \"" + target + '?' + getquery + "\");<br>";
		output = output + "curl_setopt($ch, CURLOPT_HTTPGET, 1);<br>";
	}
	else
	{
		output = output + "curl_setopt($ch, CURLOPT_URL, \"" + target + "\");<br>";
	}

	output = output + "curl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\");<br>";


	if(document.getElementById('$_POST') != undefined || document.getElementById('$_FILES') != undefined)
		output = output + "curl_setopt($ch, CURLOPT_POST, 1);<br>";

	if(document.getElementById('$_POST') != undefined)
	{
		var postquery = getQuery('$_POST');
		output = output + "curl_setopt($ch, CURLOPT_POSTFIELDS, \"" + postquery + "\");<br>";
	}

	if(document.getElementById('$_FILES') != undefined)
		output = output + "curl_setopt($ch, CURLOPT_POSTFIELDS, $postData );<br>";

	if(document.getElementById('$_COOKIE') != undefined)
	{
		var cookie = getQuery('$_COOKIE');
		output = output + "curl_setopt($ch, CURLOPT_COOKIE, \"" + cookie + "\");<br>";
	}

	if(document.getElementById('$_SERVER') != undefined)
	{
		var elements = document.getElementById('$_SERVER').elements;
		for(var i=0;i<elements.length;i++)
		{
			if(elements[i].name == 'HTTP_USER_AGENT')
				output = output + "curl_setopt($ch, CURLOPT_USERAGENT, \""+elements[i].value+"\");<br>";
			else if(elements[i].name == 'HTTP_ACCEPT')
				output = output + "curl_setopt($ch, CURLOPT_HTTPHEADER, \"Accept: "+elements[i].value+"\");<br>";
			else if(elements[i].name == 'HTTP_ACCEPT_LANGUAGE')
				output = output + "curl_setopt($ch, CURLOPT_HTTPHEADER, \"Accept-Language: "+elements[i].value+"\");<br>";
			else if(elements[i].name == 'HTTP_ACCEPT_ENCODING')
				output = output + "curl_setopt($ch, CURLOPT_ENCODING, \""+elements[i].value+"\");<br>";
			else if(elements[i].name == 'HTTP_ACCEPT_CHARSET')
				output = output + "curl_setopt($ch, CURLOPT_HTTPHEADER, \"Accept-Charset: "+elements[i].value+"\");<br>";
			else if(elements[i].name == 'HTTP_KEEP_ALIVE')
				output = output + "curl_setopt($ch, CURLOPT_HTTPHEADER, array(\"Connection: keep-alive\", \"Keep-Alive: "+elements[i].value+"\"));<br>";
			else if(elements[i].name == 'HTTP_CONNECTION')
				output = output + "curl_setopt($ch, CURLOPT_HTTPHEADER, \"Connection: "+elements[i].value+"\");<br>";
		}
	}


	if(exectime != "")
		output = output + "curl_setopt($ch, CURLOPT_TIMEOUT, " + exectime + ");<br>curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, " + exectime + ");<br>curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, " + exectime + ");<br>";

	if(cookiejar != "")
		output = output + "curl_setopt($ch, CURLOPT_COOKIEJAR, \"" + cookiejar + "\");<br>";

	if(ssl)
	{
		output = output + "curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);<br>";
		output = output + "curl_setopt($ch,	CURLOPT_SSL_VERIFYHOST, FALSE);<br>";
		output = output + "curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br>";
	}

	if(auth)
	{
		output = output + "curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);<br>";
		output = output + "curl_setopt($ch, CURLOPT_USERPWD, \"$username:$password\");<br>";
	}

	output = output + "$buf = curl_exec ($ch);<br>curl_close($ch);<br>unset($ch);<br>";
	output = output + "<br>echo $buf;<br>";

	var exploitdiv = document.getElementById('exploitcode');
	exploitdiv.innerHTML = output;
	exploitdiv.style.display = "block";
	document.getElementById('exploitbuild').style.display = "none";
}

function setssl()
{
	var targetelement = document.getElementById('target');
	var newset;
	var oldset = targetelement.value;
	if(document.getElementById('ssl').checked)
	{
		oldset = oldset.replace(/https:/, "http:");
		newset = oldset.replace(/http:/, "https:");
	} else
	{
		newset = oldset.replace(/https/, "http");
	}
	targetelement.value = newset;
}


================================================
FILE: js/hotpatch.js
================================================
function getParams(method)
{
	var query = "";
	var elements = document.getElementById(method).elements;
	for(var i=0;i<elements.length;i++)
	{
		if(elements[i].name !== 'filter')
		{
		query = query + elements[i].name + '=' + elements[i].value;
		if(i != elements.length-2)
			query = query + '&';
		}
	}
	return query;
}

function createHotpatch()
{
	var output = "mod_security rule:<br><br>";

	if(document.getElementById('$_GET') != undefined)
	{
		var getquery = getParams('$_GET');
		output = output + "SecFilterSelective QUERY_STRING \""+getquery+"\" \"deny,log,auditlog,status:404,msg:'Protected by RIPS',id:'990002',severity:'4'\"";
	}


	var exploitdiv = document.getElementById('hotpatchcode');
	exploitdiv.innerHTML = output;
	exploitdiv.style.display = "block";
	document.getElementById('hotpatchbuild').style.display = "none";
}

/*
// snort

alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg:"WEB-CGI yabb directory traversal attempt"; flow:to_server,established; uricontent:"/YaBB"; nocase; content:"../"; classtype:attempted-recon;)


// mod_security

// SERVER
SecRule REQUEST_HEADERS:User-Agent "(?:\b(?:m(?:ozilla\/4\.0 \(compatible\)|etis)|webtrends security analyzer|pmafind)\b|n(?:-stealth|sauditor|essus|ikto)|b(?:lack ?widow|rutus|ilbo)|(?:jaascoi|paro)s|webinspect|\.nasl)"
        "deny,log,auditlog,status:404,msg:'Request Indicates a Security Scanner Scanned the Site',id:'990002',severity:'4'"

		http://www.modsecurity.org/documentation/modsecurity-apache/1.9.3/html-multipage/04-rules.html
	*/


================================================
FILE: js/netron.js
================================================
Function.prototype.bind = function(obj)
{
	var fn = this;
	return function()
	{
		return fn.apply(obj, arguments);
	};
};

Array.prototype.remove = function(obj)
{
	var i = this.length;
	while (i--)
	{
		if (this[i] == obj)
		{
			this.splice(i, 1);
		}
	}
};

Array.prototype.contains = function(obj)
{
	var i = this.length;
	while (i--)
	{
		if (this[i] == obj)
		{
			return true;
		}
	}
	return false;
};

var Point = function(x, y)
{
	this.x = x;
	this.y = y;
}

var Rectangle = function(x, y, width, height)
{
	this.x = x;
	this.y = y;
	this.width = width;
	this.height = height;
};

Rectangle.prototype.contains = function(point)
{
	return ((point.x >= this.x) && (point.x <= (this.x + this.width)) && (point.y >= this.y) && (point.y <= (this.y + this.height)));
};

Rectangle.prototype.inflate = function(dx, dy)
{
	this.x -= dx;
	this.y -= dy;
	this.width += dx + dx + 1;
	this.height += dy + dy + 1;
};

Rectangle.prototype.union = function(rectangle)
{
	var x1 = (this.x < rectangle.x) ? this.x : rectangle.x;
	var y1 = (this.y < rectangle.y) ? this.y : rectangle.y;
	var x2 = ((this.x + this.width) < (rectangle.x + rectangle.width)) ? (rectangle.x + rectangle.width) : (this.x + this.width);
	var y2 = ((this.y + this.height) < (rectangle.y + rectangle.height)) ? (rectangle.y + rectangle.height) : (this.y + this.height);
	return new Rectangle(x1, y1, x2 - x1, y2 - y1);
};

Rectangle.prototype.topLeft = function()
{
	return new Point(this.x, this.y);
};

CanvasRenderingContext2D.prototype.dashedLine = function(x1, y1, x2, y2)
{
	this.moveTo(x1, y1);
	var dx = x2 - x1;
	var dy = y2 - y1;
	var count = Math.floor(Math.sqrt(dx * dx + dy * dy) / 3); // dash length
	var ex = dx / count;
	var ey = dy / count;

	var q = 0;
	while (q++ < count)
	{
		x1 += ex;
		y1 += ey;
		if (q % 2 === 0)
		{
			this.moveTo(x1, y1);
		}
		else
		{
			this.lineTo(x1, y1);
		}
	}
	if (q % 2 === 0)
	{
		this.moveTo(x2, y2);
	}
	else
	{
		this.lineTo(x2, y2);
	}
};

CanvasRenderingContext2D.prototype.roundedRect = function(x, y, width, height, radius)
{
  this.beginPath();
  this.moveTo(x + radius, y);
  this.lineTo(x + width - radius, y);
  this.quadraticCurveTo(x + width, y, x + width, y + radius);
  this.lineTo(x + width, y + height - radius);
  this.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
  this.lineTo(x + radius, y + height);
  this.quadraticCurveTo(x, y + height, x, y + height - radius);
  this.lineTo(x, y + radius);
  this.quadraticCurveTo(x, y, x + radius, y);
  this.closePath();
};

var Cursors =
{
	arrow: "default",
	grip: "pointer", // "crosshair",
	cross: "pointer", // "crosshair",
	move: "move",
	select: "pointer"
};

var Connector = function(owner, template)
{
	this.owner = owner;
	this.template = template;
	this.connections = [];
	this.hover = false;
};

Connector.prototype.getCursor = function(point)
{
	return Cursors.grip;
};

Connector.prototype.hitTest = function(rectangle)
{
	if ((rectangle.width === 0) && (rectangle.height === 0))
	{
		return this.getRectangle().contains(rectangle.topLeft());
	}
	return rectangle.contains(this.getRectangle());
};

Connector.prototype.getRectangle = function()
{
	var point = this.owner.getConnectorPosition(this);
	var rectangle = new Rectangle(point.x, point.y, 0, 0);
	rectangle.inflate(3, 3);
	return rectangle;
};

Connector.prototype.invalidate = function()
{
};

Connector.prototype.isValid = function(value)
{
	if (value === this)
	{
		return false;
	}
	var t1 = this.template.type.split(' ');
	if (!t1.contains("[array]") && (this.connections.length == 1))
	{
		return false;
	}
	if (value instanceof Connector)
	{
		var t2 = value.template.type.split(' ');
		if ((t1[0] != t2[0]) ||
		(this.owner == value.owner) ||
			(t1.contains("[in]") && !t2.contains("[out]")) ||
			(t1.contains("[out]") && !t2.contains("[in]")) ||
			(!t2.contains("[array]") && (value.connections.length == 1)))
		{
			return false;
		}
	}
	return true;
};

Connector.prototype.paint = function(context, other)
{
	var rectangle = this.getRectangle();
	var strokeStyle = this.owner.owner.theme.connectorBorder;
	var fillStyle = this.owner.owner.theme.connector;
	if (this.hover)
	{
		strokeStyle = this.owner.owner.theme.connectorHoverBorder;
		fillStyle = this.owner.owner.theme.connectorHover;
		if (!this.isValid(other))
		{
			fillStyle = "#f00";
		}
	}

	context.lineWidth = 1;
	context.strokeStyle = strokeStyle;
	context.lineCap = "butt";
	context.fillStyle = fillStyle;
	context.fillRect(rectangle.x - 0.5, rectangle.y - 0.5, rectangle.width, rectangle.height);
	context.strokeRect(rectangle.x - 0.5, rectangle.y - 0.5, rectangle.width, rectangle.height);

	if (this.hover)
	{
		// Tooltip for Connector point
		var text = ("description" in this.template) ? this.template.description : this.template.name;
		context.textBaseline = "bottom";
		context.font = "8.25pt Tahoma";
		var size = context.measureText(text);
		size.height = 14;
		var a = new Rectangle(rectangle.x - Math.floor(size.width / 2), rectangle.y + size.height + 6, size.width, size.height);
		var b = new Rectangle(a.x, a.y, a.width, a.height);
		a.inflate(4, 1);
		context.fillStyle = "rgb(255, 255, 231)";
		context.fillRect(a.x - 0.5, a.y - 0.5, a.width, a.height);
		context.strokeStyle = "#000";
		context.lineWidth = 1;
		context.strokeRect(a.x - 0.5, a.y - 0.5, a.width, a.height);
		context.fillStyle = "#000";
		context.fillText(text, b.x, b.y + 13);
	}
};

var Tracker = function(rectangle, resizable)
{
	this.rectangle = new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
	this.resizable = resizable;
	this.track = false;
};

Tracker.prototype.hitTest = function(point)
{
	// (0, 0) element, (-1, -1) top-left, (+1, +1) bottom-right
	if (this.resizable)
	{
		for (var x = -1; x <= +1; x++)
		{
			for (var y = -1; y <= +1; y++)
			{
				if ((x !== 0) || (y !== 0))
				{
					var hit = new Point(x, y);
					if (this.getGripRectangle(hit).contains(point))
					{
						return hit;
					}
				}
			}
		}
	}

	if (this.rectangle.contains(point))
	{
		return new Point(0, 0);
	}

	return new Point(-2, -2);
};

Tracker.prototype.getGripRectangle = function(point)
{
	var r = new Rectangle(0, 0, 7, 7);
	if (point.x <   0) { r.x = this.rectangle.x - 7; }
	if (point.x === 0) { r.x = this.rectangle.x + Math.floor(this.rectangle.width / 2) - 3; }
	if (point.x >   0) { r.x = this.rectangle.x + this.rectangle.width + 1; }
	if (point.y <   0) { r.y = this.rectangle.y - 7; }
	if (point.y === 0) { r.y = this.rectangle.y + Math.floor(this.rectangle.height / 2) - 3; }
	if (point.y >   0) { r.y = this.rectangle.y + this.rectangle.height + 1; }
	return r;
};

Tracker.prototype.getCursor = function(point)
{
	var hit = this.hitTest(point);
	if ((hit.x === 0) && (hit.y === 0))
	{
		return (this.track) ? Cursors.move : Cursors.select;
	}
	if ((hit.x >= -1) && (hit.x <= +1) && (hit.y >= -1) && (hit.y <= +1) && this.resizable)
	{
		if (hit.x === -1 && hit.y === -1) { return "nw-resize"; }
		if (hit.x === +1 && hit.y === +1) { return "se-resize"; }
		if (hit.x === -1 && hit.y === +1) { return "sw-resize"; }
		if (hit.x === +1 && hit.y === -1) { return "ne-resize"; }
		if (hit.x ===  0 && hit.y === -1) { return "n-resize";  }
		if (hit.x ===  0 && hit.y === +1) { return "s-resize";  }
		if (hit.x === +1 && hit.y ===  0) { return "e-resize";  }
		if (hit.x === -1 && hit.y ===  0) { return "w-resize";  }
	}
	return null;
};

Tracker.prototype.start = function(point, handle)
{
	if ((handle.x >= -1) && (handle.x <= +1) && (handle.y >= -1) && (handle.y <= +1))
	{
		this.handle = handle;
		this.currentPoint = point;
		this.track = true;
	}
};

Tracker.prototype.move = function(point)
{
	var h = this.handle;
	var a = new Point(0, 0);
	var b = new Point(0, 0);
	if ((h.x == -1) || ((h.x === 0) && (h.y === 0))) { a.x = point.x - this.currentPoint.x; }
	if ((h.y == -1) || ((h.x === 0) && (h.y === 0))) { a.y = point.y - this.currentPoint.y; }
	if ((h.x == +1) || ((h.x === 0) && (h.y === 0))) { b.x = point.x - this.currentPoint.x; }
	if ((h.y == +1) || ((h.x === 0) && (h.y === 0))) { b.y = point.y - this.currentPoint.y; }
	var tl = new Point(this.rectangle.x, this.rectangle.y);
	var br = new Point(this.rectangle.x + this.rectangle.width, this.rectangle.y + this.rectangle.height);
	tl.x += a.x;
	tl.y += a.y;
	br.x += b.x;
	br.y += b.y;
	this.rectangle.x = tl.x;
	this.rectangle.y = tl.y;
	this.rectangle.width = br.x - tl.x;
	this.rectangle.height = br.y - tl.y;
	this.currentPoint = point;
};

Tracker.prototype.paint = function(context)
{
	if (this.resizable)
	{
		for (var x = -1; x <= +1; x++)
		{
			for (var y = -1; y <= +1; y++)
			{
				if ((x !== 0) || (y !== 0))
				{
					var rectangle = this.getGripRectangle(new Point(x, y));
					context.fillStyle = "#ffffff";
					context.strokeStyle = "#000000";
					context.lineWidth = 1;
					context.fillRect(rectangle.x - 0.5, rectangle.y - 0.5, rectangle.width - 1, rectangle.height - 1);
					context.strokeRect(rectangle.x - 0.5, rectangle.y - 0.5, rectangle.width - 1, rectangle.height - 1);
				}
			}
		}
	}
};

var Element = function(template, point)
{
	this.template = template;
	this.rectangle = new Rectangle(point.x, point.y, template.defaultWidth, template.defaultHeight);
	this.content = template.defaultContent;
	this.text = '';
	this.userinput = 0;
	this.sinks = 0;
	this.vuln = 0;
	this.owner = null;
	this.hover = false;
	this.selected = false;
	this.tracker = null;
	this.connectors = [];
	for (var i = 0; i < template.connectorTemplates.length; i++)
	{
		var connectorTemplate = template.connectorTemplates[i];
		this.connectors.push(new Connector(this, connectorTemplate));
	}
};

Element.prototype.select = function()
{
	this.hover = false;
	this.selected = true;
	this.tracker = new Tracker(this.rectangle, ("resizable" in this.template) ? this.template.resizable : false);
	this.invalidate();
};

Element.prototype.deselect = function()
{
	this.selected = false;
	this.invalidate();
	this.tracker = null;
};

Element.prototype.getRectangle = function()
{
	return ((this.tracker !== null) && (this.tracker.track)) ? this.tracker.rectangle : this.rectangle;
};

Element.prototype.getPageRectangle = function()
{
	var rectangle = this.getRectangle();
	rectangle = new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
	var canvas = this.owner.canvas;
	rectangle.x += canvas.offsetLeft;
	rectangle.y += canvas.offsetTop;
	return rectangle;
};

Element.prototype.setRectangle = function(rectangle)
{
	this.invalidate();
	this.rectangle = rectangle;
	if (this.tracker !== null)
	{
		this.tracker.rectangle = new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
	}
	this.invalidate();
};

Element.prototype.paint = function(context)
{
	this.template.paint(this, context);

	if (this.selected)
	{
		this.tracker.paint(context);
	}

	// mark all connections by mouseover
	if(this.hover || this.selected)
	{
		for (var i = 0; i < this.connectors[1].connections.length; i++)
		{
			this.connectors[1].connections[i].lineWidth = 2;
			if(this.connectors[1].connections[i].color != '#F00')
				this.connectors[1].connections[i].color = '#00F';
		}
	} else
	{
		for (var i = 0; i < this.connectors[1].connections.length; i++)
		{
			this.connectors[1].connections[i].lineWidth = 1;
			if(this.connectors[1].connections[i].color != '#F00')
				this.connectors[1].connections[i].color = '#000';
		}
	}

	var rectangle = this.getRectangle();
	lines = this.text.split(",");
	context.textBaseline = "bottom";
	context.font = "8.25pt Tahoma";
	context.fillStyle = "#000";
	context.fillText(lines[0], rectangle.x + 5, rectangle.y + 13 + 20);

	// userinput DOT
	context.beginPath();
	context.fillStyle = "#FFF";
	context.arc(rectangle.x + this.template.defaultWidth-15,rectangle.y + this.template.defaultHeight-11,((this.userinput > 9) ? 9 : this.userinput),0,Math.PI*2,true);
	context.fill();
	context.closePath();

	context.beginPath();
	context.strokeStyle = "#000";
	context.lineWidth = 1;
	context.arc(rectangle.x + this.template.defaultWidth-15,rectangle.y + this.template.defaultHeight-11,((this.userinput > 9) ? 9 : this.userinput),0,Math.PI*2,true);
	context.stroke();
	context.closePath();

	// sensitive sink DOT
	context.beginPath();
	context.fillStyle = this.vuln ? "red" : "#FFCE42";
	context.arc(rectangle.x + this.template.defaultWidth-35,rectangle.y + this.template.defaultHeight-11,((this.sinks > 9) ? 9 : this.sinks),0,Math.PI*2,true);
	context.fill();
	context.closePath();

	context.beginPath();
	context.strokeStyle = "#000";
	context.lineWidth = 1;
	context.arc(rectangle.x + this.template.defaultWidth-35,rectangle.y + this.template.defaultHeight-11,((this.sinks > 9) ? 9 : this.sinks),0,Math.PI*2,true);
	context.stroke();
	context.closePath();

	if (this.hover)
	{
		// Tooltip for Element
		if(this.content.length > 20)
		{
			context.textBaseline = "bottom";
			context.font = "8.25pt Tahoma";
			var size = context.measureText(this.content);
			size.height = 14;
			var a = new Rectangle(rectangle.x, rectangle.y -20, size.width, size.height);
			var b = new Rectangle(a.x, a.y, a.width, a.height);
			a.inflate(4, 1);
			context.fillStyle = "rgb(255, 255, 231)";
			context.fillRect(a.x, a.y, a.width, a.height);
			context.strokeStyle = "#000";
			context.lineWidth = 1;
			context.strokeRect(a.x , a.y, a.width, a.height);
			context.fillStyle = "#000";
			context.fillText(this.content, b.x, b.y + 13);
		}

		/*
		// enlarge element to view whole text
		var size = context.measureText(this.text);
		size.height = 14;
		var a = new Rectangle(rectangle.x + 4.5, rectangle.y + size.height + 4.5, this.template.defaultWidth-9, this.template.defaultHeight-20 + lines.length*15 - 18);
		var b = new Rectangle(a.x, a.y+1, a.width, a.height);
		a.inflate(4, 1);
		context.fillStyle = "#ddd";
		context.fillRect(a.x - 0.5, a.y - 0.5, a.width, a.height);
		context.strokeStyle = "#246";
		context.lineWidth = 2;
		context.strokeRect(a.x - 0.5, a.y - 0.5, a.width, a.height);
		context.fillStyle = "#000";
		for (var i = 0; i<lines.length; i++)
			context.fillText(lines[i], b.x, b.y + 13 + (i*15));
		*/
	}

};

Element.prototype.invalidate = function()
{
};

Element.prototype.insertInto = function(owner)
{
	this.owner = owner;
	this.owner.elements.push(this);
};

Element.prototype.remove = function()
{
	this.invalidate();

	for (var i = 0; i < this.connectors.length; i++)
	{
		var connections = this.connectors[i].connections;
		for (var j = 0; j < connections.length; j++)
		{
			connections[j].remove();
		}
	}

	if ((this.owner !== null) && (this.owner.elements.contains(this)))
	{
		this.owner.elements.remove(this);
	}

	this.owner = null;
};

Element.prototype.hitTest = function(rectangle)
{
	if ((rectangle.width === 0) && (rectangle.height === 0))
	{
		if (this.rectangle.contains(rectangle.topLeft()))
		{
			return true;
		}

		if ((this.tracker !== null) && (this.tracker.track))
		{
			var h = this.tracker.hitTest(rectangle.topLeft());
			if ((h.x >= -1) && (h.x <= +1) && (h.y >= -1) && (h.y <= +1))
			{
				return true;
			}
		}

		for (var i = 0; i < this.connectors.length; i++)
		{
			if (this.connectors[i].hitTest(rectangle))
			{
				return true;
			}
		}

		return false;
	}

	return rectangle.contains(this.rectangle);
};

Element.prototype.getCursor = function(point)
{
	if (this.tracker !== null)
	{
		var cursor = this.tracker.getCursor(point);
		if (cursor !== null)
		{
			return cursor;
		}
	}

	/*if (window.event.shiftKey)
	{
		return Cursors.add;
	}*/

	return Cursors.select;
};

Element.prototype.getConnector = function(name)
{
	for (var i = 0; i < this.connectors.length; i++)
	{
		var connector = this.connectors[i];
		if (connector.template.name == name)
		{
			return connector;
		}
	}
	return null;
};

Element.prototype.getConnectorPosition = function(connector)
{
	var rectangle = this.getRectangle();
	var point = connector.template.position(this);
	point.x += rectangle.x;
	point.y += rectangle.y;
	return point;
};

Element.prototype.setContent = function(content)
{
	this.owner.setElementContent(this, content);
};

Element.prototype.getContent = function()
{
	return this.content;
};

/* -------------------------- connection ------------------- */

var Connection = function(from, to)
{
	this.from = from;
	this.to = to;
	this.toPoint = null;
	this.color = '#000';
	this.lineWidth = 1;
};

Connection.prototype.select = function()
{
	this.selected = true;
	this.invalidate();
};

Connection.prototype.deselect = function()
{
	this.selected = false;
	this.invalidate();
};

Connection.prototype.remove = function()
{
	this.invalidate();
	if ((this.from !== null) && (this.from.connections.contains(this)))
	{
		this.from.connections.remove(this);
	}
	if ((this.to !== null) && (this.to.connections.contains(this)))
	{
		this.to.connections.remove(this);
	}
	this.from = null;
	this.to = null;
};

Connection.prototype.insert = function(from, to)
{
	this.from = from;
	this.to = to;
	this.from.connections.push(this);
	this.from.invalidate();
	this.to.connections.push(this);
	this.to.invalidate();
	this.invalidate();
};

Connection.prototype.getCursor = function(point)
{
	return Cursors.select;
};

Connection.prototype.hitTest = function(rectangle)
{
	if ((this.from !== null) && (this.to !== null))
	{
		var p1 = this.from.owner.getConnectorPosition(this.from);
		var p2 = this.to.owner.getConnectorPosition(this.to);
		if ((rectangle.width !== 0) || (rectangle.height !== 0))
		{
			return (rectangle.contains(p1) && rectangle.contains(p2));
		}

		var p = rectangle.topLeft();

		// p1 must be the leftmost point
		if (p1.x > p2.x) { var temp = p2; p2 = p1; p1 = temp; }

		var r1 = new Rectangle(p1.x, p1.y, 0, 0);
		var r2 = new Rectangle(p2.x, p2.y, 0, 0);
		r1.inflate(3, 3);
		r2.inflate(3, 3);

		if (r1.union(r2).contains(p))
		{
			if ((p1.x == p2.x) || (p1.y == p2.y)) // straight line
			{
				return true;
			}
			else if (p1.y < p2.y)
			{
				var o1 = r1.x + (((r2.x - r1.x) * (p.y - (r1.y + r1.height))) / ((r2.y + r2.height) - (r1.y + r1.height)));
				var u1 = (r1.x + r1.width) + ((((r2.x + r2.width) - (r1.x + r1.width)) * (p.y - r1.y)) / (r2.y - r1.y));
				return ((p.x > o1) && (p.x < u1));
			}
			else
			{
				var o2 = r1.x + (((r2.x - r1.x) * (p.y - r1.y)) / (r2.y - r1.y));
				var u2 = (r1.x + r1.width) + ((((r2.x + r2.width) - (r1.x + r1.width)) * (p.y - (r1.y + r1.height))) / ((r2.y + r2.height) - (r1.y + r1.height)));
				return ((p.x > o2) && (p.x < u2));
			}
		}
	}
	return false;
};

Connection.prototype.invalidate = function()
{
	if (this.from !== null)
	{
		this.from.invalidate();
	}
	if (this.to !== null)
	{
		this.to.invalidate();
	}
};

Connection.prototype.paint = function(context)
{
	context.strokeStyle = this.color;
	context.lineWidth = (this.hover) ? 2 : this.lineWidth;
	this.paintLine(context, this.selected);
};

Connection.prototype.paintTrack = function(context)
{
	context.strokeStyle = this.from.owner.owner.theme.connection;
	context.lineWidth = 1;
	this.paintLine(context, true);
};

Connection.prototype.paintLine = function(context, dashed)
{
	if (this.from !== null)
	{
		var start = this.from.owner.getConnectorPosition(this.from);
		var end = (this.to !== null) ? this.to.owner.getConnectorPosition(this.to) : this.toPoint;
		if ((start.x != end.x) || (start.y != end.y))
		{
			context.beginPath();
			if (dashed)
			{
				context.dashedLine(start.x, start.y, end.x, end.y);
			}
			else
			{
				context.moveTo(start.x - 0.5, start.y - 0.5);
				context.lineTo(end.x - 0.5, end.y - 0.5);
			}
			context.closePath();
			context.stroke();
		}
	}
};

var Selection = function(startPoint)
{
	this.startPoint = startPoint;
	this.currentPoint = startPoint;
};

Selection.prototype.paint = function(context)
{
	var r = this.getRectangle();
	context.lineWidth = 1;
	context.beginPath();
	context.dashedLine(r.x - 0.5,           r.y - 0.5,            r.x - 0.5 + r.width, r.y - 0.5);
	context.dashedLine(r.x - 0.5 + r.width, r.y - 0.5,            r.x - 0.5 + r.width, r.y - 0.5 + r.height);
	context.dashedLine(r.x - 0.5 + r.width, r.y - 0.5 + r.height, r.x - 0.5,           r.y - 0.5 + r.height);
	context.dashedLine(r.x - 0.5,           r.y - 0.5 + r.height, r.x - 0.5,           r.y - 0.5);
	context.closePath();
	context.stroke();
};

Selection.prototype.getRectangle = function()
{
	var r = new Rectangle(
		(this.startPoint.x <= this.currentPoint.x) ? this.startPoint.x : this.currentPoint.x,
		(this.startPoint.y <= this.currentPoint.y) ? this.startPoint.y : this.currentPoint.y,
		this.currentPoint.x - this.startPoint.x,
		this.currentPoint.y - this.startPoint.y);
	if (r.width < 0)
	{
		r.width *= -1;
	}
	if (r.height < 0)
	{
		r.height *= -1;
	}
	return r;
};

var ContainerUndoUnit = function()
{
	this.undoUnits = [];
};

ContainerUndoUnit.prototype.add = function(undoUnit)
{
	this.undoUnits.push(undoUnit);
};

ContainerUndoUnit.prototype.undo = function()
{
	for (var i = 0; i < this.undoUnits.length; i++)
	{
		this.undoUnits[i].undo();
	}
};

ContainerUndoUnit.prototype.redo = function()
{
	for (var i = 0; i < this.undoUnits.length; i++)
	{
		this.undoUnits[i].redo();
	}
};

ContainerUndoUnit.prototype.isEmpty = function()
{
	if (this.undoUnits.length > 0)
	{
		for (var i = 0; i < this.undoUnits.length; i++)
		{
			if (!("isEmpty" in this.undoUnits[i]) || !this.undoUnits[i].isEmpty())
			{
				return false;
			}
		}
	}
	return true;
};

var InsertElementUndoUnit = function(element, owner)
{
	this.element = element;
	this.owner = owner;
};

InsertElementUndoUnit.prototype.undo = function()
{
	this.element.remove();
};

InsertElementUndoUnit.prototype.redo = function()
{
	this.element.insertInto(this.owner);
};

var DeleteElementUndoUnit = function(element)
{
	this.element = element;
	this.owner = this.element.owner;
};

DeleteElementUndoUnit.prototype.undo = function()
{
	this.element.insertInto(this.owner);
};

DeleteElementUndoUnit.prototype.redo = function()
{
	this.element.remove();
};

var InsertConnectionUndoUnit = function(connection, from, to)
{
	this.connection = connection;
	this.from = from;
	this.to = to;
};

InsertConnectionUndoUnit.prototype.undo = function()
{
	this.connection.remove();
};

InsertConnectionUndoUnit.prototype.redo = function()
{
	this.connection.insert(this.from, this.to);
};

var DeleteConnectionUndoUnit = function(connection)
{
	this.connection = connection;
	this.from = connection.from;
	this.to = connection.to;
};

DeleteConnectionUndoUnit.prototype.undo = function()
{
	this.connection.insert(this.from, this.to);
};

DeleteConnectionUndoUnit.prototype.redo = function()
{
	this.connection.remove();
};

var ContentChangedUndoUnit = function(element, content)
{
	this.element = element;
	this.undoContent = element.content;
	this.redoContent = content;
};

ContentChangedUndoUnit.prototype.undo = function()
{
	this.element.content = this.undoContent;
};

ContentChangedUndoUnit.prototype.redo = function()
{
	this.element.content = this.redoContent;
};

var TransformUndoUnit = function(element, undoRectangle, redoRectangle)
{
	this.element = element;
	this.undoRectangle = new Rectangle(undoRectangle.x, undoRectangle.y, undoRectangle.width, undoRectangle.height);
	this.redoRectangle = new Rectangle(redoRectangle.x, redoRectangle.y, redoRectangle.width, redoRectangle.height);
};

TransformUndoUnit.prototype.undo = function()
{
	this.element.setRectangle(this.undoRectangle);
};

TransformUndoUnit.prototype.redo = function()
{
	this.element.setRectangle(this.redoRectangle);
};

var SelectionUndoUnit = function()
{
	this.states = [];
};

SelectionUndoUnit.prototype.undo = function()
{
	for (var i = 0; i < this.states.length; i++)
	{
		if (this.states[i].undo)
		{
			this.states[i].value.select();
		}
		else
		{
			this.states[i].value.deselect();
		}
	}
};

SelectionUndoUnit.prototype.redo = function()
{
	for (var i = 0; i < this.states.length; i++)
	{
		if (this.states[i].redo)
		{
			this.states[i].value.select();
		}
		else
		{
			this.states[i].value.deselect();
		}
	}
};

SelectionUndoUnit.prototype.select = function(value)
{
	this.update(value, value.selected, true);
};

SelectionUndoUnit.prototype.deselect = function(value)
{
	this.update(value, value.selected, false);
};

SelectionUndoUnit.prototype.update = function(value, undo, redo)
{
	for (var i = 0; i < this.states.length; i++)
	{
		if (this.states[i].value == value)
		{
			this.states[i].redo = redo;
			return;
		}
	}
	this.states.push({ value: value, undo: undo, redo: redo });
};

SelectionUndoUnit.prototype.isEmpty = function()
{
	for (var i = 0; i < this.states.length; i++)
	{
		if (this.states[i].undo != this.states[i].redo)
		{
			return false;
		}
	}
	return true;
};

var UndoService = function()
{
	this.container = null;
	this.stack = [];
	this.position = 0;
};

UndoService.prototype.begin = function()
{
	this.container = new ContainerUndoUnit();
};

UndoService.prototype.cancel = function()
{
	this.container = null;
};

UndoService.prototype.commit = function()
{
	if (!this.container.isEmpty())
	{
		this.stack.splice(this.position, this.stack.length - this.position);
		this.stack.push(this.container);
		this.redo();
	}
	this.container = null;
};

UndoService.prototype.add = function(undoUnit)
{
	this.container.add(undoUnit);
};

UndoService.prototype.undo = function()
{
	if (this.position !== 0)
	{
		this.position--;
		this.stack[this.position].undo();
	}
};

UndoService.prototype.redo = function()
{
	if ((this.stack.length !== 0) && (this.position < this.stack.length))
	{
		this.stack[this.position].redo();
		this.position++;
	}
};

// -------------------------------------------- Graph--------------------------------------------------------------
var Graph = function(element)
{
	this.canvas = element;
	this.canvas.focus();
	this.context = this.canvas.getContext("2d");
	this.theme = { background: "#FFF", connection: "#000", selection: "#000", connector: "#31456b", connectorBorder: "#fff", connectorHoverBorder: "#000", connectorHover: "#0c0" };
	this.pointerPosition = new Point(0, 0);
	this.shiftKey = false;
	this.undoService = new UndoService();
	this.elements = [];
	this.activeTemplate = null;
	this.activeObject = null;
	this.newElement = null;
	this.newConnection = null;
	this.selection = null;
	this.track = false;

	this.mouseDownHandler = this.mouseDown.bind(this);
	this.mouseUpHandler = this.mouseUp.bind(this);
	this.mouseMoveHandler = this.mouseMove.bind(this);
	this.doubleClickHandler = this.doubleClick.bind(this);
	this.touchStartHandler = this.touchStart.bind(this);
	this.touchEndHandler = this.touchEnd.bind(this);
	this.touchMoveHandler = this.touchMove.bind(this);
	this.keyDownHandler = this.keyDown.bind(this);
	this.keyPressHandler = this.keyPress.bind(this);
	this.keyUpHandler = this.keyUp.bind(this);

	this.canvas.addEventListener("mousedown", this.mouseDownHandler, false);
	this.canvas.addEventListener("mouseup", this.mouseUpHandler, false);
	this.canvas.addEventListener("mousemove", this.mouseMoveHandler, false);
	this.canvas.addEventListener("touchstart", this.touchStartHandler, false);
	this.canvas.addEventListener("touchend", this.touchEndHandler, false);
	this.canvas.addEventListener("touchmove", this.touchMoveHandler, false);
	this.canvas.addEventListener("dblclick", this.doubleClickHandler, false);
	this.canvas.addEventListener("keydown", this.keyDownHandler, false);
	this.canvas.addEventListener("keypress", this.keyPressHandler, false);
	this.canvas.addEventListener("keyup", this.keyUpHandler, false);

	this.isWebKit = typeof navigator.userAgent.split("WebKit/")[1] !== "undefined";
	this.isMozilla = navigator.appVersion.indexOf('Gecko/') >= 0 || ((navigator.userAgent.indexOf("Gecko") >= 0) && !this.isWebKit && (typeof navigator.appVersion !== "undefined"));
};

Graph.prototype.dispose = function()
{
	if (this.canvas !== null)
	{
		this.canvas.removeEventListener("mousedown", this.mouseDownHandler);
		this.canvas.removeEventListener("mouseup", this.mouseUpHandler);
		this.canvas.removeEventListener("mousemove", this.mouseMoveHandler);
		this.canvas.removeEventListener("dblclick", this.doubleClickHandler);
		this.canvas.removeEventListener("touchstart", this.touchStartHandler);
		this.canvas.removeEventListener("touchend", this.touchEndHandler);
		this.canvas.removeEventListener("touchmove", this.touchMoveHandler);
		this.canvas.removeEventListener("keydown", this.keyDownHandler);
		this.canvas.removeEventListener("keypress", this.keyPressHandler);
		this.canvas.removeEventListener("keyup", this.keyUpHandler);
		this.canvas = null;
		this.context = null;
	}
};

Graph.prototype.setTheme = function(theme)
{
	this.theme = theme;
}

Graph.prototype.mouseDown = function(e)
{
	e.preventDefault();
	this.canvas.focus();
	this.updateMousePosition(e);

	if (e.button === 0) // left-click
	{
		// alt+click allows fast creation of element using the active template
		if ((this.newElement === null) && (e.altKey))
		{
			this.createElement(this.activeTemplate);
		}

		this.pointerDown();
	}
};

Graph.prototype.mouseUp = function(e)
{
	e.preventDefault();
	this.updateMousePosition(e);
	if (e.button === 0) // left-click
	{
		this.pointerUp();
	}
};

Graph.prototype.mouseMove = function(e)
{
	e.preventDefault();
	this.updateMousePosition(e);
	this.pointerMove();
};

Graph.prototype.doubleClick = function(e)
{
	e.preventDefault();
	this.updateMousePosition(e);

	if (e.button === 0) // left-click
	{
		var point = this.pointerPosition;

		this.updateActiveObject(point);
		if ((this.activeObject !== null) && (this.activeObject instanceof Element) && (this.activeObject.template !== null) && ("edit" in this.activeObject.template))
		{
			this.activeObject.template.edit(this.activeObject, point);
			this.update();
		}
	}
};

Graph.prototype.touchStart = function(e)
{
	if (e.touches.length == 1)
	{
		e.preventDefault();
		this.updateTouchPosition(e);
		this.pointerDown();
	}
};

Graph.prototype.touchEnd = function(e)
{
	e.preventDefault();
	this.pointerUp();
};

Graph.prototype.touchMove = function(e)
{
	if (e.touches.length == 1)
	{
		e.preventDefault();
		this.updateTouchPosition(e);
		this.pointerMove();
	}
};

Graph.prototype.pointerDown = function()
{
	var point = this.pointerPosition;

	if (this.newElement !== null)
	{
		this.undoService.begin();
		this.newElement.invalidate();
		this.newElement.rectangle = new Rectangle(point.x, point.y, this.newElement.rectangle.width, this.newElement.rectangle.height);
		this.newElement.invalidate();
		this.undoService.add(new InsertElementUndoUnit(this.newElement, this));
		this.undoService.commit();
		this.newElement = null;
	}
	else
	{
		this.selection = null;
		this.updateActiveObject(point);
		if (this.activeObject === null)
		{
			// start selection
			this.selection = new Selection(point);
		}
		else
		{
			// start connection
			if ((this.activeObject instanceof Connector) && (!this.shiftKey))
			{
				if (this.activeObject.isValid(null))
				{
					this.newConnection = new Connection(this.activeObject, null);
					this.newConnection.toPoint = point;
					this.activeObject.invalidate();
				}
			}
			else
			{
				// select object
				if (!this.activeObject.selected)
				{
					this.undoService.begin();
					var selectionUndoUnit = new SelectionUndoUnit();
					if (!this.shiftKey)
					{
						this.deselectAll(selectionUndoUnit);
					}
					selectionUndoUnit.select(this.activeObject);
					this.undoService.add(selectionUndoUnit);
					this.undoService.commit();
				}
				else if (this.shiftKey)
				{
					this.undoService.begin();
					var deselectUndoUnit = new SelectionUndoUnit();
					deselectUndoUnit.deselect(this.activeObject);
					this.undoService.add(deselectUndoUnit);
					this.undoService.commit();
				}

				// start tracking
				var hit = new Point(0, 0);
				if (this.activeObject instanceof Element)
				{
					hit = this.activeObject.tracker.hitTest(point);
				}
				for (var i = 0; i < this.elements.length; i++)
				{
					var element = this.elements[i];
					if (element.tracker !== null)
					{
						element.tracker.start(point, hit);
					}
				}

				this.track = true;
			}
		}
	}

	this.update();
	this.updateMouseCursor();
};

Graph.prototype.pointerUp = function()
{
	var point = this.pointerPosition;

	if (this.newConnection !== null)
	{
		this.updateActiveObject(point);
		this.newConnection.invalidate();
		if ((this.activeObject !== null) && (this.activeObject instanceof Connector))
		{
			if ((this.activeObject != this.newConnection.from) && (this.activeObject.isValid(this.newConnection.from)))
			{
				this.undoService.begin();
				this.undoService.add(new InsertConnectionUndoUnit(this.newConnection, this.newConnection.from, this.activeObject));
				this.undoService.commit();
			}
		}

		this.newConnection = null;
	}

	if (this.selection !== null)
	{
		this.undoService.begin();
		var selectionUndoUnit = new SelectionUndoUnit();

		var rectangle = this.selection.getRectangle();
		if ((this.activeObject === null) || (!this.activeObject.selected))
		{
			if (!this.shiftKey)
			{
				this.deselectAll(selectionUndoUnit);
			}
		}

		if ((rectangle.width !== 0) || (rectangle.weight !== 0))
		{
			this.selectAll(selectionUndoUnit, rectangle);
		}

		this.undoService.add(selectionUndoUnit);
		this.undoService.commit();
		this.selection = null;
	}

	if (this.track)
	{
		this.undoService.begin();
		for (var i = 0; i < this.elements.length; i++)
		{
			var element = this.elements[i];
			if (element.tracker !== null)
			{
				element.tracker.track = false;
				element.invalidate();
				var r1 = element.getRectangle();
				var r2 = element.tracker.rectangle;
				if ((r1.x != r2.x) || (r1.y != r2.y) || (r1.width != r2.width) || (r1.height != r2.height))
				{
					this.undoService.add(new TransformUndoUnit(element, r1, r2));
				}
			}
		}

		this.undoService.commit();
		this.track = false;
		this.updateActiveObject(point);
	}

	this.update();
	this.updateMouseCursor();
};

Graph.prototype.pointerMove = function()
{
	var point = this.pointerPosition;

	if (this.newElement !== null)
	{
		// placing new element
		this.newElement.invalidate();
		this.newElement.rectangle = new Rectangle(point.x, point.y, this.newElement.rectangle.width, this.newElement.rectangle.height);
		this.newElement.invalidate();
	}

	if (this.track)
	{
		// moving selected elements
		for (var i = 0; i < this.elements.length; i++)
		{
			var element = this.elements[i];
			if (element.tracker !== null)
			{
				element.invalidate();
				element.tracker.move(point);
				element.invalidate();
			}
		}
	}

	if (this.newConnection !== null)
	{
		// connecting two connectors
		this.newConnection.invalidate();
		this.newConnection.toPoint = point;
		this.newConnection.invalidate();
	}

	if (this.selection !== null)
	{
		this.selection.currentPoint = point;
	}

	this.updateActiveObject(point);
	this.update();
	this.updateMouseCursor();
};


Graph.prototype.keyDown = function(e)
{
	if (!this.isMozilla)
	{
		this.processKey(e, e.keyCode);
	}
};

Graph.prototype.keyPress = function(e)
{
	if (this.isMozilla)
	{
		if (typeof this.keyCodeTable === "undefined")
		{
			this.keyCodeTable = [];
			var charCodeTable = {
				32: ' ',  48: '0',  49: '1',  50: '2',  51: '3',  52: '4', 53:  '5',  54: '6',  55: '7',  56: '8',  57: '9',  59: ';',  61: '=',
				65:  'a', 66: 'b',  67: 'c',  68: 'd',  69: 'e',  70: 'f',  71: 'g', 72:  'h',  73: 'i',  74: 'j',  75: 'k',  76: 'l',  77: 'm',  78: 'n', 79:  'o', 80: 'p',  81: 'q',  82: 'r',  83: 's',  84: 't',  85: 'u', 86: 'v', 87: 'w',  88: 'x',  89: 'y',  90: 'z',
				107: '+', 109: '-', 110: '.', 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', 221: ']', 222: '\"'
			};

			for (var keyCode in charCodeTable)
			{
				var key = charCodeTable[keyCode];
				this.keyCodeTable[key.charCodeAt(0)] = keyCode;
				if (key.toUpperCase() != key)
				{
					this.keyCodeTable[key.toUpperCase().charCodeAt(0)] = keyCode;
				}
			}
		}

		this.processKey(e, (this.keyCodeTable[e.charCode]) ? this.keyCodeTable[e.charCode] : e.keyCode);
	}
};

Graph.prototype.keyUp = function(e)
{
	this.updateMouseCursor();
};

Graph.prototype.processKey = function(e, keyCode)
{
	if ((e.ctrlKey || e.metaKey) && !e.altKey) // ctrl or option
	{
		if (keyCode == 65) // A - select all
		{
			this.undoService.begin();
			var selectionUndoUnit = new SelectionUndoUnit();
			this.selectAll(selectionUndoUnit, null);
			this.undoService.add(selectionUndoUnit);
			this.undoService.commit();
			this.update();
			this.updateActiveObject(this.pointerPosition);
			this.updateMouseCursor();
			this.stopEvent(e);
		}

		if ((keyCode == 90) && (!e.shiftKey)) // Z - undo
		{
			this.undoService.undo();
			this.update();
			this.updateActiveObject(this.pointerPosition);
			this.updateMouseCursor();
			this.stopEvent(e);
		}

		if (((keyCode == 90) && (e.shiftKey)) || (keyCode == 89)) // Y - redo
		{
			this.undoService.redo();
			this.update();
			this.updateActiveObject(this.pointerPosition);
			this.updateMouseCursor();
			this.stopEvent(e);
		}
	}

	if ((keyCode == 46) || (keyCode == 8)) // DEL - delete
	{
		this.deleteSelection();
		this.update();
		this.updateActiveObject(this.pointerPosition);
		this.updateMouseCursor();
		this.stopEvent(e);
	}

	if (keyCode == 27) // ESC
	{
		this.newElement = null;
		this.newConnection = null;

		this.track = false;
		for (var i = 0; i < this.elements.length; i++)
		{
			var element = this.elements[i];
			if (element.tracker !== null)
			{
				element.tracker.track = false;
			}
		}

		this.update();
		this.updateActiveObject(this.pointerPosition);
		this.updateMouseCursor();
		this.stopEvent(e);
	}
};

Graph.prototype.stopEvent = function(e)
{
	e.preventDefault();
	e.stopPropagation();
};

Graph.prototype.deleteSelection = function()
{
	var i, j, k;
	var element;

	this.undoService.begin();

	var deletedConnections = [];
	for (i = 0; i < this.elements.length; i++)
	{
		element = this.elements[i];
		for (j = 0; j < element.connectors.length; j++)
		{
			var connector = element.connectors[j];
			for (k = 0; k < connector.connections.length; k++)
			{
				var connection = connector.connections[k];
				if ((element.selected || connection.selected) && (!deletedConnections.contains(connection)))
				{
					this.undoService.add(new DeleteConnectionUndoUnit(connection));
					deletedConnections.push(connection);
				}
			}
		}
	}

	for (i = 0; i < this.elements.length; i++)
	{
		element = this.elements[i];
		if (element.selected)
		{
			this.undoService.add(new DeleteElementUndoUnit(element));
		}
	}

	this.undoService.commit();
};

Graph.prototype.selectAll = function(selectionUndoUnit, rectangle)
{
	for (var i = 0; i < this.elements.length; i++)
	{
		var element = this.elements[i];
		if ((rectangle === null) || (element.hitTest(rectangle)))
		{
			selectionUndoUnit.select(element);
		}

		for (var j = 0; j < element.connectors.length; j++)
		{
			var connector = element.connectors[j];
			for (var k = 0; k < connector.connections.length; k++)
			{
				var connection = connector.connections[k];
				if ((rectangle === null) || (connec
Download .txt
gitextract_ssjddytk/

├── .gitattributes
├── CHANGELOG
├── LICENSE
├── README.md
├── config/
│   ├── general.php
│   ├── help.php
│   ├── info.php
│   ├── securing.php
│   ├── sinks.php
│   ├── sources.php
│   └── tokens.php
├── css/
│   ├── ayti.css
│   ├── barf.css
│   ├── code-dark.css
│   ├── espresso.css
│   ├── notepad++.css
│   ├── phps.css
│   ├── print.css
│   ├── rips.css
│   ├── term.css
│   └── twilight.css
├── index.php
├── js/
│   ├── exploit.js
│   ├── hotpatch.js
│   ├── netron.js
│   └── script.js
├── lib/
│   ├── analyzer.php
│   ├── constructer.php
│   ├── filer.php
│   ├── printer.php
│   ├── scanner.php
│   ├── searcher.php
│   └── tokenizer.php
├── main.php
├── papers/
│   ├── LCA 2012_ PHP Static Code Analysis.html
│   ├── LCA 2012_ PHP Static Code Analysis_files/
│   │   ├── a.html
│   │   ├── css.css
│   │   ├── prettify.txt
│   │   ├── slides.txt
│   │   └── styles.css
│   └── README.md
├── rips_stats.py
└── windows/
    ├── code.php
    ├── exploit.php
    ├── function.php
    ├── help.php
    ├── hotpatch.php
    └── leakscan.php
Download .txt
SYMBOL INDEX (110 symbols across 20 files)

FILE: config/info.php
  class Info (line 18) | final class Info

FILE: config/sources.php
  class Sources (line 18) | final class Sources

FILE: config/tokens.php
  class Tokens (line 65) | final class Tokens

FILE: js/exploit.js
  function editExploit (line 6) | function editExploit()
  function deleteMethod (line 12) | function deleteMethod(method)
  function getQuery (line 17) | function getQuery(method)
  function createExploit (line 30) | function createExploit()
  function setssl (line 146) | function setssl()

FILE: js/hotpatch.js
  function getParams (line 1) | function getParams(method)
  function createHotpatch (line 17) | function createHotpatch()

FILE: js/netron.js
  function PageTemplate (line 1915) | function PageTemplate()
  function ScriptTemplate (line 1950) | function ScriptTemplate()
  function ContentEditor (line 1985) | function ContentEditor()

FILE: js/script.js
  function scanAnimation (line 11) | function scanAnimation(height, idprefix)
  function handleResponse (line 18) | function handleResponse(idprefix) {
  function scan (line 69) | function scan(ignore_warning)
  function leakScan (line 152) | function leakScan(hoveritem, varname, line, ignore_warning)
  function search (line 255) | function search()
  function setActiveStyleSheet (line 296) | function setActiveStyleSheet(title)
  function hide (line 309) | function hide(tag)
  function catshow (line 323) | function catshow(tag)
  function showAllCats (line 341) | function showAllCats()
  function markVariable (line 350) | function markVariable(variable)
  function mouseFunction (line 365) | function mouseFunction(name, item)
  function openFunction (line 377) | function openFunction(name, linenr)
  function returnLastCode (line 389) | function returnLastCode()
  function closeFuncCode (line 403) | function closeFuncCode()
  function closeWindow (line 408) | function closeWindow(id)
  function maxWindow (line 415) | function maxWindow(id, newwidth)
  function minWindow (line 428) | function minWindow(id, oldwidth)
  function toTop (line 434) | function toTop(wid)
  function showgraph (line 446) | function showgraph(type)
  function showlist (line 456) | function showlist(type)
  function scroller (line 466) | function scroller()
  function openWindow (line 489) | function openWindow(id)
  function getFuncCode (line 502) | function getFuncCode(hoveritem, file, start, end)
  function openHelp (line 536) | function openHelp(hoveritem, type, thefunction, get, post, cookie, files...
  function openHotpatch (line 581) | function openHotpatch(hoveritem, file, get, post, cookie, files, server)
  function openCodeViewer (line 623) | function openCodeViewer(hoveritem, file, lines)
  function openExploitCreator (line 674) | function openExploitCreator(hoveritem, file, get, post, cookie, files, s...
  function saveCanvas (line 716) | function saveCanvas(canvas, id)
  function restoreCanvas (line 737) | function restoreCanvas(canvas, id)
  function draginit (line 754) | function draginit() {
  function dragstart (line 759) | function dragstart(id) {
  function dragstop (line 765) | function dragstop() {
  function drag (line 772) | function drag(ereignis) {
  function resizeStart (line 792) | function resizeStart(e, id)
  function getPos (line 809) | function getPos(e)
  function generateDiagram (line 855) | function generateDiagram()

FILE: lib/analyzer.php
  class Analyzer (line 18) | class Analyzer
    method get_tokens_value (line 21) | static function get_tokens_value($file_name, $tokens, $var_declares, $...
    method get_var_value (line 118) | static function get_var_value($file_name, $var_token, $var_declares, $...
    method getBraceEnd (line 147) | static function getBraceEnd($tokens, $i)
    method get_ini_paths (line 168) | static function get_ini_paths($path)

FILE: lib/constructer.php
  class VarDeclare (line 19) | class VarDeclare
    method __construct (line 33) | function __construct($tokens = array(), $comment = '')
  class VulnBlock (line 50) | class VulnBlock
    method __construct (line 60) | function __construct($uid = '', $category = 'match', $sink = '')
  class VulnTreeNode (line 73) | class VulnTreeNode
    method __construct (line 93) | function __construct($value = null)
  class InfoTreeNode (line 111) | class InfoTreeNode
    method __construct (line 120) | function __construct($value = null)
  class FunctionDeclare (line 132) | class FunctionDeclare
    method __construct (line 141) | function __construct($tokens)

FILE: lib/filer.php
  function read_recursiv (line 19) | function read_recursiv($path, $scan_subdirs)

FILE: lib/printer.php
  function addError (line 19) | function addError($message, $tokens, $line_nr, $filename)
  function tokenstostring (line 38) | function tokenstostring($tokens)
  function highlightline (line 62) | function highlightline($tokens, $comment, $line_nr, $title=false, $udfti...
  function getVulnNodeTitle (line 195) | function getVulnNodeTitle($func_name)
  function increaseVulnCounter (line 234) | function increaseVulnCounter($func_name)
  function traverseBottomUp (line 269) | function traverseBottomUp($tree)
  function traverseTopDown (line 292) | function traverseTopDown($tree, $start=true, $lines=array())
  function dependenciesTraverse (line 324) | function dependenciesTraverse($tree)
  function fileHasVulns (line 343) | function fileHasVulns($blocks)
  function printoutput (line 354) | function printoutput($output, $treestyle=1)
  function createFunctionList (line 501) | function createFunctionList($user_functions_offset)
  function createUserinputList (line 576) | function createUserinputList($user_input)
  function createFileList (line 603) | function createFileList($files, $file_sinks)
  function statsRow (line 724) | function statsRow($nr, $name, $amount, $all)

FILE: lib/scanner.php
  class Scanner (line 18) | class Scanner
    method __construct (line 64) | function __construct($file_name, $scan_functions, $info_functions, $so...
    method add_auto_include (line 133) | function add_auto_include($paths, $beginning)
    method scan_parameter (line 154) | function scan_parameter($mainparent, $parent, $var_token, $var_keys, $...
    method addexploitparameter (line 562) | function addexploitparameter($parent, $type, $parameter_name)
    method addtriggerfunction (line 585) | function addtriggerfunction($mainparent)
    method addfunctiondependend (line 602) | function addfunctiondependend($mainparent, $parent, $return_scan, $key)
    method variable_add (line 632) | function variable_add($var_name, $tokens, $comment, $tokenscanstart, $...
    method variable_scan (line 717) | function variable_scan($i, $offset, $category, $title)
    method already_scanned (line 805) | function already_scanned($i)
    method quote_analysis_needed (line 823) | function quote_analysis_needed()
    method parse (line 834) | function parse()

FILE: lib/searcher.php
  function searchFile (line 18) | function searchFile($file_name, $search)

FILE: lib/tokenizer.php
  class Tokenizer (line 18) | class Tokenizer
    method __construct (line 23) | function __construct($filename)
    method tokenize (line 29) | public function tokenize($code)
    method wrapbraces (line 41) | function wrapbraces($start, $between, $end)
    method prepare_tokens (line 51) | function prepare_tokens()
    method fix_tokens (line 95) | function fix_tokens()
    method array_reconstruct_tokens (line 382) | function array_reconstruct_tokens()
    method fix_ternary (line 452) | function fix_ternary()

FILE: rips_stats.py
  function getargs (line 12) | def getargs():
  function extract_td_single (line 28) | def extract_td_single(column_name,data):
  function main (line 37) | def main(args, options=[]):

FILE: windows/code.php
  function highlightline (line 22) | function highlightline($line, $line_nr, $marklines, $in_comment)

FILE: windows/exploit.php
  function creatediv (line 64) | function creatediv($method, $name)

FILE: windows/function.php
  function highlightline (line 22) | function highlightline($line, $line_nr)

FILE: windows/hotpatch.php
  function getFilterOptions (line 32) | function getFilterOptions($id)
  function creatediv (line 40) | function creatediv($method, $name)

FILE: windows/leakscan.php
  function checkLeak (line 112) | function checkLeak($tree, $line, $varname)
  function lineLeakes (line 128) | function lineLeakes($line, $var, $block)
Condensed preview — 48 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (578K chars).
[
  {
    "path": ".gitattributes",
    "chars": 265,
    "preview": "# Set the default behavior, in case people don't have core.autocrlf set.\n* text=auto\n\n*.css text eol=lf\n*.js text eol=lf"
  },
  {
    "path": "CHANGELOG",
    "chars": 10410,
    "preview": "RIPS CHANGELOG\n===============\n\nRIPS 0.55\n----------\n\t- updated configuration (sources, sinks, sanitization)\n\t- added se"
  },
  {
    "path": "LICENSE",
    "chars": 35147,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 4032,
    "preview": "# RIPS\nA static source code analyser for vulnerabilities in PHP scripts\n\n## Requirements\n* web server: Apache or Nginx r"
  },
  {
    "path": "config/general.php",
    "chars": 3248,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/help.php",
    "chars": 12513,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/info.php",
    "chars": 3690,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/securing.php",
    "chars": 4324,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/sinks.php",
    "chars": 20656,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/sources.php",
    "chars": 2747,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "config/tokens.php",
    "chars": 6232,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "css/ayti.css",
    "chars": 2896,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.userinput, .persistent {\n\tlist-style-type: disc;\n\tcolor:whit"
  },
  {
    "path": "css/barf.css",
    "chars": 2977,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.menu {\n\tbackground-color: #1D261B;\n}\n\ninput[type=\"text\"],sel"
  },
  {
    "path": "css/code-dark.css",
    "chars": 2960,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.menu {\n\tbackground-color:#010101;\n}\n\n\ninput[type=\"text\"],sel"
  },
  {
    "path": "css/espresso.css",
    "chars": 3028,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.menu {\n\tbackground-color: #351F12;\n}\n\n\ninput[type=\"text\"],se"
  },
  {
    "path": "css/notepad++.css",
    "chars": 3168,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\nbody, html {\n\tcolor: #111111;\n}\n\n.textcolor {\n\tcolor: #ffffff"
  },
  {
    "path": "css/phps.css",
    "chars": 2924,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\nbody, html {\n\tcolor: #111111;\n}\n\n.textcolor {\n\tcolor: #ffffff"
  },
  {
    "path": "css/print.css",
    "chars": 1397,
    "preview": "html, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, bi"
  },
  {
    "path": "css/rips.css",
    "chars": 12005,
    "preview": "body, html {\n\tfont-family: helvetica;\n\tbackground-color: #DFDFDF;\n\tpadding: 0;\n\tmargin: 0;\n\tcolor: #DFDFDF;\n}\n\n.menu {\n\t"
  },
  {
    "path": "css/term.css",
    "chars": 2894,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.userinput, .persistent {\n\tlist-style-type: disc;\n\tcolor:whit"
  },
  {
    "path": "css/twilight.css",
    "chars": 2880,
    "preview": "#scrollwindow {\n\tbackground-color: grey;\n\topacity:0.22;\n}\n\n.userinput, .persistent {\n\tlist-style-type: disc;\n\tcolor:whit"
  },
  {
    "path": "index.php",
    "chars": 10166,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "js/exploit.js",
    "chars": 5798,
    "preview": "/**\n\tRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\t\tby Johannes Dahse (johannes.dahse@rub.de)"
  },
  {
    "path": "js/hotpatch.js",
    "chars": 1537,
    "preview": "function getParams(method)\n{\n\tvar query = \"\";\n\tvar elements = document.getElementById(method).elements;\n\tfor(var i=0;i<e"
  },
  {
    "path": "js/netron.js",
    "chars": 50590,
    "preview": "Function.prototype.bind = function(obj)\n{\n\tvar fn = this;\n\treturn function()\n\t{\n\t\treturn fn.apply(obj, arguments);\n\t};\n}"
  },
  {
    "path": "js/script.js",
    "chars": 26917,
    "preview": "/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@rub.de)\n"
  },
  {
    "path": "lib/analyzer.php",
    "chars": 5912,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/constructer.php",
    "chars": 3403,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/filer.php",
    "chars": 1522,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/printer.php",
    "chars": 25898,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/scanner.php",
    "chars": 82872,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/searcher.php",
    "chars": 1704,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "lib/tokenizer.php",
    "chars": 16733,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "main.php",
    "chars": 16021,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis.html",
    "chars": 21301,
    "preview": "<!DOCTYPE html>\n<!--\n  Google HTML5 slide template\n\n  Authors: Luke Mahé (code)\n           Marcin Wichary (code and desi"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis_files/a.html",
    "chars": 107,
    "preview": "<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body></body></html>"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis_files/css.css",
    "chars": 1395,
    "preview": "@font-face {\n  font-family: 'Droid Sans Mono';\n  font-style: normal;\n  font-weight: 400;\n  src: local('Droid Sans Mono')"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis_files/prettify.txt",
    "chars": 53996,
    "preview": "// Copyright (C) 2006 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis_files/slides.txt",
    "chars": 14743,
    "preview": "/*\n  Google HTML5 slides template\n\n  Authors: Luke Mahé (code)\n           Marcin Wichary (code and design)\n\n           D"
  },
  {
    "path": "papers/LCA 2012_ PHP Static Code Analysis_files/styles.css",
    "chars": 11329,
    "preview": "/*\n  Google HTML5 slides template\n\n  Authors: Luke Mahé (code)\n           Marcin Wichary (code and design)\n           \n "
  },
  {
    "path": "papers/README.md",
    "chars": 1989,
    "preview": "# Papers by Johannes Dahse\n\n2016\n* [Static detection of complex vulnerabilities in modern PHP applications](https://d-nb"
  },
  {
    "path": "rips_stats.py",
    "chars": 3087,
    "preview": "#! /usr/bin/env python\n# -*- coding: UTF-8 -*-\n# Author : tintinweb@oststrom.com <github.com/tintinweb>\n#\n# minimal depe"
  },
  {
    "path": "windows/code.php",
    "chars": 4495,
    "preview": "<table width='100%'>\n<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dah"
  },
  {
    "path": "windows/exploit.php",
    "chars": 3663,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "windows/function.php",
    "chars": 2355,
    "preview": "<table width='100%'>\n<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dah"
  },
  {
    "path": "windows/help.php",
    "chars": 4973,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "windows/hotpatch.php",
    "chars": 2914,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  },
  {
    "path": "windows/leakscan.php",
    "chars": 6172,
    "preview": "<?php\n/**\n\nRIPS - A static source code analyser for vulnerabilities in PHP scripts\n\tby Johannes Dahse (johannes.dahse@ru"
  }
]

About this extraction

This page contains the full source code of the robocoder/rips-scanner GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 48 files (509.8 KB), approximately 151.6k tokens, and a symbol index with 110 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!