Jump to content

Searching an excel and reading adjacent


Recommended Posts

My goal is to acquire usernames and passwords from an excel file.

 

The table may look different for each person who has an excel file with usernames and passwords, it may be filtered in excel also (if that matters when reading from an excel file).

But the thing that they all must have in common is this fact (lets say it's for websites):

  • For each website in a column (could be the firs, the second...), there is an adjacent username, and then next to that, password, in the corresponding row.

Now I need to find and read these usernames and passwords by searching the websites column for the website that my program will need those credentials for.

The required website may be written (in the websites column) in different names, for example, YouTube as YT, Facebook as FB and so on (These can be like tags that are related, a group of these tags meaning one website, just like YT means YouTube).

 

************************************

Further on,

I'd like it to do so that the excel file is never (at least not more than once) opened, as possible.

Also, a plan ahead is to store this acquired table (array) of credentials and websites in a different file, one that is not excel or related to another program/application.

Because then I want to make this information as secure as possible, so this AutoIt program will have to be able to encrypt and decrypt this information and protect it as deeply as possible.

Later on I plan to design a unique security system for accessing this information, which will, after all, perform the above described search in the excel file (or better the created file from that).

Edited by 2Radon
Link to comment
Share on other sites

  • Moderators

That sounds like a great project, but I fail to see a question. Understand that this is a forum for helping folks with their scripts, not one where you list requirements and we barf up code for you ;)

What have you tried on your own already?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 

Because then I want to make this information as secure as possible

Then Excel is out of the game ;)

Please have a look at Keepass on the web - a secure, encrpyted password store. Keyform on this forum allows to automatically iinsert userid/password from the keepass data base into the website.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Then Excel is out of the game ;)

Please have a look at Keepass on the web - a secure, encrpyted password store. Keyform on this forum allows to automatically iinsert userid/password from the keepass data base into the website.

 

I bet KeePass won't secure your passwords if somebody simply comes up to you and beats you up when you have just logged into it. ;DD

If there is a way to draw credentials from the KeePass encrypted database with AutoIt, then that would be better than thinking up a new, inferior encryption.

But before I talk about KeePass, my first goal is to get all the credentials from an Excel file, as many people whom this program will be made for might have their credentials simply in an Excel file.

And yes I know its security is not even discussable. :)

 

Now about what code I have come up with so far, I can't bust out a large gargantuan yet, but I am thinking by steps.

#include <Excel.au3>
#include <Array.au3>

$xlsx = @ScriptDir & "\credtest.xlsx"
_WinWaitActivate("credtest.xlsx - Excel", "")
$oExcel = _ExcelBookAttach($xlsx)


; Somewhere I need a way for this script to find out which column has users (contains "usr") and which'
; column has passwords. For websites that would be some website specificalities like http, www, com, net, etc., etc.


;Dim $aCreds[100][100]
;$aCreds = _ExcelReadSheetToArray($oExcel, 2, 2) ; Was trying something here, don't remember what :O
$aCreds = _ExcelReadArray($oExcel, 2, 2, 20, 1, 1)

; Before this I had problems with creating an array from excel like I wanted, and used this to check if it is correct

;If IsArray($aCreds) Then
;   MsgBox(0, "Array", "It is." & $aCreds[3])
;Else
;   MsgBox(0, "Fail", "It is NOT.")
;EndIf



; This tells me the index is 10. It is the 11th row in the excel table, but it is the 10th user, since the index
; base for the array was set to start from 1
$search = _ArraySearch($aCreds, "usr10")

MsgBox(0, "Found User", $search)


; Next I need to try taking the password adjacent to the user once it is found.




Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    ;      :)      a random smiley
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

This isn't much at all, but I am slowly working on this aside my other projects. I will accept any teachings, suggestions and idea tomatoes. :)

credtest.xlsx

Edited by 2Radon
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...