IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Adresse IP dans un fichier texte


Sujet :

VBScript

  1. #1
    En attente de confirmation mail
    Homme Profil pro
    Responsable de service informatique
    Inscrit en
    Juin 2014
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Responsable de service informatique

    Informations forums :
    Inscription : Juin 2014
    Messages : 1
    Points : 3
    Points
    3
    Par défaut Adresse IP dans un fichier texte
    Bonsoir,

    je débute dans le domaine et je cherche un script au format VBS qui me permet d'inscrire dans un fichier texte (.txt) l'adresse IP. A présent je n'ai trouvé aucune aide adaptée à ma situation, c'est pour cela que je me tourne vers votre communauté.

    Je tiens à vous remercier d'avance pour votre aide,
    Cordialement.

  2. #2
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut IP-MAC.vbs

    Testez ce Vbscript IP-MAC.vbs
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    Option Explicit
    Dim MyFile,MaCommande,MaCommande1,MaCommande2,MaCommande3
    MyFile = "IP-MAC.txt"
    MaCommande = "if exist "& MyFile &" (del "& MyFile &")"
    MaCommande1 = "Arp -a > Tmpout.txt"
    MaCommande2 = "Cmd /U /C Type Tmpout.txt > "& MyFile &" & Del Tmpout.txt"
    MaCommande3 = "Start "& MyFile &""
    Call Executer(MaCommande,0,True)
    Call Executer(MaCommande1,0,True)
    Call Executer(MaCommande2,0,True)
    Call Executer(MaCommande3,0,False)
    '**************************************************************************************************************
    Function Executer(StrCmd,Console,bWaitOnReturn)
       Dim ws,MyCmd,Resultat
       Set ws = CreateObject("wscript.Shell")
    'La valeur 0 pour cacher la console MS-DOS
       If Console = 0 Then
          MyCmd = "CMD /C " & StrCmd & ""
          Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
          If Resultat = 0 Then
          Else
             MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
          End If
       End If
    'La valeur 1 pour montrer la console MS-DOS
       If Console = 1 Then
          MyCmd = "CMD /K " & StrCmd & ""
          Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
          If Resultat = 0 Then
          Else
             MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
          End If
       End If
       Executer = Resultat
    End Function
    '***********************************************************************************************************

  3. #3
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut Scan for IP and MAC Adress on LAN by Hackoo

    Vous pouvez essayer ce script batch
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    @echo off
    Title Scan for IP and MAC Adress on LAN by Hackoo
    mode con cols=60 lines=20
    Color A
    set ip=192.168.12.1
    set debut=1
    set fin=5
    if exist ping.txt  (del  ping.txt)
    if exist ping2.txt (del  ping2.txt)
    if exist ping3.txt (del  ping3.txt)
    if exist ping4.txt (del  ping4.txt)
    for /L %%i in (%debut%,1,%fin%) do (echo Recherche de la machine : %ip:~0,9%.%%i
    	for /f "tokens=5 delims= " %%f in ('ping -4 -n 1 %ip:~0,9%.%%i ^|find /i "32"') do (echo %%f >> ping.txt
    	)
    		for /f "tokens=1 delims= " %%k in ('Type ping.txt ^|findstr /i "19"') do echo %%k > ping2.txt
    			for /f %%l in (ping2.txt) do (arp -a %%l >> ping3.txt
    		)
    			)
    Cmd /U /C Type ping3.txt > ping4.txt
    Del ping.txt
    Del ping2.txt
    Del ping3.txt
    Start ping4.txt

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Retrouver les adresses mails dans un fichier texte
    Par bza88 dans le forum Général Java
    Réponses: 10
    Dernier message: 08/01/2014, 07h03
  2. Réponses: 2
    Dernier message: 02/03/2004, 19h38
  3. Réponses: 3
    Dernier message: 22/02/2004, 20h09
  4. [LG]rechercher dans un fichier texte
    Par BadFox dans le forum Langage
    Réponses: 11
    Dernier message: 01/12/2003, 15h57
  5. recherche de doublons dans un fichier texte
    Par portu dans le forum Algorithmes et structures de données
    Réponses: 3
    Dernier message: 07/10/2003, 14h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo