Добро пожаловать! Это — архивная версия форумов на «Хакер.Ru». Она работает в режиме read-only.
 

не хочет компилиться!!!

Пользователи, просматривающие топик: none

Зашли как: Guest
Все форумы >> [Компилируемые языки] >> не хочет компилиться!!!
Имя
Сообщение << Старые топики   Новые топики >>
не хочет компилиться!!! - 2007-09-24 23:39:18.193333   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
Есть патч для вари,не могу скампелить,может кто поможет!!!

/* * Honey-VMware patch * (c) Kostya Kortchinsky &lt;kostya(dot)kortchinsky[at]renater(dot)fr&gt; * * French Honeynet Project &lt;[link=http://www.frenchhoneynet.org/]http://www.frenchhoneynet.org/[/link]&gt; * CADHo Project &lt;[link=http://www.eurecom.fr/%7Edacier/CADHO/]http://www.eurecom.fr/~dacier/CADHO/[/link]&gt; * * BACKUP YOUR VMWARE-VMX BINARY BEFORE USING THIS PATCH ! * * gcc -Wall -lz -o NEW_VMpatch NEW_VMpatch.c # ZLib is needed ! * * Here are a few considerations on how to increase furtivity of VMware in * the context on honeypots. Of this is far from perfect as there still * remain a lot of ways to fingerprint a virtual host. * * 1) The I/O backdoor *&nbsp;&nbsp;&nbsp; Just check "VMware's back" page, it is well documented there. *&nbsp;&nbsp;&nbsp; This patch can disable it, or if you are smart enough, you can change *&nbsp;&nbsp;&nbsp; the magic number to hide it. * 2) The MAC address *&nbsp;&nbsp;&nbsp; VMware has 3 registered OUIs that will allow anyone to easily *&nbsp;&nbsp;&nbsp; fingerprint a NIC (locally, on a local network, or through SMB). *&nbsp;&nbsp;&nbsp; This patch will allow you to change the default OUI 00:0c:29 to the *&nbsp;&nbsp;&nbsp; one of your choice. Keep in mind that the NIC is supposed to be an *&nbsp;&nbsp;&nbsp; AMD PCNet32. * 3) The video adapter *&nbsp;&nbsp;&nbsp; Well since the emulated video adapter has its PCI IDs related to *&nbsp;&nbsp;&nbsp; VMware, we will fix that. We won't only change the IDs, we will *&nbsp;&nbsp;&nbsp; fully replace the video adapter bios. In order to do so, you must *&nbsp;&nbsp;&nbsp; dump a working video bios. Of course, not all the bioses will work *&nbsp;&nbsp;&nbsp; in VMware, you will have to test. You can use for example : *&nbsp;&nbsp;&nbsp; - S3_Inc._ViRGE_DX_or_GX.bios *&nbsp;&nbsp;&nbsp; - ... * 4) The CDROM device *&nbsp;&nbsp;&nbsp; There is no need to patch anything for that. Just set up a generic *&nbsp;&nbsp;&nbsp; SCSI device (/dev/sg*) linked to your physical CDROM device (use SCSI *&nbsp;&nbsp;&nbsp; emulation if needed), choose it as your CDROM device and it will do *&nbsp;&nbsp;&nbsp; the job. * * You must not use this patch if you have already installed virtual hosts * since it will probably screw some stuff. It is a lot wiser to freshly * install new hosts after having applied the patch. * * PLEASE READ THE CODE AND COMMENTS ! * */ #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;unistd.h&gt; #include &lt;linux/elf.h&gt; #include &lt;zlib.h&gt; #include &lt;fcntl.h&gt; #include &lt;sys/mman.h&gt; #define NEW_VMX86_OUI0 0x00 // NOT USED #define NEW_VMX86_OUI1 0x60 #define NEW_VMX86_OUI2 0xb0 #define PATCH_IO_BACKDOOR 1 #define PATCH_VIDEO_BIOS 2 #define PATCH_MAC_ADDRESS 4 #define VERSION 0.2.0alpha1 typedef struct { &nbsp;&nbsp; char *name; &nbsp;&nbsp; unsigned long int crc32; } vmwareVersion; // The patch has been tested on these versions vmwareVersion vmwareVersions[] = { &nbsp;&nbsp; { "VMware Workstation 5.0.0 build-13124", 0xa222c2e7 } }; int version = -1; unsigned char *vmxBinary = NULL, *vmmBinary = NULL; Elf32_Ehdr *vmxEhdr = NULL, *vmmEhdr = NULL; Elf32_Shdr *vmxShdr = NULL, *vmmShdr = NULL; char *vmxShstrtab = NULL, *vmmShstrtab = NULL; int indexText = -1, indexVbios = -1, indexVmm = -1, indexZtext = -1, indexZrodata = -1; unsigned char *sectionVbios = NULL, *sectionZtext = NULL, *sectionZrodata = NULL, *sectionVmm = NULL; char *memstr(char *haystack, unsigned int h_size, const char *needle, unsigned int n_size) { &nbsp;&nbsp; char *p; &nbsp;&nbsp; for (p = haystack; p &lt;= (haystack - n_size + h_size); p++) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (memcmp(p, needle, n_size) == 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return p; &nbsp;&nbsp; return NULL; } void usage(char *program) { &nbsp;&nbsp; printf("[!] Usage: %s [-d BIOS | [-b] [-m] [-v BIOS]]\n", program); &nbsp;&nbsp; printf("[!] -d: dumps current video adapter bios to file BIOS\n"); &nbsp;&nbsp; printf("[!] -b: disables the I/O backdoor\n"); &nbsp;&nbsp; printf("[!] -m: patches the MAC address generation routine\n"); &nbsp;&nbsp; printf("[!] -v: replaces VMware video adapter bios with the one in file BIOS\n"); &nbsp;&nbsp; exit(EXIT_FAILURE); } /* * int patchIOBackdoor(void) * * This function will disable the I/O backdoor by noping the conditional jump coming * shortly after the comparison with the magic number (0x564D5868). This comparison * is located in the VMM binary within its .ztext section. The section has to be * uncompressed, patched, then compressed again, thanks to zlib. * */ int patchIOBackdoor(void) { &nbsp;&nbsp; int error = EXIT_FAILURE; &nbsp;&nbsp; unsigned long int length, newLength; &nbsp;&nbsp; unsigned char *p, *data = NULL; &nbsp;&nbsp; const unsigned char instr_cmp[] = { 0x81, 0x7d, 0x08, 0x68, 0x58, 0x4d, 0x56 }; // cmp [ebp+arg_0],'VMXh' &nbsp;&nbsp; const unsigned char instr_jz[] = { 0x74, 0x5c }; // jz short loc_XXXXXX &nbsp;&nbsp; printf("[!] Disabling I/O backdoor\n"); &nbsp;&nbsp; length = 320 * 1024; &nbsp;&nbsp; if ((data = malloc(length)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if (uncompress(data, &amp;length, &amp;vmmBinary[vmmShdr[indexZtext].sh_offset], vmmShdr[indexZtext].sh_size) != Z_OK) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; // Look for instr_cmp in uncompressed .ztext &nbsp;&nbsp; if ((p = memstr(data, length, instr_cmp, sizeof(instr_cmp))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; p += 20; &nbsp;&nbsp; // instr_jz should be 20 bytes further &nbsp;&nbsp; if (memcmp(p, instr_jz, sizeof(instr_jz)) != 0) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //printf("[-] (Put a fancy error message here)\n"); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; memset(p, 0x90, sizeof(instr_jz)); // NOP out the jump &nbsp;&nbsp; // Compress the section &nbsp;&nbsp; newLength = 192 * 1024; &nbsp;&nbsp; if ((sectionZtext = malloc(newLength)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if (compress2(sectionZtext, &amp;newLength, data, length, Z_BEST_COMPRESSION) != Z_OK) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; vmmShdr[indexZtext].sh_size = newLength; &nbsp;&nbsp; vmmShdr[indexZtext].sh_entsize = length; &nbsp;&nbsp; printf("[+] I/O backdoor succesfully disabled\n"); &nbsp;&nbsp; error = EXIT_SUCCESS; end: &nbsp;&nbsp; free(data); &nbsp;&nbsp; return error; } /* * int patchMACAddress(void) * * This function will patch the default generated OUI (00:0C:29) with the one of * your choice 00:XX:YY (check defines at the top of the program). There are in * fact two places that need patching, the generation routine (mov), and the * verification routine (cmp). * * If you want to use vmware-natd, you will have to enable the AllowAnyOUI option. * * It will result in a conflict for existing virtual hosts, that you can solve * by removing the ethernet0.* lines in the configuration file of the virtual * machine. * */ int patchMACAddress(void) { &nbsp;&nbsp; unsigned char *p, *data = &amp;vmxBinary[vmxShdr[indexText].sh_offset]; &nbsp;&nbsp; unsigned int length = vmxShdr[indexText].sh_size; &nbsp;&nbsp; const unsigned char instr_mov1[] = { 0xc6, 0x45, 0xc8, 0x00 }; // mov byte ptr [ebp+var_38],0 &nbsp;&nbsp; const unsigned char instr_mov2[] = { 0xc6, 0x45, 0xc9, 0x0c }; // mov byte ptr [ebp+var_38+1],0ch &nbsp;&nbsp; const unsigned char instr_mov3[] = { 0xc6, 0x45, 0xcA, 0x29 }; // mov byte ptr [ebp+var_38+2],29h &nbsp;&nbsp; const unsigned char instr_cmp1[] = { 0x80, 0x7b, 0x01, 0x0c }; // cmp byte ptr [ebx+1],0ch &nbsp;&nbsp; const unsigned char instr_cmp2[] = { 0x80, 0x7b, 0x02, 0x29 }; // cmp byte ptr [ebx+2],29h &nbsp;&nbsp; printf("[!] Patching MAC address generation\n"); &nbsp;&nbsp; if ((p = memstr(data, length, instr_mov1, sizeof(instr_mov1))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; p += 4; &nbsp;&nbsp; if (memcmp(p, instr_mov2, sizeof(instr_mov2)) != 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(p + 3) = NEW_VMX86_OUI1; &nbsp;&nbsp; p += 4; &nbsp;&nbsp; if (memcmp(p, instr_mov3, sizeof(instr_mov3)) != 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(p + 3) = NEW_VMX86_OUI2; &nbsp;&nbsp; p += 4; &nbsp;&nbsp; length = p - data; &nbsp;&nbsp; if ((p = memstr(p, length, instr_cmp1, sizeof(instr_cmp1))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(p + 3) = NEW_VMX86_OUI1; &nbsp;&nbsp; p += 22; &nbsp;&nbsp; // instr_cmp2 should be 22 bytes further &nbsp;&nbsp; if (memcmp(p, instr_cmp2, sizeof(instr_cmp2)) != 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(p + 3) = NEW_VMX86_OUI2; &nbsp;&nbsp; printf("[+] MAC address generation succesfully patched\n"); &nbsp;&nbsp; return EXIT_SUCCESS; } /* * int patchVideoAdapter(char *filename) * * This routine will replace the video adapter bios shipped with VMware with * the one of your choice. It will also replace the PCI IDs hardcoded in the * .text section of the VMX binary. Of course not any BIOS can do, usually the * one of simple-and-not-too-recent video cards will work fine. * */ int patchVideoAdapter(char *filename) { &nbsp;&nbsp; int error = EXIT_FAILURE; &nbsp;&nbsp; unsigned long int length, newLength; &nbsp;&nbsp; unsigned char *p, *text, *data = NULL; &nbsp;&nbsp; unsigned short int offset; &nbsp;&nbsp; FILE *file; &nbsp;&nbsp; unsigned short int vendor, device; &nbsp;&nbsp; const unsigned char instr_mov[] = { 0x66, 0xc7, 0x03, 0xad, 0x15 }; // mov word ptr [ebx],15adh &nbsp;&nbsp; const unsigned char instr_const[] = { 0x05, 0x04 }; // 405h &nbsp;&nbsp; printf("[!] Replacing video adapter bios\n"); &nbsp;&nbsp; if ((file = fopen(filename, "rb")) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; fseek(file, 0, SEEK_END); &nbsp;&nbsp; length = ftell(file); &nbsp;&nbsp; fseek(file, 0, SEEK_SET); &nbsp;&nbsp; if ((data = malloc(length)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if (fread(data, 1, length, file) != length) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if (data[0] != 0x55 || data[1] != 0xaa) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; offset = *(unsigned short int *)(&amp;data[24]); &nbsp;&nbsp; if (memcmp(&amp;data[offset], "PCIR", 4) != 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; vendor = *(unsigned short int *)(&amp;data[offset + 4]); &nbsp;&nbsp; device = *(unsigned short int *)(&amp;data[offset + 6]); &nbsp;&nbsp; printf("[?] VendorID 0x%04x\n[?] DeviceID 0x%04x\n", vendor, device); &nbsp;&nbsp; newLength = 32 * 1024; &nbsp;&nbsp; if ((sectionVbios = malloc(newLength)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if (compress2(sectionVbios, &amp;newLength, data, length, Z_BEST_COMPRESSION) != Z_OK) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; vmxShdr[indexVbios].sh_size = newLength; &nbsp;&nbsp; vmxShdr[indexVbios].sh_entsize = length; &nbsp;&nbsp; text = &amp;vmxBinary[vmxShdr[indexText].sh_offset]; &nbsp;&nbsp; length = vmxShdr[indexText].sh_size; &nbsp;&nbsp; if ((p = memstr(text, length, instr_mov, sizeof(instr_mov))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; p += 5; &nbsp;&nbsp; length = p - text; &nbsp;&nbsp; if ((p = memstr(p, length, instr_mov, sizeof(instr_mov))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(unsigned short int *)(p + 3) = vendor; &nbsp;&nbsp; p += 5; &nbsp;&nbsp; length = p - text; &nbsp;&nbsp; if ((p = memstr(p, length, instr_const, sizeof(instr_const))) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXIT_FAILURE; &nbsp;&nbsp; *(unsigned short int *)p = device; &nbsp;&nbsp; printf("[+] Video adapter bios successfully replaced\n"); &nbsp;&nbsp; error = EXIT_SUCCESS; end: &nbsp;&nbsp; fclose(file); &nbsp;&nbsp; free(data); &nbsp;&nbsp; return error; } /* * int dumpVideoBios(char *filename) * * This function will allow you to dump the video adapter bios on the current * machine to a file. The BIOS is usually mapped at 0xc0000, but you can have * a look at /proc/iomem to be sure. * */ int dumpVideoBios(char *filename) { &nbsp;&nbsp; int error = EXIT_FAILURE; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned char *mem; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int fd1, fd2, length; &nbsp;&nbsp; printf("[!] Dumping video adapter bios\n"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((fd1 = open(filename, O_CREAT | O_WRONLY, 0600)) == 0) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((fd2 = open("/dev/mem", O_RDONLY)) == 0) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("[-] Error opening /dev/mem\n"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close(fd1); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } #define START 0xc0000 #define LENGTH 0x20000 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((mem = mmap(0, LENGTH, PROT_READ, MAP_SHARED, fd2, START)) == MAP_FAILED) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("[-] Error mapping /dev/mem\n"); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; length = mem[2] * 512; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (write(fd1, mem, length) == length) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf("[+] Video adapter bios successfully dumped (%d bytes)\n", length); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; error = EXIT_SUCCESS; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; munmap(mem, LENGTH); end: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close(fd2); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close(fd1); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return error; } int main(int argc, char *argv[]) { &nbsp;&nbsp; FILE *file, *process; &nbsp;&nbsp; char buffer[64], *videoBios = NULL; &nbsp;&nbsp; int i, error = EXIT_FAILURE; &nbsp;&nbsp; unsigned int fileSize, size; &nbsp;&nbsp; unsigned char *newBinary = NULL; &nbsp;&nbsp; int c, options = 0; &nbsp;&nbsp; if (argc &lt; 2) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; usage(argv[0]); &nbsp;&nbsp; while ((c = getopt(argc, argv, "bd:mv:")) != EOF) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch (c) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'b': &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; options |= PATCH_IO_BACKDOOR; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'd': &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit(dumpVideoBios(optarg)); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'm': &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; options |= PATCH_MAC_ADDRESS; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'v': &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; options |= PATCH_VIDEO_BIOS; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; videoBios = optarg; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; default: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; usage(argv[0]); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp; } &nbsp;&nbsp; if ((process = popen("/usr/bin/vmware -v", "r")) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; if (fgets(buffer, sizeof(buffer), process) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; if (pclose(process) == -1) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; for (i = 0; i &lt; sizeof(vmwareVersions) / sizeof(vmwareVersions[0]); i++) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (strncmp(buffer, vmwareVersions[i].name, strlen(vmwareVersions[i].name)) == 0) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; version = i; &nbsp;&nbsp; if (version == -1) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf("[-] Unknown VMware version\n"); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; } &nbsp;&nbsp; printf("[+] Detected %s\n", vmwareVersions[version].name); &nbsp;&nbsp; if ((file = fopen("/usr/lib/vmware/bin/vmware-vmx", "rb")) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return error; &nbsp;&nbsp; fseek(file, 0, SEEK_END); &nbsp;&nbsp; fileSize = ftell(file); &nbsp;&nbsp; if ((vmxBinary = malloc(fileSize)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; fseek(file, 0, SEEK_SET); &nbsp;&nbsp; if (fread(vmxBinary, 1, fileSize, file) != fileSize) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; printf("[?] CRC32 0x%08lx\n", crc32(0xffffffffL, vmxBinary, fileSize)); &nbsp;&nbsp; if (crc32(0xffffffffL, vmxBinary, fileSize) != vmwareVersions[version].crc32) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf("[-] The vmware-vmx binary is not the original one\n"); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; vmxEhdr = (Elf32_Ehdr *)(&amp;vmxBinary[0]); &nbsp;&nbsp; vmxShdr = (Elf32_Shdr *)(&amp;vmxBinary[vmxEhdr-&gt;e_shoff]); &nbsp;&nbsp; vmxShstrtab = &amp;vmxBinary[vmxShdr[vmxEhdr-&gt;e_shstrndx].sh_offset]; &nbsp;&nbsp; for (i = 1; i &lt; vmxEhdr-&gt;e_shnum; i++) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!strcmp(&amp;vmxShstrtab[vmxShdr[i].sh_name], ".text")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; indexText = i; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (!strcmp(&amp;vmxShstrtab[vmxShdr[i].sh_name], ".vbios")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; indexVbios = i; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (!strcmp(&amp;vmxShstrtab[vmxShdr[i].sh_name], ".vmm")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; indexVmm = i; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (indexText != -1 &amp;&amp; indexVbios != -1 &amp;&amp; indexVmm != -1) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; } &nbsp;&nbsp; if (i == vmxEhdr-&gt;e_shnum) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if ((options &amp; PATCH_MAC_ADDRESS) != 0) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (patchMACAddress() != EXIT_SUCCESS) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; if ((options &amp; PATCH_VIDEO_BIOS) != 0) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (patchVideoAdapter(videoBios) != EXIT_SUCCESS) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; vmmBinary = &amp;vmxBinary[vmxShdr[indexVmm].sh_offset]; &nbsp;&nbsp; vmmEhdr = (Elf32_Ehdr *)(&amp;vmmBinary[0]); &nbsp;&nbsp; vmmShdr = (Elf32_Shdr *)(&amp;vmmBinary[vmmEhdr-&gt;e_shoff]); &nbsp;&nbsp; vmmShstrtab = &amp;vmmBinary[vmmShdr[vmmEhdr-&gt;e_shstrndx].sh_offset]; &nbsp;&nbsp; for (i = 0; i &lt; vmmEhdr-&gt;e_shnum; i++) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(!strcmp(&amp;vmmShstrtab[vmmShdr[i].sh_name], ".ztext")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; indexZtext = i; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (!strcmp(&amp;vmmShstrtab[vmmShdr[i].sh_name], ".zrodata")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; indexZrodata = i; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (indexZtext != -1 &amp;&amp; indexZrodata != -1) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break; &nbsp;&nbsp; } &nbsp;&nbsp; if (i == vmmEhdr-&gt;e_shnum) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; if ((options &amp; PATCH_IO_BACKDOOR) != 0) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (patchIOBackdoor() != EXIT_SUCCESS) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; if ((sectionVmm = malloc(512 * 1024)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; memset(sectionVmm, '\0', 512 * 1024); &nbsp;&nbsp; size = sizeof(Elf32_Ehdr); &nbsp;&nbsp; for (i = 0; i &lt; vmmEhdr-&gt;e_shnum; i++) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(strcmp(&amp;vmmShstrtab[vmmShdr[i].sh_name], ".bss")) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (i == indexZtext &amp;&amp; sectionZtext) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;sectionVmm[size], sectionZtext, vmmShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (i == indexZrodata &amp;&amp; sectionZrodata) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;sectionVmm[size], sectionZrodata, vmmShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;sectionVmm[size], &amp;vmmBinary[vmmShdr[i].sh_offset], vmmShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vmmShdr[i].sh_offset = size; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; size += vmmShdr[i].sh_size; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp; } &nbsp;&nbsp; vmmEhdr-&gt;e_shoff = size; &nbsp;&nbsp; memcpy(&amp;sectionVmm[0], vmmEhdr, sizeof(Elf32_Ehdr)); &nbsp;&nbsp; memcpy(&amp;sectionVmm[size], vmmShdr, vmmEhdr-&gt;e_shentsize * vmmEhdr-&gt;e_shnum); &nbsp;&nbsp; size += vmmEhdr-&gt;e_shentsize * vmmEhdr-&gt;e_shnum; &nbsp;&nbsp; vmxShdr[indexVmm].sh_size = size; &nbsp;&nbsp; if ((file = freopen("/usr/lib/vmware/bin/vmware-vmx", "wb", file)) == NULL) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //printf("[-] (Put a fancy error message here)\n"); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; } &nbsp;&nbsp; if ((newBinary = malloc(4096 * 1024)) == NULL) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; memset(newBinary, '\0', 4096 * 1024); &nbsp;&nbsp; i = (indexVbios &lt; indexVmm) ? indexVbios : indexVmm; &nbsp;&nbsp; size = vmxShdr[i].sh_offset; &nbsp;&nbsp; memcpy(&amp;newBinary[0], &amp;vmxBinary[0], size); &nbsp;&nbsp; for (; i &lt; vmxEhdr-&gt;e_shnum; i++) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (i == indexVbios &amp;&amp; sectionVbios) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;newBinary[size], sectionVbios, vmxShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (i == indexVmm &amp;&amp; sectionVmm) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;newBinary[size], sectionVmm, vmxShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(&amp;newBinary[size], &amp;vmxBinary[vmxShdr[i].sh_offset], vmxShdr[i].sh_size); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vmxShdr[i].sh_offset = size; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; size += (((vmxShdr[i].sh_size - 1) / vmxShdr[i].sh_addralign) + 1) * vmxShdr[i].sh_addralign; &nbsp;&nbsp; } &nbsp;&nbsp; vmxEhdr-&gt;e_shoff = size; &nbsp;&nbsp; memcpy(&amp;newBinary[0], vmxEhdr, sizeof(Elf32_Ehdr)); &nbsp;&nbsp; memcpy(&amp;newBinary[size], vmxShdr, vmxEhdr-&gt;e_shentsize * vmxEhdr-&gt;e_shnum); &nbsp;&nbsp; size += vmxEhdr-&gt;e_shentsize * vmxEhdr-&gt;e_shnum; &nbsp;&nbsp; fseek(file, 0, SEEK_SET); &nbsp;&nbsp; if (fwrite(newBinary, 1, size, file) != size) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; goto end; &nbsp;&nbsp; error = EXIT_SUCCESS; end: &nbsp;&nbsp; free(newBinary); &nbsp;&nbsp; free(sectionVmm); &nbsp;&nbsp; free(sectionZrodata); &nbsp;&nbsp; free(sectionZtext); &nbsp;&nbsp; free(sectionVbios); &nbsp;&nbsp; free(vmxBinary); &nbsp;&nbsp; fclose(file); &nbsp;&nbsp; return error; }
Post #: 1
RE: не хочет компилиться!!! - 2007-09-24 23:59:23.603333   
Technologist

Сообщений: 3590
Оценки: 0
Присоединился: 2006-10-28 20:28:06.943333
Как не хочет компилиться, сообщения какие выдает, как процесс происходит? В подробностях.
Post #: 2
RE: не хочет компилиться!!! - 2007-09-25 00:48:50.770000   
alexbozhko

Сообщений: 1024
Оценки: 0
Присоединился: 2005-11-24 13:35:34
Не хочет - не компили :)

А серьезно, ну хоть бы сказал, что пишет.
Post #: 3
RE: не хочет компилиться!!! - 2007-09-25 02:09:26.453333   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
Ногами сильно не пинать,может я че не так делаю
[Error] vmpatch.dpr(1): Declaration expected but '/' found [Error] vmpatch.dpr(8): Illegal character in input file: '!' ($21) [Error] vmpatch.dpr(10): Constant expression expected [Error] vmpatch.dpr(10): Illegal character in input file: '!' ($21) [Error] vmpatch.dpr(17): Illegal character in input file: '"' ($22) [Error] vmpatch.dpr(28): Unterminated string [Error] vmpatch.dpr(44): Illegal character in input file: '!' ($21) [Error] vmpatch.dpr(48): Constant expression expected [Error] vmpatch.dpr(49): Constant expression expected [Error] vmpatch.dpr(50): Constant expression expected [Error] vmpatch.dpr(51): Constant expression expected [Error] vmpatch.dpr(52): Constant expression expected [Error] vmpatch.dpr(53): Constant expression expected [Error] vmpatch.dpr(54): Constant expression expected [Error] vmpatch.dpr(55): Constant expression expected [Error] vmpatch.dpr(57): Constant expression expected [Error] vmpatch.dpr(58): Constant expression expected [Error] vmpatch.dpr(59): Constant expression expected [Error] vmpatch.dpr(61): Constant expression expected [Error] vmpatch.dpr(62): Constant expression expected [Error] vmpatch.dpr(63): Constant expression expected [Error] vmpatch.dpr(65): Constant expression expected [Error] vmpatch.dpr(77): Illegal character in input file: '}' ($7D) [Error] vmpatch.dpr(87): '=' expected but '*' found [Error] vmpatch.dpr(87): '=' expected but identifier 'int' found [Error] vmpatch.dpr(97): Constant expression expected [Error] vmpatch.dpr(97): Expression expected but 'PROGRAM' found [Error] vmpatch.dpr(107): Expression expected but '*' found [Error] vmpatch.dpr(108): '(' expected but identifier 'patchIOBackdoor' found [Error] vmpatch.dpr(108): Undeclared identifier: 'void' [Error] vmpatch.dpr(110): Expression expected but '*' found [Error] vmpatch.dpr(97): Identifier redeclared: 'void' [Error] vmpatch.dpr(110): ';' expected but 'FUNCTION' found [Error] vmpatch.dpr(110): Function needs result type [Error] vmpatch.dpr(110): Unknown directive: 'I' [Error] vmpatch.dpr(122): '=' expected but identifier 'char' found [Error] vmpatch.dpr(122): '=' expected but '[' found [Error] vmpatch.dpr(122): Expression expected but ';' found [Error] vmpatch.dpr(124): '=' expected but '(' found [Error] vmpatch.dpr(124): '=' expected but identifier 'I' found [Error] vmpatch.dpr(124): Illegal character in input file: '\' ($5C) [Error] vmpatch.dpr(126): Declaration expected but 'IF' found [Error] vmpatch.dpr(128): Declaration expected but 'IF' found [Error] vmpatch.dpr(128): Illegal character in input file: '&amp;' ($26) [Error] vmpatch.dpr(128): Illegal character in input file: '!' ($21) [Error] vmpatch.dpr(129): '.' expected but ';' found [Warning] vmpatch.dpr(133): Text after final 'END.' - ignored by compiler
Post #: 4
RE: не хочет компилиться!!! - 2007-09-25 02:13:38.273333   
Under

Сообщений: 488
Оценки: 0
Присоединился: 2005-02-11 10:26:37
написано "необходим ZLib" (ZLib is needed !)
есть он у тебя? ))
Post #: 5
RE: не хочет компилиться!!! - 2007-09-25 02:20:35.720000   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
Не нету походу :(
стукни в асю,на аве
Post #: 6
RE: не хочет компилиться!!! - 2007-09-25 02:42:32.223333   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
Так нашел я этот ZLib,ну и че с ним делать?
Post #: 7
RE: не хочет компилиться!!! - 2007-09-25 11:40:13.176666   
tt_andrey

Сообщений: 213
Оценки: 0
Присоединился: 2007-07-03 13:54:36.440000
quote:

Так нашел я этот ZLib,ну и че с ним делать?


установить?
Post #: 8
RE: не хочет компилиться!!! - 2007-09-25 17:10:30.450000   
rgo

Сообщений: 7170
Оценки: 281
Присоединился: 2004-09-25 05:14:25
quote:

ORIGINAL: Mescalin
Ногами сильно не пинать,может я че не так делаю
[Error] vmpatch.dpr(1): Declaration expected but '/' found [Error] vmpatch.dpr(8): Illegal character in input file: '!' ($21) ... [Warning] vmpatch.dpr(133): Text after final 'END.' - ignored by compiler

ты чего компилятором паскаля компилировал? это ярко выраженный C. а сыплющиеся ошибки, по-любому, выданы не компилятором C. и уж точно не gcc. может быть и не паскалём, но не gcc.
Post #: 9
RE: не хочет компилиться!!! - 2007-09-25 18:01:55.710000   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
не с кампелил,им вообще не хочет кампелиться!!!
В журнале Хакер, номер #079 на диске есть этот патч может кто нибудь скинет его?
Post #: 10
RE: не хочет компилиться!!! - 2007-09-25 18:42:16.726666   
rgo

Сообщений: 7170
Оценки: 281
Присоединился: 2004-09-25 05:14:25
очень даже хочет:-*- mode: compilation; default-directory: "~/" -*- Compilation started at Tue Sep 25 18:35:56 gcc -Wall -lz -o tmp tmp.c -I/usr/src/linux/include Compilation finished at Tue Sep 25 18:35:57 слегка капризничает, из-за того, что linux/elf.h найти не смог в моей системе, но (как можно заметить), мне помогла его уговорить опция `-I/usr/src/linux/include'.
но если речь идёт не о линухе, то этот файлик можно и отдельно скачать и показать компилятору.
Post #: 11
RE: не хочет компилиться!!! - 2007-09-25 19:26:18.576666   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
да речь ижет не линуксе,какой файл нужен,и где его скачать можно по подробней ?
Post #: 12
RE: не хочет компилиться!!! - 2007-09-25 19:39:11.313333   
rgo

Сообщений: 7170
Оценки: 281
Присоединился: 2004-09-25 05:14:25
linux/elf.h… собственно, я затрудняюсь сказать, как из инета выкачать только его. чтобы не 50M ядра линуха, среди которых затерялись 10Kb файла elf.h, а только его… но я думаю, гугль поможет. но компилятором паскаля ты всё равно не скомпилируешь ;)
Post #: 13
RE: не хочет компилиться!!! - 2007-09-25 21:06:05.556666   
int21h

Сообщений: 105
Оценки: 0
Присоединился: 2007-08-25 12:05:16.730000
Кампилятор то Сишный … научен свои горьким опытом - компилить чужие сорсы - лага ! Писать нужно самому тогда и с отладкой проблем не будет
Post #: 14
RE: не хочет компилиться!!! - 2007-09-25 21:46:53.670000   
girlwap

Сообщений: 181
Оценки: 0
Присоединился: 2007-08-28 17:57:48.130000
Я что то не поняла вы что программу на Си пытаетесь запустить комплиятором паскаля?:D
Post #: 15
RE: не хочет компилиться!!! - 2007-09-25 22:53:36.910000   
rgo

Сообщений: 7170
Оценки: 281
Присоединился: 2004-09-25 05:14:25
quote:

ORIGINAL: int21h
Кампилятор то Сишный

вряд ли. C'шный компилятор не ругается на отсутствие точки, после END, завершающего программу. ;)
quote:

ORIGINAL: girlwap
Я что то не поняла вы что программу на Си пытаетесь запустить комплиятором паскаля?

как видишь. =)
Post #: 16
RE: не хочет компилиться!!! - 2007-09-26 01:55:49.160000   
Mescalin

Сообщений: 125
Оценки: 0
Присоединился: 2007-03-27 15:39:51.010000
все разобрался, тему клозед
Post #: 17
Страниц:  [1]
Все форумы >> [Компилируемые языки] >> не хочет компилиться!!!







Связаться:
Вопросы по сайту / xakep@glc.ru

Предупреждение: использование полученных знаний в противозаконных целях преследуется по закону.