elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


  Mostrar Mensajes
Páginas: 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 [27] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ... 92
261  Programación / Programación C/C++ / Re: [Solucionado][Consulta / Duda] Desplazando más de 31 bits en: 14 Marzo 2021, 23:21 pm
El problema con 64 bits pasa porque esta expresión:

Código
  1. (1<<i)

tiene el tipo del operando izquierdo (la constante literal 1), o sea int. En otras palabras, en realidad estás efectuando el desplazamiento sobre un valor de 32 bits. Si conviertes ese 1 a int64_t, debería funcionar.

Si era eso gracias, tema solucionado. ;-) ;-)


B#
262  Programación / Programación C/C++ / Re: [Consulta / Duda] Desplazando más de 31 bits en: 14 Marzo 2021, 16:47 pm
Gracias a ambos por responder, he cambiado el código para realizar el mismo problema con operaciones de 32 bits y si funciona perfectamente:

Código
  1. #include <cstdio>
  2. #include <cstdint>
  3.  
  4. int32_t SumadorCompleto(int32_t A,int32_t B,int8_t TamanioBits=(sizeof(int32_t)*8))
  5. {
  6.    int32_t Resultado;
  7.    int32_t PrimeraOp;
  8.    int32_t SegundaOp;
  9.    int32_t i;
  10.    int8_t CarryActual;
  11.    CarryActual^=CarryActual;
  12.    Resultado^=Resultado;
  13.    for(i^=i;i<TamanioBits;i++)
  14.    {
  15.        PrimeraOp=((A>>i)&1)^((B>>i)&1);
  16.        SegundaOp=(PrimeraOp&1)^(CarryActual&1);
  17.        Resultado|=(SegundaOp<<i)&(1<<i);
  18.        CarryActual=(PrimeraOp&1)&&(CarryActual&1)||((((A>>i)&1)&&((B>>i)&1))&1);
  19.    }
  20.    return Resultado;
  21. }
  22.  
  23. int main()
  24. {
  25.    int32_t A=4,B=-7;
  26.    printf("A:%i + B:%i = %i\n",A,B,SumadorCompleto(A,B));
  27.    return 0;
  28. }



Me doy por vencido :xD espero no necesitar números con 64 bits en mis proyectos reales...


B#
263  Programación / Programación C/C++ / [Solucionado][Consulta / Duda] Desplazando más de 31 bits en: 14 Marzo 2021, 06:51 am
Primero antes que nada buenos días/noches.

Bueno digamos que estaba muy aburrido :xD y me puse a generar un código que sume en Complemento a 2:

Código
  1. #include <cstdio>
  2. #include <cstdint>
  3.  
  4. int64_t SumadorCompleto(int64_t A,int64_t B,uint8_t TamanioBits=(sizeof(int64_t)*8))
  5. {
  6.    int64_t Resultado;
  7.    int64_t PrimeraOp;
  8.    int64_t SegundaOp;
  9.    int64_t i;
  10.    int64_t CarryActual;
  11.    CarryActual^=CarryActual;
  12.    Resultado^=Resultado;
  13.    for(i^=i;i<TamanioBits;i++)
  14.    {
  15.        PrimeraOp=((A>>i)&1)^((B>>i)&1);
  16.        SegundaOp=(PrimeraOp&1)^(CarryActual&1);
  17.        Resultado|=(SegundaOp<<i)&(1<<i);
  18.        CarryActual=(PrimeraOp&1)&&(CarryActual&1)||((((A>>i)&1)&&((B>>i)&1))&1);
  19.    }
  20.    return Resultado;
  21. }
  22.  
  23. int main()
  24. {
  25.    int64_t A=4,B=-7;
  26.    printf("A:%li + B:%li = %li\n",A,B,SumadorCompleto(A,B));
  27.    return 0;
  28. }

Si lo pruebo con ambos números enteros pequeños 4 y 7 el código funciona perfectamente, ahora el problema es cuando pongo un número entero gigante o negativo el código no funciona:



Dije quizás sea un error de GCC voy a probar otro compilador diferente y de diferente lenguaje como Pascal:

(No puedo subir el código en Pascal porque el foro no lo permite)

(Solución temporal o hasta que alguien lo verifique lo subo en imagenes)




Lo cuál ocurre lo mismo:



Pero lo que me inquietó es que pasado los 31 bits de desplazamiento no parece realizar operaciones al menos de manera correcta:



Mi duda es hay alguna manera de llegar a desplazar más bits correctamente, o yo tengo algún error y no me dí cuenta todavía del error o ¿También es una limitación de los procesadores esto?


B#
264  Programación / Programación C/C++ / Re: ¿Como es posible retornar estructuras con la convencion de llamadas cdecl? en: 7 Marzo 2021, 16:28 pm
A ver que pasa con GCC:

Código
  1. #include <stdio.h>
  2.  
  3. struct _hdr
  4. {
  5.    char data1;
  6.    double data2;
  7.    char* data3;
  8. };
  9.  
  10. struct _hdr __attribute__((__cdecl__)) foo()
  11. {
  12.    struct _hdr instance;
  13. instance.data1 = 'A';
  14. instance.data2 = 45.04;
  15. instance.data3 = (char*)"PROBANDO 123";
  16.    return instance;
  17. }
  18.  
  19. int __attribute__((noinline)) __attribute__((__cdecl__)) foo2(int a, int b)
  20. {
  21.    return 0;
  22. }
  23.  
  24. int main(int argc,char*argv[])
  25. {
  26.    struct _hdr estructura;
  27.    int entero=foo2(1,2);
  28.    estructura=foo();
  29.    printf("%c %.2f %s %i\n",estructura.data1,estructura.data2,estructura.data3,entero);
  30.    return 0;
  31. }

Al parecer una función común y corriente como foo2 en cdecl funciona perfectamente, pero es interesante ver lo que pasa con foo:



Está pasando un puntero como argumento, lo interesante es que al parecer GCC cambia la convención a tipo stdcall:



Si arreglo y paso como parametro el puntero a la estructura vemos como el descompilador funciona casi retornando el mismo código original:



Por lo que en este caso aunque además de retornar la dirección del puntero (aunque no es usado) a la estructura también trabaja con un argumento oculto.


B#
265  Seguridad Informática / Análisis y Diseño de Malware / Re: Un exploit puede hacer esto? en: 3 Marzo 2021, 00:16 am
quería saber si un exploit puede llegar a agregar nueva información a una base de datos de un web

Un exploit es un código que se ejecuta en la máquina objetivo abusando de una vulnerabilidad con el fin de enviar un "código a ejecutar", el "código a ejecutar" usualmente llamado payload puede en teoría ser casi cualquier cosa siempre que el proceso de la máquina objetivo pueda ejecutarlo...


B#
266  Foros Generales / Foro Libre / Re: ¿Una máquina de programar en cualquier lenguaje? en: 28 Febrero 2021, 20:19 pm
y sobre lo de redactar códigos; será que en un futuro cercano cualquiera podrá crear un programa con solo señalar que es lo que quiere y en que lenguaje???...

Don Machacador ese supuesto "futuro cercano" comenzó hace un año bien y permite en realidad programar con describir en un solo texto.

En el video se puede apreciar HTML con CSS (aunque no es del todo perfecto ya que en la parte de tablas se confunde)




B#
267  Foros Generales / Dudas Generales / Re: ¿Que es LUA? en: 28 Febrero 2021, 15:11 pm
Entonces quería saber para que propósito exactamente lo utilizarían... ¿Para que sirve el LUA y en qué se podría usar mejor?

Yo lo utilizo en mis cheats para añadir funcionalidad extra sin tener que re-compilar el cheat de nuevo, o para permitir a terceros que añadan funcionalidad personalizada...

Este es un ejemplo de un aimbot que funciona en mi cheat externo (un poco desactualizado) para Counter-Strike 1.6 (version build 4554), claro está que tiene la librería ImGui y funciones extras agregadas por mí que trabajan para añadirle Callbacks...

Código
  1. --[[
  2.     Author: BloodSharp
  3.     Description: Custom Aimbot for Crianosfera Hack v5 External edition
  4. ]]
  5.  
  6. -- Main default settings
  7. local bCustomAimbot = false
  8. local bRenderOrigin = false
  9. local bPrioritizeIfSomeOneIsAtShortDistance = true
  10. local iAimingMethod = 0 -- Field of View: 0 / Distance: 1
  11. local iAimTeam = 0 -- Enemies: 0 / Teammates: 1 / All: 2
  12. local colorNonTarget = ImColor(255, 255, 255, 255) -- White color
  13. local colorAimTarget = ImColor(0, 255, 0, 255) -- Green color
  14.  
  15. local iTargetAimbot = -1
  16.  
  17.  
  18. -- I need to write W2S function this way because the wrapper that I use don't support arguments as references
  19. local function WorldToScreen(vInput, vOutput)
  20. if Utils.ConvertToScreen(vInput) then
  21. local vConverted = Utils.GetLastConvertedToScreenVector()
  22. vOutput.x = vConverted.x
  23. vOutput.y = vConverted.y
  24. return true
  25. end
  26. return false
  27. end
  28.  
  29. local function DotProduct(vFirstVector, vSecondVector)
  30.    return (vFirstVector.x * vSecondVector.x + vFirstVector.y * vSecondVector.y + vFirstVector.z * vSecondVector.z)
  31. end
  32.  
  33. local function AngleBetween(vForward, vDifference)
  34.    local vNormalizedForward = vForward:Normalize()
  35.    local vNormalizedDifference = vDifference:Normalize()
  36.    return (math.acos(DotProduct(vNormalizedForward, vNormalizedDifference)) * (180 / math.pi))
  37. end
  38.  
  39. local function VectorAngles(forward, angles)
  40. local tmp
  41. local yaw
  42. local pitch
  43.  
  44. if forward.y == 0 and forward.x == 0 then
  45. yaw = 0
  46. if forward.z > 0 then
  47. pitch = 270
  48. else
  49. pitch = 90
  50. end
  51. else
  52. yaw = (math.atan(forward.y, forward.x)) * 180 / math.pi
  53. if yaw < 0 then
  54. yaw = yaw + 360
  55. end
  56.  
  57. tmp = math.sqrt(forward.x * forward.x + forward.y * forward.y)
  58. pitch = (math.atan(-forward.z, tmp)) * 180 / math.pi
  59. if pitch < 0 then
  60. pitch = pitch + 360
  61. end
  62. end
  63.  
  64. angles.x = pitch
  65. angles.y = yaw
  66. angles.z = 0
  67.  
  68. while angles.x < -89 do
  69. angles.x = angles.x + 180
  70. angles.y = angles.y + 180
  71. end
  72. while angles.x > 89 do
  73. angles.x = angles.x - 180
  74. angles.y = angles.y + 180
  75. end
  76. while angles.y < -180 do
  77. angles.y = angles.y + 360
  78. end
  79. while angles.y > 180 do
  80. angles.y = angles.y - 360
  81. end
  82. end
  83.  
  84. local function VerifyTeam(index)
  85.    if (iAimTeam == 0) and (LocalPlayer.GetTeam() ~= EntityManager.GetTeam(index)) then
  86.        return true
  87.    elseif (iAimTeam == 1) and (LocalPlayer.GetTeam() == EntityManager.GetTeam(index)) then
  88.        return true
  89.    elseif (iAimTeam == 2) then
  90.        return true
  91.    end
  92.    return false
  93. end
  94.  
  95. -- Inside the Lua Scripts tab...
  96. local function OnRenderMenu()
  97.    if ImGui.TreeNode("Custom Aimbot##CUSTOM_AIMBOT", true) then
  98.        bCustomAimbot = ImGui.Checkbox("Enable##CUSTOM_AIMBOT", bCustomAimbot)
  99.        ImGui.BeginGroup()
  100.        bRenderOrigin = ImGui.Checkbox("Show origin##CUSTOM_AIMBOT", bRenderOrigin)
  101.        bPrioritizeIfSomeOneIsAtShortDistance = ImGui.Checkbox("Prioritize short distance##CUSTOM_AIMBOT", bPrioritizeIfSomeOneIsAtShortDistance)
  102.        colorAimTarget.Value = ImGui.ColorEdit4("AimOrigin##CUSTOM_ESP", colorAimTarget.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaBar)
  103.        ImGui.EndGroup()
  104.  
  105.        ImGui.SameLine()
  106.        ImGui.BeginGroup()
  107.        ImGui.PushItemWidth(120)
  108.        iAimingMethod = ImGui.Combo("Aiming method##CUSTOM_AIMBOT", iAimingMethod, "Field of View\0Distance\0\0")
  109.        iAimTeam = ImGui.Combo("Aim team##CUSTOM_AIMBOT", iAimTeam, "Enemies\0Teammates\0All\0\0")
  110.        colorNonTarget.Value = ImGui.ColorEdit4("NonAimOrigin##CUSTOM_ESP", colorNonTarget.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaBar)
  111.        ImGui.PopItemWidth()
  112.        ImGui.EndGroup()
  113.  
  114.        ImGui.NewLine()
  115.        ImGui.TreePop()
  116.    end
  117. end
  118.  
  119. -- Rendering at the screen...
  120. local function OnRenderBackground()
  121.    if bRenderOrigin then
  122.        for index = 1, 32 do
  123.            if index ~= LocalPlayer.GetIndex() then
  124.                if EntityManager.IsAlive(index) then
  125.                    local vOrigin = EntityManager.GetOrigin(index)
  126.                    local vOrigin2D = Vector2D(0, 0)
  127.                    if WorldToScreen(vOrigin, vOrigin2D) then
  128.                        local originColor = ImColor(0, 0, 0, 0)
  129.                        if index == iTargetAimbot then
  130.                            originColor = colorAimTarget
  131.                        else
  132.                            originColor = colorNonTarget
  133.                        end
  134.                        ImGui.Render.AddRectFilled(ImVec2(vOrigin2D.x - 2, vOrigin2D.y - 2), ImVec2(vOrigin2D.x + 2, vOrigin2D.y + 2), originColor:ToImU32(), 0, ImDrawCornerFlags_All)
  135.                    end
  136.                end
  137.            end
  138.        end
  139.    end
  140. end
  141.  
  142. -- At update function, use only logical functions here...
  143. local function OnUpdate()
  144.    iTargetAimbot = -1
  145.    if bCustomAimbot then
  146.        if LocalPlayer.IsAlive() then
  147.            local flBestFOV = 360
  148.            local flBestDistance = 8192
  149.            local vForward = LocalPlayer.GetForwardVector()
  150.            local vEye = LocalPlayer.GetEyePosition()
  151.  
  152.            if bPrioritizeIfSomeOneIsAtShortDistance then
  153.                for index = 1, 32 do
  154.                    if index ~= LocalPlayer.GetIndex() then
  155.                        if EntityManager.IsAlive(index) then
  156.                            if VerifyTeam(index) then
  157.                                local flPlayerDistance = EntityManager.GetActualDistance(index)
  158.                                -- 220 Units equals 10 Units from EntityManager.GetDistance(index)
  159.                                if (flPlayerDistance <= 220) and (flPlayerDistance < flBestDistance) then
  160.                                    flBestDistance = flPlayerDistance
  161.                                    iTargetAimbot = index
  162.                                end
  163.                            end
  164.                        end
  165.                    end
  166.                end
  167.            end
  168.  
  169.            if iTargetAimbot == -1 then
  170.                for index = 1, 32 do
  171.                    if index ~= LocalPlayer.GetIndex() then
  172.                        if EntityManager.IsAlive(index) then
  173.                            if VerifyTeam(index) then
  174.                                if iAimingMethod == 0 then
  175.                                    local vPlayerOrigin = EntityManager.GetOrigin(index)
  176.                                    local vDifference = vPlayerOrigin - vEye
  177.                                    local flPlayerFOV = AngleBetween(vForward, vDifference)
  178.                                    if flPlayerFOV < flBestFOV then
  179.                                        flBestFOV = flPlayerFOV
  180.                                        iTargetAimbot = index
  181.                                    end
  182.                                elseif iAimingMethod == 1 then
  183.                                    local flPlayerDistance = EntityManager.GetActualDistance(index)
  184.                                    if flPlayerDistance < flBestDistance then
  185.                                        flBestDistance = flPlayerDistance
  186.                                        iTargetAimbot = index
  187.                                    end
  188.                                end
  189.                            end
  190.                        end
  191.                    end
  192.                end
  193.            end
  194.  
  195.            if iTargetAimbot ~= -1 then
  196.                local vAimAngles = Vector(0, 0, 0)
  197.                local vAimTargetOrigin = EntityManager.GetOrigin(iTargetAimbot)
  198.  
  199.                VectorAngles(vAimTargetOrigin - vEye, vAimAngles)
  200.  
  201.                if (LocalPlayer.GetButtons() & IN_ATTACK) == IN_ATTACK then
  202.                    LocalPlayer.SetViewAngles(vAimAngles)
  203.                end
  204.            end
  205.        end
  206.    end
  207. end
  208.  
  209. local function OnLoadSettings(szFile)
  210.    bCustomAimbot = Utils.LoadBooleanInSection(szFile, "CustomAimbot", "Enable")
  211.    bRenderOrigin = Utils.LoadBooleanInSection(szFile, "CustomAimbot", "Origin")
  212.    bPrioritizeIfSomeOneIsAtShortDistance = Utils.LoadBooleanInSection(szFile, "CustomAimbot", "PrioritizeShortDistance")
  213.    iAimingMethod = Utils.LoadIntegerInSection(szFile, "CustomAimbot", "Method")
  214.    iAimTeam = Utils.LoadIntegerInSection(szFile, "CustomAimbot", "Team")
  215.    colorNonTarget = Utils.LoadColorInSection(szFile, "CustomAimbot", "ColorNonTarget")
  216.    colorAimTarget = Utils.LoadColorInSection(szFile, "CustomAimbot", "ColorTarget")
  217. end
  218.  
  219. local function OnSaveSettings(szFile)
  220.    Utils.SaveBooleanInSection(szFile, "CustomAimbot", "Enable", bCustomAimbot)
  221.    Utils.SaveBooleanInSection(szFile, "CustomAimbot", "Origin", bRenderOrigin)
  222.    Utils.SaveBooleanInSection(szFile, "CustomAimbot", "PrioritizeShortDistance", bPrioritizeIfSomeOneIsAtShortDistance)
  223.    Utils.SaveIntegerInSection(szFile, "CustomAimbot", "Method", iAimingMethod)
  224.    Utils.SaveIntegerInSection(szFile, "CustomAimbot", "Team", iAimTeam)
  225.    Utils.SaveColorInSection(szFile, "CustomAimbot", "ColorNonTarget", colorNonTarget)
  226.    Utils.SaveColorInSection(szFile, "CustomAimbot", "ColorTarget", colorAimTarget)
  227. end
  228.  
  229. Hooks.RegisterCallback(CH5_CALLBACK_AT_RENDERING_MENU, OnRenderMenu)
  230. Hooks.RegisterCallback(CH5_CALLBACK_AT_RENDERING_BACKGROUND, OnRenderBackground)
  231. Hooks.RegisterCallback(CH5_CALLBACK_AT_UPDATE, OnUpdate)
  232. Hooks.RegisterCallback(CH5_CALLBACK_AT_LOAD_SETTINGS, OnLoadSettings)
  233. Hooks.RegisterCallback(CH5_CALLBACK_AT_SAVE_SETTINGS, OnSaveSettings)


B#
268  Programación / Programación C/C++ / Re: Me podrían ayudar urge gracias todo debe estar en unos código en: 26 Febrero 2021, 05:01 am
Me podrían ayudar urge gracias todo debe estar en unos código

Se te puede ayudar, pero no hacer la tarea (de esa manera nunca se aprende), mostrá hasta donde llegaste y de ahí en adelante se te puede ayudar...


B#
269  Programación / Programación C/C++ / [Aporte] Mini juego laberinto estilo FPS en terminal de Linux en: 12 Febrero 2021, 06:41 am
Buenas gente del foro, les quería aportar un mini juego laberinto fps que porté a Linux utilizando la librería ncurses además agregando algunos colores:




El código para Linux puede verse acá:
https://github.com/Agustin-dos-Santos/CommandLineFPS

Pero si lo quieren el código original para Windows (Visual Studio) les dejo el repositorio original y el video de como fue hecho originalmente:
https://www.youtube.com/watch?v=xW8skO7MFYw
https://github.com/OneLoneCoder/CommandLineFPS


B#
270  Programación / Java / Re: Mostrar cartas GUI en: 10 Febrero 2021, 07:39 am
Por ejemplo: "2 de oro", "1 de espada". Necesito vincular el nombre con la imagen de la carta.

Si ya tenés el nombre en un vector podés utilizar cada elemento del vector de nombres y añadirle la extensión cuando lo necesites.

Código
  1. for(int i=0;i<vectorNombres.length;i++) {
  2.    JButton btn = new JButton("");
  3.    btn.setIcon(new ImageIcon(Class.class.getResource("recursos/cartas" + vectorNombres[i] + ".png")));
  4.    ventanaPrincipal.add(btn);
  5. }


B#
Páginas: 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 [27] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ... 92
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines