Linux·¢ËÍarpÇëÇóÓë½ÓÊÕarpÏìÓ¦
Linux ÖлñµÃ±¾»úÍø¿¨MACµØÖ·ºÜ¼òµ¥£¬ioctl()¾ÍOK¡£¿ÉÈçºÎ»ñµÃ¾ÖÓòÍøÆäËûÖ÷»úµÄMACµØÖ·ÄØ…Á´Â·²ã¹ã²¥ARPÇëÇó£¬È»ºó½ÓÊÕARPÏìÓ¦¡£ÊµÏÖ½é¸ö¹¦ÄÜÆäʵÒÑÓÐÏÖ³ÉÈý·½¿â¿ÉÓã¬Èçlibnet¡£²»¹ýÏë¼ÓÉî¶ÔÐÒéµÄÀí½âºÍLinuxÍøÂç±à³ÌAPIµÄÀí½â£¬jiayi »¹ÊǾö¶¨ÓÃLinuxµÄPF_PACKET×Ô¼ºÊµÏÖ£¬¸Ä°¡¸Ä£¬ÖÕÓڳɹ¦¡«ÒÔÏÂÊÇ´óÌå˼·
1. ΪÊý¾Ý±¨·ÖÅä¿Õ¼ä£¬´´½¨ÏàÓ¦µÄ½á¹¹Ìå req£¬arp Êý¾Ý±¨µÄÖ¡¸ñʽÈçͼ
2. ´´½¨ PF_PACKET ÔʼÌ×½Ó×Ö£¬·¢ËÍÌ×½Ó×ÖΪ reqfd£¬½ÓÊÕÌ×½Ó×ÖΪ recvfd
3. ÌîдÁ´Â·²ãͨÓýṹÌå reqsa
3. get_ifi()»ñÈ¡±¾»úÍøÂç½Ó¿ÚÊý¾Ý£¬ÌîдҪ·¢Ë͵ÄARPÊý¾Ý±¨ req ½á¹¹Ì壬sendto()·¢ËÍ
4. Ñ»·recvfrom()½ÓÊÕARPÏìÓ¦£¬Â˵ô¾Óɱ¾µØ½Ó¿ÚµÄÆäËûARPÊý¾Ý±¨
·¢ËÍARPÇëÇóÄÜ×öµÄʲ»½ö½ö»ñÈ¡MACµØÖ·°É…ÆäËû“ÓÐÒâÒ唵ÄÊÂÒ²¿ÉÒÔ³¢ÊÔÒ»ÏÂÏÂ……ÏÂÃæÊÇ´úÂë
C code
/**
* @send_arp.c
* @This software is intended to be used as a example to show how to send and receive arp request with Linux * PF_PACKET interface
* @Author£ºjiayi,http://www.jiayii.com
**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <sys/types.h>
#include <asm/types.h>
#include <features.h> /* ÐèÒªÀïÃæµÄ glibc °æ±¾ºÅ */
#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
#include <netpacket/packet.h>
#include <net/ethernet.h> /* Á´Â·²ã£¨L2£©ÐÒé */
#else
#include <asm/types.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h> /* Á´Â·²ãÐÒé */
#endif
#include <netinet/if_ether.h>
#define INLEN 4
#define MAC_BCAST_ADDR (uint8_t *) "\xff\xff\xff\xff\xff\xff"
void usage_quit(char *arg0);
int get_ifi(char *
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
tty0£6ÊÇlinux±¾µØÖÕ¶Ë£¬pts/xÊÇÔ¶³ÌµÇ½ÐèÒªµÄÖÕ¶Ë£¬±ÈÈçijÈËÒªtelnetµ½ÄãµÄ»ú×Ó£¬¾ÍÐèÒªÄãµÄϵͳÓÐpts/x¡£
»ù±¾¸ÅÄ
¡¡
¡¡1. tty(ÖÕ¶ËÉ豸µÄͳ³Æ):
¡¡¡¡ttyÒ»´ÊÔ´ÓÚTeletypes£¬»òÕßteletypewriters£¬ÔÀ´Ö¸µÄÊǵ紫´ò×Ö»ú£¬ÊÇͨ¹ý´®ÐÐÏßÓôòÓ¡»ú¼üÅÌͨ¹ýÔĶÁºÍ·¢ËÍÐÅÏ¢µÄ¶«Î÷£¬ºóÀ´Õâ¶«Î÷±»¼üÅÌÓëÏÔʾÆ÷È¡´ú ......
/* Offtimer.c.For auto halt. */
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define DELAY 60/* Time of sleeping */
int main()
{
time_t now;
struct tm *p;
while(1)
{
now = time(NULL);
&n ......
¶ÔÐí¶àÓû§À´Ëµ£¬ÔÚDOSºÍWindows»·¾³ÏÂÀûÓù¤¾ßÈí¼þARJ¡¢WinzipµÈ£¬Ñ¹Ëõ»ò½âѹÎļþÊDZȽÏÈÝÒ×µÄÊ¡£µ«ÊÇ£¬ÔÚLinuxÖÐÈçºÎ¶ÔÎļþ½øÐÐѹËõÓë½âÑ¹ÄØ£¿±¾ÎÄ»ùÓÚRed Hat 6.0£¬½éÉÜÁËѹËõÓë½âѹÎļþµÄ¼¸ÖÖ·½·¨Óë¼¼ÇÉ£¬Ï£Íû¶Ô¶ÁÕßÓÐÒ»¶¨µÄ°ïÖú¡£
ÃüÁ
compress
¸ñʽ£º
compress Ñ¡Ïî ÎļþÁбí
¹¦ÄÜ£º
ÓÃLempel-zivѹËõ·½·¨ ......