[ Pobierz całość w formacie PDF ]
.Here's a cool example.Make this script:cat >.lookeehere!who|morenetstat|moreRemember to save this script by holding down the control key while hittingthe letter "d".Now try the command: ".lookeehere!" You should get backsomething that looks like:bash:./.lookeehere!: Permission deniedThat's what will stump the average kode kiddie, presuming he can even findthat script in the first place.Now try the command "sh.lookeehere!" All of a sudden you get screen afterscreen of really interesting stuff!Your Internet Service provider may have disabled some of the commands ofthis Guide.Or it may have just hidden them in directories that you can getto if you know how to look for them.For example, if the "netstat" commanddoesn't work, give the command "whereis netstat." or else "locate netstat."If, for example, you were to find it in /usr/bin, you can make that commandwork with "/usr/bin/netstat" in your script.If neither the whereis or locate commands find it for you, if you are anewbie, you have two choices.Either get a better shell account, or talkyour sysadmin into changing permissions on that file so you can execute it.Many sysadmins will help you out this way -- that is, they will help if whenthey check their syslog files they don't find evidence of you trying tobreak into or trash computers.Neat trick: take your sysadmin to a fancyrestaurant and wait to ask him for access to EVERY Unix command until afteryou have paid for his meal.*****************************************************Evil genius tip: Your sysadmin won't let you run your favorite Unixcommands? Don't grovel! Compile your own! Most ISPs don't mind if you keepand use your favorite Unix stuff in your own account.Says Damian, "I tendto keep my own binaries in ~/bin/ (My home directory slash bin) and put thatin my path.(With the directory being 700 or drwx------ of course)."Where can you get your own? Try http://sunsite.unc.edu/pub/Linux/welcome.html*****************************************************Now it's time to really think about what you can do with scripts.Yes, ashell script can take a complex task such as impressing the heck out of yourfriends, and make it possible for you to do by giving just one command percool stunt.If you are a bit of a prankster, you could create a bunch of scripts anduse them to make your friends think you have a special, super duperoperating system.And in fact you really will, honestly, be in control ofthe most special, wonderful operating system on the planet.The beauty andpower of Unix is that it is so easy to customize it to do anything andeverything! Windows no! Unix yes!****************************************************Evil Genius tip: Bring up the file.login in Pico.It controls lots of whathappens in your shell account.Want to edit it? You could totally screw upyour account by changing.login.But you are a hacker, so you aren't afraid,right? Besides, if you mess up your shell account, you will force yourselfto either learn Unix real fast so you can fix it again, or else make friendswith tech support at your ISP as your try to explain why you accidentallymapped the letter "e" to mean "erase." (I did that once.Hey, no one'sperfect!)For example, do you have to put up with some babysitter menu every time youlog in? Do you see something that looks like "/usr/local/bin/menu" in.login? Put a "#" in front of that command (and any other ones you want toput to sleep) and it won't execute when you login.Then if you decide youare sorry you turned it off, just remove the "#" and that command will workagain.Damian adds "Of great importance to newbies and a sign of greatintelligence in advanced Unix gurus is backing up before you screw it up,i.e., in your pico of.cshrc.Their command lines should contain: mkdir.trash;chmod 700.trash;cp.cshrc.trash; pico.cshrc."Or, make the following alias in your.cshrc after creating your'.trash'directory: alias backup 'cp \!$ ~/.trash'"When you next source the.cshrc, you just type 'backup filename' and itwill be copied into the.trash directory in case you need it later."Modify the startup script, save the changes and then telnet in a secondtime to see if it works.If it doesn't, fix it or 'cp ~/.trash/.cshrc ~'.Idon't recommend you 'source' the newly modified file because if it'sscrewed, so are you.It's always best to keep one session untarnished, justin case.If it works OK on your 2nd login, then you can 'source.cshrc;rehash;' in your first window to take advantage of the changes made."*******************************************************OK, now how about just cutting loose and playing with scripts? See whatwonderful things you can do with them
[ Pobierz całość w formacie PDF ]