recherche de texte dans un fichier a partir d'une liste
Posté : sam. 09 déc. 2017 17:18
Salut a tous,
je cherche a dev un bout de code qui me permettrais d'extraire des données d'un fichier texte a partir d'une liste et faire ressortir tout ca dans un tableau.
je m'explique,
j'ai, dans un fichier excel (IP.xls), les champs suivants :
- une adresse ip
- un numéro de carte SIM
| N°SIM | IP |
|12345678910| 172.30.0.1|
|22345678910| 172.30.0.2|
Un appareil utilisant une des cartes sim du fichier IP.XLS se connecte sur un serveur ftp pour déposer des fichiers,lorsqu'il se connecte, l'adresse IP de la SIM utilisée est loggée dans le fichier log.txt du serveur ftp.
ci dessous le détail du fichier log.txt (log du serveur FTP)
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> Connected on port 21, sending welcome message...
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220-FileZilla Server 0.9.60 beta
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220 Please visit https://filezilla-project.org/
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> AUTH TLS
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 502 Explicit TLS authentication not allowed
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> AUTH SSL
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 502 Explicit TLS authentication not allowed
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> USER toto
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 331 Password required for toto
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> PASS ****
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 230 Logged on
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> SYST
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 215 UNIX emulated by FileZilla
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> FEAT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 211-Features:
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MDTM
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> REST STREAM
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> SIZE
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLST type*;size*;modify*;
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLSD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> UTF8
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> CLNT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MFMT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> EPSV
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> EPRT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 211 End
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> PWD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 257 "/" is current directory.
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> TYPE I
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 200 Type set to I
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> PASV
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 227 Entering Passive Mode (192,168,1,68,216,1)
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLSD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 150 Opening data channel for directory listing of "/"
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 226 Successfully transferred "/"
je cherche a lister dans un tableau la date et l'heure de la dernière connexion de chacune des IP du fichier IP.XLS.
pouvez vous m'indiquer comment faire ?
je cherche a dev un bout de code qui me permettrais d'extraire des données d'un fichier texte a partir d'une liste et faire ressortir tout ca dans un tableau.
je m'explique,
j'ai, dans un fichier excel (IP.xls), les champs suivants :
- une adresse ip
- un numéro de carte SIM
| N°SIM | IP |
|12345678910| 172.30.0.1|
|22345678910| 172.30.0.2|
Un appareil utilisant une des cartes sim du fichier IP.XLS se connecte sur un serveur ftp pour déposer des fichiers,lorsqu'il se connecte, l'adresse IP de la SIM utilisée est loggée dans le fichier log.txt du serveur ftp.
ci dessous le détail du fichier log.txt (log du serveur FTP)
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> Connected on port 21, sending welcome message...
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220-FileZilla Server 0.9.60 beta
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 220 Please visit https://filezilla-project.org/
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> AUTH TLS
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 502 Explicit TLS authentication not allowed
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> AUTH SSL
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 502 Explicit TLS authentication not allowed
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> USER toto
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> 331 Password required for toto
(000002) 09/12/2017 15:04:54 - (not logged in) (192.168.1.68)> PASS ****
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 230 Logged on
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> SYST
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 215 UNIX emulated by FileZilla
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> FEAT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 211-Features:
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MDTM
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> REST STREAM
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> SIZE
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLST type*;size*;modify*;
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLSD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> UTF8
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> CLNT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MFMT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> EPSV
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> EPRT
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 211 End
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> PWD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 257 "/" is current directory.
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> TYPE I
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 200 Type set to I
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> PASV
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 227 Entering Passive Mode (192,168,1,68,216,1)
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> MLSD
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 150 Opening data channel for directory listing of "/"
(000002) 09/12/2017 15:04:54 - toto (192.168.1.68)> 226 Successfully transferred "/"
je cherche a lister dans un tableau la date et l'heure de la dernière connexion de chacune des IP du fichier IP.XLS.
pouvez vous m'indiquer comment faire ?