[ SEA-GHOST MINI SHELL]
#!/bin/bash
IFS=$'\n'
first=1
echo -ne "{ \"data\" : [\n";
for LINE in `iscsiadm -m session`
{
sid=`echo ${LINE}|awk '{print $2}'| sed 's/\[//g;s/\]//g'`
target=`echo ${LINE}|awk '{print $3}'`
name=`echo ${LINE}|awk '{print $4}'`
if [ ! -z "$sid" ]; then
if [ $first == 0 ]; then echo -ne ",\n";
fi
first=0
echo -ne "{"
echo -ne " \"{#SID}\" : \"$sid\" , \"{#TARGET}\" : \"$target\" , \"{#NAME}\" : \"$name\" ";
echo -ne " }"
fi
}
echo -ne " ]";
echo -ne " }\n";
SEA-GHOST - SHELL CODING BY SEA-GHOST