Pen Testing the SA account

  • I have written a script that is using OPENROWSET to connect to a server with a dynamic supplied username and password combination.

    If login fails I want my script to continue and try the next pair supplied.

    i.e when recieving

    Server: Msg 18456, Level 14, State 1, Line 1

    Login failed for user 'user'.

    I want to LOOP and try again.

    Any assistance appreciated.

  • Additional:

    I have tried @@error :

    exec @err = sp_executesql @query

    /* However the script terminates here 🙁 */

    select @@error, @err

  • More information for anyone that is able to help me..

    USE MyDB

    go

    CREATE PROCEDURE sp_bruteforce

    @pwd varchar(25)

    AS

    EXECUTE ('insert into OPENROWSET(''SQLOLEDB'',''SERVER=ipaddress,1433;uid=sa;pwd=' + @pwd + N''',''select * from table1'') select * from table 2')

    print 'foo'

    go

    EXEC sp_bruteforce foo

    print 'foo'

    When log in fails 'foo' is not printed. I need to carry on the execution.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply