Skip to content
Snippets Groups Projects
Verified Commit da376b5f authored by David Beniamine's avatar David Beniamine
Browse files

Transmit file in one netcat

parent 909b75ee
No related branches found
No related tags found
No related merge requests found
...@@ -17,18 +17,13 @@ ...@@ -17,18 +17,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1) IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
netcat="netcat -l $IP 9999" port=9999
netcat="netcat -l $IP $port"
KPID=`ps aux | grep "$netcat" | awk '{print $2}'` KPID=`ps aux | grep "$netcat" | awk '{print $2}'`
[ ! -z "$KPID" ] && kill $KPID [ ! -z "$KPID" ] && kill $KPID > /dev/null 2>&1
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3) subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
host=$subnet.52 host=$subnet.52
port=9999
echo "get_registry" | netcat $host $port echo "get_registry" | netcat $host $port
nline=$($netcat | cut -d ' ' -f 1) stdbuf -i0 $netcat
i=0;
for i in $(seq 1 $nline)
do
$netcat
done
...@@ -47,11 +47,6 @@ do ...@@ -47,11 +47,6 @@ do
done done
elif [ $MAC == "get_registry" ] elif [ $MAC == "get_registry" ]
then then
hostfile="/etc/registry/hosts" stdbuf -oL cat /etc/registry/hosts | netcat $host $port
wc -l $hostfile | netcat $host $port
while read line
do
echo "$line" | netcat $host $port
done < $hostfile
fi fi
done done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment