Jump to content

doubt in converting powershell code to Autoit


Recommended Posts

Hi All,

       Due to some restriction in our environment we should not pass the user id and password of the database directly in code to connect to the DB. so we have dll which will help to retrive the user id and password. initially we had a powershell code which will get the login id and password from the dll, now i want to to do the same using autoit.. i know autoit is capable of.. but i am failing to do that.. can someone help me how to do it?

Here is my Powershell coe:

$dll = New-Object -TypeName TESTS.SecurityAssist

[string] $userid = ""
[string] $pwd = ""
[string]$domain = ""

$dll.retrieveSA("DATABASE", [ref]$domain,[ref]$userid, [ref]$pwd)

Here is the autoit code which i tried:

$Open = DllOpen("C:\temp\TEST.dll")
$DLL = ObjCreate("TESTS.SecurityAssist")
$userid = ""
$pwd = ""


I am very poor at DLL using :( so please appologise if my code irritated any of you :)

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

I've got no idea about powershell or know the dll documentation but thought I'd have a blind pop.

$userid = DllStructCreate("char[256]")
$pwd = DllStructCreate("char[256]")
$domain = DllStructCreate("char[256]")

DllCall("C:\temp\TEST.dll", "none", "retrieveSA", "str*", DllStructGetPtr($domain), "str*", DllStructGetPtr($userid), "str*", DllStructGetPtr($pwd))
If @error Then
    Exit MsgBox(0,"Error", "ErrorNo: " & @error)

ConsoleWrite(DllStructGetData($domain, 1) & @LF & DllStructGetData($userid, 1) & @LF & DllStructGetData($pwd, 1) & @LF)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hi Richard,

               Thanks for your reply. sorry i was on vacation so i couldn't reply.. you are right! the DLL was created in .Net. :(

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • 3 weeks later...

So you're just saying that the dll has the username and password in its code instead of in the AutoIt script?

That's not any safer than just putting it in the script as any program can call the dll too.


I'm imagine this:

The dll is created by another language/compiler, compiled, and should no decompiler able to decompile it.

I know probably there is no such a language/compiler, my point is it's much harder to decompile than AutoIT

or if someone able to decompile it, it will only get the source code in binary/asm.

This dll is relly to another file for protection. If this another file is not exist, we assume it's run from a incorrect environment so it should terminated.

I'm taking about scripts that will run on a particular environment, like in a company, not scripts that developed for public used.

Is that solution make sense and applicable?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...