Get basic configuration information for a Web site in Java

Source: Internet
Author: User

Foreword: When we are in the website infiltration, usually the first step is to obtain some configuration information of the target website, such as: the type of server used, what kind of CMS is used, which plugins are used by the website and so on. Of course, if we get enough information in this step, there is no doubt that we can do a targeted search and mining of the vulnerability, which is very helpful for the final penetration test.

A Brief introduction

Today, I mainly give you amway a better site for the basic information on the target site, it is: https://builtwith.com. It is also very simple to use, directly to the target site search on the line, for example, we search: https://builtwith.com/blog.6ag.cn. The results returned are as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/66/wKiom1aPx0yCrxyrAAC-c-ij4pI732.png "style=" float: none; "title=" 20160107000354_84162.png "alt=" Wkiom1apx0ycrxyraac-c-ij4pi732.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/64/wKioL1aPx3fw_Gg4AAClY5Ac1fs682.png "style=" float: none; "title=" 20160107000425_55164.png "alt=" Wkiol1apx3fw_gg4aacly5ac1fs682.png "/>

Here, I cut two pictures, other information can not, left to everyone to see it 650) this.width=650; "Src=" http://www.zifangsky.cn/wp-content/plugins/ Kindeditor-for-wordpress/plugins/emoticons/images/13.gif "border=" 0 "style=" border:0px;vertical-align:middle; Height:auto; "/>

Next, after analyzing this information, I decided to use Java to extract some of the more useful information and present it in a more intuitive way to facilitate the analysis behind us.

Two-code implementation

/** *  through the website: https://builtwith.com Search information  *  @param  domain *  @return   Queried domain name information  * */public static string getservermoremess (string domain) {String  message =  ""; Try {url url = new url ("https://builtwith.com/"  +  domain); httpurlconnection connection =  (HttpURLConnection)  url.openconnection (); Connection.setrequestmethod ("GET"); Connection.setreadtimeout (20000); Connection.setreadtimeout (20000); if ( Connection.getresponsecode ()  == 200) {inputstream inputstream =  Connection.getinputstream (); Bufferedreader reader = new bufferedreader (New inputstreamreader (InputStream)); string line =  ""; pattern pattern = null; Matcher matcher = null;while ((Line = reader.readline ())  != null) {pattern  = pattern.compile ("<span>Web Server</span>"); MatcheR = pattern.matcher (line); if (Matcher.find ()) message = message +  "Web Server : \ n ";p attern = pattern.compile (" <a href=\ "//trends.builtwith.com/web-server/[^\\s\"]+?\ "> ([^<>\ "]+?)  Usage Statistics</a> "); Matcher = pattern.matcher (line); if (Matcher.find ()) message  = message +  "    "  + matcher.group (1)  +  "\ n"; Pattern = pattern.compile ("<span>Content Management Systems</span>"); Matcher  = pattern.matcher (line); if (Matcher.find ()) message = message +  "Content  management systems:\n ";p attern = pattern.compile (" <a href=\ "//trends.builtwith.com/cms/ [^\\s\ "]+?\" > ([^<>\ "]+?)  Usage Statistics</a> "), Matcher = pattern.matcher (line), while (Matcher.find ()) message  = message +  "    "  + matcher.grOUP (1)  +  "\ n";p attern = pattern.compile ("<span>Frameworks</span>"); Matcher  = pattern.matcher (line), if (Matcher.find ()) message = message +  "Frameworks:\n"; Pattern = pattern.compile ("<a href=\"//trends.builtwith.com/framework/[^\\s\ "]+?\" > ([^ <>\ "]+?)  Usage Statistics</a> "), Matcher = pattern.matcher (line), while (Matcher.find ()) message  = message +  "    "  + matcher.group (1)  +  "\ n"; Pattern = pattern.compile ("<span>Widgets</span>"); Matcher = pattern.matcher ( Line), if (Matcher.find ()) message = message +  "widgets:\n";p attern =  Pattern.compile ("<a href=\"//trends.builtwith.com/widgets/[^\\s\ "]+?\" > ([^<>\]]+?)  Usage Statistics</a> "), Matcher = pattern.matcher (line), while (Matcher.find ()) message  = message +  "     " + matcher.group (1)  + " \ n ";p attern = pattern.compile (" <span>Encoding</span> "); Matcher = pattern.matcher (line); if (Matcher.find ()) message =  message +  "encoding:\n";p attern = pattern.compile ("<a href=\"// Trends.builtwith.com/encoding/[^\\s\ "]+?\" > ([^<>\ "]+?)  Usage Statistics</a> "), Matcher = pattern.matcher (line), while (Matcher.find ()) message  = message +  "    "  + matcher.group (1)  +  "\ n";}}  catch  (malformedurlexception e)  {e.printstacktrace ();}  catch  (ioexception e)  {e.printstacktrace ();} Return message;}

Three-Test

public static void Main (string[] args) {String str = "";//str = servertype.getservermoremess ("www.zifangsky.cn"); str = Ser Vertype.getservermoremess ("blog.6ag.cn/"); System.out.println (str);}

Web Server:
Tengine
Content Management Systems:
Wordpress
WordPress Weekly Activity
WordPress 4.4
Widgets:
Crayon Syntax Highlighter
Crayon Syntax Highlighter
WordPress Plugins
Font Awesome
Encoding:
UTF-8


This article is from "Zifangsky's personal blog" blog, make sure to keep this source http://983836259.blog.51cto.com/7311475/1733108

Get basic configuration information for a Web site in Java

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.