Sign in to follow this  
Followers 0
jtrout

vb.net dll always returning function not found from AutoIt

1 post in this topic

Here is my vb .net code. This works from a console application, however this is not working while being called from an AutoIt script using DLLCall. Can someone tell me what I am doing wrong?

Console Application:

Module Module1
Sub Main()
     Dim strEncrypt As String = Decide("Encrypt", "Hello")
     Console.WriteLine("The encrypted value is: " & strEncrypt)
     Console.ReadLine()
     Dim strDecrypt As String = Decide("Decrypt", strEncrypt)
     Console.WriteLine("The decrypted value is: " & strDecrypt)
     Console.ReadLine()
End Sub
End Module

VB.NET DLL Code

Imports System.IO
Imports System.Text
Imports System.Security.Cryptography
Public Class Crypto
Private Shared DES As New TripleDESCryptoServiceProvider
Private Shared MD5 As New MD5CryptoServiceProvider
Private Shared Function MD5Hash(ByVal value As String) As Byte()
     Return MD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(value))
End Function
Private Shared Function Encrypt(ByVal stringToEncrypt As String, ByVal key As String) As String
     DES.Key = Crypto.MD5Hash(key)
     DES.Mode = CipherMode.ECB
     Dim Buffer As Byte() = ASCIIEncoding.ASCII.GetBytes(stringToEncrypt)
     Return Convert.ToBase64String(DES.CreateEncryptor().TransformFinalBlock(Buffer, 0, Buffer.Length))
End Function
Private Shared Function Decrypt(ByVal encryptedString As String, ByVal key As String) As String
     Try
         DES.Key = Crypto.MD5Hash(key)
         DES.Mode = CipherMode.ECB
         Dim Buffer As Byte() = Convert.FromBase64String(encryptedString)
         Return ASCIIEncoding.ASCII.GetString(DES.CreateDecryptor().TransformFinalBlock(Buffer, 0, Buffer.Length))
     Catch ex As Exception
         'MessageBox.Show("Invalid Key", "Decryption Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
         'Console.WriteLine("Invalid Key - Decryption Failed")
         Return "ERROR"
     End Try
End Function
Public Shared Function Decide(ByVal strEncryptOrDecrypt As String, ByVal strParameter As String) As String
     Dim EncryptionKey As String = "Decryption String Goes Here!"
     If strEncryptOrDecrypt = "Encrypt" Then
         Dim strEncrypted As String = Crypto.Encrypt(strParameter, EncryptionKey)
         Return strEncrypted
     ElseIf strEncryptOrDecrypt = "Decrypt" Then
         Dim strDecrypted As String = Crypto.Decrypt(strParameter, EncryptionKey)
         Return strDecrypted
     Else
         Return "ERROR"
     End If
End Function
End Class

AutoIt code:

$myDll = @ScriptDir & "\Encryption.dll"
$result = DllCall($myDll, "str", "Decide", "str", "Encrypt", "str", "Happy")
MsgBox(0,"@Error", @error)

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • X_xkijux_x
      By X_xkijux_x
      Ok so im using this program. clarify for school. I would like to have a program that takes every word i type in microsoft word and searches on it in claryfi. is this possible. I would like to have the program not stopping me from typing more after that word. Like when i type a word it auto search it on clarify without making me stop typing and if i want to change i can do that and if im fine that word i can just keep typing and it will search after the next word. 
    • Miliardsto
      By Miliardsto
      Is this possible to make program works like in diagram? There is so much encryption methods and UDFs are they give security? If the $Address will be crypted with some encryption algorithm could be possible to get the value of $Address in easy way? Of course We know its easy too look into autoit code and get value of variable and so We dont want to anyone see $Address value - there are functions Could func1.au3, func2.au3.. be for example func1.php or other type of file? As we know .php files are unnable to see. For example func1 would be read by FileRead() and then Execute() Is this generally possible to do?
      Will it give secure?
      What do you think about? Maybe there is something wrong in this concept or missed.

    • Earthshine
      By Earthshine
      This baby can do almost any language! I found Gleany on this site and set it up on a fresh win10 install. all i would need to do to make it build an exe of the search files app we discovered is the .NET Target Framework download to build 100 % but the exe works and generates! You also need to add the path the the version of csc.exe that you want to run. MSBuild is part of .NET and can read your .csproj file.
      YOU can develop .NET OR C/C++ on this baby!
      Super lightweight (fit for crappy laptops), and you can use any dev compilers you wish, Ming, MS, etc, whatever.
      To use the build, you need to open the csproj file, else, to check your syntax it can compile individual files as well. The warning are because I do not have the .NET 4.6 Targeting Pack installed... LOL, and I could get rid of the Core warning, yes, I did not want to build a .NET Core.dll I wanted a live x64 exe! Told you MSBUILD could handle .CSPROJ, .VBPROJ, and all others Microsoft. Don't let Visual Code or Visual Studio slow you down, although, this works with Visual Code as well but there is only debugging in CORE.DLL projects

      ListFiles Example.zip
       

    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )

       
    • nassausky
      By nassausky
      Hey all,
      Has anyone created any queries for youtube? I was thinking it might be something like this but can't quite figure it out:
      $oIE = _IECreateEmbedded() _IENavigate($oIE,"https://www.youtube.com") Local $oForms = _IETagNameGetCollection($oIE, "form") Local $sTxt = "" For $oForm In $oForms If $oForm.id = "masthead-search" Then $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id = "masthead-search-term" Then _IEFormElementSetValue($oInput, "cards") _IEFormSubmit($oForm) EndIf Next EndIf Next