SRL Archive - News and General

So you left your details in your the script you uploaded and got hacked...


footballjds

2012-12-03 11:10:02

EDIT:
if a mod reads this please change the title to:
"So you left your details in the script you uploaded and got hacked…"

Hello fellow SRL'ers(if indeed you can use that form of the word),

This is a quick tidbit I decided to post after I noticed the number of scripts uploaded with user info still in them. It's very common to excitedly upload your script after making a final tweak. Usually you check through the script to remove info, maybe you even have to copies specifically for this reason. However you do it, here's an alternative that will ensure you NEVER upload your details in your script.

I use the following in a script that is committed to subversion every time I make changes. It's quite simple to use and is very straightforward.

procedure DeclarePlayers;
var
FileNum: integer;
s: string;
usrInfo: TStringArray;
begin
//Opens a text file on your computer
FileNum := OpenFile('C:\accs.txt', true);

//Reads the entire txt file and saves its value to string 's'
ReadFileString(FileNum, s, FileSize(FileNum));

//Closes the file
CloseFile(FileNum);

//Parses string 's' and breaks it into an array of strings
//Every new line will be a new string in the array 'usrInfo'
usrInfo := Explode(chr(10), s);

//Sets the number of players to 1, if you use multi-player I suggest changing this...
//For Multi-player NumberOfPlayers(Length(usrInfo)/2); should work
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := usrInfo[0]; //sets the first player's username to the first line in the text file
Pass := usrInfo[1]; //sets the firsts player's password to the second line in the text file
Active := True;
end;
end;

If you use the above tidbit you'll need a text file placed on your 'C' drive named 'accs.txt' with a username on the first line and your password on the second line.
Obviously this is just how I chose to do it and their are many other ways. Play around with the procedure till it fits your needs.

Happy Scripting and Happy Holidays!!! :D

Benny

2012-12-03 11:17:05

Nice advice!

Pretty handy, but what about if someone gets into your pc files and notices that? :/

footballjds

2012-12-03 11:19:16

From: -Benny
Nice advice!

Pretty handy, but what about if someone gets into your pc files and notices that? :/


This is obviously a non-issue as everyone that uploads a script with their info in it will also leave their details in their .simba scripts on their PC's anyhow. Someone could just as easily get a .simba file off your PC as a .txt file.

Benny

2012-12-03 11:20:04

yeah that's true. I was just raising the point.

Would it be possible to encrypt that file and then request you to enter it?

footballjds

2012-12-03 11:22:53

From: -Benny
yeah that's true. I was just raising the point.

Would it be possible to encrypt that file and then request you to enter it?


You can't encrypt the file and then open it with simba, you could encrypt the text in the file and then de-crypt it but this was meant to be a simple solution. If you're worried about security then create a form in every script you use and don't save the variables in the form to a file somewhere.

nokkasiili

2012-12-03 11:27:44

From: -Benny
yeah that's true. I was just raising the point.

Would it be possible to encrypt that file and then request you to enter it?


If attacker can read files in your comp. You already lost the game

footballjds

2012-12-03 11:32:00

From: nokkasiili
If attacker can read files in your comp. You already lost the game


This is true. The biggest worry then, is sharing your information mistakenly. Using a tidbit like this will help with making that impossible (:

Olly

2012-12-03 12:47:58

or use a form. :)

footballjds

2012-12-03 12:50:22

From: Ollybest
or use a form. :)


Definitely a viable solution(as i pointed out in my reply to benny when he mentioned using encryption). However it's much more complicated to teach a newb how to create and use a form. Ever since we switched from SCAR to SIMBA the number of forms has declined…

That being said, it's very simple for a new guy to simply replace their declare players with the tidbit posted and totally avoid uploading info accidentally :)

NCDS

2012-12-03 17:49:17

A similar bit to this is being coded into SRL6 to try and prevent the same thing, just so everyone knows. :)

Ian

2012-12-03 18:00:58

From: NCDS
A similar bit to this is being coded into SRL6 to try and prevent the same thing, just so everyone knows. :)


Awesome, can't wait! Thanks SRL Devs! :D

Prometheus

2012-12-03 18:19:11

Wow, this would help lots of people!

Flight

2012-12-03 18:47:55

Good advice buddy. :)