Vault login bypass

Vault login bypass

snappyjazz
Collaborator Collaborator
2,069 Views
28 Replies
Message 1 of 29

Vault login bypass

snappyjazz
Collaborator
Collaborator

I am working on a script that's accessing content center. We are using windows authentication for our vault access, so this makes it easy to fill out the login dialog.

 

I would like the code to check if you're logged into vault; if not login. But I'm not having much luck getting it to work. I'm pretty sure the line under try: "SecureResults = VDF..." isn't working because the try always catches the exception. Any ideas?

 

Imports Connectivity.InventorAddin.EdmAddin
Imports VDF = Autodesk.DataManagement.Client.Framework.Vault

Dim SecureResults As VDF.Results.LogInResult
        Dim Conn As VDF.Currency.Connections.Connection = Nothing
        Try
            SecureResults = VDF.Library.ConnectionManager.LogIn("neb-cdmsp", "Vault", "", "", VDF.Currency.Connections.AuthenticationFlags.WindowsAuthentication, Nothing)
            If SecureResults.Success Then
                Conn = SecureResults.Connection
                MsgBox("Worked")
            End If
        Catch ex As Exception
            MsgBox("Didn't work!")
        End Try
0 Likes
2,070 Views
28 Replies
Replies (28)
Message 2 of 29

JamieVJohnson2
Collaborator
Collaborator

Your code looks good (assuming you are actually using Windows Authentication - I don't use).  The next question is your code references:

Autodesk.Connectivity.WebServices

Autodesk.Connectivity.WebServices.WCF

Autodesk.DataManagement.Client.Framework

Autodesk.DataManagement.Client.Framework.Vault 

make sure all these are of the correct version (my standalone app copies them all local).

Also make sure you copy this file local (for 2020), I copied it into my project, and just set the file to copy always:

AdskLicensingSDK_2.dll

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 3 of 29

snappyjazz
Collaborator
Collaborator

I am still using 2019. I mistakenly forgot to mention that before. I was able to add the ".Connectivity.Webservices" references to the project, however I don't know where the "AdskLicensingSDK_2.dll" is. I tried running the script and it still gives me the exception from the try.

0 Likes
Message 4 of 29

JamieVJohnson2
Collaborator
Collaborator

for 2019 and earlier that file was called cmloader.dll

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
Message 5 of 29

snappyjazz
Collaborator
Collaborator

"for 2019 and earlier that file was called cmloader.dll"

 

I tried finding it. I searched in "Program Files/Autodesk" and "Program Files (x86)" to no avail. sorry to be a pain, I'm still pretty new to vb.net.

0 Likes
Message 6 of 29

JamieVJohnson2
Collaborator
Collaborator

cmloader should be found wherever the vault dlls are also found.  You can find a copy in the Inventor Vault-Add In folder, and the Vault Explorer folder.

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 7 of 29

machiel.veldkamp
Collaborator
Collaborator

Hi!

 

I'm doing it like this:

 

 

Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection

If mVltCon Is Nothing Then
	MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule. (POTENTIONAL ADD-IN FAULURE)")
	Exit Sub
End If


 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 8 of 29

snappyjazz
Collaborator
Collaborator

@JamieVJohnson2 

Unfortunately I'm not finding cmloader.dll. I've found clmloader.dll; is this what you're refering to? I tried loading it, and it gives me an error(see below).

 

image.png

 

@machiel.veldkamp 

Thanks for helping. I am trying to go one step further and login to vault automatically.

0 Likes
Message 9 of 29

JamieVJohnson2
Collaborator
Collaborator

ok, so you found the correct file, I've updated all my code since 2020 release, but still have a copy in my project folder.  Don't reference it in place, physically copy it into your code project directory (same folder as your .vb or .xaml code files), then include in project, and use copy always property.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 10 of 29

snappyjazz
Collaborator
Collaborator

This is the first time I've done this, so I've attempted your instructions in the following way. I hope it's not too far off.

 

image.png

 

 

image.png

 

If that's right, then I'm still not getting an automatic login to vault.

Imports System
Imports System.Type
Imports System.Activator
Imports System.Runtime.InteropServices
'Imports System.Collections.Specialized
'Imports Microsoft.Office.Core
Imports Excel = Microsoft.Office.Interop.Excel
Imports Inventor
Imports Connectivity.InventorAddin.EdmAddin
Imports VDF = Autodesk.DataManagement.Client.Framework.Vault
Imports Autodesk.Connectivity.WebServices
Imports Autodesk.Connectivity.WebServices.WCF
Imports Autodesk.DataManagement.Client.Framework

 Dim SecureResults As VDF.Results.LogInResult
        Dim Conn As VDF.Currency.Connections.Connection = Nothing
        Try
            SecureResults = VDF.Library.ConnectionManager.LogIn("neb-cdmsp", "Vault", "", "", VDF.Currency.Connections.AuthenticationFlags.WindowsAuthentication, Nothing)
            If SecureResults.Success Then
                Conn = SecureResults.Connection
                MsgBox("Worked")
            End If
        Catch ex As Exception
            MsgBox("Didn't work!")
        End Try

        End
0 Likes
Message 11 of 29

snappyjazz
Collaborator
Collaborator

@machiel.veldkamp wrote:

Hi!

 

I'm doing it like this:

 

 

Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection

If mVltCon Is Nothing Then
	MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule. (POTENTIONAL ADD-IN FAULURE)")
	Exit Sub
End If


 


@machiel.veldkamp 

on the line with: "mVltCon = VB.ConnectionManager.Instance.Connection"

Where is "VB" coming from?

0 Likes
Message 12 of 29

machiel.veldkamp
Collaborator
Collaborator
Imports VB = Connectivity.Application.VaultBase
Imports VDF = Autodesk.DataManagement.Client.Framework

you might want these as well if you are going to do fancy stuff:

 

AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
AddReference "Autodesk.DataManagement.Client.Framework.dll"
AddReference "Connectivity.Application.VaultBase.dll"
AddReference "Autodesk.Connectivity.WebServices.dll"

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 13 of 29

snappyjazz
Collaborator
Collaborator

@machiel.veldkamp @JamieVJohnson2 

 

I removed the try function from the code and ran it. The error shows the following:

image.png

 

The "Autodesk.Connectivity.WebServices..." is both in the references and has been imported at the top of the code. I must be missing something. Do you have tell?

0 Likes
Message 14 of 29

JamieVJohnson2
Collaborator
Collaborator

1.  All vault Dlls are of the same correct version (that should be easy if they all came from the same folder). 

2.  Make sure your Visual Studio project's .Net version matches (I've set mine to 4.7 for the current Autodesk software for the past 2 years).  

3.  Set all referenced vault dlls to Copy Local as well.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
Message 15 of 29

snappyjazz
Collaborator
Collaborator

@JamieVJohnson2 

Thanks for your perseverance with my issue. I went through all my vault references and made sure their properties are set to copy local. For point 2, my framework is set to .net 4.7.2. I'm still pretty new at visual studio, so I hope that's what you're referring to. Unfortunately, I'm still getting the error above though. Is there another reason why "Autodesk.Connectivity.WebServices.WCF" isn't loading?

0 Likes
Message 16 of 29

JamieVJohnson2
Collaborator
Collaborator

Vault is like having an expensive large cat as a pet.  She's cute and cuddly, purrs loudly, but when she wants your attention, she may crush your lap, and eat your hand off during play time...

My target framework is 4.7 exactly no .2 additional.  This is to match the exact framework reported by the Autodesk dlls.  It may help.  If not there below are my exact properties for the WCF file I have referenced.

WCF Reference PropertiesWCF Reference Properties

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 17 of 29

snappyjazz
Collaborator
Collaborator

bwahaha. good kitty, good kitty. 

 

I had to download the 4.7 framework, but I still have the error. I found something online about the differences in 32 X 64 X 86 platforms. I was able to get the code to run error free with x64. However, it's not actually logging in. Is this right or do I need to be running it from x86?

0 Likes
Message 18 of 29

JamieVJohnson2
Collaborator
Collaborator

My project is x64.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 19 of 29

JamieVJohnson2
Collaborator
Collaborator
 Dim lgResults As Vault.Results.LogInResult =
               VDF.Vault.Library.ConnectionManager.LogIn(VaultServer, VaultVault, VaultUsername, VaultPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)
        If lgResults.Success = True Then
            vConnection = lgResults.Connection
        End If

This is my exact log in code.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 20 of 29

JamieVJohnson2
Collaborator
Collaborator

If you get this far, check for error codes on the server ADMS console \ Management \ Server Logs.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes