Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic Client/Server Connection in Delphi
06-16-2009, 10:32 AM (This post was last modified: 06-17-2009 03:17 AM by Back_track.)
Post: #1
Basic Client/Server Connection in Delphi
Note:
If this has any bugs\Flaws send me a PM also this is NOT a tutorial that teaches you how to make programs suck as ProRat it is designed for the purpose of teaching you how a client /server connection works with a few functions

Programs Needed
Delphi 7 or 6 (for the client and server sockets)
Ok as you know by my signature I am making a rat in Delphi so I’m going to make a short tutorial on how to make a basic unhidden client\Server with the capabilities to open and close cd trays
WARNING:
For some reason it ejected my USB drive also
First the CLIENT:
((If you are using Delphi 7 install the package in the C:\ProgramFiles\Borlands\Delphi7\Bin\dclsockets70.bpl or something along the lines of that))
Ok go to the internet tab of your Delphi toolbar
Add To The form Client Socket : place it anywhere it won’t be visible in the opening of the client
Then Add An Edit( you can name it IPBox or keep it as edit1) 4 Buttons(one for connecting then disconnecting then two for your functions)
Now Lets Add Captions So you know what the hell you are Clicking On For The First One it should look like this( The Whole Form: )

[Image: AndSocket.jpg]
Note TO Make The Letter of the caption underlined to as followed in the caption Box
&Connect
Or
&Disconnect
Now Add The Client Socket Feature
As you can see it has a plug
NOW ---------------
Lets Add Some Functionality To This
SINGLE click on Button One Click Over To the events tab
[Image: Panel.jpg]
Double Click On The OnCLick Feature
The Following Line Should say
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin

end;
That is where you put you code for that event
Now add this code
Code:
Clientsocket1.Host := Edit1.Text;    //where the ip is stored
Clientsocket1.Port := 55555;    //you can have any port as long as it’s open
Clientsocket1.Active := True;    //tells the client is active
Now Remember That socket we put on our form??
Click on it then go to the events tab and double Click On The OnConnect Tab
And it should look like this
Code:
procedure TForm1.ClientSocket1Connect(Sender: TObject;
  Socket: TCustomWinSocket);
Begin

End;
Now in the area in between the procedure and end; statement put the following code
Code:
Form1.Caption :=  (‘connection established ‘);// when connection established changes our caption to say //so
Since We Did a connect event lets do a disconnect event
Events Tab then OnDisconnect Write
Code:
Form1.Caption := (‘Disconnected’); //if socket disconnected then make caption state the that
You could also do this
Double click on Form1 then add this
Code:
Form1.Caption := (‘ No Connections have been established ‘);
Lets Get That Disconnect Button To Work
Click on it then hit the events tab again and OnClick
Code:
Clientsocket1.Active := False;     //in between begin and end;
Now for a basic function how to open/close a cd
NOTE:
I found out this function form opensc
For The Button Open CD Tray single click on it go to events double click on onclick and place this code
Code:
Clientsocket1.Socket.SendText ('opencd'); //the text means nothing you can substitute it with anything //as long as it matches the servers receive text command
For the button that has a caption close cd do this code
Code:
Clientsocket1.Socket.SendText('closecd'); //as I said as long as it matches the servers commands it can //be changed
Now If there is an error with any of these commands the app will crash to prevent that lets add a little error code
Place a Memo[Image: Memo.jpg]Add to the form
Code:
Memo1.Clear;// clears memo1
Ok now click on the client socket go to events tab and click on OnError
Code:
procedure TForm1.ClientSocket1Error(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;);
That’s what it should look like now add Error Code As a variable
So now we declared the error as an integer so lets put the error code in…
Code:
procedure TForm1.ClientSocket1Error(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);// declares the variable and shows the procedure
begin
Memo1.Lines.Add (' Error Connection Failed: ' +IntToStr(ErrorCode));
ErrorCode := 0;
end;\
NOW we’re done with our client
ONTO the server:::
Open Up A New Instance Of Delphi
The Server requires very few lines of code so don’t get stressed
Add the Server Socket
[Image: NormalServer.jpg]
The codeHeres what Client should look like
[Image: ServerCode.jpg]
[Image: AndSocket.jpg]


CHANGES:::
Ok before you are finished on your server do the following change the following under properties
Active = True
To allow communication you must also add these under the usage this is what you should add
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, ComCtrls, ScktComp;
Jpeg only if you want to add a jpeg
Ok this should be good but if you have a problem setting up this simple Server\Client Tool just PM me
+Rep if you liked Big Grin
I will be making more tutorials on Remote Administration type tools in the future followed by the release of my (most likely to be) open source Delphi RAT
Have Fun



Already compiled files are being uploaded to media fire as i type




DOWNLOAD for the already compiled sources + word document

http://www.mediafire.com/download.php?zz4izynmzmm



original thread
http://www.hackforums.net/showthread.php?tid=79435

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
06-16-2009, 06:46 PM (This post was last modified: 06-16-2009 06:52 PM by drdebcol.)
Post: #2
RE: Basic Client/Server Connection id Delphi
Wow great ! I have never used sockets, and i don't know about them, but this is surely good tut !
I learned a lot ! This program works for me, but there are basically two mistakes :
-First, you didn't put client code in .zip file !
-Second, about server, when it gets "closecd" command it openes drive, you have it on this picture :
[Image: ServerCode.jpg]
Look, this should look like this :
Code:
if socket.ReceiveText='opencd' then
    mciSendString('Set cdaudio door open wait', nil, 0, handle)
  else
    if socket.ReceiveText='closecd' then
      mciSendString('Set cdaudio door closed wait', nil, 0, handle);
But generally it is great, and i have ideas from this !
Now it is easy to make a chat program, even a keylogger . . .
I know ways to bypass AV-s and to bypass dynamic IP address changing, so this could be good . . .

P.S. For those who have Delphi 7, you install this component C:\ProgramFiles\Borlands\Delphi7\Bin\dclsockets70.bpl in a way
you go to Component>>Install Packages, and there you can install .bpl files !
And also, add into uses "MMSystem" if you use mcisendstring() function !

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
06-17-2009, 02:46 AM
Post: #3
RE: Basic Client/Server Connection id Delphi
(06-16-2009 06:46 PM)drdebcol Wrote:  Wow great ! I have never used sockets, and i don't know about them, but this is surely good tut !
I learned a lot ! This program works for me, but there are basically two mistakes :
-First, you didn't put client code in .zip file !
-Second, about server, when it gets "closecd" command it openes drive, you have it on this picture :
[Image: ServerCode.jpg]
Look, this should look like this :
Code:
if socket.ReceiveText='opencd' then
    mciSendString('Set cdaudio door open wait', nil, 0, handle)
  else
    if socket.ReceiveText='closecd' then
      mciSendString('Set cdaudio door closed wait', nil, 0, handle);
But generally it is great, and i have ideas from this !
Now it is easy to make a chat program, even a keylogger . . .
I know ways to bypass AV-s and to bypass dynamic IP address changing, so this could be good . . .

P.S. For those who have Delphi 7, you install this component C:\ProgramFiles\Borlands\Delphi7\Bin\dclsockets70.bpl in a way
you go to Component>>Install Packages, and there you can install .bpl files !
And also, add into uses "MMSystem" if you use mcisendstring() function !

lol if you want to see some delphi source codes i have about 20 delphi RAT sources along with a few keyloggers

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
06-17-2009, 03:40 AM
Post: #4
RE: Basic Client/Server Connection in Delphi
You can post a tut every day here, so i can see and others can see !

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
06-17-2009, 06:33 AM
Post: #5
RE: Basic Client/Server Connection in Delphi
Very interesting actually, I'll look at this, perhaps it's similar to how it works in VB 6.
Visit this user's website Find all posts by this user
Quote this message in a reply
06-24-2009, 11:00 AM
Post: #6
RE: Basic Client/Server Connection id Delphi
(06-16-2009 06:46 PM)drdebcol Wrote:  Wow great ! I have never used sockets, and i don't know about them, but this is surely good tut !
I learned a lot ! This program works for me, but there are basically two mistakes :
-First, you didn't put client code in .zip file !
-Second, about server, when it gets "closecd" command it openes drive, you have it on this picture :
[Image: ServerCode.jpg]
Look, this should look like this :
Code:
if socket.ReceiveText='opencd' then
    mciSendString('Set cdaudio door open wait', nil, 0, handle)
  else
    if socket.ReceiveText='closecd' then
      mciSendString('Set cdaudio door closed wait', nil, 0, handle);
But generally it is great, and i have ideas from this !
Now it is easy to make a chat program, even a keylogger . . .
I know ways to bypass AV-s and to bypass dynamic IP address changing, so this could be good . . .

P.S. For those who have Delphi 7, you install this component C:\ProgramFiles\Borlands\Delphi7\Bin\dclsockets70.bpl in a way
you go to Component>>Install Packages, and there you can install .bpl files !
And also, add into uses "MMSystem" if you use mcisendstring() function !
Oh the reason i didnt put the code in the .zip file is i just wanted to see if people could do it themselves

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
06-24-2009, 06:23 PM
Post: #7
RE: Basic Client/Server Connection in Delphi
Ha , OK it is better to make it yourself that is learning !

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: