Hi.
Ich bastle grade an nem Tool das dem -3 Angriff (arpreplay) von aireplay sehr ähnelt.
Problem:
ich bekomme diese Meldung beim Compilen:
Code:
In file included from send.h:15,
from main.c:1:
sniff.h:24: error: variably modified ‘pack’ at file scope
sniff.h sieht so aus:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <net/ethernet.h>
#include <arpa/inet.h>
#include <errno.h>
//----------------------------------------------------------------------------
void sniff();
void choosepack();
//----------------------------------------------------------------------------
int packsiz = 12000;
char pack[packsiz];
//----------------------------------------------------------------------------
void sniff() {
int sock;
//this is the raw socket we want to sinff from:
if((sock = socket(AF_INET, SOCK_PACKET, htons(0x3))) < 0) {
perror("Couldn't create a socket for sniffing!!!");
exit(EXIT_FAILURE);
}
//now we read from the socket:
read(sock, pack, packsiz);
}
//----------------------------------------------------------------------------
void choosepack() {
struct ether_header *eth = (struct ether_header*)pack;
struct iphdr *ip = (struct iphdr*)(pack + sizeof(struct ether_header));
struct tcphdr *tcp = (struct tcphdr*)(pack + sizeof(struct tcphdr) + sizeof(struct iphdr));
char *pay = (pack + sizeof(struct tcphdr) + sizeof(struct iphdr) + sizeof(struct tcphdr));
char yn[0];
while(1) {
memset(pack, '\0', packsiz);
sniff();
printf("SRC MAC: %x:%x:%x:%x:%x:%x\n", eth -> ether_shost[0], eth -> ether_shost[1], eth -> ether_shost[2], eth -> ether_shost[3], eth -> ether_shost[4], eth -> ether_shost[5]);
printf("DST MAC: %x:%x:%x:%x:%x:%x\n", eth -> ether_dhost[0], eth -> ether_dhost[1], eth -> ether_dhost[2], eth -> ether_dhost[3], eth -> ether_dhost[4], eth -> ether_dhost[5]);
printf("SRC IP: %s\n", inet_ntoa(*(struct in_addr*) &ip -> saddr)); //print the source IP
printf("DST IP: %s\n", inet_ntoa(*(struct in_addr*) &ip -> daddr)); //print the destination IP
printf("use packet? [y/n]");
fgets(yn,sizeof(yn),stdin);
if(strcmp(yn,"y") == 0) {
return;
}
}
}
//----------------------------------------------------------------------------
hoffe mir kann da einer Helfen :S
greez li0n