分享
 
 
 

用模拟精灵写的自动投票系统

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

<?xml version="1.0" encoding="gb2312" ?>

<ApeML LID="CHS" MD="0" 抓屏模式="0" 名称="icctv-vote" 作者="xing006" 信息窗口="false" 速度="15" 循环次数="20" 自定义属性="ConnectionName = adsl,ConnectionPassword = m7x9b6r4,ConnectionUser = 100001230164">

<!--创建时间:2005年11月30日-05:07-->

<脚本区块 语言="LAScript" 名称="init" 延时="0" 启用="true" 编辑密钥="" 运行公钥="">

<![CDATA[

_set = ape:loadSetting(); --读取自定义属性

stopPlay = function() --这个函数回放停止时被调用.

ape:saveSetting(_set); --保存自定义属性

collectgarbage();--清理内存

end;

import("net");

import("clean");

Forms=net.System.Windows.Forms

Drawing=net.System.Drawing

Form=Forms.Form

TextBox=Forms.TextBox

Label=Forms.Label

Button=Forms.Button

Point=Drawing.Point

Size=Drawing.Size

FormStartPosition=Forms.FormStartPosition

wb = web.new();

identify= function()

clean.IE(false,true);

local strUrl="http://"

wb:setSilent(true,true);

wb:go(strUrl);

wb:show(false);

delay(200);

for i=1,100,1 do

if(wb:getEle("CheckCode_input"))then

local img=image.new();

img:getURL("http://","*.gif");

if(img:ok())then

img:corp(5,4,41,14);--对图进行修剪;

local img2,img3,img4,img5=img:split(1,4);

if(img2)then

img2:median(2);--是否加中值滤波,及中值滤波的值,要根据实际情况进行调整。;

img3:median(2);

img4:median(2);

img5:median(2);

end;

imgBinKey=bytestoImg();--得到包含样本图片的表

local str="";--识别出来的文字

str=test(imgBinKey,img2);

str=str..test(imgBinKey,img3);

str=str..test(imgBinKey,img4);

str=str..test(imgBinKey,img5);

local ele=wb:getEle("CheckCode_input")

ele:setAttribute("value",str);

ele:submit();--提交表单

image.del(img);

image.del(img2);

image.del(img3);

image.del(img4);

image.del(img5);

element.del(ele);

break;

end;

end;

if(i==100)then

return false;

end;

delay(100)

end;

return true;

end;

function isConnect(url)

local str = web.getURL(url);

if (str=="")then

return false;

end;

if( string.find( str, "找不到服务器" ) )then

return false;

end;

if( string.find( str , "没有可以显示的页面" ) )then

return false;

end;

return true;

end;

function isConnectX()

NETWORK_ALIVE_LAN = 0x00000001 --是否有可用网卡

NETWORK_ALIVE_WAN = 0x00000002 -- 是否有可用远程连接

NETWORK_ALIVE_AOL = 0x00000004 -- NETWORK_ALIVE_AOL(仅对98\95有效判断是否联上美国的网络)

--IsNetworkAlive的参数是传址的,所以需要用P来标记参数类型,然后在返回值中添加一个返回值flag

IsNetworkAlive = dll.open("sensapi.dll", "IsNetworkAlive", "I(P)","stdcall")

ok,flag = IsNetworkAlive(NETWORK_ALIVE_WAN); --ok对应上面的默认返回值I,flag对应上面的输出参数返回值P

-- 注意上面的参数 ,应在网络连接以后延迟一下再检测是否有活动的连接

if( ok == 0 )then

return false;

else

if( (flag & NETWORK_ALIVE_WAN) == NETWORK_ALIVE_WAN)then

return true;

else

return false;

end;

end;

end;

bytestoImg= function()

local codeKey=ape:loadTable("验证码样本");--从数据岛读取表

local imgBinKey={};--这个表是放真正的图像的

toImage= function(k,v)

local img9=image.new();

img9:setBytes(string.decode(v,""),"*.gif");

imgBinKey[k]=img9;

end;

table.foreach(codeKey,toImage)

return imgBinKey;--调用函数,将返回包含样本图片的表

end;

test= function(imgBinKey,imgX)

local limit=9999;

local chr="";

testImg= function(k,v)

local n=imgX:testXX(imgBinKey[k]);

if (n<limit) then

limit=n;

chr=k.."";

end;

end;

table.foreach(imgBinKey,testImg);

return chr

end;

function dail(connN,connU,connP)

collectgarbage();

win.exec(win.getSysDir().."\rasdial.exe"," "..connName.." /DISCONNECT",win.getSysDir(),0);

delay(2*1000); --延时2秒

win.exec(win.getSysDir().."\rasdial.exe"," "..connName.." "..connUser.." "..connPassword,win.getSysDir(),0);

delay(5*1000); --延时2秒

end;

function btnVote_click(sender,args)

connName = txtConnectionName.Text;

connUser = txtConnectionUser.Text;

connPassword = txtConnectionPassword.Text;

ape:setRunNumber(txtVoteCount.Text);

local i = 0;

local j= ape:getRunNumber();

while(i<j)

do

if(math.mod(i,10)==0) then

dail(connName,connUser,connPassword);

if(isConnectX())then

if(identify())then

i=i+1

lblValue.Text = i.."/"..j

delay(1000);

end;

end;

else

if(not isConnectX())then

dail(connName,connUser,connPassword);

end;

if(identify())then

i = i + 1;

lblValue.Text = i.."/"..j;

delay(1000);

end;

end;

end;

end;

form = Form();

txtVoteCount = TextBox();

txtConnectionName = TextBox();

txtConnectionUser = TextBox();

txtConnectionPassword = TextBox();

lblVoteCount = Label();

lblConnectionName = Label();

lblConnectionUser = Label();

lblConnectionPassword = Label();

lblPercent = Label();

lblValue = Label();

btnVote = Button();

form:SuspendLayout();

lblVoteCount.Location = Point(10, 10);

lblVoteCount.Name = "lblVoteCount";

lblVoteCount.Size = Size(40, 10);

lblVoteCount.TabIndex = 0;

lblVoteCount.Text = "票数:";

txtVoteCount.Location = Point(80, 10);

txtVoteCount.Name = "txtVoteCount";

txtVoteCount.Size = Size(60, 60);

txtVoteCount.TabIndex = 1;

txtVoteCount.Text ="20000"

lblConnectionName.Location = Point(10, 40);

lblConnectionName.Name = "lblConnectionName";

lblConnectionName.Size = Size(70, 10);

lblConnectionName.TabIndex = 2;

lblConnectionName.Text = "拔号连接名:";

txtConnectionName.Location = Point(80, 40);

txtConnectionName.Name = "txtConnectionName";

txtConnectionName.Size = Size(60, 60);

txtConnectionName.TabIndex = 3;

txtConnectionName.Text ="adsl"

lblConnectionUser.Location = Point(10, 70);

lblConnectionUser.Name = "lblConnectionUser";

lblConnectionUser.Size = Size(70, 10);

lblConnectionUser.TabIndex = 4;

lblConnectionUser.Text = "拔号用户名:";

txtConnectionUser.Location = Point(80, 70);

txtConnectionUser.Name = "txtConnectionUser";

txtConnectionUser.Size = Size(60, 60);

txtConnectionUser.TabIndex = 5;

txtConnectionUser.Text ="100001230164"

lblConnectionPassword.Location = Point(10, 100);

lblConnectionPassword.Name = "lblConnectionPassword";

lblConnectionPassword.Size = Size(70, 10);

lblConnectionPassword.TabIndex = 6;

lblConnectionPassword.Text = "拔号密码:";

txtConnectionPassword.Location = Point(80, 100);

txtConnectionPassword.Name = "txtConnectionPassword";

txtConnectionPassword.Size = Size(60, 60);

txtConnectionPassword.TabIndex = 7;

txtConnectionPassword.Text ="m7x9b6r4";

lblPercent.Location = Point(10, 130);

lblPercent.Name = "lblPercent";

lblPercent.Size = Size(70, 10);

lblPercent.TabIndex = 8;

lblPercent.Text = "进度:";

lblValue.Location = Point(80, 130);

lblValue.Name = "lblValue";

lblValue.Size = Size(70, 10);

lblValue.TabIndex = 9;

--lblValue.Text = "";

btnVote.Location = Point(70, 170);

btnVote.Name = "btnVote";

btnVote.TabIndex = 10;

btnVote.Text = "开始投票";

btnVote.Click:Add(btnVote_click);

form.AutoScaleBaseSize = Size(5, 13);

form.ClientSize = Size(200, 200);

form.Controls:Add(lblVoteCount);

form.Controls:Add(txtVoteCount);

form.Controls:Add(lblConnectionName);

form.Controls:Add(txtConnectionName);

form.Controls:Add(lblConnectionUser);

form.Controls:Add(txtConnectionUser);

form.Controls:Add(lblConnectionPassword);

form.Controls:Add(txtConnectionPassword);

form.Controls:Add(lblPercent);

form.Controls:Add(lblValue);

form.Controls:Add(btnVote);

form.Name = "MainForm"

form.Text = "ICCTV Vote"

form.StartPosition = FormStartPosition.CenterScreen

form.MaximizeBox=false;

form.MinimizeBox=true;

form:ResumeLayout(false);

form:ShowDialog();]]>

</脚本区块>

<数据区块>

<验证码样本>

<item key="0" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQWEMhApaX4Bj1tB5sXhtdEViZImqjnRgA7" ktype="string" vtype="string" />

<item key="1" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQTEMgQpAW0Xpz31BsYehOJkZ1pRQA7" ktype="string" vtype="string" />

<item key="2" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQXEIAQZrXXTsl3l9SnfWFHZVyZnuTpBhEAOw==" ktype="string" vtype="string" />

<item key="3" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQUEIRJgb124qt3x9WWBWJWdihZXhEAOw==" ktype="string" vtype="string" />

<item key="4" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQWEEgZwpzV3qyp7hWGfSFQZpeYUmsaAQA7" ktype="string" vtype="string" />

<item key="5" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQVEIQAqpX30lxn35zHYeMmSqB3jkAEADs=" ktype="string" vtype="string" />

<item key="6" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQWEIAQZpVUTn01915mcZ3YjWiaiaAXAQA7" ktype="string" vtype="string" />

<item key="7" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQUMIA5g6T4YmA311S3iRn4mZ93ehEAOw==" ktype="string" vtype="string" />

<item key="8" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQVEIAQZpVUWnw391/2jR02gpmorVIEADs=" ktype="string" vtype="string" />

<item key="9" value="R0lGODlhCQAKAOMAAP///wAAAMjIyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAP8ALAAAAAAJAAoAAAQWEIAQZpVUWnwx19m3aWRHTiDYUezpRgA7" ktype="string" vtype="string" />

</验证码样本>

</数据区块>

</ApeML>

注意:需要dotnet1.1支持.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有