飘云阁

 找回密码
 加入我们

QQ登录

只需一步,快速开始

查看: 8964|回复: 11

[Delphi] 5天会用delphi写完美内存挂

[复制链接]

该用户从未签到

发表于 2008-9-28 22:21:29 | 显示全部楼层 |阅读模式
5天之前我用vb的。也是集合百家众长来做的(就是把所有的资料和循环用法都找过来用到什么去查怎么用需要什么地址去查什么地址)
本贴没有任何其他意思。只有告诉比我晚来的怎么利用这里的资源
强烈顶一下广海。能让人5天从用按键到VB然后从VB到delphi。
太感谢他们了;
本贴中不是全部的源代码。但是把他们复制到一起然后添加添加控件也是可以用的。
主要资料来源:
我也发个武林的资料 非常齐全 (4月5日已更新)

还有一个高手。也是论坛里的。写的delphi源代码。主要就是参照他来学会用那些循环、变量、赋值什么的
真找不到那个贴了。他的文件是my50.exe。想学delphi的一定要去看。
找到了↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
lewei2000
DELPHI版武林小挂,新手多借鉴,高手给点意见

学东西就靠他了
变量定义的部分就不发了。没什么意义。反正用到什么去定义什么就好了。先发主函数
【主循环】
procedure TForm1.Timer1Timer(Sender: TObject);//主循环
begin
xinxi;//刷新个人信息
guaixinxi;//刷新怪物信息
xuanguai;//执行选怪
checkwuqi;//检测武器持久是否需要更换
hpmpbh;//红蓝保护
dopickup;//执行拣取
dofz;//检测辅助技能/物品更换
doatt;//执行攻击
huanguai;//是否需要换怪。是否打怪超时间
end;
我是把整个函数放在了一个timer里。这样根据调整timer的响应时间。来调整执行的效率
【时间获取i控制】
procedureiTForm1.Timer2Timer(Sender:iTObject);
begin
Ifi(CheckBox5.checked)iandi(ComboBox16.text<>'0')ANDi(gjtime1<strtoint(edit38.t
ext))then
gjtime1:=gjtime1+1;//攻击的延时。用来使这个变量通过这个timer不停的自加1一直加到延时等于想攻击的时间。比如我设置的攻击。是3秒按一下。那这个就是自加到3,然后等调用的地方清0edit38里放着需要等到的时间。checkbox5是用来检测是否启用了这个功能。combobox是用户选择的快捷键。如果这个没有设置。是0的情况。也认为是没有启用这个功能。以下的都跟这个是一样的
Ifi(CheckBox6.checked)iandi(ComboBox17.text<>'0')andi(gjtime2<strtoint(edit39.text))then
gjtime2:=gjtime2+1;
Ifi(CheckBox7.checked)iandi(ComboBox18.text<>'0')andi(gjtime3<strtoint(edit40.text))then
gjtime3:=gjtime3+1;
Ifi(CheckBox8.checked)iandi(ComboBox19.text<>'0')andi(gjtime4<strtoint(edit41.text))then
gjtime4:=gjtime4+1;

Ifi(CheckBox9.checked)iandi(ComboBox20.text<>'0')ANDi(fztime1<strtoint(edit22.text))then
fztime1:=fztime1+1;
Ifi(CheckBox10.checked)iandi(ComboBox21.text<>'0')andi(fztime2<strtoint(edit23.text))then
fztime2:=fztime2+1;
Ifi(CheckBox11.checked)iandi(ComboBox22.text<>'0')andi(fztime3<strtoint(edit24.text))then
fztime3:=fztime3+1;
Ifi(CheckBox12.checked)iandi(ComboBox23.text<>'0')andi(fztime4<strtoint(edit20.text))then
fztime4:=fztime4+1;

Ifi(CheckBox13.checked)iandi(strtoint(edit25.text)>0)and(huanidtime<strtoint(edit25.text))then
huanidtime:=huanidtime+1;
Ifi(CheckBox1.checked)iandi(strtoint(edit17.text)>0)iand(ComboBox1.text<>'0')and(hptime<10)ithen
hptime:=hptime+1;
Ifi(CheckBox2.checked)iandi(strtoint(edit18.text)>0)iand(ComboBox2.text<>'0')and(mptime<10)ithen
mptime:=mptime+1;
ifi(CheckBox18.checked)iandi(strtoint(edit52.text)>0)iandi(combobox25.text<>'0')andi(bbtime<strtoint(edit52.text))then
bbtime:=bbtime+1;
ifi(CheckBox4.checked)iandi(combobox4.text<>'0')ithen
huanwqtime1:=huanwqtime1+1;
ifi(CheckBox4.checked)iandi(huanweizhi<>0)ithen
huanwqtime2:=huanwqtime2+1;
edit7.Text:=Concat('攻',inttostr(gjtime1));
edit8.Text:=Concat('攻',inttostr(gjtime2));
edit9.Text:=Concat('攻',inttostr(gjtime3));
edit10.Text:=Concat('攻',inttostr(gjtime4));
edit11.Text:=Concat('辅',inttostr(fztime1));
edit12.Text:=Concat('辅',inttostr(fztime2));
edit13.Text:=Concat('辅',inttostr(fztime3));
edit14.Text:=Concat('辅',inttostr(fztime4));
edit48.Text:=Concat('换',inttostr(huanidtime))i;
edit15.Text:=Concat('HP',inttostr(hptime))i;
edit16.Text:=Concat('MP',inttostr(Mptime))i;
edit49.Text:=Concat('宝',inttostr(bbtime))i;
edit55.Text:=Concat('武',inttostr(huanwqtime1))i;
edit56.Text:=Concat('器',inttostr(huanwqtime2))i;
//这些是把这些变量都用一个text表输出出来。我好测试一些问题看着。没什么用
end;

这是第2个timer。用来监控时间的。他用来把那些变量每秒+1。让各自函数分别检测这些变量来判断是否应该执行对应的操作。比如喝血cd。技能cdi以及打怪时间,换怪时间,i换武器时间等等

【选怪函数】
procedure TForm1.xuanguai;
var
tes1:array[0..1000] of integer;//建立一个长度为1001个的数组。数组里的类型是integer。
i,jlwz,jlwz1,jlwz2,jlwz3,sjs:integer;
jlmin:single;
begin
if (DuMem(basep+$9f8) = 0) then//读当前目标的内存地址。如果目标不存在。则执行选怪代码
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('选怪');//输出信息用的
jlwz:=0;
jlwz1:=0;
jlwz2:=0;
//jlwz3:=0;
for i:=0 to souchang do//这个souchang是控件传回来的。就叫搜索长度
begin
tes1 :=souguai+i//这个souguai 就是搜索怪的起始id
end;
jlmin:=100;//这个是检测怪物离自己距离用的尺码。大于这个距离的怪不做判定
for i:=0 to souchang do//把长度定义的所有怪物id都执行以下操作
begin
if (gjuli(tes1 )<>0)//gjuli 是一个函数,他是对传入id返回一个当前离这个怪的距离
and (gjuli(tes1 ) <> jlmin)//距离要小于定义值,或者小于上一次所选择的怪,
and (tes1 <>scdz)//这个scdz是上一次选择的怪的id。因为怪死后有1秒的时间id和距离是不消失的。所以因为效率。不要求他参与判断
and(tes1 <>glv1)
and(tes1 <>glv2)
and(tes1 <>glv3)
and(tes1 <>glv4)
and(tes1 <>glv5)
and(tes1 <>glv6)
and(tes1 <>glv7)
and(tes1 <>glv8)
and(tes1 <>glv9)
and(tes1 <>glv10)
and(tes1 <>glv11)
and(tes1 <>glv12)//这是12个根据控件传回来的需要过滤的怪物id。比如npc等,后来改用listbox了。当时不会使那个控件
and(guaix(tes1 )>strtoint(edit3.text))
and(guaiy(tes1 )>strtoint(edit4.text))
and(round(guaix(tes1 ))<strtoint(edit5.text))
and(round(guaix(tes1 ))<strtoint(edit6.text))//怪物的坐标需要在自己定义的范围内的,用来实现范围打怪
then
begin
//jlwz3:=jlwz2;
jlwz2:=jlwz1;//把第2个怪的id放如第1个怪的id
jlmin:=gjuli(tes1 );//当前怪的距离。也是下一个怪距离判断的标准
jlwz1:=tes1 ;//当前怪的id
if gjuli(jlwz2) <20 then break;//如果找到的2个怪物都在20步以内就停止不需要再找了
end;
end;
if checkbox14.checked then
begin
sjs:=random(2);//随机2个数,让他任意选最近的2个怪的其中之一
case sjs of
0:jlwz:=jlwz1;
1:jlwz:=jlwz2;
//2:jlwz:=jlwz3;
//3:jlwz:=jlwz4;
//4:jlwz:=jlwz5;
end;
end else jlwz:=jlwz1;
scdz:=jlwz;
bReadSucceed :=false;
while not bReadSucceed do
begin
PHND := OpenProcess(PROCESS_ALL_ACCESS, False,pid);
bReadSucceed :=WriteProcessMemory(PHND, Pointer(basep+$9f8), @jlwz, 16, tt);
CloseHandle(PHND);
end;
end;
end;//写入目标参数

这个是选怪子程序。他一共有2个部分。一个部分是搜索怪物id ,这个id是有起始,有长度。根据他的长度for分别对一个数组赋值,把这个长度中的每个怪物的id。都分别赋值给对应的数组单位
比如。起始怪物id是 00000000001
然后怪物数组就定义为
guai[0]=000000001
guai[1]=000000001
guai[2]=000000001
guai[3]=000000001
然后分别对这个数组中的每个值去求与人的距离,,求x,y坐标
在通过判断xy坐标是否是属于自己定义的范围内的值。然后再得到自己最近的2个怪的id。在随机打其中一个(如果只挑最近的打,挂的号多了容易开火车)
这个,有问题。他老是斜体。[ i ]是开始[ /i ]是结束,弄不来

【检测更换武器】
procedure TForm1.checkwuqi;
var
wqj:integer;
begin
if (CheckBox4.checked)and (ComboBox4.text<>'0') and not (huanwqtime1<(strtoint(edit19.text)*3600))then//如果时间不小于自己定义的时间就执行换武器
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('换武器1');
wqj:=dujian(pchar(ComboBox4.text));
ComboBox4.text:='0';
postmessage(hwd,WM_KEYDOWN,wqj,0);
postmessage(hwd,WM_KEYUP,wqj,0);
huanweizhi:=1;
ListBox1.ItemIndex:=listbox1.items.add('换武器1');
exit;
end;
if (CheckBox4.checked)and not (huanwqtime2<(strtoint(edit44.text)*3600))then
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('换武器n');
case huanweizhi of
1:wqj:=dujian(pchar(ComboBox5.text));
2:wqj:=dujian(pchar(ComboBox6.text));
3:wqj:=dujian(pchar(ComboBox7.text));
4:wqj:=dujian(pchar(ComboBox8.text));
5:wqj:=dujian(pchar(ComboBox9.text));
end;
postmessage(hwd,WM_KEYDOWN,wqj,0);
postmessage(hwd,WM_KEYUP,wqj,0);
huanweizhi:=huanweizhi+1;
huanwqtime2:=0;
end;
end;

没什么可说的。dujian(这个函数是根据目标控件的值返回对应的按键码
【红蓝保护】
procedure TForm1.hpmpbh;
var
hpj,mpj:integer;
begin
If (CheckBox1.checked)and ((hpmax - hp) > strtoint(edit17.text))and not (hptime<5) then
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('吃红');
hpj:=dujian(pchar(ComboBox1.text));
hptime:=0;
postmessage(hwd,WM_KEYDOWN,hpj,0);
postmessage(hwd,WM_KEYUP,hpj,0);
end;
If (CheckBox2.checked)and ((mpmax - mp) > strtoint(edit18.text))and not (mptime<5) then
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('吃蓝');
mpj:=dujian(pchar(ComboBox2.text));
mptime:=0;
postmessage(hwd,WM_KEYDOWN,mpj,0);
postmessage(hwd,WM_KEYUP,mpj,0);
end;
end;
同上。没什么可说的。调用了一个dujian。和判断timer2里传回来的时间变量发送及格postmessage而已
【执行拣取】
procedure TForm1.dopickup;
var
pickup:integer;
i:integer;
begin
if (guaiid = 0) and (jqci>1) and (CheckBox3.checked) then
begin
if Button6.caption='暂停'then ListBox1.ItemIndex:=listbox1.items.add('拣取');
fzci:=true;
pickup:=dujian(pchar(ComboBox3.text));
for i:=0 to strtoint(edit45.text) do
begin
postmessage(hwd,WM_KEYDOWN,pickup,0);
postmessage(hwd,WM_KEYUP,pickup,0);
sleep(strtoint(edit46.text));
end;
jqci:=0;
end;
end;
这里有个东西比较乱guaiid 就是目标id。但是因为循环体制问题比如打完怪了。目标为0
main
{
刷新信息;//读内存。赋值guaiid=0
执行选怪;//这里的选怪是既时,得到当前目标为0马上写入内存为目标,这个时间guaiid地址的内存虽然不为0,但是他的变量是为0的
拣取;//他是判断的guaiid。而不是当前内存,因为执行完打怪肯定刷新信息会把guaiid为0,为此判断一次杀完怪物只执行一次拣取,并且执行拣取时一定是杀完了一个怪
执行打怪;//这个时候guaiid虽然还是为0,但是选怪已经把他所判断的地址写入了怪id。所以会执行攻击
}
这样出现了打完怪, 目标消失后马上会选中下一个目标。执行拣取的时候虽然是有目标的。但是不会错过拣取的机会。
【执行辅助】;
【执行换怪】;
【执行攻击】;
都是和执行吃血喝药一样。判断控件,判断目标。执行按键就没了。改改就行了
【下是函数】
//=======================读取浮点内存函数==================================
Function DuMemf(Addres: Cardinal): single;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_VM_READ, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=ReadProcessMemory(PHND, Pointer(Addres), @Result, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
//=======================读取无符号内存函数==================================
Function DuMem(Addres: Cardinal): Cardinal;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_VM_READ, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=ReadProcessMemory(PHND, Pointer(Addres), @Result, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
//=======================得到怪物距离函数==================================
Function gjuli(guaiid:integer):single;
begin
if maxg<>0 then
gjuli:=dumemf(
dumem(
DuMem(
DuMem(
BaseG+$18)
+(Dword(guaiid) mod MaxG)*4)
+$4)
+$254);
end;
【这个是根据id取x和y的函数】。我不会一个函数传回2个值去baidu搜了好久也不知道。就会传进入2个参数
Function guaix(guaiid:integer):single;
begin
MaxG:= DuMem(BaseG+$24);//怪数最大值
if maxg<>0 then
guaix:=
dumemf(
dumem(
DuMem(
DuMem(
BaseG+$18)
+(Dword(guaiid) mod MaxG)*4)
+$4)
+$26c);
if guaiid=0 then guaix:=0;
end;

Function guaiy(guaiid:integer):single;
begin
MaxG:= DuMem(BaseG+$24);//怪数最大值
if maxg<>0 then
guaiy:=
dumemf(
dumem(
DuMem(
DuMem(
BaseG+$18)
+(Dword(guaiid) mod MaxG)*4)
+$4)
+$274);
if guaiid=0 then guaiy:=0;
end;
后续的开发计划
一个是过滤物品
其实主要就是找基址。因为完美和武林的基址稍微有点不同。我都是这样找的
for i:=22 to 500 do
begin
wpshou:= DuMem(DuMem(DuMem(DuMem(DuMem(DuMem(base+$8)+$28)+(i*4))+$8)+$4)+$164);
if wpshou>0 then break;
end;
让他自动找一个符合条件的。几率比较小。
还是佩服那些找的出来地址和偏移的人们。有了他们就等于有了外挂。比源代码还好的东西
【武器持久】
【过滤拣取】
【包裹栏使用】
【后台走路】
最近想做的事
一直在找相关资料。
等都完成了再去学习注入和call游戏函数
最后再学习如何找call和如何找这些基址
最最后再学习如果脱壳(对付一些有壳的程序)
最最最后谢谢了
UID231 帖子33 精华0 积分0 阅读权限150 在线时间1 小时 注册时间2008-9-25 最后登录2008-9-28 查看详细资料

编辑用户

禁止用户
  编辑 引用 使用道具 报告 评分 回复 删除 屏蔽帖子 TOP
PYG19周年生日快乐!

该用户从未签到

发表于 2008-9-29 10:06:02 | 显示全部楼层
很牛啊,偶还看不懂
PYG19周年生日快乐!
  • TA的每日心情
    开心
    2023-4-6 10:07
  • 签到天数: 23 天

    [LV.4]偶尔看看III

    发表于 2008-10-4 15:54:44 | 显示全部楼层
    呵呵  支持了
    PYG19周年生日快乐!

    该用户从未签到

    发表于 2008-10-17 15:51:51 | 显示全部楼层
    路漫漫,不宜!!!
    PYG19周年生日快乐!

    该用户从未签到

    发表于 2008-10-31 16:10:44 | 显示全部楼层
    收藏,以后慢慢看,不错的
    PYG19周年生日快乐!
  • TA的每日心情
    开心
    2023-11-1 13:08
  • 签到天数: 2 天

    [LV.1]初来乍到

    发表于 2008-11-1 11:23:48 | 显示全部楼层
    5天就能写成这样强哦,
    PYG19周年生日快乐!

    该用户从未签到

    发表于 2009-1-22 05:01:13 | 显示全部楼层
    支持了,虽然看不懂
    PYG19周年生日快乐!
  • TA的每日心情
    开心
    2015-12-4 12:32
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2009-9-4 23:34:45 | 显示全部楼层
    这么好呀,谢谢
    PYG19周年生日快乐!
  • TA的每日心情
    开心
    2015-12-4 12:32
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2009-9-5 20:38:40 | 显示全部楼层
    呵呵,不错,冰是看不懂/:L
    PYG19周年生日快乐!

    该用户从未签到

    发表于 2010-1-6 00:05:04 | 显示全部楼层
    很神奇啊   楼主强人
    PYG19周年生日快乐!
    您需要登录后才可以回帖 登录 | 加入我们

    本版积分规则

    快速回复 返回顶部 返回列表