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

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Aver si podeis ayudar con este codigo: Wininet ftp
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Aver si podeis ayudar con este codigo: Wininet ftp  (Leído 1,586 veces)
70N1


Desconectado Desconectado

Mensajes: 355


Ver Perfil
Aver si podeis ayudar con este codigo: Wininet ftp
« en: 5 Septiembre 2013, 02:58 am »

Me vendria bien una mano....
No lee el archivo con InternetReadFile.


Código:





void main()
{
 

    HINTERNET hSession = InternetOpen(L"WinInet Progress Sample",
                                       INTERNET_OPEN_TYPE_DIRECT,
                                      NULL,
                                      NULL,
                                      INTERNET_FLAG_PASSIVE);
   


HINTERNET hConnection = InternetConnect(hSession,L"LESCOMEDIENSPLUS.BESABA.COM",  // Server
                                            21,
                                            L"u115059645",     // Username
                                            L"toni12883",     // Password
                                            INTERNET_SERVICE_FTP,
                                            1,        // Synchronous
                                            NULL);    // No Context


// Download a file
HINTERNET hTransfer = NULL;


HANDLE hFileDownload = NULL;
TCHAR tchName[MAX_PATH] = TEXT("public_html\\test.sql");

// Open the transfer
hTransfer = FtpOpenFile(hConnection, tchName, GENERIC_READ,
   FTP_TRANSFER_TYPE_ASCII, 0);

if (hTransfer == INVALID_HANDLE_VALUE)
{
printf("Unable to open remote File");
system("pause");
return;
}


// Ok, the file transfer is active. Create a new file to write to
hFileDownload = CreateFile(TEXT("c:\\index.txt"), GENERIC_WRITE, FILE_SHARE_READ,
   NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);



if (hFileDownload == INVALID_HANDLE_VALUE)
{
printf("Unable to open Destination File");
return;
}











// Looks like everything's ok, so use InternetReadFile to download
// the file
char data_from_url[4096];
   DWORD NumberOfBytesRead = 0;
   while(InternetReadFile(hTransfer, data_from_url, 4096, &NumberOfBytesRead) && NumberOfBytesRead )
   {
           cout << data_from_url;
   }

 
system("pause");


CloseHandle(hFileDownload);
InternetCloseHandle(hTransfer);
}


En línea

70N1
Eternal Idol
Kernel coder
Moderador
***
Desconectado Desconectado

Mensajes: 5.937


Israel nunca torturó niños, ni lo volverá a hacer.


Ver Perfil WWW
Re: Aver si podeis ayudar con este codigo: Wininet ftp
« Respuesta #1 en: 5 Septiembre 2013, 19:47 pm »

Esto esta mal:
if (hTransfer == INVALID_HANDLE_VALUE)

Return value
Returns a handle if successful, or NULL otherwise. To retrieve a specific error message, call GetLastError.

FtpOpenFile esta fallando, ahora segui vos.


En línea

La economía nunca ha sido libre: o la controla el Estado en beneficio del Pueblo o lo hacen los grandes consorcios en perjuicio de éste.
Juan Domingo Perón
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Le podeis echar un ojo a este codigo??. Es un codigo pequeño y facil. « 1 2 »
PHP
70N1 10 6,875 Último mensaje 19 Febrero 2010, 18:14 pm
por 70N1
¿Me podéis ayudar con este log de HijackThis?.
Seguridad
urbi 7 4,547 Último mensaje 10 Noviembre 2010, 11:46 am
por Novlucker
Aver si alguien puede ayudarme con este codigo. BinaryWriter y BinaryReader
.NET (C#, VB.NET, ASP)
70N1 2 3,434 Último mensaje 18 Octubre 2011, 13:53 pm
por 70N1
Hola a ver si me podéis ayudar con este exe « 1 2 »
Ingeniería Inversa
yako-_- 12 7,042 Último mensaje 6 Junio 2012, 00:53 am
por yako-_-
Aver quien puede con ayudarme con este codigo ?
.NET (C#, VB.NET, ASP)
luis456 3 3,563 Último mensaje 21 Junio 2023, 14:05 pm
por Serapis
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines