L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h


Download 7.3 Mb.
Pdf ko'rish
bet84/115
Sana27.10.2023
Hajmi7.3 Mb.
#1728481
1   ...   80   81   82   83   84   85   86   87   ...   115
Bog'liq
linuxbasicsforhackers

79
E XERCISES
Before you move on to Chapter 8, try out the skills you learned from this chapter 
by completing the following exercises:
1. View all of your environment variables with the more command.
2. Use the echo command to view the HOSTNAME variable.
3. Find a method to change the slash (/) to a backslash (\) in the faux 
Microsoft cmd PS1 example (see Listing 7-2).
4. Create a variable named MYNEWVARIABLE and put your name in it.
5. Use echo to view the contents of MYNEWVARIABLE.
6. Export MYNEWVARIABLE so that it’s available in all environments.
7. Use the echo command to view the contents of the PATH variable.
8. Add your home directory to the PATH variable so that any binaries in your 
home directory can be used in any directory.
9. Change your PS1 variable to "World's Greatest Hacker:".



8
B A S H S C R I P T I N G
Any self-respecting hacker must be able 
to write scripts. For that matter, any self-
respecting Linux administrator must be 
able to script. Hackers often need to automate 
commands, sometimes from multiple tools, and this 
is most efficiently done through short programs they 
write themselves.
In this chapter, we build a few simple bash shell scripts to start you off 
with scripting. We’ll add capabilities and features as we progress, eventually 
building a script capable of finding potential attack targets over a range of 
IP addresses.
To become an elite hacker, you also need the ability to script in one of 
the widely used scripting languages, such as Ruby (Metasploit exploits are 
written in Ruby), Python (many hacking tools are Python scripts), or Perl 
(Perl is the best text-manipulation scripting language). I give a brief intro-
duction to Python scripting in Chapter 17.



Download 7.3 Mb.

Do'stlaringiz bilan baham:
1   ...   80   81   82   83   84   85   86   87   ...   115




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling