¸ß¼¶Linux³ÌÐòÉè¼ÆµÚÒ»Õ£ºÈëÃÅ
1¡¢ÓÃGCC±àÒë
1.1¡¢´´½¨Ô´Îļþ
(main.c) C Ô´Îļþ - main.c
#include
#include “reciprocal.hpp”
int main (int argc, char **argv)
{
int i;
i = atoi (argv[1]);
printf (“The reciprocal of %d is %g\n”, i, reciprocal (i));
return 0;
}
(reciprocal.cpp) C++ Ô´Îļþ - reciprocal.cpp
#include
#include “reciprocal.hpp”
double reciprocal (int i) {
// I should be non-zero.
assert (i != 0);
return 1.0/i;
}
(reciprocal.hpp) Í·Îļþ - reciprocal.hpp
#ifdef __cplusplus
extern “C” {
#endif
extern double reciprocal (int i);
#ifdef __cplusplus
}
#endif
1.2¡¢±àÒëÔ´Îļþ
±àÒëmain.c:
% gcc -c main.c
±àÒëreciprocal.cpp:
% g++ -c reciprocal.cpp
²ÎÊý-IÖ¸¶¨ËÑË÷Í·ÎļþµÄλÖá£
ĬÈÏÇé¿öÏ£¬GCCÔÚµ±Ç°Îļþ¼Ð¼°±ê×¼¿âµÄÍ·ÎļþËùÔÚµÄÎļþ¼ÐÀ´ËÑË÷Í·Îļþ¡£
% g++ -c -I ../include reciprocal.cpp
¿ÉÒÔÓòÎÊý-DÔÚÃüÁîÐÐÉ趨ºê(macro)£¬²¢ÇÒ¿ÉÒÔÉ趨ºêµÄÖµ
¶ÔÓÚÈçϳÌÐòdefinemacro.c:
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char** argv){
int i = 3;
#ifdef CHANGEVALUE
i = 4;
#endif
printf("i = %d\n", i);
printf("PT = %f\n", PI);
}
Èç¹û±àÒëʱÃüÁîÐÐΪgcc definemacro.c£¬»á±¨‘PI’ undeclared´íÎó¡£
Èç¹û±àÒëʱÃüÁîÐÐΪgcc -D PI=3.14 definemacro.c£¬ÔòÊä³öÈçÏ£º
i = 3
PT = 3.140000
Èç¹û±àÒëʱÃüÁîÐÐΪgcc -D PI=3.14 -D CHANGEVALUE definemacro.c£¬ÔòÊä³öÈçÏ£º
i = 4
PT = 3.140000
¿ÉÒÔÓÃGCC±àÒëʱÓÅ»¯´úÂë.
% g++ -c -O2 reciprocal.cpp
1.3¡¢Á´½Ó¶ÔÏóÎļþ
g++¿ÉÒÔ½«.o¶ÔÏóÎļþÁ´½Ó³É³ÌÐò
% g++ -o reciprocal main.o reciprocal.o
Èç¹ûÏëÁ´½ÓÆäËû¿âÎļþ£¬ÔòÓòÎÊý-I
ÀýÈçÓûÁ´½Ó¿âlibpam.a£¬ÔòÓÃÈçÏÂÃüÁîÐУ¬±àÒëÆ÷»á×Ô¶¯¼ÓÉÏǰ׺libºÍºó׺.a
% g++ -o reciprocal mai
Ïà¹ØÎĵµ£º
ÎÒÃÇÖªµÀÅжÏÒ»¸öϵͳµÄ¸ºÔØ¿ÉÒÔʹÓÃtop£¬uptimeµÈÃüÁîÈ¥²é¿´£¬Ëü·Ö±ð¼Ç¼ÁËÒ»·ÖÖÓ¡¢Îå·ÖÖÓ¡¢ÒÔ¼°Ê®Îå·ÖÖÓµÄϵͳƽ¾ù¸ºÔØ¡£
¡¡¡¡Äã¿ÉÄܶÔÓÚ Linux µÄ¸ºÔؾùÖµ(load averages)ÒÑÓÐÁ˳ä·ÖµÄÁ˽⡣¸ºÔؾùÖµÔÚ uptime »òÕß top ÃüÁîÖпÉÒÔ¿´µ½£¬ËüÃÇ¿ÉÄÜ»áÏÔʾ³ÉÕâ¸öÑù×Ó£º
¡¡¡¡
Shell´úÂë
load average: 0.0 ......
LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º liukang@bjut.edu.cn
slab.cÀ´×ÔlinuxÄÚºË2.4.22°æ£¬±¾Îļþ°´ÕÕGNUÐÒé·¢²¼¡£
Ò»¡¢×¼±¸ÖªÊ¶£º
slabµÄ¸ÅÄ
Ìá³öµÄÔÒò£ºÓÉÓÚ²Ù×÷ϵͳÔÚÔËÐÐÖл᲻¶Ï²úÉú¡¢Ê¹Óá¢ÊÍ·Å´óÁ¿Öظ´µÄ¶ÔÏó£¬
ËùÒÔ¶ÔÕâÑùµÄÖظ´¶ÔÏóµÄÉú³É½øÐиĽø¿ÉÒÔ´ó´óÌá¸ßЧÂÊ
×îÔçÓÉsunµÄ¹¤³ÌʦÌá³ö(1994Äê)²¢Ê×ÏÈÔ ......
ÔÚSWAP¿Õ¼ä²»¹»ÓõÄÇé¿öÏ£¬ÈçºÎÊÖ¹¤Ìí¼ÓSWAP¿Õ¼ä£¿ÒÔϵIJÙ×÷¶¼ÒªÔÚrootÓû§Ï½øÐУº
¡¡¡¡Ê×ÏÈÏȽ¨Á¢Ò»¸ö·ÖÇø£¬²ÉÓÃddÃüÁî±ÈÈç
¡¡¡¡dd if=/dev/zero of=/home/swap bs=1024 count=512000
¡¡¡¡ÕâÑù¾Í»á´´½¨/home/swapÕâôһ¸ö·ÖÇøÎļþ¡£ÎļþµÄ´óСÊÇ512000¸öblock£¬Ò»°ãÇé¿öÏÂ1¸öblockΪ1K£¬ËùÒÔÕâÀï¿Õ¼äÊÇ512M¡£½Ó×ÅÔ ......
1)webmin
WebminÊÇÄ¿Ç°¹¦ÄÜ×îÇ¿´óµÄ»ùÓÚWebµÄUnixϵͳ¹ÜÀí¹¤¾ß¡£¹ÜÀíԱͨ¹ýä¯ÀÀÆ÷·ÃÎÊWebminµÄ¸÷ÖÖ¹ÜÀí¹¦Äܲ¢Íê³ÉÏàÓ¦µÄ¹ÜÀí¶¯×÷¡£Ä¿Ç°
WebminÖ§³Ö¾ø´ó¶àÊýµÄUnixϵͳ£¬ÕâЩϵͳ³ýÁ˸÷ÖÖ°æ±¾µÄlinuxÒÔÍ⻹°üÀ¨£ºAIX¡¢HPUX¡¢Solaris¡¢Unixware¡¢Irix
ºÍFreeBSDµÈ¡£
Webmin ÈÃÄúÄÜ ......
/*
* /*
* Linux x86 Dropbear SSH <= 0.34 remote root exploit
* coded by live
*
* You'll need a hacked ssh client to try this out. I included a patch
* to openssh-3.6.p1 somewhere below this comment.
*
* The point is: the buffer being exploited is too small(25 bytes) to hold our
......