Ergebnis 1 bis 4 von 4
  1. #1
    Anfänger Avatar von li0n
    Registriert seit
    31.05.2010
    Beiträge
    12

    Standard : Permission denied

    Hallo ich werkle grade (wie schon ein Topic vorher erwähnt) an einem ARPreplay tool.
    das ganze schaut im Moment so aus:
    Code:
    //main.c
    #include "send.h"
    
    int main(void) {
      send_sniffed_pack();
      return 0;
    }
    Code:
    //send.h
    #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>
    #include "sniff.h"
    
    //--------------------------------------------------------------------------------------
    
    int send_sniffed_pack() {
      int sock;
      int input;
      int i;
      struct sockaddr_in addr;
      struct iphdr *ip = (struct iphdr*)(pack + sizeof(struct ether_header));
      struct tcphdr *tcp = (struct tcphdr*)(pack + sizeof(struct ether_header) + sizeof(struct iphdr));
    
      choosepack();
      printf("how many times should the packet be sent? [enter a number or 0 for endless]\n");
      scanf("%1i",&input);
    
      if((sock = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) < 0) {
        perror("Couldn't create a socket for sending the packet!");
        exit(EXIT_FAILURE);
      }
    
      memset(&addr, '\0', sizeof(addr));
      addr.sin_family = AF_INET;
      addr.sin_port = tcp -> dest;
      addr.sin_addr.s_addr = ip -> daddr;
    
      i = input*2;
      
      while(i >= input) {
        if(input != 0) {
          i--;
        }
        sleep(100);
        if(sendto(sock, pack, packsiz, 0, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0) {
          perror("Couldn't send a packet\n");
        }
      }
      close(sock);
      return 0;
    }
    Code:
    //sniff.h
    #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();
    
    //----------------------------------------------------------------------------
    
      const int packsiz = 12000;
      char pack[12000];
    
    //----------------------------------------------------------------------------
    
    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));
      int yn;
      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]");
        yn = getchar();
        if(yn == 'y') {
          return;
        }
      }
    }
    
    //----------------------------------------------------------------------------
    so wenn ich das Programm jetzt aber starte bekomme ich folgende ausgabe:
    Code:
    SRC MAC: 0:17:31:b1:cf:ae
    DST MAC: ff:ff:ff:ff:ff:ff
    SRC IP: 192.168.178.22
    DST IP: 192.168.178.255
    use packet? [y/n]y
    how many times should the packet be sent? [enter a number or 0 for endless]
    100
    Couldn't send a packet
    : Permission denied
    Warum ist das so?
    Ich habe maal mit tcpdump gesnifft und es sah su aus als würde das Packet bis dahin öfters zurückgeschickt werden. Wobei ich mich da auch irren kann (wa nich selten ist)

    greez li0n

    PS: Ja ich weis das Das Tool NOCH keine ARP Packs erkennt wenn es sie sieh, was bei einem ARPreplay tool warscheinlich nicht so toll ist

  2. #2
    Der mit Anatidaephobie Avatar von blackberry
    Registriert seit
    11.07.2008
    Beiträge
    2.350

    Standard

    Ohne das jetzt genau getestet zu haben: bist du root?
    RAW-Sockets sind in der Regel stark eingeschränkt.

    PDFTT cr3w a.E. — ReiDC0Re, lindor, Sera, berry
    please do feed the trolls crew and elk
    Ehrenwerte Mitglieder im Ruhestand: OpCodez, SFX.
    "Was sich blackberry gerade denkt" — Vorsicht! Frei laufender Wahnsinn!
    Zitat von fuckinghot19: "PS: Blackberry ist auf FH der Trollkönig ^^."
    An dieser Stelle danke ich all meinen Fans und Hatern gleichermaßen ^.^

  3. #3
    -=Cookies=- Avatar von moppelito
    Registriert seit
    17.07.2009
    Beiträge
    347

    Standard

    wie blackberry grade sagt schonmal sudo blafoo gemacht? (blafoo = ur prog)
    Also als root starten? du nutzt ja Ubuntu, und das sit ein typischer fehler wenn man nciht root@ ist ;p
    Mit dem Wissen steigt die Verantwortung

    [spoiler]
    <?php echo $ip; ?> Das ist wie wenn du am Frühstuckstisch sagen würdest Mama gib mir mal die X rüber!

  4. #4
    Anfänger Avatar von li0n
    Registriert seit
    31.05.2010
    Beiträge
    12

    Standard

    natürlich bin ich root sonst hätte ich vorher schon einen Fehler bekommen dass ich den Socket nicht erstellen kann das Senden und empfangen dürfte da kein Problem mehr sein

Ähnliche Themen

  1. BM Profil access Denied!
    Von blackcat im Forum Support
    Antworten: 1
    Letzter Beitrag: 09.05.2010, 21:10
  2. You dont have permission
    Von aggroberlin132 im Forum Webmaster
    Antworten: 6
    Letzter Beitrag: 03.08.2009, 14:41

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •