PHP static analysis and cross-site scripting (2)-PHP source code

Source: Internet
Author: User
Ec (2); & nbsp; Continue with yesterday's topic, this time I am still working to understand the php parsing process. This shows the ParseTree generated by parsing the PHP file in ProgramConverter, and uses JTree. & Nbsp; of course, ProgramConverter's script ec (2); script

Today, we continue to talk about yesterday. This time we are still working to understand the php parsing process. This shows the ParseTree generated by parsing the PHP file in ProgramConverter, and uses JTree.
Of course, the ParseTree method is not returned in ProgramConverter. If it is resolved again in the Checker, it is undoubtedly not cost-effective. Therefore, rewrite ProgramConverter and add several lines of code. Then, the Checker calls the class that generates the specific JTree, transmits the ParseTree as the parameter, and then OK.
Compared with Draw yesterday, JTabbedPane is used as the underlying container to carry DrawPanel and today's ParseTreePanel, and the changes in these areas will not be written.
The following lists the class files that convert ParseTree to JTree:


Package at. ac. tuwien. infosys. www. pixy;

Import java. util .*;
Import javax. swing .*;
Import javax. swing. tree .*;
Import java. awt .*;
Import at. ac. tuwien. infosys. www. phpparser .*;


Public class ParseTreePanel extends JPanel
...{
Private ParseTree parseTree;

Public ParseTreePanel (ParseTree parseTree)
...{
This. parseTree = parseTree;

This. add (new JTree (convert (this. parseTree. getRoot (), BorderLayout. CENTER );
}
Public DefaultMutableTreeNode convert (ParseNode parseNode)
...{
String name = parseNode. getName ();
If (parseNode. isToken ())
...{
Name + = ":" + parseNode. getLineno ();
}
DefaultMutableTreeNode dmtNode = new DefaultMutableTreeNode (name );
Java. util. List List = parseNode. getChildren ();
For (ParseNode node: list)
...{
DmtNode. add (convert (node ));
}
Return dmtNode;
}
}
These are all superficial articles that do not involve the meaning of Pixy.
By the way, PhpParser and Pixy are made by the same person. I really admire it!

In addition, I read this ASPA thing today and converted the asp file into a PHP file. It was amazing that it could not run. However, after I recompile AspParser. java, I can run it. Otherwise, some problems may occur in the referenced commons component. I don't know if it's just me.



<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.