Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "windows.bi"
- #include "win\combaseapi.bi"
- #include "win\winerror.bi"
- #include "..\win\wincred.bi"
- #include "..\MyTDT\detour.bas"
- #inclib "ole32"
- extern "windows"
- UndefAllParams()
- #define P1 byval pUiInfo as PCREDUI_INFOA
- #define P2 byval dwAuthError as DWORD
- #define P3 byval pulAuthPackage as ULONG ptr
- #define P4 byval pvInAuthBuffer as LPCVOID
- #define P5 byval ulInAuthBufferSize as ULONG
- #define P6 byval ppvOutAuthBuffer as LPVOID ptr
- #define P7 byval pulOutAuthBufferSize as ULONG ptr
- #define P8 byval pfSave as BOOL ptr
- #define P9 byval dwFlags as DWORD
- declare function CredUIPromptForWindowsCredentialsA(P1, P2, P3, P4, P5, P6, P7, P8, P9) as DWORD
- UndefAllParams()
- #define P1 byval pUiInfo as PCREDUI_INFOW
- #define P2 byval dwAuthError as DWORD
- #define P3 byval pulAuthPackage as ULONG ptr
- #define P4 byval pvInAuthBuffer as LPCVOID
- #define P5 byval ulInAuthBufferSize as ULONG
- #define P6 byval ppvOutAuthBuffer as LPVOID ptr
- #define P7 byval pulOutAuthBufferSize as ULONG ptr
- #define P8 byval pfSave as BOOL ptr
- #define P9 byval dwFlags as DWORD
- declare function CredUIPromptForWindowsCredentialsW(P1, P2, P3, P4, P5, P6, P7, P8, P9) as DWORD
- UndefAllParams()
- #define P1 dwFlags as DWORD
- #define P2 pAuthBuffer as PVOID
- #define P3 cbAuthBuffer as DWORD
- #define P4 pszUserName as LPSTR
- #define P5 pcchMaxUserName as DWORD ptr
- #define P6 pszDomainName as LPSTR
- #define P7 pcchMaxDomainname as DWORD ptr
- #define P8 pszPassword as LPSTR
- #define P9 pcchMaxPassword as DWORD ptr
- declare function CredUnPackAuthenticationBufferA(P1, P2, P3, P4, P5, P6, P7, P8, P9) as BOOL
- UndefAllParams()
- #define P1 dwFlags as DWORD
- #define P2 pAuthBuffer as PVOID
- #define P3 cbAuthBuffer as DWORD
- #define P4 pszUserName as LPWSTR
- #define P5 pcchMaxUserName as DWORD ptr
- #define P6 pszDomainName as LPWSTR
- #define P7 pcchMaxDomainname as DWORD ptr
- #define P8 pszPassword as LPWSTR
- #define P9 pcchMaxPassword as DWORD ptr
- declare function CredUnPackAuthenticationBufferW(P1, P2, P3, P4, P5, P6, P7, P8, P9) as BOOL
- end extern
- dim as CREDUI_INFOW credui
- with credui
- .cbSize = sizeof(credui)
- .hwndParent = GetConsoleWindow()
- .pszMessageText = @wstr("enter password to hack me")
- .pszCaptionText = @wstr("enter me not")
- .hbmBanner = NULL '320x60
- end With
- dim as uint authPackage = 0
- dim as any ptr outCredBuffer
- dim as uint outCredSize
- dim as bool save = false
- dim as wstring*(CREDUI_MAX_USERNAME_LENGTH+1) usernameBuf
- dim as wstring*(CREDUI_MAX_PASSWORD_LENGTH+1) passwordBuf
- dim as wstring*(100+1) domainBuf
- var maxUserName = CREDUI_MAX_USERNAME_LENGTH
- var maxPassword = CREDUI_MAX_PASSWORD_LENGTH
- var maxDomain = 100
- dim as DWORD promptresult
- dim as BOOL unpackresult
- promptresult = CredUIPromptForWindowsCredentialsW(@credui, 0, @authPackage, NULL, 0, @outCredBuffer, @outCredSize, @save, 1 /' Generic '/)
- if promptresult = ERROR_SUCCESS then 'function didnt failed
- unpackresult = CredUnPackAuthenticationBufferW(0, @outCredBuffer, outCredSize, @usernameBuf, @maxUserName, @domainBuf, @maxDomain, @passwordBuf, @maxPassword)
- if unpackresult then
- 'clear the memory allocated by CredUIPromptForWindowsCredentials
- CoTaskMemFree(outCredBuffer)
- print "Username:" + usernameBuf
- print "Password:" + passwordBuf
- print "Domain:" + domainBuf
- else
- print "CredUnPackAuthenticationBuffer error: " & GetLastError()
- endif
- elseif promptresult = ERROR_CANCELLED then
- print "user canceled..."
- else
- print "CredUIPromptForWindowsCredentials error: " & promptresult
- endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement