User Controls

Problem passing shell commands from a shelscript in bash.

  1. #1
    Sophie Pedophile Tech Support
    I has a script that is going to run some bash commands if certain criteria are met. Consider the following example i just made up on the fly because i don't have my original script on this pc:


    #/bin/bash
    Go=$1
    list="/etc/list.txt"

    if [ "Go" == "' ]
    then
    echo "provide arbitrary arg, lulz..."
    else
    `cat $list | xargs curl "custom: arg1 arg2 arg3 | printf /n`
    fi

    # In my original script i have a some more code here which is important as you'll read shortly.


    Ok see the part where i am telling bash to run shell commands? Contents of list.txt should be passed to curl via xargs, however the curl argument "custom: is essential to the proper way in which i intend to use curl to retrieve the data i want.However this is where a problem arises, backticks tell bash to treat what ever is inbetween them as shell commands as you may know. However the quotation marks are problematic since they escape the backticked area of the code. If i don't add another quotation mark just before the end backtick the rest of the script is treated by bash as if it were shell commands which breaks the script but if i keep the quotation mark at the end curl might not do what i want.

    Also printf /n prints a new line right? I am never sure. Lel.

    So... wut do?




  2. #2
    Sophie Pedophile Tech Support
    Also guys i would test it myself with the quotation mark in curl to see what happens but since my main machine is still having trouble with my internet connection i cannot because as you know curl requires a connection to the web lol.

    so if you are able to help in any way it would be really appreciated. When the original shellscript is done it's going to be really easy to 'cat etc/passwd' a list of hosts vulnerable to shellshock from your terminal i might even extend it to add options to automatically enumerate a number of other valuable information from the hosts. I am pretty excited about it and will of course be pushing my work to github if you are interested in the functional script or wish to extend or improve it's funcrionality, i am all about open source.
Jump to Top