Networks explorationPost Exploitation Hacking Course

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATION
Already a Member Login Here

Home Forums Courses Post Exploitation Hacking Course Networks exploration

This topic contains 2 replies, has 3 voices, and was last updated by  cybermo 3 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22291

    Hugynn
    Participant

    Hey guys !

    Nothing much but I created a little script during a network practical at school and I wanted to have your thoughts on it (for possible improvements).
    My goal was to make a quick discovery of all networks I were plugged on (we used computers with multiple network interfaces) so the nmap options are not really advanced.

    Here seemed to be the right place but if I was wrong tell me so (and also if there is any big English mistakes, I’m french and want to improve 🙂 )

    There is the code :

    #!/bin/bash
    
    for interface in <code>ifconfig -s | cut -d&quot; &quot; -f1 | grep -v Iface | grep -v lo</code>; do
            bcast_ip=<code>ifconfig $interface | grep -Eo 'addr:([0-9]{1,3}\.){3}[0-9]{1,3}' | cut -d':' -f2</code>
            mask=<code>ifconfig $interface | grep -Eo 'Mask:([0-9]{1,3}\.){3}[0-9]{1,3}' | cut -d':' -f2</code>
            ip_nmap=""
            for i in {1..3}
            do
                    if [ <code>echo $mask | cut -d'.' -f$i</code> = 255 ]
                    then
                            ip_nmap=$ip_nmap<code>echo $bcast_ip | cut -d'.' -f$i</code>.
                    else
                            ip_nmap=$ip_nmap'0-255.'
                    fi
            done
            ip_nmap=$ip_nmap'0-255'
    
            echo "Starting nmap on $ip_nmap"
    
            nmap -sP -T4 $ip_nmap
    done

    EDIT : Hu… I do not know how to correct it so currently the code tags within the actual code correspond to grave accent…

    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    • This topic was modified 3 years, 7 months ago by  Hugynn.
    #43412

    kush
    Participant

    🙂

    #45695

    cybermo
    Participant

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel