Linuxϼ¸Àý×¥°ü³ÌÐò´úÂë
×¥°ü³ÌÐò1 grub_allpacket.c
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <linux/in.h>
#include <linux/if_ether.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int sock, n,i;
char buffer[2048];
unsigned char *iphead, *ethhead;
struct ifreq ethreq;
if ( (sock=socket(PF_PACKET, SOCK_RAW,
htons(ETH_P_IP)))<0) {
perror("socket");
exit(1);
}
/* Set the network card in promiscuos mode */
strncpy(ethreq.ifr_name,"eth0",IFNAMSIZ);
if (ioctl(sock,SIOCGIFFLAGS,ðreq)==-1) {
perror("ioctl");
close(sock);
exit(1);
}
ethreq.ifr_flags|=IFF_PROMISC;
if (ioctl(sock,SIOCSIFFLAGS,ðreq)==-1) {
perror("ioctl");
close(sock);
exit(1);
}
while (1) {
printf("----------\n");
n = recvfrom(sock,buffer,2048,0,NULL,NULL);
printf("%d bytes read\n",n);
printf("the frame content is :\n");
for(i=0;i<n;)
{
printf("%02x",(unsigned char)buffer[i]);
fflush(stdout);
i=i+1;
if(i%8==0)
printf("\n");
else
printf(":");
}
printf("\n");
/* Check to see if the packet contains at least
&nbs
Ïà¹ØÎĵµ£º
ronÊÇÒ»¸ölinuxϵĶ¨Ê±Ö´Ðй¤¾ß£¬¿ÉÒÔÔÚÎÞÐèÈ˹¤¸ÉÔ¤µÄÇé¿öÏÂÔËÐÐ×÷Òµ¡£ÓÉÓÚCron ÊÇLinuxµÄÄÚÖ÷þÎñ£¬µ«Ëü²»×Ô¶¯ÆðÀ´£¬¿ÉÒÔÓÃÒÔϵķ½·¨Æô¶¯¡¢¹Ø±ÕÕâ¸ö·þÎñ:
¡¡¡¡/sbin/service crond start //Æô¶¯·þÎñ
¡¡¡¡/sbin/service crond stop //¹Ø±Õ·þÎñ
¡¡¡¡/sbin/service crond restart //ÖØÆô·þÎñ
¡¡¡¡/sbin/service crond ......
ËùÓÐÏ̶߳¼ÓÐÒ»¸öÏ̺߳ţ¬Ò²¾ÍÊÇ
Thread ID
¡£ÆäÀàÐÍΪ
pthread_t
¡£Í¨¹ýµ÷ÓÃ
pthread_self()
º¯Êý¿ÉÒÔ»ñµÃ×ÔÉíµÄÏ̺߳š£
ÏÂÃæ˵һÏÂÈçºÎ´´½¨Ò»¸öÏ̡߳£
ͨ¹ý´´½¨Ị̈߳¬Ï߳̽«»áÖ´ÐÐÒ»¸öÏ̺߳¯Êý£¬¸ÃÏ̸߳ñʽ±ØÐë°´ÕÕÏÂÃæÀ´ÉùÃ÷£º
void * Thread_Function(void *)
´´½¨Ï ......
1.1.1 iptablesÔÀí
1.1.2 ÒÔ±¾µØΪԴµÄ°ü·¾¶
Step
Table
Chain
Comment
1
±¾µØ³ÌÐò£¨±ÈÈ磬·þÎñ³ÌÐò»ò¿Í»§³ÌÐò£©
2
·ÓÉÅжϣ¬ÒªÊ¹ÓÃÔ´µØÖ·£¬Íâ³ö½Ó¿Ú£¬»¹ÓÐÆäËûһЩÐÅÏ¢¡£
3
mangle
OUTPUT
ÔÚÕâ¶ù¿ÉÒÔmangle°ü¡£½¨Òé²»ÒªÔÚÕâ¶ù×ö¹ýÂË£¬¿ ......
system-config-printer ͼÐνçÃæÉèÖôòÓ¡»ú
BSD(FreeBSD)/System V
lpr/lp ´òÓ¡ÎļþÃû ´òÓ¡
lpr -P´òÓ¡»úÃû ´òÓ¡ÎļþÃû
lp &nb ......