Closed SENPAY98K closed 3 years ago
Hey, I have create a small script to convert the typed you sayed into the config file.
const fs = require('fs');
const data = fs.readFileSync('./test.txt', {encoding:'utf8', flag:'r'});
var endString = "var config = [];\n";
const loginRows = data.split("\n");
for (let i = 0; i < loginRows.length; i++) {
const login = loginRows[i];
const loginInfo = login.split(":")
if(loginInfo.length = 3){
endString += `config.push({
steam_user: "${loginInfo[0]}",
steam_pass: "${loginInfo[1]}",
sharedSecret: "${loginInfo[2]}"
});\n`;
}
}
endString += "module.exports = config;";
console.log(endString);
Might need to chance the data.split("\n");
to data.split("\r\n");
base on your file ( you will know if it add \r in the end of the sharedSecret code.
Then just copy the console log into the config.js file.
If this is somefing you do offen, then create a new js file in the main folder, and add
fs.writeFile('config.js', endString, err => {
if (err) {
console.error(err)
return
}
//file written successfully
})
to the end of the file, then you just have to run that file, to convert them into the config file
Thanks for the help, I will try to do it, as i am not really into this things :)
I could not make it run :/
I could not make it run :/
what did the console say?
What you have to do , is in the root folder, create new file eks, ConvertToConfig.js And place my code into it
const fs = require('fs');
const data = fs.readFileSync('./test.txt', {encoding:'utf8', flag:'r'});
var endString = "var config = [];\n";
const loginRows = data.split("\r\n");
for (let i = 0; i < loginRows.length; i++) {
const login = loginRows[i];
const loginInfo = login.split(":")
if(loginInfo.length = 3){
endString += `config.push({
steam_user: "${loginInfo[0]}",
steam_pass: "${loginInfo[1]}",
sharedSecret: "${loginInfo[2]}"
});\n`;
}
}
endString += "module.exports = config;";
console.log(endString);
fs.writeFile('config.js', endString, err => {
if (err) {
console.error(err)
return
}
//file written successfully
})
and then replace the part test.txt
whit the txt file whit all the logins in.
and then just in the cmd in that folder run node ConvertToConfig.js
and it will convert the logins into the config file. and then you can use it.
Thanks works just in a sec
Is there any possibility to request accounts from a text file with the format
username:password:sharedsecret
instead of manually filling config everytime.