SRL Archive - Other Scripts

Port Scanner


Markus

2007-07-01 04:06:57

Nice piece of code, found some open ports (at my own computer).
You could use a for loop to loop around all ports from start to end, that's maybe a bit easier to do.
Other then that works fine, found some open ports at my own computer :p

Ron

2007-07-01 05:23:33

Cool script man and very simple too! :D

I knew about OpenConnection, but I never knew you could specify the port number. :)

Markus

2007-07-01 07:03:51

I found a bug: you don't free the connection causing an out of memory error.

Ron

2007-07-01 08:34:20

*sigh* no one seems to care about memory. Most scripts that involve bitmaps, dtms, forms, connections, or the like, don't free it from memory. They either just don't know or just don't care.

If only Kait freed his form in that tiny form tutorial in the F1 Help in SCAR, many would follow that example. Perhaps it should be mentioned to Freddy.

Yakman

2007-07-01 09:06:31

nice work fromint :)

Listen to Ron guys, freeing memory is important
although, its not so important in forms because you only run them once, but if you have a procedure that loads a bitmap, but doesnt free, that bitmap will get loaded many times, eventually scar would run out of memory

also be careful because if you port scan a server which isnt your own, it could be considered hostile, so dont do it to http://www.google.com, do it to localhost

Markus

2007-07-01 12:46:48

You see your K := k + 1? Just add FreeConnection(somestuffhere) there.

Smartzkid

2007-07-01 12:56:54

Nice

A try-except will work fine to free the connection (I also changed your repeat-until to a for loop):

program Port_Scanner;  //by fromint
var x,i,start,finish,k: integer;
target: string;

procedure setup;
begin;

//Setup----->

start:= 1; //Starting port.
finish:= 2000; //End port.
target:= 'www.msi-forums.com'; //Target to scan for open ports.

//Setup----->

k:= 0;

end;


begin
setup;
cleardebug;
writeln('Open Ports');
writeln('------------');
for i := start to finish do
begin
x:= openconnection(target, i, 100);
if (x>-1) then
begin;
writeln(inttostr(i));
k:= k + 1;
try
FreeConnection(x);
except end;
end;
end;
if (k=0) then
begin;
writeln('No open ports were found.');
writeln('');
end;
end.

//by fromint

Jason2gs

2007-07-01 14:20:23

This is a pretty cool idea :)

I never thought about making a port scanner before. Good job ;)

Sp0rky

2007-07-01 22:25:56

lol, crazy. Port scanner made in scar. Gj.