Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 115e9eb

Browse files
committed
Update to 16.2
1 parent 1db5a39 commit 115e9eb

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

ddnet.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
hid,pid=win32process.GetWindowThreadProcessId(window)
2525
phand=win32api.OpenProcess(PROCESS_ALL_ACCESS,False,pid)
2626
mydll = ctypes.windll.LoadLibrary("C:\\Windows\\System32\\kernel32.dll")
27+
module_handles = win32process.EnumProcessModules(phand)
28+
module_handle = module_handles[0]
2729

2830
lock=_thread.allocate_lock()
2931
points={}
30-
asm_addr=0x004D65D0
32+
asm_addr=0x0DBA50 + module_handle
3133
str_addr=0
32-
blank_addr=0x006E492B
33-
str_dis=0x1158
34+
blank_addr=0x228F98 + module_handle
35+
str_dis=0x12A8
3436
def getpoints():
3537
while 1:
3638
lock.acquire()
@@ -76,8 +78,8 @@ def getpoints():
7678
time.sleep(1)
7779

7880
data = ctypes.c_long(0)
79-
mydll.ReadProcessMemory(int(phand),asm_addr,ctypes.byref(data),2,None)
80-
if data.value!=37008 and data.value!=19080:
81+
mydll.ReadProcessMemory(int(phand),ctypes.c_void_p(asm_addr),ctypes.byref(data),2,None)
82+
if data.value!=37008 and data.value!=18568:
8183
print('游戏已升级,当前版本不可使用,请使用steam更新游戏或前往github获取本程序更新')
8284
print("https://github.com/MageDelfador/DDNet-show-points-in-game")
8385
print('error:game file unmatch')
@@ -88,29 +90,27 @@ def getpoints():
8890
print("作者ID:410164263,如果你在游戏中遇到我,一定要带我恰分哦")
8991
#不更新战队显示
9092
data = ctypes.c_long(2425393296) #nop
91-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
92-
asm_addr+=0x0C
93-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
94-
asm_addr+=0x0C
95-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
96-
asm_addr+=0x0A
97-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
98-
99-
asm_addr-=0x03
100-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
101-
asm_addr-=0x04
102-
data = ctypes.c_long(0x0020E33C)
103-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),4,None)
104-
asm_addr-=0x03
93+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(asm_addr),ctypes.byref(data),3,None)
94+
asm_addr+=0x03
10595
data = ctypes.c_long(0x001D8948)
106-
mydll.WriteProcessMemory(int(phand),asm_addr,ctypes.byref(data),3,None)
96+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(asm_addr),ctypes.byref(data),3,None)
97+
asm_addr+=0x03
98+
data = ctypes.c_long(0x0014D53E)
99+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(asm_addr),ctypes.byref(data),3,None)
100+
asm_addr+=0x03
101+
data = ctypes.c_long(0x001EEB00)
102+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(asm_addr),ctypes.byref(data),3,None)
107103

108104
wait_s=1
109105
while str_addr == 0:
110106
data = ctypes.c_long(0)
111-
mydll.ReadProcessMemory(int(phand),blank_addr,ctypes.byref(data),4,None)
112-
if data.value > 0:
113-
str_addr = data.value + 0x30D054 - 0x10
107+
mydll.ReadProcessMemory(int(phand),ctypes.c_void_p(blank_addr),ctypes.byref(data),3,None)
108+
str_addr = data.value
109+
mydll.ReadProcessMemory(int(phand),ctypes.c_void_p(blank_addr+3),ctypes.byref(data),3,None)
110+
str_addr = (data.value << 24) + str_addr
111+
112+
if str_addr > 0:
113+
str_addr = str_addr + 0x32FA8C - 0x10
114114
time.sleep(1)
115115
for i in range(0,thread_count):
116116
_thread.start_new_thread(getpoints,())
@@ -120,12 +120,12 @@ def getpoints():
120120
wait_s=1
121121
for clientid in range(0,64):
122122
data = ctypes.c_long(0)
123-
mydll.ReadProcessMemory(int(phand),str_addr+str_dis*clientid,ctypes.byref(data),3,None)
123+
mydll.ReadProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid),ctypes.byref(data),3,None)
124124
name=data.value.to_bytes(3, byteorder='little')
125125
if name[0]==0:
126126
continue
127127
for i in range(1,6):
128-
mydll.ReadProcessMemory(int(phand),str_addr+i*3+str_dis*clientid,ctypes.byref(data),3,None)
128+
mydll.ReadProcessMemory(int(phand),ctypes.c_void_p(str_addr+i*3+str_dis*clientid),ctypes.byref(data),3,None)
129129
name+=data.value.to_bytes(3, byteorder='little')
130130
for i in range(0,18):
131131
if name[i]==0:
@@ -137,25 +137,25 @@ def getpoints():
137137
point=points[name]
138138
if point<-5:
139139
data = ctypes.c_long(0)
140-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10,ctypes.byref(data),1,None)
140+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10),ctypes.byref(data),1,None)
141141
elif point<0:
142142
data = ctypes.c_long(0x2e)
143143
for i in range(0,wait_s):
144-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10+i,ctypes.byref(data),1,None)
144+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10+i),ctypes.byref(data),1,None)
145145
data = ctypes.c_long(0)
146-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10+wait_s,ctypes.byref(data),1,None)
146+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10+wait_s),ctypes.byref(data),1,None)
147147
elif point>=1000:
148148
data = ctypes.c_long(int.from_bytes(str(point//1000).encode(encoding='UTF-8'),byteorder='little'))
149-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10,ctypes.byref(data),len(str(point//1000)),None)
149+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10),ctypes.byref(data),len(str(point//1000)),None)
150150
data = ctypes.c_long(int.from_bytes(str(point-point//1000*1000).zfill(3).encode(encoding='UTF-8'),byteorder='little'))
151-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10+len(str(point//1000)),ctypes.byref(data),3,None)
151+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10+len(str(point//1000))),ctypes.byref(data),3,None)
152152
data = ctypes.c_long(0)
153-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10+len(str(point)),ctypes.byref(data),1,None)
153+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10+len(str(point))),ctypes.byref(data),1,None)
154154
else:
155155
data = ctypes.c_long(int.from_bytes(str(point).encode(encoding='UTF-8'),byteorder='little'))
156-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10,ctypes.byref(data),len(str(point)),None)
156+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10),ctypes.byref(data),len(str(point)),None)
157157
data = ctypes.c_long(0)
158-
mydll.WriteProcessMemory(int(phand),str_addr+str_dis*clientid+0x10+len(str(point)),ctypes.byref(data),1,None)
158+
mydll.WriteProcessMemory(int(phand),ctypes.c_void_p(str_addr+str_dis*clientid+0x10+len(str(point))),ctypes.byref(data),1,None)
159159
else:
160160
points[name]=-10
161161
time.sleep(0.2)

0 commit comments

Comments
 (0)