В чем заключается проблема моментального закрытия exe py файла

Код

from threading import Thread
import win32api
import pymem
import keyboard
from math import atan2, sqrt, pi, asin, isnan
import time
WH, BHOP, N_Flash, Trigger, Aim, Radar = True, True, True, True, True, True
aimlock = True
pm = pymem.Pymem("csgo.exe")
client = pymem.process.module_from_name(pm.process_handle, "client_panorama.dll").lpBaseOfDll
engine = pymem.process.module_from_name(pm.process_handle, "engine.dll").lpBaseOfDll
# offsets
m_vecOrigin = 0x138
m_iHealth = 0x100
m_vecViewOffset = 0x108
dwLocalPlayer = 0xD2FB84
m_bGunGameImmunity = 0x3930
m_vecVelocity = 0x114
dwForceAttack = 0x3175088
m_iCrosshairId = 0xB3D4
m_dwBoneMatrix = 0x26A8
dwClientState_ViewAngles = 0x4D88
m_iShotsFired = 0xA380
dwClientState_GetLocalPlayer = 0x180
m_aimPunchAngle = 0x302C
dwClientState = 0x589DCC
dwRadarBase = 0x5178824
m_flFlashMaxAlpha = 0xA40C
dwGlowObjectManager = 0x528B880
m_iTeamNum = 0xF4
dwEntityList = 0x4D43AB4
m_fFlags = 0x104
m_iGlowIndex = 0xA428
dwForceJump = 0x51ED750
m_bSpottedByMask = 0x980
m_bSpotted = 0x93D
aimfov = 7
aimbone = 8
enginepointer = pm.read_int(engine + dwClientState)


def checkindex():
    localplayer = pm.read_int(client + dwLocalPlayer)
    for y in range(64):
        if pm.read_int(client + dwEntityList + y * 0x10):
            entity = pm.read_int(client + dwEntityList + y * 0x10)
            if localplayer == entity and y:
                return y


def radar():
    while True:
        if pm.read_int(client + dwLocalPlayer):
            localplayer = pm.read_int(client + dwLocalPlayer)
            localplayer_team = pm.read_int(localplayer + m_iTeamNum)
            for i in range(64):
                if pm.read_int(client + dwEntityList + i * 0x10):
                    entity = pm.read_int(client + dwEntityList + i * 0x10)
                    entity_team = pm.read_int(entity + m_iTeamNum)
                    if entity_team != localplayer_team:
                        pm.write_int(entity + m_bSpotted, 1)


radar = Thread(target=radar)
radar.start()


def buny():
    while True:
        if BHOP and pm.read_int(client + dwLocalPlayer):
            player = pm.read_int(client + dwLocalPlayer)
            force_jump = client + dwForceJump
            on_ground = pm.read_int(player + m_fFlags)

            if keyboard.is_pressed("space"):
                if on_ground == 257:
                    pm.write_int(force_jump, 5)
                    time.sleep(0.17)
                    pm.write_int(force_jump, 4)



t1 = Thread(target=buny)
t1.start()


def no_flash():
    while True:
        if N_Flash and pm.read_int(client + dwLocalPlayer):
            localplayer = pm.read_int(client + dwLocalPlayer)
            try:
                flash_value = localplayer + m_flFlashMaxAlpha
                pm.write_float(flash_value, float(0))
                time.sleep(0.0001)
            except pymem.exception.MemoryReadError:
                pass
            except pymem.exception.MemoryWriteError:
                pass


no_flash = Thread(target=no_flash)
no_flash.start()


def rcs():
    global amount
    oldpunchx = 0.0
    oldpunchy = 0.0
    while True:
        if pm.read_int(client + dwLocalPlayer):
            time.sleep(0.01)
            rcslocalplayer = pm.read_int(client + dwLocalPlayer)
            rcsengine = pm.read_int(engine + dwClientState)
            if pm.read_int(rcslocalplayer + m_iShotsFired) > 2:
                rcs_x = pm.read_float(rcsengine + dwClientState_ViewAngles)
                rcs_y = pm.read_float(rcsengine + dwClientState_ViewAngles + 0x4)
                punchx = pm.read_float(rcslocalplayer + m_aimPunchAngle)
                punchy = pm.read_float(rcslocalplayer + m_aimPunchAngle + 0x4)
                newrcsx = rcs_x - (punchx - oldpunchx) * 2
                newrcsy = rcs_y - (punchy - oldpunchy) * 2
                oldpunchx = punchx
                oldpunchy = punchy
                if nanchecker(newrcsx, newrcsy) and checkangles(newrcsx, newrcsy):
                    pm.write_float(rcsengine + dwClientState_ViewAngles, newrcsx)
                    pm.write_float(rcsengine + dwClientState_ViewAngles + 0x4, newrcsy)
            else:
                oldpunchx = 0.0
                oldpunchy = 0.0


rcs = Thread(target=rcs)
rcs.start()


def wallhack():
    while True:
        if pm.read_int(client + dwLocalPlayer):
            for x in range(64):
                localplayer = pm.read_int(client + dwLocalPlayer)
                localplayer_team = pm.read_int(localplayer + m_iTeamNum)
                if pm.read_int(client + dwEntityList + x * 0x10):
                    entity = pm.read_int(client + dwEntityList + x * 0x10)
                    spotted = pm.read_int(entity + m_bSpottedByMask)
                    index = checkindex()
                    entity_team = pm.read_int(entity + m_iTeamNum)
                    glow_manager = pm.read_int(client + dwGlowObjectManager)
                    entity_glow = pm.read_int(m_iGlowIndex + entity)
                    if index and entity and entity_team != localplayer_team and spotted == 1 << index:
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0x4, float(3))  # R
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0x8, float(0))  # G
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0xC, float(2.5))  # B
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0x10, float(1))
                        pm.write_int(glow_manager + entity_glow * 0x38 + 0x24, 1)
                    elif index and spotted != 1 << index and entity and entity_team != localplayer_team:
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0x8, float(1))  # G
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0xC, float(0))  # B
                        pm.write_float(glow_manager + entity_glow * 0x38 + 0x10, float(1))
                        pm.write_int(glow_manager + entity_glow * 0x38 + 0x24, 1)


wallhack = Thread(target=wallhack)
wallhack.start()


def trigger():
    while True:
        if Trigger and pm.read_int(client + dwLocalPlayer):
            localplayer = pm.read_int(client + dwLocalPlayer)
            localplayer_team = pm.read_int(localplayer + m_iTeamNum)
            entity1 = pm.read_int(localplayer + m_iCrosshairId)
            if entity1 > 0 and entity1 <= 64:
                entity2 = pm.read_int(client + dwEntityList + (entity1 - 1) * 0x10)
                entity_team = pm.read_int(entity2 + m_iTeamNum)
                if localplayer_team != entity_team and pm.read_int(client + dwForceAttack) != 5:
                    for x in range(10):

                        shooting = True
                        pm.write_int(client + dwForceAttack, 5)
                        if localplayer_team != entity_team and shooting == True:
                            shooting = False
                            pm.write_int(client + dwForceAttack, 4)


t = Thread(target=trigger)
t.start()

bone = 8


def nanchecker(first, second):
    if isnan(first) or isnan(second):
        return False
    else:
        return True


def calc_distance(current_x, current_y, new_x, new_y):
    distancex = new_x - current_x
    if distancex < -89:
        distancex += 360
    elif distancex > 89:
        distancex -= 360
    if distancex < 0.0:
        distancex = -distancex

    distancey = new_y - current_y
    if distancey < -180:
        distancey += 360
    elif distancey > 180:
        distancey -= 360
    if distancey < 0.0:
        distancey = -distancey
    return distancex, distancey


def checkangles(x, y):
    if x > 89:
        return False
    elif x < -89:
        return False
    elif y > 360:
        return False
    elif y < -360:
        return False
    else:
        return True


def normalizeAngles(viewAngleX, viewAngleY):
    if viewAngleX > 89:
        viewAngleX -= 360
    if viewAngleX < -89:
        viewAngleX += 360
    if viewAngleY > 180:
        viewAngleY -= 360
    if viewAngleY < -180:
        viewAngleY += 360
    return viewAngleX, viewAngleY


def Magnitude(vec_x, vec_y, vec_z):
    return sqrt(vec_x * vec_x + vec_y * vec_y + vec_z * vec_z)


def Subtract(src_x, src_y, src_z, dst_x, dst_y, dst_z):
    diff_x = src_x - dst_x
    diff_y = src_y - dst_y
    diff_z = src_z - dst_z
    return (diff_x, diff_y, diff_z)


def Distance(src_x, src_y, src_z, dst_x, dst_y, dst_z):
    diff_x, diff_y, diff_z = Subtract(src_x, src_y, src_z, dst_x, dst_y, dst_z)
    return Magnitude(diff_x, diff_y, diff_z)


def calcangle(src_x, src_y, src_z, dst_x, dst_y, dst_z):
    x = -atan2(dst_x - src_x, dst_y - src_y) / pi * 180.0 + 180.0
    y = asin((dst_z - src_z) / Distance(src_x, src_y, src_z, dst_x, dst_y, dst_z)) * 180.0 / pi
    z = 0.0
    return x, y


def GetBestTarget(local):
    while True:
        olddist = 1.7976931348623157e+308
        newdist = 0
        target = None
        if local:
            localplayer_team = pm.read_int(local + m_iTeamNum)
            for x in range(64):
                if pm.read_int(client + dwEntityList + x * 0x10):
                    entity = pm.read_int(client + dwEntityList + x * 0x10)
                    spotted = pm.read_int(entity + m_bSpottedByMask)
                    index = checkindex()
                    entity_health = pm.read_int(entity + m_iHealth)
                    gungameimmunity = pm.read_int(entity + m_bGunGameImmunity)
                    entity_team = pm.read_int(entity + m_iTeamNum)
                    if index and localplayer_team != entity_team and entity_health > 0 and gungameimmunity != 1 and spotted == 1 << index:
                        entity_bones = pm.read_int(entity + m_dwBoneMatrix)
                        localpos_x = pm.read_float(local + m_vecOrigin)
                        localpos_y = pm.read_float(local + m_vecOrigin + 4)
                        localpos_z = pm.read_float(local + m_vecOrigin + 8)

                        localpos_x_angles = pm.read_float(enginepointer + dwClientState_ViewAngles)
                        localpos_y_angles = pm.read_float(enginepointer + dwClientState_ViewAngles + 0x4)
                        localpos_z_angles = pm.read_float(enginepointer + dwClientState_ViewAngles + 0x8)

                        entitypos_x = pm.read_float(entity_bones + 0x30 * bone + 0xC)
                        entitypos_y = pm.read_float(entity_bones + 0x30 * bone + 0x1C)
                        entitypos_z = pm.read_float(entity_bones + 0x30 * bone + 0x2C) + 64

                        X, Y = calcangle(entitypos_x, entitypos_y, entitypos_z, localpos_x, localpos_y, localpos_z)
                        newdist = Distance(localpos_x_angles, localpos_y_angles, localpos_z_angles, entitypos_x,
                                           entitypos_y, entitypos_z)
                        if newdist < olddist:
                            olddist = newdist
                            target = entity
            if target:
                return target


def aimthread():
    global localpos3
    while True:
        if pm.read_int(client + dwLocalPlayer):
            aimlocalplayer = pm.read_int(client + dwLocalPlayer)
            aimflag = pm.read_int(aimlocalplayer + m_fFlags)
            aimteam = pm.read_int(aimlocalplayer + m_iTeamNum)
            enginepointer = pm.read_int(engine + dwClientState)

            for y in range(32):
                if pm.read_int(client + dwEntityList + y * 0x10):

                    aimplayer = GetBestTarget(aimlocalplayer)
                    aimplayerbone = pm.read_int(aimplayer + m_dwBoneMatrix)
                    gungameimmunity = pm.read_int(aimplayer + m_bGunGameImmunity)
                    aimplayerteam = pm.read_int(aimplayer + m_iTeamNum)
                    aimplayerhealth = pm.read_int(aimplayer + m_iHealth)
                    if aimplayerteam != aimteam and aimplayerhealth > 0 and gungameimmunity != 1:
                        localpos1 = pm.read_float(aimlocalplayer + m_vecOrigin)
                        localpos2 = pm.read_float(aimlocalplayer + m_vecOrigin + 4)
                        if aimflag == 263:
                            localpos3 = pm.read_float(aimlocalplayer + m_vecOrigin + 8) + 45
                        elif aimflag == 257:
                            localpos3 = pm.read_float(aimlocalplayer + m_vecOrigin + 8) + 62
                        elif aimflag == 256:
                            localpos3 = pm.read_float(aimlocalplayer + m_vecOrigin + 8) + 64
                        enemypos1 = pm.read_float(aimplayerbone + 0x30 * bone + 0xC)
                        enemypos2 = pm.read_float(aimplayerbone + 0x30 * bone + 0x1C)
                        enemypos3 = pm.read_float(aimplayerbone + 0x30 * bone + 0x2C)

                        targetline1 = enemypos1 - localpos1
                        targetline2 = enemypos2 - localpos2
                        targetline3 = enemypos3 - localpos3

                        viewanglex = pm.read_float(enginepointer + dwClientState_ViewAngles)
                        viewangley = pm.read_float(enginepointer + dwClientState_ViewAngles + 0x4)

                        if targetline2 == 0 and targetline1 == 0:
                            yaw = 0
                            if targetline3 > 0:
                                pitch = 270
                            else:
                                pitch = 90
                        else:
                            yaw = (atan2(targetline2, targetline1) * 180 / pi)
                            if yaw < 0:
                                yaw += 360
                            hypo = sqrt(
                                (targetline1 * targetline1) + (targetline2 * targetline2) + (targetline3 * targetline3))
                            pitch = (atan2(-targetline3, hypo) * 180 / pi)

                            if pitch < 0:
                                pitch += 360

                        pitch, yaw = normalizeAngles(pitch, yaw)
                        if checkangles(pitch, yaw):

                            distance_x, distance_y = calc_distance(viewanglex, viewangley, pitch, yaw)

                            if distance_x < aimfov and distance_y < aimfov:

                                if nanchecker(pitch, yaw):
                                    pm.write_float(enginepointer + dwClientState_ViewAngles, pitch)
                                    pm.write_float(enginepointer + dwClientState_ViewAngles + 0x4, yaw)



                            elif distance_x < aimfov and distance_y < aimfov and pm.read_int(aimlocalplayer + m_iShotsFired) >= 1:

                                if nanchecker(pitch, yaw):
                                    pm.write_float(enginepointer + dwClientState_ViewAngles, pitch)

                                    pm.write_float(enginepointer + dwClientState_ViewAngles + 0x4, yaw)


aimthread()

По идеи, так как есть потоковые функции, exe файл не должен моментально закрываться. Превращал в exe с помощью pyinstaller. pyinstaller -i "C:\Users\user\PycharmProjects\illegal project\icon.ico" -F multihack.py.Помогите пожалуйста.


Ответы (1 шт):

Автор решения: Димон

Когда вы еще пишете код, в самом начале пропишите import time. Так вы импортируете модуль time, а в конце напишите sleep(999999) Таким образом когда вы вашу прогу скомпилите в exe, то она закроется через 999999 секунд

→ Ссылка