Nmap Development mailing list archives

Question about unpwdb filter_iterator


From: Phil <mainframed767 () gmail com>
Date: Thu, 16 Apr 2015 15:51:09 -0700

I’m writing a few scripts for mainframe activities and they have some really interesting rules for usernames/password. 

I’m working on a brute force script and for now want to limit usernames to only contain characters/numbers and be less 
than or equal to eight chars in length. 

Should be easy:

local valid_name = function(x)
        local patt = "[%w]"
        return (string.len(x) <= 8 and string.match(x,patt))
end

later in action = function( host, port ) I put this:

local users = unpwdb.filter_iterator(brute.usernames_iterator(),valid_name)


And in my usernames.lst file I have 7 users:

root
admin
administrator
webadmin
sysadmin
netadmin
test

Now, what I expected to happen is that it would iterate through root, admin, webadmin, sysadmin, netadmin and test. In 
reality, filter_iterator returns root and admin, then nil and my script ends after only testing those two users. 

Am I doing something wrong? Am I misunderstanding how filter_iterator works? For now I’m working around it by placing a 
check in the login function for brute but I don’t think thats the right way to do it. 
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: