net :: libdnet.

Dug SongÀÇ libdnet ¿ë ¹ÙÀεù
Áö±Ý ´Ù¿î·Îµå

net :: libdnet. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • Perl Artistic License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Patrice Auffret
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~gomor/

net :: libdnet. ű×


net :: libdnet. ¼³¸í

ÆÄ°í ¼ÛÀÇ libdnet¿¡ ´ëÇÑ ¹ÙÀεù net :: libdnetÀº ³×Æ®¿öÅ© ÁÖ¼Ò Á¶ÀÛ, Ä¿³Î ARP ij½Ã ¹× ¶ó¿ìÆ® Å×À̺í Á¶È¸ ¹× Á¶ÀÛ, ³×Æ®¿öÅ© ¹æÈ­º® °Ë»ö ¹× Á¶ÀÛ, ³×Æ®¿öÅ© Æ®·¡ÇÈ Â÷´ÜÀ» Æ÷ÇÔÇÏ¿© ¿©·¯ °³ÀÇ Àú¼öÁØ ³×Æ®¿öÅ· ·çƾ¿¡ ´ëÇÑ ´Ü¼øÈ­ µÈ ÈÞ´ë¿ë ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. ÅͳΠÀÎÅÍÆäÀ̽º ¹× ¿ø½Ã IP ÆÐŶ ¹× ÀÌ´õ³Ý ÇÁ·¹ÀÓ Àü¼ÛÀ» ÅëÇØ LIBPCAP.ALL¿¡¼­ Á¦°øÇÏ´Â ±â´ÉÀ» º¸¿ÏÇϱâÀ§ÇÑ °ÍÀÔ´Ï´Ù. ¿ø·¡ ¹× ¾µ¸ð¾ø´Â ÇÔ¼ö´Â ÇØÁ¦µÇÁö ¾ÊÀº °æ¿ì ¹®Á¦°¡ ¹ß»ýÇÒ ¶§ Ç¥ÁØ ¿À·ù¿¡ °æ°í ¸Þ½ÃÁö¸¦ ÀμâÇÕ´Ï´Ù. ¾µ¸ð¾ø´Â ÇÔ¼ö´Â addr_cmp, addr_bcast, addr_net, arp_add, arp_get_get, intf_get, intf_get_src, intf_get_dst, route_add, route_delete, route_get.these osbsolete ÇÔ¼ö°¡ °è¼Ó ÀÛµ¿ÇÏ¿© ¿ª ȣȯ¼ºÀ» À¯ÁöÇÏÁö¸¸ ´õ ÀÌ»ó »ç¿ëÇÏ¸é ¾ÈµË´Ï´Ù. »õ·Î¿î API°¡ ¼±È£µÇ¾î¾ßÇÕ´Ï´Ù. ÇϳªÀÇ »õ·Î¿î API°¡ ÀÖÀ¸¸ç, Çϳª´Â ³·Àº ¼öÁØÀÇ LibdNet ÇÔ¼ö ÀÏÄ¡ÇÏ°í ´Ù¸¥ Çϳª´Â Perl °´Ã¼ ÁöÇâ ÇÁ·Î±×·¡¹Ö°ú ÀÏÄ¡ÇÏ´Â °í±Þ APIÀÔ´Ï´Ù. ÀÌ ÃֽŠ°ÍÀº ¸Å¿ì ¼±È£ÇÕ´Ï´Ù. ½½¸®ºê ¸ðµâÀº ³·Àº ¼öÁØÀÇ API¸¦ ±¸ÇöÇÕ´Ï´Ù. ÇÏÀÌ ·¹º§ API´Â ´ÙÀ½ ¸ðµâÀ» »ç¿ëÇÏ¿© ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. net :: libdnet :: intf, net :: libdnet :: route, net :: libdnet :: fw, net :: libdnet :: arp, net :: libdnet : : eth, net :: libdnet :: IP ¹× net :: libdnet :: tun.synopsis # # ÀÌ°ÍÀº ¸ðµç ÇÔ¼ö¿Í »ó¼ö # net :: libdnetÀ» »ç¿ëÇÕ´Ï´Ù. # # ³×Æ®¿öÅ© ÀÎÅÍÆäÀ̽º Á¶ÀÛ # !!! Á¶¾ð : net :: libdnet :: intf ´ë½Å net :: libdnet qw (: intf)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. MY $ INTF = DNET_INTF_OPEN (); MY $ ETH = DNET_INTF_GET ($ intf, {intf_name => 'eth0'}); "IP :"ÀμâÇϽʽÿÀ. $ eth -> {intf_addr}. "\ n"; Àμâ "Mac :". $ eth -> {intf_link_addr}. "\ n"; MY $ DST = DNET_INTF_GET_DST ($ INTF, '192.168.0.10'); "name :". $ dst -> {intf_name} "\ n"; "IP :"ÀμâÇϽʽÿÀ. $ dst -> {intf_addr}. "\ n"; "Mac :"ÀμâÇϽʽÿÀ. $ dst -> {intf_link_addr}. "\ n"; ³» $ src = dnet_intf_get_src ($ intf, '192.168.0.1'); "name :". $ src -> {intf_name} "\ n"; "IP :"ÀμâÇϽʽÿÀ. $ src -> {intf_addr}. "\ n"; Àμâ "Mac :". $ src -> {intf_link_addr}. "\ n"; dnet_intf_close ($ intf); # # # ARP ij½Ã Á¶ÀÛ # !!! Á¶¾ð : Net :: libdnet :: arp ´ë½Å # net :: libdnet qw (: ARP)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. MY $ ARP = DNET_ARP_OPEN (); ³» $ entry = dnet_arp_get ($ arp, {arp_pa => '10 .0.0.1 '}); "Mac :"ÀμâÇϽʽÿÀ. $ entry -> {arp_ha} "\ n"; dnet_arp_add ($ arp, {arp_ha => '00 : 11 : 22 : 33 : 44 : 55 ', arp_pa => '10 .0.0.10'}); dnet_arp_delete ($ arp, {arp_ha => '00 : 11 : 22 : 33 : 44 : 55 ', arp_pa => '10 .0.0.10'}); DNET_ARP_CLOSE ($ ARP); # # ·çÆ® Å×À̺í Á¶ÀÛ # !!! Á¶¾ð : net :: libdnet :: lorting ´ë½Å # net :: libdnet qw (: °æ·Î)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. MY $ ROUTE = DNET_ROUTE_OPEN (); DNET_ROUTE_ADD ($ ROUTE, {ROUTE_GW => '10.0.0.1 ', ROUTE_DST =>'192.168.0.1 '}); DNET_ROUTE_DELETE ($ ROUTE, {ROUTE_GW => '10 .0.0.1 ', ROUTE_DST =>'192.168.0.1 '}); $ GET = DNET_ROUTE_GET ($ ROUTE, {ROUTE_DST => '192.168.0.10'}); "GW :"ÀμâÇϽʽÿÀ. $ get -> {route_gw}. "\ n"; DNET_ROUTE_CLOSE ($ ROUTE); # # ¹æÈ­º® ±ÔÄ¢ Á¶ÀÛ # !!! Á¶¾ð : ´ë½Å net :: libdnet :: fw¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. net :: libdnet qw (: fw : const); ³» $ fw = dnet_fw_open (); # ÀÌ°ÍÀº ¸Å¿ì º¹ÀâÇÕ´Ï´Ù. ÀÌ ±ÔÄ¢Àº TCP¸¦ 10.0.0.1 # 0.0.0.1 # Net :: libdnet :: fw¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. dnet_fw_add ($ fw, {fw_op => fw_dir_in, fw_proto => 6, fw_dst => '10 .0.0.1 '}); dnet_fw_delete ($ fw, {fw_op => fw_dir_in, fw_proto => 6, fw_dst => '10 .0.0.1 '}); DNET_FW_CLOSE ($ FW); # # # IP ·¹º§ # # !!! Á¶¾ð : Net :: libdnet :: IP ´ë½Å # net :: libdnet qw (: IP)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. MY $ IP = DNET_IP_OPEN (); MY $ RAW = "\ x47 \ x47 \ x47 \ x47"; DNET_IP_SEND ($ IP, $ RAW, ±æÀÌ ($ RAW)); DNET_IP_CLOSE ($ IP); # # ÀÌ´õ³Ý ·¹º§ # # !!! Á¶¾ð : net :: libdnet :: eth ´ë½Å # net :: libdnet qw (: eth)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. ³» $ eth = dnet_eth_open ( 'eth0'); DNET_ETH_SEND ($ eth, $ raw, ±æÀÌ ($ raw)); DNET_ETH_CLOSE ($ eth); # # ±³Åë Â÷´Ü # # !!! Á¶¾ð : net :: libdnet :: tun ´ë½Å # net :: libdnet qw (: Tun)¸¦ »ç¿ëÇؾßÇÕ´Ï´Ù. MY $ TUN = DNET_TUN_OPEN ('10.0.0.10 ','192.168.0.10 ', 1500); MY $ BUF = DNET_TUN_RECV ($ TUN, 1500); # $ BUF DNET_TUN_SEND ($ TUN, $ BUF, ±æÀÌ ($ BUF))¸¦ »ç¿ëÇÏ¿© ¹°°ÇÀ» ¼öÇàÇϽʽÿÀ. DNET_TUN_CLOSE ($ TUN); # # intf = {intf_len => 112, intf_len => intf_name => 'eth0', intf_name => nodef, intf_link_addr => '0000 : 11 : 22 : 33 : 44 : 55 ', intf_flags => 49, intf_addr => '10 .100.0.10 / 24', intf_alias_addrs => }; MY $ ARP = {ARP_PA => '10 .100.0.1 ', ARP_HA => '11 : 22 : 33 : 44 : 55 : 66'}; MY $ ROUTE = {ROUTE_GW => '10 .100.0.1 ', route_dst =>'0.0.0.0/0 '}; MY $ FW = {fw_dir => 2, fw_sport => , fw_dport => , fw_src => '0.0.0.0/0', fw_dst => '0.0.0.0/0', fw_proto => 6, fw_device => 'eth0', fw_op => 2}; ¿ä±¸ »çÇ× : ¡¤ Perl.


net :: libdnet. °ü·Ã ¼ÒÇÁÆ®¿þ¾î