Sign in to follow this  
Followers 0
Kyme

Iniwrite/iniread but encrypted

9 posts in this topic

hi all

as you can see the topic name i try to find some solution to iniwrite/iniread but when you open the file to be encrypted

like this functions

Func write()
    $w1=guictrlread($input1)
    $w2=guictrlread($input2)
    $w3=guictrlread($input3)
    IniWrite("C:\data.dll", "Settings", "Nuconnector",$w1)
    IniWrite("C:\data.dll", "Settings", "Bot",$w2)
    IniWrite("C:\data.dll", "Settings", "Game",$w3)
EndFunc

Func read()
    $r1=IniRead("C:\data.dll", "Settings", "Nuconnector","")
    $r2=IniRead("C:\data.dll", "Settings", "Bot","")
    $r3=IniRead("C:\data.dll", "Settings", "Game","")
    guictrlsetdata($input1,$r1)
    guictrlsetdata($input2,$r2)
    guictrlsetdata($input3,$r3)
EndFunc

perhaps $input1="input1 data"

the data it's saved in c:\data.dll but when you open data.dll with notepad for example you will see only encrypted codes and when you iniread will be the decrypted code...some like protection for the data

can anybody give me some clue for this???

tnx

Share this post


Link to post
Share on other sites



Look at _StringEncrypt

What you will need to do is use the command on each part of the iniwrite so that when viewed, the string looks encrypted.

oky i made something but the decription didn't work:|

i have wrong something?

Func write()
    $w1=guictrlread($input1)
    $w2=guictrlread($input2)
    $w3=guictrlread($input3) 
    IniWrite("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1,$w1,$enc_pass,"2"))
    IniWrite("C:\data.dll", "Settings", "Bot",_StringEncrypt(1,$w2,$enc_pass,"2"))
    IniWrite("C:\data.dll", "Settings", "Game",_StringEncrypt(1,$w3,$enc_pass,"2"))
EndFunc

Func read()
    $r1=IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(0,"",$enc_pass,"2"))
    $r2=IniRead("C:\data.dll", "Settings", "Bot",_StringEncrypt(0,"",$enc_pass,"2"))
    $r3=IniRead("C:\data.dll", "Settings", "Game",_StringEncrypt(0,"",$enc_pass,"2"))
    guictrlsetdata($input1,$r1)
    guictrlsetdata($input2,$r2)
    guictrlsetdata($input3,$r3)
EndFunc

Share this post


Link to post
Share on other sites

use a msgbox to see what is being returned on the iniread. see if that matches what is being encrypted. Also, I would encrypt the section and the key name. That way it all looks like jibberish when viewed in notepad.

When you decrypt, you need the encrypted string in the command. Run the iniwrite to get the string, then copy that string into your command.

Share this post


Link to post
Share on other sites

use a msgbox to see what is being returned on the iniread. see if that matches what is being encrypted. Also, I would encrypt the section and the key name. That way it all looks like jibberish when viewed in notepad.

When you decrypt, you need the encrypted string in the command. Run the iniwrite to get the string, then copy that string into your command.

ok i try this one but no chance....i don't have ideas anymore:|

Func write()
    
    GuiSetState(@SW_DISABLE,$Menu1)
    $string = GuiCtrlRead($input1)
    GUICtrlSetData($input1,'Working')
    IniWrite("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1,$string,$enc_pass,"2"))
    GuiSetState(@SW_ENABLE,$Menu1)
EndFunc

Func read()
    GuiSetState(@SW_DISABLE,$Menu1)
    $string = GuiCtrlRead($input1)
    GUICtrlSetData($input1,'Working')
    GUICtrlSetData($input1,IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(0,$string,$enc_pass,"2")))
    GuiSetState(@SW_ENABLE,$Menu1)
EndFunc

please some clues

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hey,

I think this is what your doing wrong....

(not tested)

; => write()

; _StringEncrypt(1, $string, $enc_pass, "2")
IniWrite("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1, $string, $enc_pass, 2))

; => read()

; GUICtrlSetData($input1,IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(0,$string,$enc_pass,"2")))
GUICtrlSetData($input1,_StringEncrypt(0,IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1,$string,$enc_pass,2)),$enc_pass,2))

Edit: codebox

Edited by Robjong

Share this post


Link to post
Share on other sites

Hi,

here this is an easy way to use the encrypted ini

#include <String.au3>

; define encryption settings
Global Const $enc_pass = "ABC123" ; set the encrypotion password
Global Const $enc_level = 2 ; set the encrypotion level (check the help file for _StringEncrypt for possible levels)

; you can use the functions the same as the default IniWrite and IniRead
_IniWrite("data.ini", "settings", "foo", "bar")
ConsoleWrite(_IniRead("data.ini", "settings", "foo", "OOPS!") & @CRLF)

; just like the default IniWrite
Func _IniWrite($sIniPath, $sIniSection, $sIniKey, $sIniValue)
    IniWrite($sIniPath, $sIniSection, $sIniKey, _StrEncrypt($sIniValue))
EndFunc   ;==>_IniWrite

; just like the default IniRead
Func _IniRead($sIniPath, $sIniSection, $sIniKey, $sIniDefault)
    Return _StrDecrypt(IniRead($sIniPath, $sIniSection, $sIniKey, _StrEncrypt($sIniDefault)))
EndFunc   ;==>_IniRead

; Encrypt a string using the default $enc_pass and $enc_level
Func _StrEncrypt($sString)
    Return _StringEncrypt(1, $sString, $enc_pass, $enc_level)
EndFunc   ;==>_StrEncrypt

; Decrypt a string using the default $enc_pass and $enc_level
Func _StrDecrypt($sString)
    Return _StringEncrypt(0, $sString, $enc_pass, $enc_level)
EndFunc   ;==>_StrDecryptoÝ÷ Ù.­û§rبÌ(ºWe¢%G­+ºÚ"µÍ[ÈÜ]J
BQÕRTÙ]Ý]JÕ×ÑTÐPK    ÌÍÓY[LJBIÌÍÜÝ[ÈHÕRPÝXY
    ÌÍÚ[]JBQÕRPÝÙ]]J  ÌÍÚ[]K   ÌÎNÕÛÜÚ[ÉÌÎNÊBWÒ[]J   ][ÝÐÎÌLÙ]K ][ÝË  ][ÝÔÙ][ÜÉ][ÝË    ][ÝÓXÛÛXÝÜ][ÝË  ÌÍÜÝ[ÊBQÕRTÙ]Ý]JÕ×ÑSPK   ÌÍÓY[LJB[[ÈÏOIÝÝÜ]B[ÈXY

BQÕRTÙ]Ý]JÕ×ÑTÐPK    ÌÍÓY[LJBIÌÍÜÝ[ÈHÕRPÝXY
    ÌÍÚ[]JBQÕRPÝÙ]]J  ÌÍÚ[]K   ÌÎNÕÛÜÚ[ÉÌÎNÊBQÕRPÝÙ]]J    ÌÍÚ[][TXY
    ][ÝÐÎÌLÙ]K ][ÝË  ][ÝÔÙ][ÜÉ][ÝË    ][ÝÓXÛÛXÝÜ][ÝË  ÌÍÜÝ[ÊJBQÕRTÙ]Ý]JÕ×ÑSPK  ÌÍÓY[LJB[[ÈÏOIÝÜXY

Share this post


Link to post
Share on other sites

Hey,

I this is what your doing wrong.... (not tested)

; => write()

; _StringEncrypt(1, $string, $enc_pass, "2")
IniWrite("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1, $string, $enc_pass, 2))

; => read()

; GUICtrlSetData($input1,IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(0,$string,$enc_pass,"2")))
GUICtrlSetData($input1,_StringEncrypt(0,IniRead("C:\data.dll", "Settings", "Nuconnector",_StringEncrypt(1,$string,$enc_pass,2)),$enc_pass,2))

Edit: codebox

atlast i get it how this think with decript work...you must set the iniread in string section:| :) tnx bro

i made it little short

Guictrlsetdata($input1,_StringEncrypt(0,IniRead("C:\data.dll", "Settings", "Nuconnector",""),$enc_pass,"2"))
but the idea belongs to you;)

tnx again

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

hey,

glad i could help.

btw, that is shorter, but if you want to use a default value it must be encrypted or you wont get the expected result because everything returned by IniRead will go through the _StrDecrypt func :)

Edit: ow boy i love to edit :S

Edited by Robjong

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