1 (изменено: Malcev, 2017-04-15 07:41:47)

Тема: AHK: Base64 заархивированный ZLib

Имеется Base64 заархивированный ZLib.
Не получается у меня разархивировать его без временных файлов.
А вроде как можно:
Сайт: http://www.zlib.net/
Сайт рус.:http://zlib.net.ru/
Атохотки враппер: https://github.com/shajul/Autohotkey/tr … plets/zlib
Современная dll для 64 бит систем: https://sourceforge.net/projects/libpng … ;download=   
Кто-нибудь сталкивался с этим?

Пока написал вариант с использованием offzip:
http://aluigi.altervista.org/mytoolz/offzip.zip
Перед распаковкой мне нужно сделать смещение на 32 байта, я его сделал, но мне кажется кривой способ.
Может есть правильнее варианты?

var =
( Join
AQAAAAAAAAB8YAAAAAAAAENvbXByZXNzZWRUaXRsZQB4nO0da3Nat1I/hen3
mIcBJzMqHceP1lMnzhiamE8ZjLHDLQEKOLH74+/tPqSj9wHjJBxuGQ+Esw9p
Je2u9qwe+d9/pfhFPIjPYiRK4osYiJmYi6GYiLH4WfwkqmJPVODfEmDGog/w
G8COxR1h/xAdcSpeAFWTaH4RLSHFIdBMxDVwfBSX8GsiFgG8A6UsoM4BYd47
9bZEDeqsiJfwOYBPDSjKAY0Ub6hkfv4o2oBf0DNKNyeKd1BDTzwC9hSoZuIr
PM1AihbQzcQ9cGDJaSoJpS7oaQFYXU8fngfUHy1xC9gR1MYlLaNGiWZZv4zg
rwXtYxl8uBQnUNacoGfEzZQ+FOnGIC3WeAt/+RLm06J8E6BdRCUMMbaMF9Cf
i4iUGo7Q5SNWztESbO+c5B0SfibOadwmVMMc9O99Un+R36b2n0+oPwZQ+oLq
uQV4vLyfVLsNfQdKmZKMuu0xHGKW1ehLdQw1f6ax0TLEZKopmabiCkbpDL5P
oJQ2wA7IkrDmEIf0Xfh9Jt4CDCENoG8qaheDtG1xBCN/An9vYYwuqbV7QP8S
+BqiDrzMGdJJGN0ZSPsVWvSJ2jRT7da2rPGXALkDGmw5Po+pzGXcfs+Gveb3
6yHpHesRPg+U9rWBBsfE6N0h1dYjLD7fKh3fA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LV+oy9Z/oIjcPeG
hlI2vinsVXZfC7dP570Yp2+4TtHo8Q5vb/Epy0pDvl3fLWj2tW/2GKvfpraQ
phx4Dhfqzt/l6Fxv3mfZ298LfbuMeS6Ju+y371Om1Ad9qKkDH5yHwhOzIYUk
i+opL2ziRh8qHevAuvEW+57K1xjvp/vIyMzP6daVvYipHERU77ObtE/VW02Y
/c87h3qruHyLKycx2GNHWaTaUjfj+1BNx1rmvpe7GISkZWe8aaV7CzND8Lxw
3p3sLeWJYv8jwD8ihQdc
)

Bytes := Base64Dec(BIN, var)
FileDelete, temp
oFile := FileOpen("temp", "rw")
oFile.RawWrite(BIN, Bytes)
oFile.Pos := 32
oFileContent := oFile.Read()
oFile.Pos := 0
oFile.Write(oFileContent)
oFile.Close()
RunWait, offzip.exe temp temp1,,Hide
FileRead, temp, temp1
FileDelete, temp
FileDelete, temp1
msgbox % temp
ExitApp


Base64dec(ByRef OutData, ByRef InData)
{
   DllCall("Crypt32.dll\CryptStringToBinary", Ptr, &InData, UInt, StrLen(InData), UInt,1, UInt,0, UIntP, Bytes, UIntP, 0, UIntP, 0, "CDECL Int")
   VarSetCapacity(OutData, Bytes)
   DllCall("Crypt32.dll\CryptStringToBinary",  Ptr, &InData, UInt, StrLen(InData), UInt,1, Str, OutData, UIntP, Bytes, UIntP, 0, UIntP, 0, "CDECL Int")
   Return Bytes
}

2

Re: AHK: Base64 заархивированный ZLib

Вот так заменяет "Hello world!" на "Привет, мир!".
Нужна zlib1.dll и ahk 32 бит.
http://zlib.net/zlib128-dll.zip

var := "AQAAAAAAAACgYQAAAAAAAENvbXByZXNzZWRUaXRsZQB4nO1d63NTuxHXn+L2O/hBnMfMae6EkBSmgTBxLpBPjHGc4NbYru1Acv/4tru/lY7ex064YKd4MglH+9JK2l3tkY7Ef/9TqN/Urfqihqqmvqq+mqqZGqixGqm/qb+qpnqqGvRvjTAj1SP4JWFH6hrY39W5OlZPiGobNL+pfVWoA6IZq0/E8VGd0dNYzSP4OUmZU519Y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+BvsvUmqZ0M/cUPszh0zL8DPpcz7WhZ+eowjalT0fHFHx2gntS5r2ZzgXmyt7AmMYyzo/kKZhE/BOKJNeIY0Ljl+WWOjtn2DKXXqDfvuGbCXtTXQpqak7B7Il/yctMiW9vHauJjrh3ydnIfLn0kFsm3pbR2+Yucu5lm36e4uTZts7OGHcHXFufNzani1NS3IyKefl7ij2SyOuwu4FEew7dSHS5lz2nvw43unzPLSG/yp0Z9Qr79q1feE1Wxs/+d0EpWI5b/MyMV+422ZriG4LNPXLm7HoTmEnJMVNy1s6n4HrMqV6/XQNYSNVpXr5/wZ4IbpOnyF2k5mS/jy9wo63Ep9hTLW7xid6vpYYy+5h+Cm02T1d4PXaS9NUqCsZX9RpTHGFdaKijDPO5t/1Z27K3/rDUZbkeesfNGck4iXrKQNnmzuCf07KtL5WcPOcboCUa88nBv2hbDqkLZC4j9BhD+GYOaZP4/qW29Sm8Vb7Vy90VuxxlTdfImf0N2mnPhdScWCNZu3+rQ620iRC7rbEfyttbpIVmrUxw5hbwHI2xkfgul5Cyrq3qz+u9OWZs9zaQkX62tcU09Sjq+FB/zq8n8wP7DiwzxY0yd83Yck1dl89hPJqgD3pU0zn98hwWn7KNKQp4YVdHcJtrhtDC8yium2/67+o1Hhs5TR9ZnaWcb109yLLqURb2rrzL+1i/CcU7BlVnV680V+hz9SyGe+ywzG73dWQOoYZOrMx/l/cxDMnrLnjbSv9OaIHwGeOqe+v3dfRK/a8J/wMFyDy9"

size := StringBase64ToData(var, outData)
offset := 32, OriginalSize := size*100
VarSetCapacity(var1, offset, 0)
DllCall("Ntdll\RtlMoveMemory", Ptr, &var1, Ptr, &outData, Ptr, offset)
VarSetCapacity(var2, size-offset, 0)
DllCall("Ntdll\RtlMoveMemory", Ptr, &var2, Ptr, &outData+offset, Ptr, size-offset)
zlib_Decompress(Decompressed, var2, size-offset, OriginalSize)
DecompressedData := StrGet(&Decompressed, "UTF-16")
DecompressedData := StrReplace(DecompressedData, "Hello world!", "Привет, мир!")
DecompressedSize := VarSetCapacity(DecompressedData, -1)
CompressedSize := zlib_Compress(Compressed, DecompressedData, DecompressedSize)
VarSetCapacity(var3, CompressedSize+offset, 0)
DllCall("Ntdll\RtlMoveMemory", Ptr, &var3, Ptr, &var1, Ptr, offset)
DllCall("Ntdll\RtlMoveMemory", Ptr, &var3+offset, Ptr, &Compressed, Ptr, CompressedSize)
msgbox % Base64Enc(var3, CompressedSize+offset)
return



Base64Enc(ByRef Bin, nBytes) { ; By SKAN / 18-Aug-2017
   Local Rqd := 0, B64 ; CRYPT_STRING_BASE64 := 0x1, CRYPT_STRING_NOCRLF := 0x40000000
   DllCall( "Crypt32.dll\CryptBinaryToString", "Ptr", &Bin ,"UInt", nBytes, "UInt",0x1|0x40000000, "Ptr",0,"UIntP",Rqd )
   VarSetCapacity( B64, Rqd * ( A_Isunicode ? 2 : 1 ), 0 )
   DllCall( "Crypt32.dll\CryptBinaryToString", "Ptr",&Bin, "UInt",nBytes, "UInt",0x1|0x40000000, "Str",B64, "UIntP",Rqd )
   Return B64
}


StringBase64ToData(stringBase64, ByRef outData)
{
   static CRYPT := CRYPT_STRING_BASE64 := 1
   DllCall("Crypt32\CryptStringToBinary", Ptr, &stringBase64, UInt, StrLen(stringBase64), UInt, CRYPT, UInt, 0, UIntP, bytes, UIntP, 0, UIntP, 0)
   VarSetCapacity(outData, bytes, 0)
   DllCall("Crypt32\CryptStringToBinary", Ptr, &stringBase64, UInt, StrLen(stringBase64), UInt, CRYPT, Str, outData, UIntP, bytes, UIntP, 0, UIntP, 0)
   Return bytes
}


; ===================================== zlib.ahk =====================================
; by shajul -- http://www.autohotkey.com/board/topic/63343-zlib/
; Download zlib1.dll -- http://zlib.net/zlib128-dll.zip
 
zlib_Compress(Byref Compressed, Byref Data, DataLen, level = -1) {
    nSize := DllCall("zlib1\compressBound", "UInt", DataLen, "Cdecl")
    VarSetCapacity(Compressed,nSize, 0)
    ErrorLevel := DllCall("zlib1\compress2", "ptr", &Compressed, "UIntP", nSize, "ptr", &Data, "UInt", DataLen, "Int"
                   , level    ;level 0 (no compression), 1 (best speed) - 9 (best compression)
                   , "Cdecl") ;0 means Z_OK
    return ErrorLevel ? 0 : nSize
} ;http://www.autohotkey.com/forum/viewtopic.php?t=68170
 
zlib_Decompress(Byref Decompressed, Byref CompressedData, DataLen, OriginalSize = -1) {
    OriginalSize := (OriginalSize > 0) ? OriginalSize : DataLen*10 ;should be large enough for most cases
    VarSetCapacity(Decompressed,OriginalSize, 0)
    ErrorLevel := DllCall("zlib1\uncompress", "Ptr", &Decompressed, "UIntP", OriginalSize, "Ptr", &CompressedData, "UInt", DataLen)
    return ErrorLevel ? 0 : OriginalSize
} ;http://www.autohotkey.com/forum/viewtopic.php?t=68170
 
 
/*
Return codes for the compression/decompression functions. Negative values are errors, positive values are used for special but normal events.
#define Z_OK            0
#define Z_STREAM_END    1
#define Z_NEED_DICT     2
#define Z_ERRNO        (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR   (-3)
#define Z_MEM_ERROR    (-4)
#define Z_BUF_ERROR    (-5)
#define Z_VERSION_ERROR (-6)
 
Compression levels.
#define Z_NO_COMPRESSION         0
#define Z_BEST_SPEED             1
#define Z_BEST_COMPRESSION       9
#define Z_DEFAULT_COMPRESSION  (-1)
*/

3

Re: AHK: Base64 заархивированный ZLib

Ничего не знаю про zlib1.dll, но для сжатия данных сторонние библиотеки не нужны: Compression API.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

4

Re: AHK: Base64 заархивированный ZLib

Там нет алгоритма Deflate.
https://docs.microsoft.com/en-us/window … compressor

5

Re: AHK: Base64 заархивированный ZLib

Насколько понимаю, MSZIP — это примерно то же самое.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

6

Re: AHK: Base64 заархивированный ZLib

А у тебя уже есть какие-то наработки?

7

Re: AHK: Base64 заархивированный ZLib

Не-а, пока руки не дошли, только присматриваюсь. Вот сейчас заметил, что только с Windows 8 включено.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg