SRL Archive - Other Scripts

SCARInternals


Smartzkid

2009-05-30 10:42:18

program New;
var
i, j, k, total: integer;
ax: TCOMPONENT;
TerminateBTN, DoSomethingBTN: TBUTTON;
pop: TPOPUPMENU;
popOpt1: TMenuItem;
DEAD: Boolean;

procedure updRes;
begin
GetApplication.MAINFORM.CAPTION := IntToStr(GetSelf.Height) + ' x ' + IntToStr(GetSelf.Width);
end;

procedure onRes(Sender: TObject);
var
vars: TVariantArray;
begin
ThreadSafeCall('updRes', vars);
end;

procedure doSomething(Sender: TObject);
begin
GetApplication.MESSAGEBOX('Something has been done!', 'CONGRATULATIONS!', 0);
end;

procedure Term(Sender: TObject);
begin
DEAD := true;
GetSelf.Invalidate;
end;

begin
ClearDebug;
GetSelf.ONRESIZE := @onRes;
total := GetApplication.MAINFORM.COMPONENTCOUNT;
writeln(inttostr(total));
for i := 0 to total - 1 do
begin
writeln(inttostr(i) + ': ' + GetApplication.MAINFORM.COMPONENTS[i].NAME);
if(GetApplication.MAINFORM.COMPONENTS[i].COMPONENTCOUNT > 0) then
for j := 0 to GetApplication.MAINFORM.COMPONENTS[i].COMPONENTCOUNT - 1 do
begin
writeln(' ' + GetApplication.MAINFORM.COMPONENTS[i].COMPONENTS[j].NAME);
// ax :=
end;
end;

DoSomethingBTN := TButton.Create(GetApplication.MAINFORM);//.FindComponent('Panel1'));
DoSomethingBTN.Parent := GetApplication.MAINFORM//.FindComponent('Panel1');
DoSomethingBTN.Left := 245;
DoSomethingBTN.Top := 1;
DoSomethingBTN.Width := 75;
DoSomethingBTN.Height := 20;
DoSomethingBTN.Caption := 'Do Something';
DoSomethingBTN.Visible := true;
DoSomethingBTN.ONCLICK := @DoSomething;

TerminateBTN := TButton.Create(GetApplication.MAINFORM);//.FindComponent('Panel1'));
TerminateBTN.Parent := GetApplication.MAINFORM//.FindComponent('Panel1');
TerminateBTN.Left := 201;
TerminateBTN.Top := 26;
TerminateBTN.Width := 121;
TerminateBTN.Height := 20;
TerminateBTN.Caption := 'Terminate';
TerminateBTN.Visible := true;
TerminateBTN.ONCLICK := @Term;

popOpt1 := TMenuItem.Create(GetApplication.MAINFORM);
popOpt1.Caption := 'Terminate';
popOpt1.ONCLICK := @Term;

pop := TPopUpMenu.Create(GetApplication.MAINFORM);
pop.ITEMS.ADD(popOpt1);

GetApplication.MAINFORM.POPUPMENU := pop;

repeat
wait(50);
GetApplication.PROCESSMESSAGES;
GetApplication.HANDLEMESSAGE;
until(DEAD)

try
pop.Free;
popOpt1.Free;
DoSomethingBTN.free;
TerminateBTN.Free;
except end;
end.


What it does:
  • Extracts a list of all children components of the main SCAR form
  • Adds two buttons and a right-click menu to SCAR
  • Try resizing the window :)

SCAR 2.03
[Apparently I'm not allowed to link to SCAR…]

nielsie95

2009-05-30 20:52:11

I didn't try it, but it sounds pretty cool :)

Smartzkid

2009-05-31 00:35:01

Well, its completely useless because of the old-SCAR requirement, but it's definitely interesting :p

mastaraymond

2009-05-31 02:29:27

Yeah, unfortunately this is one of the things Freddy removed in the first version of DiVi :-(

Smartzkid

2009-05-31 06:33:01

'Vulnerabilities'

Dan Cardin

2009-06-01 03:48:38

what exactly is happening here. Installing 2.03 would sadden me.

Wizzup?

2009-06-01 03:52:04

From: Dan Cardin
what exactly is happening here. Installing 2.03 would sadden me.


If you read the thread you would see that it has been removed after SCAR 2.03.

ian.

2009-06-01 04:38:47

He's asking what it does, I believe. And he doesn't want to install SCAR 2.03, I'm also assuming. :]

Smartzkid

2009-06-01 07:42:36

Aight, aight, I uploaded SCAR & script in a very simple archive file (top post). Maybe now I can get some reactions (*cough* just make sure you tell Freddy how amazing it would be to still be able to do this!)

ian.

2009-06-01 07:59:06

Got an access violation when I right clicked - Terminate then tried to resize the window.. :] cool though. :p

Full size - Right click - Terminate - Double click to reduce size

makes my SCAR crash anyways :p

Or if you pause it then when it's paused right click - terminate it crashes

or if you pause it at all. haha :p

senrath

2009-06-01 08:00:53

Pretty cool, but it gave me a bunch of errors when I tried to exit the program.

ian.

2009-06-01 08:05:00

And senrath, that doesn't sound very profound

nielsie95

2009-06-01 12:23:48

Pretty cool indeed. Would be fun if you used this to add buttons to let users set up your script.

Dan Cardin

2009-06-01 14:51:26

From: Wizzup?
If you read the thread you would see that it has been removed after SCAR 2.03.
lol

I actually didnt get any errors. That was quite interesting. I could think of this being abused by people, but i guess it would work just like malicious code now, people realize it right away and their script gets not used. Otherwise i dont really see how its a vulnerability.

It is interesting, however i dont really see a large use for it. Unless this Making a small form would probably amount to just as much work. Unless the changes persisted until SCAR was closed, i dont see it being used much. Can anyone think of somewhere where this would be useful?

Smartzkid

2009-06-03 09:30:13

I could see various scripting utilities integrating with SCAR, which would be convenient; you would be able to script alongside, say, ACA.

I'm not sure if it could be done, but if we were to have access to the script as it was being written, it would open all sorts of doors - backup on every change, warnings for unfreed resources, on-the-fly SRL procedure description viewer, etc.

Dan Cardin

2009-06-03 14:40:53

but everything goes away once the script is terminated = my point

Smartzkid

2009-06-04 04:58:29

Yeah. You would run the helper script, then switch to your actual script with the helper still running in the background.

Dan Cardin

2009-06-04 05:55:29

since when can you run 2 scripts from the same scar window? or edit code while running. I could see editing code while a script is running being bad. Along with it being kind of pointless if you could, for then you would kinda need to be able to run multiple at once. For the most part being something that would probably remain unused for the majority of scripts (assuming that it wouldnt lead to bad things in the first place).