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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 [89] 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ... 401
881  Programación / Programación C/C++ / Re: El programa deja de funcionar en: 12 Diciembre 2016, 11:09 am
por que empiezas contador en 1 en la linea 24? al igual que ahí con ese +1 se te va a desbordar la variable

al igual que no entiendo abajo la razón del operador ternario (y no se si entiendes como funciona, porque a mucha gente se le complica)  y tambien un j empezando en


code::blocks es el ide, no el compilador... a mi ni por accidente me deja compilar eso XD



Este hermoso código compila en algunos compiladores de C (ahora estoy usando GCC):
Código
  1. main(){
  2. func(5);
  3. }
  4.  
  5. func(n){
  6. printf("%i", n);
  7. }

Se toma el uso de las funciones como una "declaracióm implícita".
Eso sí, a la hora de linkear, tira error si no encuentra las funciones.

Pero como dice engel, Naimaderis, las funciones tienen un retorno siempre (el del main es int), y antes de usar una función, el compilador debe conocerla:

Código
  1. #include <stdio.h>
  2.  
  3. void func(int);
  4.  
  5. int main(){
  6. func(5);
  7. }
  8.  
  9. void func(int n){
  10. printf("%i", n);
  11. }
O
Código
  1. #include <stdio.h>
  2.  
  3. void func(int n){
  4. printf("%i", n);
  5. }
  6.  
  7. int main(){
  8. func(5);
  9. }
882  Programación / Bases de Datos / Re: Buscar palabra de forma desordenada SQL Server en: 11 Diciembre 2016, 22:09 pm
Una opción es ver si están todas las palabras:

Código
  1. SELECT * FROM Animales
  2. WHERE Descripción LIKE '%grande%'
  3.  AND Descripción LIKE '%muy%'
  4.  AND Descripción LIKE '%perro%'
883  Programación / Programación C/C++ / Re: El programa deja de funcionar en: 11 Diciembre 2016, 20:12 pm
Código
  1. scanf("%d", cantidadnumerossumar);
Los argumentos de scanf son direcciones de memoria donde vas a almacenar los datos.

Por tanto, para pasarle las direcciones, usa el operador "&":
Código
  1. scanf("%d", &cantidadnumerossumar);

El error es que interpretaba los datos que tenía el int cantidadnumerossimar como si fuera una dirección, y trató de escribir en ella, lo que generó el error.
884  Programación / Ingeniería Inversa / Re: Ayuda para parsear este formato... en: 11 Diciembre 2016, 18:14 pm
Obtengo estos datos:
Código:
boots_2000
boots_2001
boots_2002
boots_2003
boots_2004
boots_2005
boots_2006
boots_2007
boots_2008
boots_2009
boots_200A
boots_200B
boots_200C
boots_200D
boots_200E
boots_200F
boots_2010
boots_2011
boots_2012
boots_2013
boots_2014
boots_2015
boots_2016
boots_2017
boots_2018
boots_2019
boots_201A
boots_201B
boots_201C
boots_201D
boots_201E
boots_201F
boots_2020
boots_2021
boots_2022
boots_2023
boots_2024
boots_2025
boots_2026
boots_2027
boots_2028
boots_2029
boots_202A
boots_202B
boots_202C
boots_202D
boots_202E
boots_202F
boots_2030
boots_2031
boots_2032
boots_2033
boots_2034
boots_2035
boots_2036
boots_2037
boots_2038
boots_2039
boots_203A
boots_203B
boots_203C
boots_203D
boots_203E
boots_203F
boots_2040
boots_2041
boots_2042
boots_2043
boots_2044
boots_2045
boots_2046
boots_2047
boots_2048
boots_2049
boots_204A
boots_204B
boots_204C
boots_204D
boots_204E
boots_204F
boots_2050
boots_2051
boots_2052
boots_2053
boots_2054
boots_2055
boots_2056
boots_2057
boots_2058
boots_2059
boots_205A
boots_205B
boots_205C
boots_205D
boots_205E
boots_205F
boots_2060
boots_2061

Con este código en C++:
Código
  1. #include <fstream>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct BMDHeader{
  8. uint8_t chunkId;
  9. uint8_t __pad0[3];
  10. uint16_t fileSize;
  11. uint8_t __pad1[1];
  12. uint32_t magicIdentifier ;
  13. uint32_t _null_ : 32;
  14. uint16_t textTableEnd;
  15. uint8_t __pad2[2];
  16. uint16_t offsetAmount;
  17. uint8_t __pad3[2];
  18. uint8_t entryAmount;
  19. uint8_t __pad4[3];
  20. uint32_t _20000_;
  21. };
  22.  
  23. int main(){
  24.    /// READ FILE
  25. fstream inFile("datBootsHelp.bmd", ios::binary | ios::in);
  26. if(!inFile){
  27. cout << "File error" << endl;
  28. return 1;
  29. }
  30.  
  31. inFile.seekg(0, ios::end);
  32. string file(inFile.tellg(), '\0');
  33. inFile.seekg(0);
  34.  
  35. inFile.read(const_cast<char*>(file.data()), file.size());
  36.    /// FILE READED
  37.  
  38.    /// GETTING HEADER
  39. BMDHeader header = *(BMDHeader*)file.data();
  40. if(header._20000_ != 0x20000 || header.fileSize != file.size()){
  41.        cout << "Header error" << endl;
  42.        return 2;
  43. }
  44.    /// HEADER OK
  45.  
  46. cout << (int)header.entryAmount << " entries" << '\n' << endl;
  47.  
  48.    /// READING VALUES
  49.    vector<string> entries(header.entryAmount);
  50.  
  51.    for(int i=0; i<header.entryAmount; i++){
  52.        uint16_t offset = *(uint16_t*)&file[0x24 + 8 * i];
  53.        entries[i] = string(&file[0x20 + offset]);
  54.    }
  55.  
  56.    for(string& str :  entries){
  57.        cout << str << '\n';
  58.    }
  59.  
  60.    cout << '\n' << "ENDED" << endl;
  61. }

Eso sí, ignoré gran parte de los campos del header. No sé si son necesarias.

Y ya podías decir al menos de qué trataba el formato eh? Que tuve que descubrirlo xD http://datacrystal.romhacking.net/wiki/Persona_3_and_4/BMD_(File_Format)


EDITO:
Un poco hardcodeado para obtener los datos que faltan (a parte del ID):

Código
  1. #include <fstream>
  2. #include <iostream>
  3. #include <map>
  4.  
  5. using namespace std;
  6.  
  7. struct BMDHeader{
  8. uint8_t chunkId;
  9. uint8_t __pad0[3];
  10. uint16_t fileSize;
  11. uint8_t __pad1[1];
  12. uint32_t magicIdentifier ;
  13. uint32_t _null_ : 32;
  14. uint16_t textTableEnd;
  15. uint8_t __pad2[2];
  16. uint16_t offsetAmount;
  17. uint8_t __pad3[2];
  18. uint8_t entryAmount;
  19. uint8_t __pad4[3];
  20. uint32_t _20000_;
  21. };
  22.  
  23. int main(){
  24.    /// READ FILE
  25. fstream inFile("datBootsHelp.bmd", ios::binary | ios::in);
  26. if(!inFile){
  27. cout << "File error" << endl;
  28. return 1;
  29. }
  30.  
  31. inFile.seekg(0, ios::end);
  32. string file(inFile.tellg(), '\0');
  33. inFile.seekg(0);
  34.  
  35. inFile.read(const_cast<char*>(file.data()), file.size());
  36.    /// FILE READED
  37.  
  38.    /// GETTING HEADER
  39. BMDHeader header = *(BMDHeader*)file.data();
  40. if(header._20000_ != 0x20000 || header.fileSize != file.size()){
  41.        cout << "Header error" << endl;
  42.        return 2;
  43. }
  44.    /// HEADER OK
  45.  
  46. cout << (int)header.entryAmount << " entries" << '\n' << endl;
  47.  
  48.    /// READING VALUES
  49.    map<string, string> entries;
  50.  
  51.    for(int i=0; i<header.entryAmount; i++){
  52.        uint16_t offset = *(uint16_t*)&file[0x24 + 8 * i];
  53.        string id = string(&file[0x20 + offset]);
  54.        entries[id] = string(&file[0x20 + offset + id.size() + 0x20]);
  55.    }
  56.  
  57.    for(auto& p :  entries){
  58.        cout << p.first << ":\n";
  59.        cout << p.second << "\n\n";
  60.    }
  61.  
  62.    cout << '\n' << "ENDED" << endl;
  63. }
Datos:
Código:
boots_2000:
Reserve


boots_2001:
Solidly made
work boots.


boots_2002:
An ordinary pair of
loafers.


boots_2003:
Long, black boots.


boots_2004:
Boots with a horizontal
line over the toes.


boots_2005:
Classic-model sneakers.


boots_2006:
Shoes for playing
indoor soccer.


boots_2007:
Low-heeled boots.


boots_2008:
Sandals that massage
your pressure points.


boots_2009:
Strong enough to take
any punishment.


boots_200A:
Boots with thick soles.


boots_200B:
Sandals with many
bumps.


boots_200C:
Boots made out of
leather.


boots_200D:
Shoes with a single
row of wheels.


boots_200E:
Geta made with the
latest technology.


boots_200F:
Boots from military
surplus.


boots_2010:
Greaves colored
a dark red.


boots_2011:
Sandals that boost
the wearer's magic.


boots_2012:
Shoes made with
modern technology.


boots_2013:
Sandals worn by
ninjas.


boots_2014:
Shoes with needles
on the soles.


boots_2015:
Boots with jet engines
attached.


boots_2016:
Exceptionally durable
greaves.


boots_2017:
Very light shoes.


boots_2018:
Sandals with dazzling
silver ornaments.


boots_2019:
0x2019


boots_201A:
0x201A


boots_201B:
Shoes with pentacle
symbols.


boots_201C:
Hitmen's favorite
shoes.


boots_201D:
Unbelievably light
pair of sandals.


boots_201E:
A war god's spirit
dwells in these boots.


boots_201F:
Boots that have been
blessed.


boots_2020:
Women's boots that
lend beauty.


boots_2021:
A famous ninja's
sandals.


boots_2022:
0x2022


boots_2023:
0x2022


boots_2024:
Men's boots embroidered
with dragons.


boots_2025:
Can supposedly be
remote-controlled...


boots_2026:
0x2026


boots_2027:
A manly pair of
geta, for men.


boots_2028:
Shoes with vicious-
looking spikes.


boots_2029:
0x2029


boots_202A:
Sandals with a lion
drawn on them.


boots_202B:
Men's greaves, worn
by a veteran warrior.


boots_202C:
0x202C


boots_202D:
0x202D


boots_202E:
Sandals with a fresh
grass scent.


boots_202F:
0x202F


boots_2030:
0x2030


boots_2031:
0x2031


boots_2032:
Savior's boots worn
only by men.


boots_2033:
0x2033


boots_2034:
Leopard-print leggings
for women.


boots_2035:
0x2035


boots_2036:
Lightweight pumps
for women.


boots_2037:
0x2037


boots_2038:
Heels that make women
supersexy.


boots_2039:
0x2039


boots_203A:
0x203A


boots_203B:
0x203B


boots_203C:
Women's boots that
last forever.


boots_203D:
The paw pads are very
soft to the touch.


boots_203E:
0x203E


boots_203F:
0x203F


boots_2040:
0x2040


boots_2041:
0x2041


boots_2042:
0x2042


boots_2043:
0x2043


boots_2044:
0x2044


boots_2045:
0x2045


boots_2046:
0x2046


boots_2047:
Ordinary leg parts for
Aigis.


boots_2048:
Leg parts for Aigis made
with strong fibers.


boots_2049:
Processed iron leg parts
for Aigis.


boots_204A:
Molecularly cohesive leg
parts for Aigis.


boots_204B:
Ceramic leg parts for
Aigis.


boots_204C:
Cobalt leg parts for
Aigis.


boots_204D:
Lightweight leg parts for
Aigis.


boots_204E:
Alloyed leg parts for
Aigis.


boots_204F:
Consolidated leg parts
for Aigis.


boots_2050:
Leg parts for Aigis from
the Beast God.


boots_2051:
2051


boots_2052:
2052


boots_2053:
Shining leg parts for
Metis.


boots_2054:
Leather-covered leg parts
for Metis.


boots_2055:
Resin leg parts for Metis.


boots_2056:
Light ceramic leg parts
for Metis.


boots_2057:
Light alloy leg parts for
Metis.


boots_2058:
Titanium leg parts for
Metis.


boots_2059:
Zirconium leg parts for
Metis.


boots_205A:
Imitation dancing shoes
for Metis.


boots_205B:
Magical leg parts for
Metis.


boots_205C:
Crimson leg parts for
Metis.


boots_205D:
Angelic leg parts for
Aigis.


boots_205E:
Mysterious glass leg
parts for Metis.


boots_205F:
The ultimate prototype
leg parts for Aigis.


boots_2060:
Supreme pitch-black leg
parts for Metis.


boots_2061:
ü·ü╩ü┘

Tengo que ver cómo obtener los datos, ya que no parece que hablen de ello en lo del formato.

EDITO:
Mejorado. Ahora capta bien el mensaje (salvo para el último, que no parece tener el mismo formato (o el formato está mal interpretado))

Y con respecto a lo que dices de cuándo acaba la primera tabla y cuándo empieza la segunda, yo me limité a lo que dice esa web y utilizar directamente el offset "Text offset relative from offset 20". Sumarlo, para saber la posición de la celda de texto, y listo. Iterar por cada elemento de la primera tabla, y se acabó.
885  Programación / Programación C/C++ / Re: Ayuda, pasar programa en main a subprogramas en: 10 Diciembre 2016, 22:57 pm
No te podemos ayudar si no sabemos qué problema tienes exactamente.
886  Programación / Programación C/C++ / Re: crear una clave de registro con c++ en: 10 Diciembre 2016, 22:56 pm
¿Por qué están las líneas comentadas?
Con esas líneas comentadas, no saltarían lso errores.

En cualquier caso:

El macro TEXT() se utiliza para constantes. No le puedes pasar .c_str().

Corrige eso, descomenta las líneas antes de pegar aquí el código, y vuelve a poner los errores.
887  Programación / Java / Re: [Java] Sustituir caracteres por números en: 8 Diciembre 2016, 22:35 pm
Pusiste letra = 1. Estás igualando letra a un número, es decir, a su valor en la codificación que sea.
A uncaracter, normalmente le asignarás otro caracter, es decir: letra = '1'

Y como detalle, quita el else del final, donde el if 'u', o no meterás los '5'.
888  Programación / Programación C/C++ / Re: Pasaje de varios parámetros del mismo tipo en C en: 5 Diciembre 2016, 19:58 pm
No, el tipo irá antes de cada parámetro.

Otra posibilidad sería pasar un array, pero dudo que sea lo que buscas.
889  Programación / Programación C/C++ / Re: Duda acerca de la programación y GitHub en: 4 Diciembre 2016, 16:45 pm
No utilicé ni Metasploit ni suelo programar Ruby, así que te pongo otro ejemplo: SFML

https://github.com/SFML/SFML

SFML no es un programa, es una librería. Una librería no tiene un "main", sino que tiene un funciones y clases.
En el caso de SFML, si por ejemplo quisieras hacer una ventana gráfica, incluirías el header "SFML/Graphics.hpp", para así utilizar la clase "sf::RenderWindow".
El header Graphics.hpp es este: https://github.com/SFML/SFML/blob/master/include/SFML/Graphics.hpp
Como ves, solo tiene includes. También podrías directamente incluir "SFML/Graphics/RenderWindow.hpp".

A donde quiero llegar, es que utilizas lo que necesites (y si utilizas un header, puede estar a su vez incluyendo muchos más headers), pero no hay main.

metasploit-framework es una librería? Siendo así, no sería muy diferente (salvando las diferencias que tenga Ruby). Si es un programa, pues todo sería encontrar el punto de inicio (cada lenguaje tiene su "convención", y no conozco Ruby).
Aquí seguro que encuentras el main xD: https://github.com/ivancea/RogueLikeGame
890  Programación / Programación General / Re: [Curiosidad] Como hacer bindings de una librería en: 4 Diciembre 2016, 12:40 pm
C#: https://github.com/flibitijibibo/SDL2-CS/blob/master/src/SDL2.cs
Python: https://bitbucket.org/marcusva/py-sdl2/src/0c43a27d17f8a792234a12e45b728638e34c36fa/sdl2/dll.py?at=default&fileviewer=file-view-default#dll.py-121

Esos 2 de SDL, lo que hacen prácticamente es importar funciones de la DLL de SDL para luego poderlas utilizar desde ese lenguaje. Además, añaden módulos, namespaces, clases, etc...
Pero la funcionalidad en sí, la cogen en su mayoría de la DLL.
En C# ves el DLLImport y en Python te remarqué el módulo y función que usa por todo el código paraimportar de la DLL.

Si la librería que tienes es una DLL, hacer el binding de este modo es bastante fácil, ya que el código que tendrás que ahcer es mínimo; te limitarías a estructurar las funciones y clases.
Si la librería no es una DLL, pues bueno, habría que ver cada caso.
Páginas: 1 ... 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 [89] 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ... 401
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines