Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14

Discussione: Script ip to hostname

  1. #1

    Script ip to hostname

    Ragassuoli da un file txt che contiene 8000 indirizzi ip io dovrei fare uno script che mi scrive affianco ad ogni indirizzo l' hostname che preleva con il comando

    codice:
    nbtscan 10.10.33.177
    
    Doing NBT name scan for addresses from 10.10.33.177
    
    IP address       NetBIOS Name     Server    User             MAC address
    ------------------------------------------------------------------------------
    10.10.33.177     NOTEBOOK0452592   <server>  <unknown>        00-0c-f1-22-41-f2
    Come si puo fare?
    Vi va di darmi una mano?
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    1,526
    Si dai mi va (almeno a me lol)
    Devi aggiungere quello in rosso ad ogni indirizzo ip della lista che gli corrisponde?

    comunque ti consiglio di postare dati di fantasia..

  3. #3
    Li avevo gia modificati

    la lista degli ip e' questa per esempio


    10.0.0.9
    10.40.2.46
    10.1.209.71
    10.1.206.216
    10.10.32.49
    10.30.30.23
    10.1.208.118
    10.0.001.17


    penso che il programma debba prendere il primo indirizzo fare nbtscan 10.0.0.9

    prendere il nome del HOSTNAME e non fa altro che scriverlo poi passa al secondo indirizzo e cosi via...

    mi consigliate anche un bel libro o qualcosa per imparare a fare queste cose??

    grassieeeee
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  4. #4
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    1,526
    http://www.pluto.it/files/ildp/guide/abs/index.html

    quello che devi fare non e' una cosa facilissima, ma siccome ogni problematica risulta un ottimo spunto, mi metto con carta e penna a studiarla..

  5. #5
    Grazie ma mi raccomando non voglio portarti via tempo utile per fare altre cose.
    Comunque non saprei se e' possibile estrarre l' hostname dal risultato del nbtscan.

    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  6. #6
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    1,526
    Originariamente inviato da claudiocrack
    Grazie ma mi raccomando non voglio portarti via tempo utile per fare altre cose.
    Comunque non saprei se e' possibile estrarre l' hostname dal risultato del nbtscan.

    si che si puo', ci sarebbe da smanettare con awk.Il guaio e' che non ho pc windows in rete e non posso neanche fare test

  7. #7
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    1,526
    dal manuale di nbtscan

    nbtscan -v -s : 192.168.1.0/24
    Scans C-class network. Prints results in script-friendly
    format using colon as field separator.
    Produces output like that:
    192.168.0.1:NT_SERVER:00U
    192.168.0.1:MY_DOMAIN:00G
    192.168.0.1:ADMINISTRATOR:03U
    192.168.0.2:OTHER_BOX:00U

  8. #8
    Utente di HTML.it L'avatar di toraz
    Registrato dal
    Nov 2001
    Messaggi
    263
    Se ho capito qual'è il problema, una cosa del genere dovrebbe servire allo scopo
    codice:
    for ip in $(cat file); do
      nbtscan $ip | tail -n 1 | cut -f 1-2
    done

  9. #9
    Originariamente inviato da detroit
    dal manuale di nbtscan

    nbtscan -v -s : 192.168.1.0/24
    Scans C-class network. Prints results in script-friendly
    format using colon as field separator.
    Produces output like that:
    192.168.0.1:NT_SERVER:00U
    192.168.0.1:MY_DOMAIN:00G
    192.168.0.1:ADMINISTRATOR:03U
    192.168.0.2:OTHER_BOX:00U

    non sarebbe male..unico problema che non mi deve scansionare tutta la rete ma solo gli indirizzi nel txt.


    for ip in $(cat file); do
    nbtscan $ip | tail -n 1 | cut -f 1-2
    done
    Ma e' "linguaggio bash" ??
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  10. #10
    Utente di HTML.it L'avatar di toraz
    Registrato dal
    Nov 2001
    Messaggi
    263
    Dovrebbe funzionare su qualsiasi shell POSIX, credo.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.