如何使用DELPHI自动投票? ( 积分: 100 )

  • 主题发起人 主题发起人 深之蓝
  • 开始时间 开始时间

深之蓝

Unregistered / Unconfirmed
GUEST, unregistred user!
如果某投票网站并不限制同一IP地址投票,请问如何使用DELPHI实现?
 
如果某投票网站并不限制同一IP地址投票,请问如何使用DELPHI实现?
 
哪位大虾出面说说啊.
分不够可以再加.
 
分析网页源代码,做一个自动提交网页,用webbrowser反复打开
 
To ymjy,
偶下载了选择投票"赞成"和""反对"的网页源代码,发现在按"确定"提交之前是一样的,您能说的细些吗?
 
你把网页源代码贴出来
 
我给法院做过一个自动投票系统,原理是用代码实现宽带的自动拨号连接和断开,从而实现IP地址的不同,投票是分析网页的form提交地址和提交参数,然后用idhttp控件提交参数到指定的form接收页面就是了。也可以用webbrowser,先给投票项目赋值,一般是打勾什么的,然后定时模拟点击提交投票页面就可以了。我花了一个晚上搞定,赚了2000块,后来我才知道我们当地的法院因为评上了全国十佳法院,每人光奖金就发了5000,TMD的腐败的GCD,他们原来是排在最后几位的,都是靠自动投票作弊才赶上去的,不说了,这个世道
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, OleCtrls, SHDocVw, MSHTML;

type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DownloadComplete(Sender: TObject);
private
{ Private declarations }
FDownComplete : Boolean;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
var
ovDoc, ovInput, ovTag: OleVariant;
I : Integer;
begin
if not FDownComplete then Application.MessageBox('网页正在下载中,请稍后……', '提示', MB_OK + MB_ICONINFORMATION)
else begin
ovDoc := WebBrowser1.Document;
ovInput := ovDoc.all.tags('INPUT');
for I := 0 to ovInput.length -1 do begin
ovTag := ovInput.item(I);
if (ovTag.Type = 'text') or (ovTag.Type = 'password') then begin
if ovTag.Name = 'uid' then ovTag.Value := 'chenybin';
if ovTag.Name = 'passwd' then ovTag.Value := '******';
end
else if ovTag.Type = 'image' then begin
if ovTag.alt = '登录ChinaRen' then
ovTag.Click;
end;
end;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
FDownComplete := False;
WebBrowser1.Navigate('http://www.chinaren.com');
end;

procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
FDownComplete := True;
end;

end.


刚刚写的点击中国人网站登录的例子,供参考
 
以下是截获IE发送和接收的数据:请注意该投票分成两部分,第一个ID是指那个部分的投票,第一段POST数据结尾的ID是指对该部分的投票选择.
POST /vote/fivote.asp?voteID=18 HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Content-Length: 29
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK

ID=117&Submit.x=28&Submit.y=5


HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:01 GMT

HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:01 GMT
Location: voteview.asp?voteID=18
Content-Length: 121
Content-Type: text/html
Cache-control: private

GET /vote/voteview.asp?voteID=18 HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
Content-Length: 5342
Content-Type: text/html
Cache-control: private

GET /css.css HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/vote/voteview.asp?voteID=18
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
If-Modified-Since: Tue, 25 Jan 2005 03:16:50 GMT
If-None-Match: "4eefae4f8c2c51:1558"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


GET /forenotice/point_line.gif HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/vote/voteview.asp?voteID=18
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


GET /vote/images/bar0.gif HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/vote/voteview.asp?voteID=18
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 15 Jan 2001 07:13:00 GMT
If-None-Match: "0a6af97c27ec01:1558"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


GET /vote/images/bar.gif HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/vote/voteview.asp?voteID=18
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 15 Jan 2001 07:13:00 GMT
If-None-Match: "0a6af97c27ec01:1558"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


HTTP/1.1 304 Not Modified
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
ETag: "4eefae4f8c2c51:1559"
Content-Length: 0

GET /vote/images/bar1.gif HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/vote/voteview.asp?voteID=18
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 15 Jan 2001 07:13:00 GMT
If-None-Match: "0a6af97c27ec01:1558"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Connection: Keep-Alive
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK


HTTP/1.1 404 Object Not Found
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
Connection: close
Content-Length: 3733
Content-Type: text/html

HTTP/1.1 304 Not Modified
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
ETag: "0a6af97c27ec01:1559"
Content-Length: 0

HTTP/1.1 304 Not Modified
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
ETag: "0a6af97c27ec01:1559"
Content-Length: 0

HTTP/1.1 304 Not Modified
Server: Microsoft-IIS/5.0
Date: Tue, 30 Aug 2005 03:59:02 GMT
ETag: "0a6af97c27ec01:1559"
Content-Length: 0
 
那位大虾看看啊,郁闷中...
 
唉……。不知道是兄台懒还是因为兄台想用其他方式,我上面的代码稍微修改一下就可以投票了,你再把我下面的代码放进去运行一下看看,而且从你发回去的数据看,只有
POST /vote/fivote.asp?voteID=18 HTTP/1.1
Accept: */*
Referer: http://www.cng.com.cn/
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: www.cng.com.cn
Content-Length: 29
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDSSTSQSSR=ADDJDGDBJELFMPGNBKLAPBFK

ID=117&Submit.x=28&Submit.y=5
这段是正真选数据的,如果不嫌弃,暂时用偶滴办法吧,改一下,让它定时自动选,另外找点代码让他不要打开新窗口

procedure TForm1.FormCreate(Sender: TObject);
begin
FDownComplete := False;
WebBrowser1.Navigate('http://www.cng.com.cn/');
end;

procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
FDownComplete := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
ovDoc, ovForms, ovForm, ovInput: OleVariant;
I, J : Integer;
begin
if not FDownComplete then Application.MessageBox('网页正在下载中,请稍后……', '提示', MB_OK + MB_ICONINFORMATION)
else begin
ovDoc := WebBrowser1.Document;
ovForms := ovDoc.all.tags('FORM');
for I := 0 to ovForms.length -1 do begin
ovForm := ovForms.item(I);
if AnsiSameText(ovForm.action, 'vote/fivote.asp?voteID=17') then begin
for J := 0 to ovForm.length - 1 do begin
ovInput := ovForm.item(J);
Memo1.Lines.Add(ovInput.Type);
if (ovInput.Type = 'radio') then begin
// 下面的这个113是从网页里面找出来的,分别是113,114,115
if (ovInput.Value = '113') and (ovInput.Name = 'ID') then begin
ovInput.Checked := True;
ovForm.submit;
Break;
end;
end
end;
end;
end;
end;
end;
 
呵呵,谢谢chenybin.
请有空时给我邮件:toyzn2004@126.com
我这儿有项目时就请您参加.
 
后退
顶部