Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I'm new on this forum. I hope i'm in the right section for my question.. I'm trying to create a script that scans my home network for foreign (not ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2013
    Posts
    3

    network scan


    Hello,

    I'm new on this forum. I hope i'm in the right section for my question..

    I'm trying to create a script that scans my home network for foreign (not allowed) connections & gives me a popup on my pc. Not that there are lot of people that connect to my network without me knowing but still.. I thought it would be nice to create something like that & i like scripting so..

    For the moment i don't really know how to retrieve the hostnames from the used IP adresses. I tried nmap (with a few options) but i doesn't give me the information i want..
    The "problem" is that there are linux, windows & apple machines on the network.

    When using "ping -a xxx.xxx.xxx.xxx" in windows it gives me the hostname.. buti don't want to use windows for this.. I would like to create a daemon on my ubuntu server for this.

    Thx in advance..
    greg

  2. #2
    Just Joined! kerim's Avatar
    Join Date
    May 2010
    Location
    Istanbul
    Posts
    15

    Thumbs up Help for your script

    You can retrieve hostname with this command. (win/mac)

    You will scan with nmap and parse ip address, then you will use at this command

    You must install smbclient first


    Usage Example:
    Code:
    nmblookup -A 192.168.0.12
    it will give you an output like this
    Code:
    Looking up status of 192.168.0.12
    	KERIMS-IMAC     <00> -         H <ACTIVE> 
    
    	MAC Address = 10-DD-B1-XX-XX-XX
    You can parse this output

    KERIMS-IMAC is hostname

    You can use at your script

    Thats all......

  3. #3
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    428
    Very good question.

    It would seem to me that you should ask the router for a list of clients. So I think it would be router dependent, but I have no idea how to ask my router who it's talking to, outside of hitting it's web interface (192.168.1.254) manually. ISP gave me no documentation on this aspect of their fine blinkendongle when they forced me to use it.

    Perhaps a variant of
    Code:
     wget -r 192.168.1.254
    and then scram it through some filtering scripts?

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2013
    Posts
    3
    Thx for your reply..
    It looks like nmblookup can do the trick. I recieved the hostname from most of my clients.
    There were still a few that didn't. Probably because they don't have smbclient installed..
    I'll look into that later on.

    grtz

  6. #5
    Just Joined!
    Join Date
    Aug 2013
    Posts
    3
    Quote Originally Posted by Miven View Post
    Very good question.

    It would seem to me that you should ask the router for a list of clients. So I think it would be router dependent, but I have no idea how to ask my router who it's talking to, outside of hitting it's web interface (192.168.1.254) manually. ISP gave me no documentation on this aspect of their fine blinkendongle when they forced me to use it.

    Perhaps a variant of
    Code:
     wget -r 192.168.1.254
    and then scram it through some filtering scripts?

    Yes, that's the idea..
    I would like to know wich dhcp addresses (given by router) are in use.
    I could use the web interface to find out but it's easier if i could automate it.
    I don't have any permission to use wget on my router..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •