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 37 38 39 40 41 42 43
| Dim Titre,URL
Titre = "Extraire les adresse(s) e-mail(s) dans une page Web © Hackoo"
URL = InputBox("Entrez l'url de la page web pour trouver et extraire les adresses e-mails" &vbcr&vbcr&" © Hackoo © 2013" ,Titre,"http://www.tomsguide.fr/faq/id-2858177/retrouver-mails-gmail.html")
If URL = "" Then WScript.Quit
Call ExtractMail(URL)
Sub ExtractMail(URL)
Dim ie,objFSO,Data,OutPut,objRegex,Match,Matches
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate (URL)
ie.Visible=false
DO WHILE ie.busy
wscript.sleep 100
LOOP
Data = ie.document.documentElement.innertext
str = URL
Tab = Split(Str,"/")
LogFile = Tab(2) & ".txt"
Set OutPut = objfso.OpenTextFile(LogFile,2,True)
ie.Quit
Set ie = Nothing
Set objRegex = new RegExp
objRegex.Pattern = "\b[a-zA-Z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}\b"
objRegex.Global = True
objRegex.IgnoreCase = True
Set Matches = objRegex.Execute(Data)
For Each Match in Matches
OutPut.WriteLine string(120,"-") & vbcr &" Nous sommes le "& Now & vbcr & string(120,"-") & vbcr & "Adresse E-mail trouvé dans la page "&qq(URL)&" : "& qq(Match.Value) & vbcr & string(120,"*")
Next
Call OpenLog(LogFile)
End Sub
Sub OpenLog(File)
Dim ws
Set ws = CreateObject("wscript.shell")
ws.run "Notepad " & File,1,True
Set ws = Nothing
End Sub
Function qq(strIn)
qq = Chr(34) & strIn & Chr(34)
End Function |
Partager