Jump to content

Ini file access barred to script only?


 Share

Recommended Posts

I am creating a script that will auto open my emails and some of my other favorite websites, and automatically log me in. My buddy wants a copy as well. So I want to create an ini file or another type, that the script and only the script can access. Basically, I dont want the file to be opened and easily read with a text editor or another similar program. Any Ideas or suggestions?

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

  • Moderators

Realm,

Use the Crypt UDF to encrypt the data before you write it and to decrypt it once you have read it back in. The file can still be opened, but not read.

Although it is impossible to completely secure your data, this would be a pretty good beginning. :idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You can embark any file you want using FileInstall (look in the Help file). You may obfuscate it somehow; that won't be NSA grade security but probably enough for layman application.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@jchd: I used FileInstall() to embark in the good ship 'settings.ini' on a long journey 'round the world. Posted Image

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

jchd, I was looking at fileinstall, If I understand it correctly, the file to be compiled in the exe, must have all the varaiables declared, and cannot be added to by the end user. This would be a difficult situation, for I don't believe my buddy wants share his passwords with me. But I appreciate the pointer, It gives me an idea for another script I am currently working on, Thanks

Melba23. As long as the file cannot be easily read, this should be great. I took a quick look at '_Crypt_EncryptData', plz correct me if i am wrong, this will encrypt, the data in the file, making it almost impossible to retrieve from outside sources, unless you have the key. and the key will be store in the compiled exe?

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Well, it could be stored in the compiled exe, or it could be given as a master password by your friend. Depends on what you prefer.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Another simple way is to use Binary.

$sKey = "Key"
$sData = "This is some sample data."
$sIni = "Somefile.ini"

IniWrite($sIni, $sKey, StringToBinary($sData))

Then to read it

$Val = IniRead($sIni, $sKey, BinaryToString($sData), "Ooops")

You can use the same Binary trick for $sKey to make it even more confusing.

Again, it's not industrial strength but it's also not plain text.

EDIT: I forgot to mention that it's not always a great idea to store the ini in @ScriptDir. First it's easier to find it and secondly you may run into a security issue with Windows. @AppDataDir or @AppDataDir & "\Somefolder\" are generally good places. Also take a look at

@AppDataDir & "\" & StringTrimLeft(Binary(@UserName), 2)
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

GEOsoft, Thanks for your example, that may be useful in another project I am working on.

Fulano, I think for this project using a key set by the end user, my buddy, would be best, making it more difficult for an outside user to decrypt his info.

Thanks to everyone for their input, even though some were less suitable to my needs for this project, the rest gave me some great ideas for some of my other projects.

Cheers!

After taking another look at GEOsoft's example, maybe it would be another step to obfuscating it more, Thanks again!

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

No problem but check the edit I made to it regardless of the method you use

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

@Realm

You got it about the Crypt part. Granted, files enclosed in compiled scripts can't be easily modified.

@Fulano,

Yep, and a pair of microSD cards can fit inside a coin (yes) and hold Ghosts images of the system on one and the data partition one the other. This way you can travel light, just having any basic system on your laptop and the Ghost restore stuff (and a popular game to divert attention). No more hassle at boundaries, being searched for dubious files and answering silly questions.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

GEOsoft, as for your edit, I was already considering that but was confused on the options of it, thanks to your edit, it does open some clarity and doors.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...