Add input
This commit is contained in:
parent
42dc38258d
commit
8237793260
9
laconia
9
laconia
|
@ -13,14 +13,14 @@ usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
request(){
|
request(){
|
||||||
page=$(printf "$host /$path $( $post | wc -c )\r\n$post" | nc $host $port)
|
page=$(printf "$host /$path $post_len\r\n$post\r\n" | nc $host $port)
|
||||||
status=$(echo $page | awk 'NR == 1 {print $1}')
|
status=$(echo $page | awk 'NR == 1 {print $1}')
|
||||||
meta=$(echo $page | awk 'NR == 1 {$1=="";print}')
|
meta=$(echo $page | awk 'NR == 1 {$1=="";print}')
|
||||||
if [[ $status == 2 ]]; then
|
if [[ $status == 2 ]]; then
|
||||||
printf "$host /$path $( $post | wc -c )\r\n$post" | nc $host $port | awk 'NR > 1 {print}'
|
printf "$host /$path $post_len\r\n$post\r\n" | nc $host $port | awk 'NR > 1 {print}'
|
||||||
elif [[ $status == 3 ]]; then
|
elif [[ $status == 3 ]]; then
|
||||||
#path=$meta
|
#path=$meta
|
||||||
printf "%s %s 0\r\n" "$host" "/$path/"| nc $host 300
|
printf "%s %s %s\r\n%s\r\n" "$host" "/$path/" "$post_len" "$post" | nc $host $port | awk 'NR > 1 {print}'
|
||||||
elif [[ $status == 4 ]]; then
|
elif [[ $status == 4 ]]; then
|
||||||
printf "Client error: %s\n" "$meta"
|
printf "Client error: %s\n" "$meta"
|
||||||
elif [[ $status == 5 ]]; then
|
elif [[ $status == 5 ]]; then
|
||||||
|
@ -37,6 +37,7 @@ while getopts ":h:p:i:u:" arg; do
|
||||||
;;
|
;;
|
||||||
i | --input)
|
i | --input)
|
||||||
export post=$OPTARG
|
export post=$OPTARG
|
||||||
|
export post_len=$( echo $post | wc -c )
|
||||||
;;
|
;;
|
||||||
u | --url)
|
u | --url)
|
||||||
url_unparsed=$OPTARG
|
url_unparsed=$OPTARG
|
||||||
|
@ -47,6 +48,8 @@ while getopts ":h:p:i:u:" arg; do
|
||||||
host=$(echo "$url" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
|
host=$(echo "$url" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
|
||||||
path="$(echo $url | grep / | cut -d/ -f2-)"
|
path="$(echo $url | grep / | cut -d/ -f2-)"
|
||||||
port=${port:-300}
|
port=${port:-300}
|
||||||
|
post=${post:-""}
|
||||||
|
post_len=${post_len:-0}
|
||||||
request
|
request
|
||||||
else
|
else
|
||||||
echo $url_unparsed is not a Spartan URL
|
echo $url_unparsed is not a Spartan URL
|
||||||
|
|
Loading…
Reference in New Issue