Results 1 to 10 of 12

Thread: Bash script examples

Hybrid View

  1. #1
    Member imported_vvpalin's Avatar
    Join Date
    Apr 2009
    Posts
    442

    Default Bash script examples

    I have come to the conclusion that i learn MUCH better by looking at others work rather than reading an article that just says this does this and that does that. I also obviously learn allot better if im interested in a certain subject as i think we all do.

    So im wondering is there a good site out there that has a collection of scripts i can take a look at. I'd prefer them to be security related as ill pick up on things quicker since thats what my focus is. However i really dont mind if there not.

    I seem to remember seeing a link posted in the forum of a very nice site with a ton of scripts but sadly im unable to find it and google isnt being much of a help.

    Im also open to suggestions of a forum or message board thats friendly to n00bs i can go to as this really isnt the place to be making 20 threads asking questions.

    Thanks for the help.
    Using backtrack for the first time is like being 10 years old again with the keys to a Ferrari.

  2. #2
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Man google gave me 731,000 hits with "bash scripting examples"

    Since I know that you are adept at using google, I would suggest
    the ibm link bash by example, the linuxconfiwiki link
    Also go back to that other thread on books, and have a look for bash scripting books offered by pureh@te ( I believe).

    Also as far as security programs go just go to the program and open it up with your favorite editor and have a look at. You could even take one of the simpler ones make a copy of it and set it to run from a different directory and then play with the code.
    netdiscover is a really simple program in this dept.

    As for forums there are some that are more noob tolerable but they may not give answers to "hacking/pentest" type questions. Or info on the tools.
    One such is http://www.linuxquestions.org/

    www.unix.com is another.
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  3. #3
    Developer
    Join Date
    Mar 2007
    Posts
    6,126

    Default

    When I was learning bash one of the guys on our Backtrack team jabra showed me this tool he wrote. Download the source and check it out. Its a insanely long script and there are perfect examples of almost every kind of thing you could hope for. Its a excellent example.

    http://getwifi.sourceforge.net/download.html

    And as already said http://www.amazon.com/Linux-Command-...2679180&sr=8-1

    Is the best bash book I have ever read. I didnt even know bash had fuctions until I read this. Also here is the source for my wpa crack script if that would help..

    http://pastie.org/482040

    I do understand how sometimes taking 4 or 5 other scripts and making your own is easier and more fun than examples in a book.

  4. #4
    Senior Member Thorn's Avatar
    Join Date
    Jan 2010
    Location
    The Green Dome
    Posts
    1,509

    Default

    Wicked Cool Shell Scripts is another good book for learning how to script in Bash.
    Thorn
    Stop the TSA now! Boycott the airlines.

  5. #5

    Default

    vvpalin; I've got about a dozen bash and perl scripts HERE that I wrote. I'm like you, I learn better by looking at what others have done and then figure out how to modify it for my own purposes.

    My personal theory: There has been only 1 original piece of code: hello world. Everything else has been a cut-n-paste modification of it!

  6. #6
    Jenkem Addict imported_wyze's Avatar
    Join Date
    Jul 2007
    Posts
    1,543

    Default

    Quote Originally Posted by Thorn View Post
    Wicked Cool Shell Scripts is another good book for learning how to script in Bash.
    I own it, but to me it's definitely not for n00bs. Very good resource for intermediate bash'ers though.
    dd if=/dev/swc666 of=/dev/wyze

  7. #7
    Senior Member Thorn's Avatar
    Join Date
    Jan 2010
    Location
    The Green Dome
    Posts
    1,509

    Default

    Quote Originally Posted by wyze View Post
    I own it, but to me it's definitely not for n00bs. Very good resource for intermediate bash'ers though.
    Good point, if you're new to Bash, you should probably have a solid grounding in a structured language to pick up on the scripts in WCSS. On the other hand, if you're looking to see how someone else has tackled some complicated ideas using Bash, it's a great reference and learning tool.
    Thorn
    Stop the TSA now! Boycott the airlines.

  8. #8
    Junior Member Relentless's Avatar
    Join Date
    Jan 2010
    Posts
    59

    Default Time frame to master Bash Scripting?

    [quote=pureh@te;133484]When I was learning bash one of the guys on our Backtrack team jabra showed me this tool he wrote.[end quote].

    I was just wondering how much time did it take to master bash scripting?

    I know that it can be a variable depended on the time of input and time allotted by a given individual; however, I just wanted to know how long it took pureh@te and the others, and if you used multiple books or just one book or only the listed books in this thread.

    It's also interesting to note that I also enjoy jumping into the code and getting hands dirty when learning a new language it is more fun than reading a million books on the theory behind a language I guess the best way to learn is the practical approach and when baffled by a piece of code- start referencing the theory or books to find solutions or the rules for a given language.

    So the next question would be what is best book with examples and solutions that one can follow by.

  9. #9
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Here area a couple more free resources that may be of help.
    Bash programming basics.
    http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
    Advanced Bash-scripting guide
    http://tldp.org/LDP/abs/html/
    tldp or The Linux Documentation Project has lots of good resources
    While a lot of it may be old in terms of dating, it is still mostly relevant and useful.
    Bash scripting tutorial from Linux Config
    http://www.linuxconfig.org/Bash_scripting_Tutorial
    A quick overview or reference page
    http://linuxhelp.blogspot.com/2005/1...ash-shell.html
    A bash scripting cheat sheet
    http://linux-sxs.org/programming/bashcheat.html
    Another with examples
    http://www.patchshorts.com/cheatsheets/bash
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  10. #10
    Member imported_vvpalin's Avatar
    Join Date
    Apr 2009
    Posts
    442

    Default

    Before i fall asleep can i ask a big favor ... Im probably going to write a firefox update script tomorrow and i was wondering how you could match a givin text string in a file and replace it with whatever you need. Im sure it will support wildcards so i really neednot ask but thats a must.

    Thanks a bunch.
    Using backtrack for the first time is like being 10 years old again with the keys to a Ferrari.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •