• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pcap_inject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pcap_inject函数的典型用法代码示例。如果您正苦于以下问题:C++ pcap_inject函数的具体用法?C++ pcap_inject怎么用?C++ pcap_inject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pcap_inject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pcapint_write_packet

static int pcapint_write_packet(libtrace_out_t *libtrace,
                                libtrace_packet_t *packet)
{
    int err;

    if (trace_get_link_type(packet) == TRACE_TYPE_NONDATA)
        return 0;

    if (!OUTPUT.trace.pcap) {
        OUTPUT.trace.pcap = (pcap_t *)pcap_open_live(
                                libtrace->uridata,65536,0,0,NULL);
    }
#ifdef HAVE_PCAP_INJECT
    err=pcap_inject(OUTPUT.trace.pcap,
                    packet->payload,
                    trace_get_capture_length(packet));
    if (err!=(int)trace_get_capture_length(packet))
        err=-1;
#else
#ifdef HAVE_PCAP_SENDPACKET
    err=pcap_sendpacket(OUTPUT.trace.pcap,
                        packet->payload,
                        trace_get_capture_length(packet));
#else
    trace_set_err(packet->trace,TRACE_ERR_UNSUPPORTED,"writing is not supported on this platform");
    return -1;
#endif
#endif
    return err;
}
开发者ID:superpig0501,项目名称:libtrace,代码行数:30,代码来源:format_pcap.c


示例2: authenticate

/* Authenticate ourselves with the AP */
void authenticate()
{
    const void *radio_tap = NULL, *dot11_frame = NULL, *management_frame = NULL, *packet = NULL;
    size_t radio_tap_len = 0, dot11_frame_len = 0, management_frame_len = 0, packet_len = 0;

    radio_tap = build_radio_tap_header(&radio_tap_len);
    dot11_frame = build_dot11_frame_header(FC_AUTHENTICATE, &dot11_frame_len);
    management_frame = build_authentication_management_frame(&management_frame_len);
    packet_len = radio_tap_len + dot11_frame_len + management_frame_len;

    if(radio_tap && dot11_frame && management_frame)
    {
        packet = malloc(packet_len);
        if(packet)
        {
            memset((void *) packet, 0, packet_len);

            memcpy((void *) packet, radio_tap, radio_tap_len);
            memcpy((void *) ((char *) packet+radio_tap_len), dot11_frame, dot11_frame_len);
            memcpy((void *) ((char *) packet+radio_tap_len+dot11_frame_len), management_frame, management_frame_len);

            pcap_inject(get_handle(), packet, packet_len);

            free((void *) packet);
        }
    }

    if(radio_tap) free((void *) radio_tap);
    if(dot11_frame) free((void *) dot11_frame);
    if(management_frame) free((void *) management_frame);

    return;
}
开发者ID:Egyptghost1,项目名称:reaver-wps-fork-t6x,代码行数:34,代码来源:80211.c


示例3: packet_socket_writev

int packet_socket_writev(struct packet_socket *psock,
			 const struct iovec *iov, int iovcnt)
{
	/* Copy the ethernet header and IP datagram into a single buffer,
	 * since that's all the pcap API supports. TODO: optimize this.
	 */

	u8 *buf = NULL, *p = NULL;
	int len = 0, i = 0;

	/* Calculate how much space we need. */
	for (i = 0; i < iovcnt; ++i)
		len += iov[i].iov_len;

	buf = malloc(len);

	/* Copy into the linear buffer. */
	p = buf;
	for (i = 0; i < iovcnt; ++i) {
		memcpy(p, iov[i].iov_base, iov[i].iov_len);
		p += iov[i].iov_len;
	}

	DEBUGP("calling pcap_inject with %d bytes\n", len);

	if (pcap_inject(psock->pcap_out, buf, len) != len)
		die_pcap_perror(psock->pcap_out, "pcap_inject");

	free(buf);
	return STATUS_OK;
}
开发者ID:BillTheBest,项目名称:packetdrill,代码行数:31,代码来源:packet_socket_pcap.c


示例4: process_packet

void process_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) {

	int size = (int) header->len;
	int seq = -1;
	int i;
	int ret;
	if (verify_packet_chk((u_char*)packet, size, ROUTE_ON_RELIABLE) == 0) {
		struct rlhdr* rlh = (struct rlhdr*)(packet + ETH_HLEN + sizeof(struct rthdr));
		seq = ntohs(rlh->seq);
		fprintf(stdout, "Received sequence %d\n", seq);
		checkArray[seq] = 1;
		for (i = 0; i < TEST_SEQ_CNT; i++) {
			if (checkArray[i] != 1) {
				return;
			}
		}
		printf("ALL test segments received.\n");
		int pktlen = generate_openflow_test_packet(packetOut, 128, 9999, source, dest);
		if ((ret = pcap_inject(handle_sniffed, packetOut, pktlen)) < 0){
			fprintf(stderr, "Fail to inject packet\n");
			// exit(1);
		}
		exit(1);
	}
	//print_data(stdout, (u_char*)packet, size);
}
开发者ID:zhan849,项目名称:cs558,代码行数:26,代码来源:pcap_receiver.c


示例5: forward_from_hijacker

/**
 * Forward data from hijacker
 *
 */
static ssize_t forward_from_hijacker ( struct hijack *hijack, int fd ) {
    char buf[SNAPLEN];
    ssize_t len;

    /* Read packet from hijacker */
    len = read ( fd, buf, sizeof ( buf ) );
    if ( len < 0 ) {
        logmsg ( LOG_ERR, "read from hijacker failed: %s\n",
                 strerror ( errno ) );
        return -1;
    }
    if ( len == 0 )
        return 0;

    /* Set up filter if not already in place */
    if ( ! hijack->filtered ) {
        if ( hijack_filter ( hijack, buf, len ) == 0 )
            hijack->filtered = 1;
    }

    /* Transmit packet to network */
    if ( pcap_inject ( hijack->pcap, buf, len ) != len ) {
        logmsg ( LOG_ERR, "write to hijacked port failed: %s\n",
                 pcap_geterr ( hijack->pcap ) );
        return -1;
    }

    hijack->tx_count++;
    return len;
};
开发者ID:B-Rich,项目名称:serialice,代码行数:34,代码来源:hijack.c


示例6: captop_handler

    void
    captop_handler(u_char *user, const struct pcap_pkthdr *h, const u_char *payload)
    {
        auto that = reinterpret_cast<capthread *>(user);

        if (unlikely(global::stop.load(std::memory_order_relaxed)))
            return;

        if (likely(that != nullptr))
        {
            if (that->in)
            {
                that->atomic_stat.in_count.fetch_add(1, std::memory_order_relaxed);
                that->atomic_stat.in_band.fetch_add(h->len, std::memory_order_relaxed);
            }

            if (that->out)
            {
                int ret = pcap_inject(that->out, payload, h->caplen);
                if (ret != -1)
                {
                    that->atomic_stat.out_count.fetch_add(1, std::memory_order_relaxed);
                    that->atomic_stat.out_band.fetch_add(h->len, std::memory_order_relaxed);
                }
                else {
                    that->atomic_stat.fail.fetch_add(1, std::memory_order_relaxed);
                }
            }

            if (unlikely(that->dumper != nullptr))
                pcap_dump(reinterpret_cast<u_char *>(that->dumper), h, payload);
        }
    }
开发者ID:awgn,项目名称:captop,代码行数:33,代码来源:handler.cpp


示例7: deauthenticate

/* Deauthenticate ourselves from the AP */
void deauthenticate()
{
    const void *radio_tap = NULL, *dot11_frame = NULL, *packet = NULL;
    size_t radio_tap_len = 0, dot11_frame_len = 0, packet_len = 0;

    radio_tap = build_radio_tap_header(&radio_tap_len);
    dot11_frame = build_dot11_frame_header(FC_DEAUTHENTICATE, &dot11_frame_len);
    packet_len = radio_tap_len + dot11_frame_len + DEAUTH_REASON_CODE_SIZE;

    if(radio_tap && dot11_frame)
    {
        packet = malloc(packet_len);
        if(packet)
        {
            memset((void *) packet, 0, packet_len);

            memcpy((void *) packet, radio_tap, radio_tap_len);
            memcpy((void *) ((char *) packet+radio_tap_len), dot11_frame, dot11_frame_len);
            memcpy((void *) ((char *) packet+radio_tap_len+dot11_frame_len), DEAUTH_REASON_CODE, DEAUTH_REASON_CODE_SIZE);

            pcap_inject(get_handle(), packet, packet_len);

            free((void *) packet);
        }
    }

    if(radio_tap) free((void *) radio_tap);
    if(dot11_frame) free((void *) dot11_frame);

    return;
}
开发者ID:Egyptghost1,项目名称:reaver-wps-fork-t6x,代码行数:32,代码来源:80211.c


示例8: tunemu_write

int tunemu_write(int ppp_sockfd, char *buffer, int length)
{
    allocate_data_buffer(length + 4);

    data_buffer[0] = 0x02;
    data_buffer[1] = 0x00;
    data_buffer[2] = 0x00;
    data_buffer[3] = 0x00;

    memcpy(data_buffer + 4, buffer, length);

    if (pcap == NULL)
    {
        tun_error("pcap not open");
        return -1;
    }

    length = pcap_inject(pcap, data_buffer, length + 4);
    if (length < 0)
    {
        tun_error("injecting packet: %s", pcap_geterr(pcap));
        return length;
    }
    tun_noerror();

    length -= 4;
    if (length < 0)
        return 0;

    return length;
}
开发者ID:HannesHofer,项目名称:hans,代码行数:31,代码来源:tunemu.c


示例9: wifi_inject

int wifi_inject(char *frameToSend,int frameLength)
{
	static int count =1 ;

	PRINT_DEBUG("wifi_inject has been called");
	// Add the mac header then send it
		unsigned char *frame;
		frame =   (unsigned char *)malloc(frameLength + SIZE_ETHERNET); //todo:check if this cannot be allocated once to 1500B


		// src = 00:1c:bf:87:1a:fd
		//dest Alex = 0x00,0x1c,0xbf,0x86,0xd2,0xda

		char dest[]={0x00,0x1c,0xbf,0x87,0x1a,0xfd};
		char src[]={0x00,0x1c,0xbf,0x87,0x1a,0xfd};
		memcpy(((struct sniff_ethernet *)frame)->ether_dhost,dest,ETHER_ADDR_LEN);
		memcpy(((struct sniff_ethernet *)frame)->ether_shost,src,ETHER_ADDR_LEN);
		((struct sniff_ethernet *)frame)->ether_type=htons(0x0800);
		memcpy(frame+SIZE_ETHERNET,frameToSend,frameLength);





		if (pcap_inject ( inject_handle, frame,frameLength + SIZE_ETHERNET) == -1)
			PRINT_DEBUG("Failed to inject the packet");
		PRINT_DEBUG("\n Message #%d has been injected",count);
		count++;
		//free(frameToSend);
		return(1);

}
开发者ID:TrainingProject,项目名称:FINS-Framework,代码行数:32,代码来源:wifimod.c


示例10: pcap_send

int pcap_send(struct pcap_conn *conn, char *buf, int size)
{
	int ret;
	if (!conn || !conn->desc || !buf || size <= 0)
		return -EINVAL;
	ret = pcap_inject(conn->desc, buf, size);
	return ret;
}
开发者ID:guolinp,项目名称:euler,代码行数:8,代码来源:pcap_comm.c


示例11: memset

bool MF_Segmentor::sendAck(MF_ChunkInfo *ci, MF_DeviceInfo *di) {
	MF_Log::mf_log(MF_DEBUG, "MF_Segmentor:sendAck send ack packet for given chunk");
	u_char buffer[65536];// large enough for any size of bitmap
	memset((void *) buffer, 0xff, 65536);
	struct hop_data *hop;
	unsigned int pktCount = ci->getChunkPktCnt();
	struct csyn_ack *ack;
	ack = (struct csyn_ack *) MF_PacketSupport::getHopHeaderPtr(buffer);
	ack->type = htonl(CSYN_ACK_PKT);
	ack->hop_ID = htonl((unsigned int) (ci->getHopID()));
	ack->chk_pkt_count = htonl(pktCount);

	unsigned int i = 0;
	unsigned int j = 0;
	int ret;

	if (ci->isDelivered()) {// last ack get lost
		for (i = 0; i < (pktCount - 1) / 8 + 1; i++) {
			ack->bitmap[i] = 0xff;
		}
	} else {
		vector <u_char *> *pList = ci->getPacketList();
		for (i = 0; i < pktCount; i++) {
			hop = (struct hop_data *) MF_PacketSupport::getHopHeaderPtr((*pList)[i]);
			if (hop->pld_size == 0) { //did not get the packet yet
				*(ack->bitmap + (i / 8)) &= (0xfe << (i % 8));
				j++;
			}
		}
	}
	unsigned int z;
	//TODO remove the harcoded value
	char tempBitmap[512];
	for (z = 0; (z < (pktCount - 1) / 8 + 1) && z<512; z++) {
		sprintf(tempBitmap + z, "%x",ack->bitmap[z]);
	}
	MF_Log::mf_log(MF_DEBUG, "MF_Segmentor:sendAck sent bitmap: %s", tempBitmap);

	MF_IPProto::fillHeader(buffer, ETH_HEADER_SIZE, CSYN_SIZE + ((pktCount - 1) / 8 + 1), di->getSIP().c_str(), di->getAPIP().c_str());
	MF_EtherProto::fillHeader(buffer, 0, di->getSMAC().c_str(), di->getAPMAC().c_str());

	if ((ret = pcap_inject(mPcapHandle, (void *) buffer, ETH_HEADER_SIZE + IP_HEADER_SIZE + CSYN_SIZE + ((pktCount - 1) / 8 + 1))) < 0) {
		MF_Log::mf_log(MF_ERROR, "MF_Segmentor:sendAck pcap_inject() error, errno=%d", errno);
		return false;
	}
	MF_Log::mf_log(MF_DEBUG, "MF_Segmentor:sendAck Sent CSYN-ACK hop_ID=%d, recvd/lost/total %d/%d/%d if = %s", ntohl(ack->hop_ID), pktCount-j, j, pktCount, di->getName().c_str());

	//OML
#ifdef __OML__
	di->increaseOutBytesByInt(ETH_HEADER_SIZE + IP_HEADER_SIZE + CSYN_SIZE + ((pktCount - 1) / 8 + 1));
	di->increaseOutPackets();
#endif

	if (j == 0) { //get all the packets
		return true;
	}
	return false;
}
开发者ID:crockct,项目名称:GNRS-DOS,代码行数:58,代码来源:mfsegmentor.cpp


示例12: l2_packet_send

int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
		   const u8 *buf, size_t len)
{
	if (!l2->l2_hdr) {
		int ret;
		struct l2_ethhdr *eth = os_malloc(sizeof(*eth) + len);
		if (eth == NULL)
			return -1;
		os_memcpy(eth->h_dest, dst_addr, ETH_ALEN);
		os_memcpy(eth->h_source, l2->own_addr, ETH_ALEN);
		eth->h_proto = htons(proto);
		os_memcpy(eth + 1, buf, len);
		ret = pcap_inject(l2->pcap, (u8 *) eth, len + sizeof(*eth));
		os_free(eth);
		return ret;
	} else
		return pcap_inject(l2->pcap, buf, len);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:18,代码来源:l2_packet.c


示例13: packetrelay

int packetrelay(pcap_t *pcd, char *dev, u_char *packet, u_char *g_ip, u_char *t_ip, u_char *s_mac, u_char *t_mac, u_char *g_mac){
    struct ether_header *etheh;
    struct ip *iph;
    u_char tip[IPSIZE], sip[IPSIZE];
    u_char *cp = packet;
    etheh = (struct ether_header *)cp;
    if(etheh == NULL)
        return 0;
    cp += sizeof(struct ether_header);
    if(etheh->ether_type == ntohs(ETHERTYPE_IP)){
        iph = (struct ip*)cp;

        inet_ntop(AF_INET, &iph->ip_dst, tip, sizeof(tip));
        inet_ntop(AF_INET, &iph->ip_src, sip, sizeof(sip));
        if(!strcmp(sip, t_ip)){
            memcpy(etheh->ether_dhost, g_mac, MACASIZE);
            memcpy(etheh->ether_shost, s_mac, MACASIZE);
            pcap_inject(pcd, packet, sizeof(struct ether_header) + ntohs(iph->ip_len));
        }
        else if(!strcmp(tip, t_ip) && !memcmp(etheh->ether_shost, g_mac, MACASIZE)){
            memcpy(etheh->ether_shost, s_mac, MACASIZE);
            memcpy(etheh->ether_dhost, t_mac, MACASIZE);
            pcap_inject(pcd, packet, sizeof(struct ether_header) + ntohs(iph->ip_len));
        }
    }
    else if (etheh->ether_type == ntohs(ETHERTYPE_ARP)){
        struct ether_arp *arph;
        cp = (struct ether_arp*)cp;
        inet_ntop(AF_INET, &arph->arp_tpa, tip, sizeof(tip));
        inet_ntop(AF_INET, &arph->arp_spa, sip, sizeof(sip));
        if((!strcmp(sip, t_ip) && !strcmp(tip, g_ip)) || (!strcmp(sip, g_ip) && !strcmp(tip, t_ip))){
            if((sendarprep(pcd ,dev, packet, g_ip, s_mac, t_ip, t_mac)) ==-1) {
                pcap_perror(pcd,0);
                pcap_close(pcd);
                exit(1);
            };
            if((sendarprep(pcd, dev, packet, t_ip, s_mac, g_ip, g_mac)) ==-1) {
                pcap_perror(pcd,0);
                pcap_close(pcd);
                exit(1);
            };
        }
    }
}
开发者ID:Ri0S,项目名称:arp_poison,代码行数:44,代码来源:packetcntl.c


示例14: dt_simulate_send

int dt_simulate_send(pcap_t *p, const void *buf, size_t size) {
  int bytesSend;

  /* send packet */
  bytesSend = pcap_inject(p, buf, size);
  if (bytesSend != size) {
    fprintf(stderr, "WARNING: pcap_inject\n");
  }
  return bytesSend;
}
开发者ID:federicomariti,项目名称:deviceTester,代码行数:10,代码来源:deviceTester_impl.c


示例15: inject_command

void inject_command(pcap_t *fp, gcry_cipher_hd_t * hd,char * dst_mac, char * command, int len, unsigned long * seqnum){
        char pkt[1000];
        u_char buf[1024];
        u_char iv[GCRY_IVLEN]={0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11};
        len+=SEQ_LEN;
        char pkt_len[6];


        char type[] =  {    0x00,0x00,0x0d,0x00,0x04,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,
			    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x11,0x00,0x00,0x05,
		             'I', 'N', 'T', 'C', 'P',0x01,0x04,0x82,0x84,0x8b,0x96,0x03,0x01,0x0c,0x04,0x06,0x01,0x02,0x00,0x00,0x00,0x00,0x05,0x04,0x00,0x01,0x00,0x00,0xdd,0x18,0x00,0x50,0xf2,0x01,0x01,
			    0x00,0x00,0x50,0xf2,0x04,0x01,0x00,0x00,0x50,0xf2,0x04,0x01,0x00,0x00,0x50,0xf2,0x02,0x00,0x00}; 



        u_int tlen=len+MAC_LEN+CHECKSUM_LEN+GCRY_IVLEN;
        random_vector(iv,GCRY_IVLEN);
        memcpy(&pkt[0],dst_mac,MAC_LEN);
        memcpy(&pkt[MAC_LEN],iv,GCRY_IVLEN);
        gcry_cipher_setiv(*hd,iv, GCRY_IVLEN);


        char cmdseq[1000];
        memcpy(cmdseq,command,len);
        u_int ac=0;
        (*seqnum)++;
        if(*seqnum>0xFFFFFFFF){*seqnum=0x01;}
        for(ac=0;ac<SEQ_LEN;ac++){
                cmdseq[len-1-ac]=(char)((*seqnum)>>(ac*8));
        }

        gcry_cipher_encrypt(*hd, &pkt[GCRY_IVLEN+MAC_LEN],len , cmdseq, len);

        u_int chk=checksum(pkt,tlen);
        u_char chkarr[CHECKSUM_LEN];
        chkarr[0]=(chk>>8);
        chkarr[1]=chk&0x00FF;

        memcpy(&pkt[GCRY_IVLEN+MAC_LEN+len], chkarr,CHECKSUM_LEN);
        memcpy(buf, type, sizeof(type));
        memcpy(buf+sizeof(type), pkt, tlen);

	#ifndef MANDO_ABORDO
        print_vector(pkt,tlen);
        #endif

        for(ac=0;ac<BEACONS_PER_REQUEST;ac++){
	    int inj=pcap_inject(fp,buf, sizeof(type)+sizeof(pkt_len)+tlen);
	    #ifndef MANDO_ABORDO
		printf("\r\n INJ %i",inj);
	    #endif	
            
        }
        
}
开发者ID:RootedWarfare,项目名称:Atropos-Flight-Control,代码行数:55,代码来源:udp_emisora.c


示例16: tap_callback

/*
 * tap_callback
 *
 * This function is called every times a package is received through the
 * (optional) tap device. It retransmits the package to all connected devices.
 */
void
tap_callback(void)
{
  int len, i;

  len = read(tapFD, buffer, sizeof(buffer));
  if (len > 0) {
    for (i = 0; i < deviceCount; i++) {
      pcap_inject(devices[i], buffer, len);
    }
  }
}
开发者ID:CharlieTLe,项目名称:qurinet,代码行数:18,代码来源:netsimpcap.c


示例17: epcap_send

    static void
epcap_send(EPCAP_STATE *ep)
{
    const int fd = STDIN_FILENO;
    ssize_t n = 0;
    unsigned char buf[SNAPLEN] = {0};
    u_int16_t len = 0;

    for ( ; ; ) {
        if (child_exited)
            return;

        n = read_exact(fd, buf, sizeof(len));

        if (n != sizeof(len)) {
            VERBOSE(1, "epcap_send: header len != %lu: %ld",
                    (unsigned long)sizeof(len), (long)n);
            return;
        }

        len = (buf[0] << 8) | buf[1];

        VERBOSE(2, "epcap_send: packet len = %u", len);

        if (len >= sizeof(buf))
            return;

        n = read_exact(fd, buf, len);

        if (n != len) {
            VERBOSE(1, "epcap_send: len = %u, read = %ld",
                    len, (long)n);
            return;
        }

        if (ep->opt & EPCAP_OPT_INJECT) {
            n = pcap_inject(ep->p, buf, len);

            if (n < 0) {
                VERBOSE(0, "epcap_send: %s", pcap_geterr(ep->p));
                return;
            }
            else if (n != len) {
                VERBOSE(1, "epcap_send: len = %u, sent = %ld",
                        len, (long)n);
            }
        }
        else {
            VERBOSE(2, "epcap_send: ignoring: len = %u", len);
        }
    }
}
开发者ID:kostyushkin,项目名称:epcap,代码行数:52,代码来源:epcap.c


示例18: pb_transmit_packet

void pb_transmit_packet(pcap_t *ppcap, int seq_nr, uint8_t *packet_transmit_buffer, int packet_header_len, const uint8_t *packet_data, int packet_length) {
	//add header outside of FEC
	wifi_packet_header_t *wph = (wifi_packet_header_t *)(packet_transmit_buffer + packet_header_len);
	wph->sequence_number = seq_nr;
	//copy data
	memcpy(packet_transmit_buffer + packet_header_len + sizeof(wifi_packet_header_t), packet_data, packet_length);
	int plen = packet_length + packet_header_len + sizeof(wifi_packet_header_t);
	int r = pcap_inject(ppcap, packet_transmit_buffer, plen);
	if (r != plen) {
		pcap_perror(ppcap, "Trouble injecting packet");
		exit(1);
	}
}
开发者ID:OpenGelo,项目名称:multigcs,代码行数:13,代码来源:wifibc-tx.c


示例19: mrb_capture_inject

static mrb_value
mrb_capture_inject(mrb_state *mrb, mrb_value self)
{
  struct capture_object *cap;
  const char *data;
  mrb_int len, n;
  cap = (struct capture_object *)mrb_get_datatype(mrb, self, &mrb_pcap_type);
  if (!cap) return mrb_nil_value();

  mrb_get_args(mrb, "s", &data, &len);
  n = pcap_inject(cap->pcap, data, (size_t)len);
  return mrb_fixnum_value(n);
}
开发者ID:selman,项目名称:mruby-pcap,代码行数:13,代码来源:pcap.c


示例20: send_packet

/* 
 * All transmissions are handled here to ensure that the receive timer 
 * is always started immediately after a packet is transmitted.
 */
int send_packet(const void *packet, size_t len)
{
	int ret_val = 0;

	if(pcap_inject(get_handle(), packet, len) == len)
	{
		ret_val = 1;
	}
		
	start_timer();

	return ret_val;
}
开发者ID:2e4L,项目名称:reaver-wps,代码行数:17,代码来源:send.c



注:本文中的pcap_inject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pcap_lookupdev函数代码示例发布时间:2022-05-30
下一篇:
C++ pcap_geterr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap