Nmap Development mailing list archives
Re: NSE:porting mysql-brute to brute framework
From: Patrik Karlsson <patrik () cqure net>
Date: Sat, 11 Feb 2012 14:56:13 +0100
On Sat, Feb 11, 2012 at 2:50 AM, Littlefield, Tyler <tyler () tysdomain com>wrote:
Hello: I'm working on porting the mysql-brute script over. Here's what I have so far, I'm just moving the code around. I have a quick question regarding this though. The connect I believe is called when this is passed on to the engine. Do I need to keep disconnecting and reconnecting?
This depends on the behavior of mysql and if it requires disconnecting after an invalid login attempt. If that's not the case, you can have a look at how smtp-brute uses a socket pool of connected sockets.
Also, I'm noticing some try functions, but there's no error handling setup. What do I need to do there?
The try function essentially checks the whether the first parameter (status) returned from the called function is true or false and executes the catch function before it halts script execution in case status is false. You should probably replace it with an if statement when porting it to the brute framework like this: local status = mysql.receiveGreeting( socket ) if ( not(status) ) then some error handling code here end
Finally, how do I submit this when it is finally done?
You can submit the script as an attachment here (to nmap-dev) once you have something and me or someone else will have a look at it and get back to you with comments. Some comments in regards to the code and the brute framework; The scripts that do not make use of the brute framework load a dictionary of usernames and passwords usually using unpwdb.usernames() and unpwdb.passwords(), this is done by the framework, so you can get rid of this code. Also, iterating over usernames and passwords is done by the brute framework, so the login function should really only have the code needed to perform the actual login and check whether it was successful or not. Hope that helps. //Patrik -- Patrik Karlsson http://www.cqure.net http://twitter.com/nevdull77 _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- NSE:porting mysql-brute to brute framework Littlefield, Tyler (Feb 10)
- Re: NSE:porting mysql-brute to brute framework Patrik Karlsson (Feb 11)