#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\oldchicKens.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Computer Plucker DB viewer ;NSC ;2021 ;V 0.5 DB selection #include #include #include #include #include #include #include #include #include #include #include #include #include #include <_GOLLOG.au3> ; NSC first UDF #include #include Global $gollogcount = 0, $lastlog = "sicrlf", $guititle = "ComputerPlucker DB browser V.0.5 alpha" Global $idListview, $Brefresh, $rec_trovati, $idCheckbox1 Global $cryptstring = "", $cryptop = "decrypt", $whatDB = 1 Gollog("-->START " & $guititle) GuiCPDBB() Func GuiCPDBB() GUICreate($guititle, 1000, 700, 100, 200, -1) GUISetBkColor(0xa89e8a) ; will change background color Gollog_ini($guititle, 10, 10, 600, 150, "0xADEF2F") $idListview = GUICtrlCreateListView("serial|computername|manufacturer|model|cpuname|cpuid|cpuarc|cpuvendor|cpucores|cpuspeed|ram|username|domain|dnsdomain|logonserver|osver|osarch|osbuild|oslang|drives|localip1|localip2|localip3|localip4|publicip|gw|adapter|mac|date|groupid", 5, 170, 990, 525) ;,$LVS_SORTDESCENDING) _GUICtrlListView_SetColumnWidth($idListview, 0, 150) _GUICtrlListView_SetColumnWidth($idListview, 1, 70) _GUICtrlListView_SetColumnWidth($idListview, 2, 150) _GUICtrlListView_SetColumnWidth($idListview, 3, 70) _GUICtrlListView_SetColumnWidth($idListview, 4, 70) GUICtrlSetFont(-1, 10, 800, 0, "consolas") $Brefresh = GUICtrlCreateButton("Refresh", 620, 7, 200, 50) GUICtrlSetFont(-1, 13, 900, 0, "consolas") GUICtrlCreateGroup("Group crypt", 610, 120, 380, 45) $idRadio1 = GUICtrlCreateRadio("decrypted", 610, 135, 100, 20) GUICtrlSetTip(-1, "display data decrypted or not") GUICtrlSetColor(-1, $color_white) $idRadio2 = GUICtrlCreateRadio("NOT decrypted", 800, 135, 200, 20) GUICtrlSetColor(-1, $color_white) GUICtrlSetState($idRadio1, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW) ;Manageorders() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE funcExit() Case $Brefresh $whatDB = 2 Gollog("test DB") If _IsChecked($idRadio1) Then $cryptop = "decrypt" Gollog("decrypting") Else $cryptop = "bypass" Gollog("NOT decrypting") EndIf viewhosts() EndSwitch WEnd EndFunc ;==>GuiCPDBB Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func viewhosts() renewlistview() $rec_trovati = pluckering() If $rec_trovati = 9999 Then GOLLOG("ERROR in search ") Return EndIf If $rec_trovati = 0 Then GOLLOG("NO data <---") Else GOLLOG("N°" & $rec_trovati & " machines") EndIf EndFunc ;==>viewhosts Func pluckering() Gollog("Start reading DB") #cs Local $mysqlhost = "sql11.freemysqlhosting.net" Local $mysqlport = "3306" Local $mysqldb = "sql11403701" Local $mysqluser = "sql11403701" Local $mysqlpsw = "QtL7T9U5GV" #ce Local $ainisql = extractINI() $mysqlhost = $ainisql[0][1] $mysqlport = $ainisql[1][1] $mysqldb = $ainisql[2][1] $mysqluser = $ainisql[3][1] $mysqlpsw = $ainisql[4][1] If Not _EzMySql_Startup() Then Gollog("Error Starting MySql: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg()) funcExit() Else EndIf If Not _EzMySql_Open($mysqlhost, $mysqluser, $mysqlpsw, $mysqldb, $mysqlport) Then GOLLOG("Error opening Database: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg()) funcExit() Else GOLLog("DB connected") EndIf Local $sMySqlStatement $sMySqlStatement = "select * from Plucker order by date DESC" $qresult = _EzMySql_query($sMySqlStatement) ;News is the table that I am getting data from. Change News to the name of the Table you want to query. Gollog($qresult & " " & @error & " " & _EzMySql_ErrMsg()) Local $contarecord = 0 Local $stringCPdata = "" While 1 $arowCP = _EzMySql_FetchData() If $arowCP = 0 Then ExitLoop $contarecord += 1 For $i = 0 To UBound($arowCP) - 1 If $i > 0 Then $stringCPdata = $stringCPdata & "|" $tempfield = $arowCP[$i] ; Gollog($tempfield& " " & $cryptop& " " & $cryptstring) ;Gollog(Ncrypt($cryptop, $tempfield, $cryptstring)) $stringCPdata = $stringCPdata & Ncrypt($cryptop, BinaryToString($arowCP[$i]), $cryptstring) ;decrypting... Next ;Gollog($tempfield& " " & $cryptop& " " & $cryptstring) ;Gollog(Ncrypt($cryptop, $tempfield, $cryptstring)) ;$stringCPdata = _ArrayToString($arowCP, "|") GUICtrlCreateListViewItem($stringCPdata, $idListview) $stringCPdata = "" WEnd ;_ArrayDisplay($arowCP) _EzMySql_QueryFinalize() _EzMySql_Close() _EzMySql_ShutDown() Return $contarecord EndFunc ;==>pluckering Func renewlistview() GUICtrlDelete($idListview) $idListview = GUICtrlCreateListView("serial|computername|manufacturer|model|cpuname|cpuid|cpuarc|cpuvendor|cpucores|cpuspeed|ram|username|domain|dnsdomain|logonserver|osver|osarch|osbuild|oslang|drives|localip1|localip2|localip3|localip4|publicip|gw|adapter|mac|date|groupid", 10, 170, 990, 525) ;,$LVS_SORTDESCENDING) _GUICtrlListView_SetColumnWidth($idListview, 0, 150) _GUICtrlListView_SetColumnWidth($idListview, 1, 70) _GUICtrlListView_SetColumnWidth($idListview, 2, 150) _GUICtrlListView_SetColumnWidth($idListview, 3, 70) _GUICtrlListView_SetColumnWidth($idListview, 4, 70) GUICtrlSetFont(-1, 10, 800, 0, "consolas") EndFunc ;==>renewlistview Func _sqlini_test($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Base64String $Base64String &= 'U7AAbXlzcWxob3MEdD0AcDExLmZyBGVlBphpbmcubhBldA0KAkRwb3JAdD0zMzA2BDxkAmIDzDQwMzcwMSEEKHVzZXIQLHBzAHc9UXRMN1Q5AFU1R1Y=' $Base64String = _WinAPI_Base64Decode($Base64String) If @error Then Return SetError(1, 0, 0) Local $tSource = DllStructCreate('byte[' & BinaryLen($Base64String) & ']') DllStructSetData($tSource, 1, $Base64String) Local $tDecompress _WinAPI_LZNTDecompress($tSource, $tDecompress, 117) If @error Then Return SetError(3, 0, 0) $tSource = 0 Local Const $bString = Binary(DllStructGetData($tDecompress, 1)) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\CP_test.ini", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_sqlini_test Func extractINI() $cryptstring = "" If $whatDB = 2 Then Local $astring = _StringExplode(BinaryToString(_sqlini_test()), @CRLF) EndIf Local $avalues[0][2] Local $asemivalue = "" ;_ArrayDisplay($astring) For $i = 0 To UBound($astring) - 1 $asemivalue = _StringExplode($astring[$i], "=") $cryptstring = $cryptstring & StringLeft($asemivalue[1], 1) _ArrayAdd($avalues, $asemivalue[0] & "|" & $asemivalue[1]) Next ;gollog($cryptstring) ;_ArrayDisplay($avalues) Return $avalues EndFunc ;==>extractINI Func Ncrypt($operation, $string, $Key) ; NSC standard string crypt/decrypt function, ; >>>>>>>>>>>>>>>>>> if changed, change the same function in Ncrypt.au3 (and recompile testbed Ncrypt.exe) <<<<<<<<<<<<<<<<<<<<<<<<<< ; operation = crypt/decrypt - bypass -> (no operation!) , string= string to operate, key = the password If $operation <> "bypass" Then Local $iAlgorithm = $CALG_AES_256 If StringStripWS($string, $STR_STRIPALL) <> "" Then ; Check there is text available to encrypt. If $operation = "crypt" Then $string = _Crypt_EncryptData($string, $Key, $iAlgorithm) ; ENcrypt the text with the new cryptographic key.) Else $string = BinaryToString(_Crypt_DecryptData($string, $Key, $iAlgorithm)) ; DEcrypt the text with the new cryptographic key. EndIf Else $string = "" EndIf EndIf Return $string EndFunc ;==>Ncrypt Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize) $tOutput = DllStructCreate("byte[" & $iBufferSize & "]") If @error Then Return SetError(1, 0, 0) Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0) If @error Then Return SetError(2, 0, 0) If $aRet[0] Then Return SetError(3, $aRet[0], 0) Return $aRet[6] EndFunc ;==>_WinAPI_LZNTDecompress Func funcExit() Gollog("<<<<<<<< Computer Plucker DB Browser - exiting|") Exit EndFunc ;==>funcExit