Jump to content

extract from *.txt unkown string after keyword


Recommended Posts

Hallo,

I have got about 300 *.txt with passwords, IP Adresses, ... that I want to import into the keepass programm via csv import. The First step I think is to extract it into an ini file. 

 

each password.txt is inside a specific folder name

 

the password.txt contains:

user: specific1

password: specific_start_then_random

user: specific2

password: random

 

The idea is to go in each folder, open the txt file  and

 

for user specific1:

search for "password: specific_start" and then copy the next signs until there is LF or CLRF into an ini file

 

for user specific2:

search for "password: " and then copy the next signs until there is LF or CLRF into an ini file

 

can you give me a short plan with wich commands I should work?

 

Thanks!

Martin

Link to post
Share on other sites

Hi @mseidel, and welcome to the AutoIt forums :welcome:

You could try _FileListToArray() to get the list of all .txt files you have, then loop through the array returned, use FileRead() to read the content of the i-file, and extract all the Users and Passwords stored in it, which then you can do whatever you want.

Could you please provide a real-world (reproducible) example of a Password.txt file? :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to post
Share on other sites
  • Moderators

mseidel,

300+ files with IP addresses, user names and passwords? Please explain just what these are and what you intend doing with them.

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

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 post
Share on other sites
  • 2 weeks later...

Hi, 

Sorry for my late answer, I havn't got an email.

I'm working in an IT company an the Passwords are generated from the work at customers.

 

An example of the txt file:

 

Quote

 

IP-Adresse: 192.168.2.31

Serial: 8027600364000017831

User: root
Password: xYk7zWQjpYpU

User: wbadmin
Password: CFK394682

Contract-ID: Ev23K-sdCp7?tZ*T

 

 

to "extract" the Password I think something like (?<=root\nPassword:\s)*(?=\s) should work or do you have a better idea?

 

greetings

 

 

Edited by mseidel
Link to post
Share on other sites
  • Moderators

mseidel,

You work in IT and store customer usernames and passwords in clear text? Please tell me you are joking!

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 post
Share on other sites
  • Moderators

mseidel,

Disgraceful! Well, we are certainly not going to encourage such appalling behaviour - thread closed.

And can we please have the name of your company to make sure we have nothing to do with it in the future.

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 post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...