Jump to content

Database Editor


themax90
 Share

Recommended Posts

This is a public release of AutoIt-ITS v0.9.2's Database Editor. Now you can save important information in a way that cannot be accessed by the public. This would be perfect for Passwords, Secure Information, TCP Servers(Will be featured in AutoIt-ITS v0.9.2), and general protected storage.

ScreenShot located here:

http://img136.imageshack.us/img136/9003/dbeditwp6.png

OR

http://www.autoit-its.com/autoit-its/forum...wtopic.php?t=69

The actual Database Editor w/ GUI:

Supports a command line load as -load "FullPath" Password

The Command line load has protection against bad load strings, but make sure it follows this example:

-load "C:\Sample.dbf" Sample

Warning: This version is edited for content from the official release for AutoIt-ITS. Security points have been taken out.

If you don't want the GUI, here is an include, with examples:

Example -

Include -

Sample Database File -

Usually the Database Editor will read the files as .dbf, so if you use the Sample Database File in the Graphic Editor it will tell you it is an illegal database file. Rename the extension to .dbf and you will be fine.

To remove this feature, remove lines 247 - 249.

Read.au3 Example

#Include "Database.au3"
$Database = "Sample.dbf"
$Pass = "SamplePass"
$aDatabase = DatabaseLoad($Database, $Pass)
_ArrayAdd($aDatabase, "NewVariable = NewValue")
_ArrayDisplay($aDatabase, $Database)

Database.au3 Include

CODE
#Include-once

#Include <Array.au3>

#Include <File.au3>

#Include <String.au3>

Func DatabaseLoad($DatabaseFile, $Password)

Dim $Array[1]

Select

Case Not $Password = _Encrypt(FileReadLine($DatabaseFile, 1), $Password, 2, 0)

MsgBox(16, "Error", "Invalid database password.")

Return -1

Case Else

SplashTextOn("Loading...", "Loading your database...", 200, 30)

$Lines = _FileCountLines($DatabaseFile)

$Track = 1

For $Track = 1 To $Lines Step 1

Select

Case $Track = 1

$Array[0] = "%password% = " & $Password

Case Else

$BuffLine = FileReadLine($DatabaseFile, $Track)

$StringLength = StringLen($BuffLine)

$EType = StringRight(StringLeft($BuffLine, 2), 1)

$String = StringRight($BuffLine, ($StringLength - 3))

$String = _Encrypt($String, $Password, $EType, 0)

_ArrayAdd($Array, $String)

EndSelect

Next

Return $Array

EndSelect

EndFunc

Func DatabaseSave($DatabaseFile, $Password, $Array)

SplashTextOn("Saving...", "Saving your database..", 200, 30)

Local $Random = Random(0, 2, 1)

Local $Track = 0

FileDelete($DatabaseFile)

For $Track = 0 To (UBound($SpoolN) - 1) Step 1

Select

Case $Track = 0

FileWriteLine($DatabaseFile, _Encrypt($Password, $Password))

Case $Array[$Track] <> ""

FileWriteLine($DatabaseFile, "[" & $Random & "]" & _Encrypt($Array[$Track], $Password, $Random))

EndSelect

Next

SplashOff()

Return 1

EndFunc

Func _Encrypt($String, $Password, $Type = 2, $EncryptType = 1)

Select

Case $Type = 0

Return _StringEncrypt($EncryptType, $String, $Password)

Case $Type = 1

If $EncryptType = 0 Then Return _HexToString (_StringEncrypt($EncryptType, $String, $Password))

Return _StringEncrypt($EncryptType, _StringToHex ($String), $Password)

Case $Type = 2

If $EncryptType = 0 Then Return _Chr2Str(_HexToString (_StringEncrypt($EncryptType, $String, $Password)))

Return _StringEncrypt($EncryptType, _StringToHex (_Str2Chr($String)), $Password)

EndSelect

EndFunc ;==>_Encrypt

Func _Str2Chr(Const $String)

Local $Array = StringSplit($String, "")

Local $BuffStr = ""

Local $Str = ""

Local $Track = 1

For $Track = 1 To $Array[0] Step 1

$BuffStr = Asc($Array[$Track])

$Str = $Str & StringLen($BuffStr) & $BuffStr

Next

Return $Str

EndFunc ;==>_Str2Chr

Func _Chr2Str(Const $String)

Local $Start = 1

Local $Str = ""

Local $StrLenGo

While $Start <= StringLen($String)

$StrLenGo = StringRight(StringLeft($String, $Start), 1)

$Str = $Str & Chr(StringRight(StringLeft($String, $Start + $StrLenGo), $StrLenGo))

$Start = $Start + StringRight(StringLeft($String, $Start), 1) + 1

WEnd

Return $Str

EndFunc ;==>_Chr2Str

Sample.dbf Database File

Sorry please download it, apparently IPB won't allow me to display brackets inside a code field.

I hope you all like,

AutoIt Smith

Edit 1:

This is similar to my Administrative Database located here:

http://www.autoitscript.com/forum/index.ph...c=22371&hl=

AdminDB is a hosted database system over a TCP Server and is rather outdated according to the new ITS Methods. Never the less a good thing for remote database hosting. The new v0.9.2 ITS Server will include this updated feature in a option with remote hosting.

Edited by AutoIt Smith
Link to comment
Share on other sites

  • 3 months later...

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...