From 10754eb7ca2caa64f543c60b5f8327330210e449 Mon Sep 17 00:00:00 2001 From: zeus Date: Thu, 4 Mar 2021 22:51:48 +0200 Subject: [PATCH] nmap --- README.md | 25 ++++++++----------- .../usr/share/swarmlab.io/sec/swarmlab-nmap | 6 +++++ .../usr/share/swarmlab.io/sec/swarmlab-sec | 7 ++++++ 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100755 install/usr/share/swarmlab.io/sec/swarmlab-nmap diff --git a/README.md b/README.md index cfe0d86..13ca163 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,17 @@ This is a quickstart guide of howto use this *LabInstance to deploy MPI programs ``` +#### Create hosts file + + +```bash + +``` + #### Compile -> mpicc -o /home/ubuntu/mpi_hello_world examples/mpi_hello_world.c +> mpicc -o /project/mpi_hello_world examples/mpi_hello_world.c #### run the MPI hello world program @@ -68,24 +75,12 @@ This is a quickstart guide of howto use this *LabInstance to deploy MPI programs # scp hello wrold to all clients. sudo -u mpi for auto scp connect. see /home/mpi/.ssh while read -r line; do - scp /home/ubuntu/mpi_hello_world ubuntu@$line:/home/ubuntu/mpi_hello_world -done < /home/ubuntu/hosts + scp /project/mpi_hello_world ubuntu@$line:/project/mpi_hello_world +done < /project/hosts ``` --- -#### Publish Your Work - - -```bash - - mkdir /home/ubuntu/directory - put your files and other directories into /home/ubuntu/directory - swarmlab-publish /home/ubuntu/directory - open URL in Browser - -``` - --- **MORE INFO** diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-nmap b/install/usr/share/swarmlab.io/sec/swarmlab-nmap new file mode 100755 index 0000000..b739754 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/swarmlab-nmap @@ -0,0 +1,6 @@ +#/bin/sh + +#ip=`nslookup hybrid-mpi_master_1.hybrid-mpi_hybrid-mpi | grep Addr | cut -d':' -f2 | grep -v 127.0.` +ip=`nslookup $NODENAME | grep Addr | cut -d':' -f2 | grep -v 127.0.` +nmap -sn -oG - $ip/24 | grep Up | cut -d ' ' -f 2 + diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-sec b/install/usr/share/swarmlab.io/sec/swarmlab-sec index 3d0283f..ee9eb64 100755 --- a/install/usr/share/swarmlab.io/sec/swarmlab-sec +++ b/install/usr/share/swarmlab.io/sec/swarmlab-sec @@ -41,6 +41,7 @@ IMAGE_origin="hub.swarmlab.io:5480/hybrid-mpi:latest" bootstrap="sec_bootstrap" hostnames="auto_update_hosts" hostnames_get="get_hosts" +NODENAME=${HYBRID_NETWORK}_master_1.${HYBRID_NETWORK}_${HYBRID_NETWORK} # shellcheck disable=SC1091 #. ./.env @@ -310,6 +311,8 @@ fi /bin/mkdir -p $Wdir/project +/bin/mkdir -p $Wdir/project/bin +/bin/cp -f $DIR/project/swarmlab-nmap $Wdir/project/bin /bin/cp -f $DIR/project/mpich-3.2.tar.gz $Wdir /bin/cp -f $DIR/project/examples $Wdir/project /bin/cp -f $DIR/project/hello_world.sh $Wdir/project @@ -333,6 +336,8 @@ services: master: image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME privileged: true + environment: + - NODENAME=${NODENAME} cap_add: - NET_ADMIN user: root @@ -348,6 +353,8 @@ services: worker: image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME privileged: true + environment: + - NODENAME=${NODENAME} cap_add: - NET_ADMIN user: root