Jump to content
Darknightx37

Lock .txt or.ini files

Recommended Posts

Darknightx37

hay there i try to lock a .txt file so that nobody can read or edit it (I dont want to crypt the text inside).

so that my script can store things in it but nobody can read or edit it is that possible?

sry for my bad english

gretz usbstick

Edited by Darknightx37

Share this post


Link to post
Share on other sites
TheDcoder

You can prevent editing by using FileOpen Function ;)

Ex:

$sFile = ; Path of file to lock

FileOpen($sFile)

TD :)

P.S Note that it can't prevent reading

Edited by TheDcoder

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
Darknightx37

You can prevent editing by using FileOpen Function ;)

Ex:

$sFile = ; Path of file to lock

FileOpen($sFile)

TD :)

P.S Note that it can't prevent reading

thx for the answere but that is not what i was searching for i thought about a .txt that cant get opened so that nobody can read or a new datatype like "config.xyz" that only my script can read

Share this post


Link to post
Share on other sites
TheDcoder

Sorry DarkNight, But its not possible without encryption

P.S You can make your own format though, Still it will be readable


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
ViciousXUSMC

Sounds like you want to use FileMove() and change the file extension.

Somebody can still open it if they know to tell the computer to open the file with a program directly.

NTFS Permissions may be a more secure way to actually lock it down.

Share this post


Link to post
Share on other sites
TheDcoder

NTFS Permissions may be a more secure way to actually lock it down.

 

Right, But attributes are easy to change with admin rights :D


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
Darknightx37

Sounds like you want to use FileMove() and change the file extension.

Somebody can still open it if they know to tell the computer to open the file with a program directly.

NTFS Permissions may be a more secure way to actually lock it down.

 

Thx for the answere

"NTFS Permissions" what is that ?

Share this post


Link to post
Share on other sites
Darknightx37

FileWrite("config.xdat", "This is a test")

i tryied this but i can still read it with notpad++  any ideas to avoid this ?

Share this post


Link to post
Share on other sites
TheDcoder

i can still read it with notpad++  any ideas to avoid this ?

Impossible :(


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
Darknightx37

Impossible :(

ouh ok thats a pitty but thx for your fast replys 

Share this post


Link to post
Share on other sites
ViciousXUSMC

Right, But attributes are easy to change with admin rights :D

 

Yeah, but that is the point usually if your an Admin is to have access to everything.  Now if a corporation is setup where users have Admin rights, thats bad on them.

If I had to go the way of encryption I would probably just keep my scripts on a thumbdrive with bitlocker.

  • Like 1

Share this post


Link to post
Share on other sites
guinness

LockFile in my signature will "lock" the file to the process. FileOpen doesn't do that, which was incorrectly suggested above.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
TheDcoder

Thanks guinness, I am still learning :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
MikahS

You can check out my Short-Order Encrypter in my signature. It does file encryption and does not store the key internally. 

:)


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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

×