Page 1 sur 1

[R] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 13:20
par Boulanza
Bonjour,
Je cherche un script Autoit pour obtenir des informations sur les domaines à partir des serveurs WhoIs. http://whois.domaintools.com/Votre Nom de domaine
J’ai cherché sur tous les forums un code qui marche pour obtenir des informations sur les domaines mais hélas ça ne fonctionnent pas.
Merci pour votre aide.
Cordialement.

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 15:10
par jchd
Il suffit de traiter la page renvoyée par http://whois.domaintools.com/autoitscript.com par exemple.

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 15:37
par Boulanza
Ramadan karim...
Merci jchd pour votre réponse et votre suggestion.
Comment je peux traiter la page renvoyée par http://whois.domaintools.com/autoitscript.com. Je n'ai aucune notion à ce sujet, un lien ou un exemple me suffira.
Cordialement.

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 15:41
par orax
Une autre solution serait d'utiliser l'outil en ligne de commande Whois de Sysinternals. Il peut être téléchargé sur https://docs.microsoft.com/fr-fr/sysint ... oads/whois

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 16:04
par Boulanza
Merci orax pour votre réponse, ce que je cherche à récupérer les données d'une page Web, j'ai testé votre proposition ça répond pas à mes besoins.
Je continue de chercher une solution comme proposée par jchd.
A+

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 19:20
par Boulanza
Bonjour,
Ce code réalisé par mikell copie la page web dans le fichier code.ini. Y a-t'-il moyen de supprimer toutes les lignes du fichier ini ou de la page Web pour ne laisser que les lignes suivantes avec leurs informations:
Registrant Name:
Registrant Organization:
Registrant Street:
Registrant City:
Registrant State/Province:
Registrant Postal Code:
Registrant Country:
Registrant Phone:
Registrant Phone Ext:
Registrant Fax:
Registrant Fax Ext:
Registrant Email:

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://www.whois.com/whois/autoitscript.com ", 0)
$oHTTP.Send()
$txt = $oHTTP.Responsetext
$oHTTP = 0
$txt2 = StringRegExpReplace($txt, '\h|(<br />)', "")
;Msgbox(0,"", $txt2)
 FileWrite("code.ini", $txt2)
ShellExecute(@ScriptDir&"\code.ini")
Cordialement

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mar. 07 mai 2019 21:32
par mikell
C'est basique. Vous lisez la page avec la méthode habituelle, BinaryToString(InetRead(...)) etc
Et vous faites ceci

$res = StringRegExp($page, '(?m)^Registrant\N+', 3)
_ArrayDisplay($res)
Mais c'est aléatoire, le format de la page étant susceptible d'être différent suivant le domaine recherché. L'outil évoqué par orax me parait nettement plus fiable

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mer. 08 mai 2019 14:02
par Boulanza
Bonjour,
Le code suivant répond à ma demande mais il reste à modifier le résultat obtenu comme expliqué ci-dessous :

Le résultat obtenu:
930:RegistrantName:REDACTEDFORPRIVACY
931:RegistrantOrganization:AutoItConsultingLtd
932:RegistrantStreet:REDACTEDFORPRIVACY
933:RegistrantCity:REDACTEDFORPRIVACY
934:RegistrantState/Province:ABE
935:RegistrantPostalCode:REDACTEDFORPRIVACY
936:RegistrantCountry:GB
937:RegistrantPhone:REDACTEDFORPRIVACY

Le résultat que je cherche: Supprimer les numéros de 930 à 937,: et le mot "Registrant" puis séparer les mot des phrases comme ci-dessous

Name: REDACTED FOR PRIVACY
Organization: AutoIt Consulting Ltd
Street: REDACTED FOR PRIVACY
City: REDACTED FOR PRIVACY
State/Province: ABE
PostalCode: REDACTED FOR PRIVACY
Country: GB
Phone : REDACTED FOR PRIVACY

Je vous avoue que j'ai aucune notion pour arriver au résultat recherché. Votre aide SVP.
Cordialement.
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://www.whois.com/whois/autoitscript.com", 0)
$oHTTP.Send()
$txt = $oHTTP.Responsetext
$oHTTP = 0
$txt2 = StringRegExpReplace($txt, '\h|(<br />)', "")
;Msgbox(0,"", $txt2)
 FileWrite("code.ini", $txt2)
;=============
Global $file = @ScriptDir & "\code.ini", $search = "RegistryRegistrantID"
Global $iLine = 0, $sLine = '', $iValid = 0
Global $hFile = FileOpen($file)
If $hFile = -1 Then
    MsgBox(0,'ERROR','Unable to open file for reading.')
    Exit 1
EndIf

; find the line that has the search string
While 1
    $iLine += 1
    $sLine = FileReadLine($hFile)
    If @error = -1 Then ExitLoop

    ; test the line for the $search string until the flag $iValid is set
    If StringInStr($sLine, $search) And Not $iValid Then
        $iValid = 1
        ContinueLoop
    EndIf

    If $iValid Then
        $iValid += 1
        ConsoleWrite($iLine & ':' & $sLine & @CRLF)
     ;   Msgbox(0,"", $sLine)
      FileWrite("Résultat.ini", $iLine & ':' & $sLine & @CRLF)
      If $iValid > 8 Then ExitLoop
    EndIf
WEnd
FileClose($hFile)
Sleep(100)
FileDelete(@ScriptDir & "\code.ini")

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : mer. 08 mai 2019 15:47
par Boulanza
Bonjour à tous,
je souhaiterais supprimer un mot "Registrant" et tout ce qui se trouve à gauche"chiffres aléatoire": de ce mot qui se trouve dans un fichier texte , tout les mots sont à la ligne .
StringReplace($STR, "numéro de la ligne aléatoires :Registrant", " ")
Merci pour votre aide.
Cordialement.

Re: [..] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : jeu. 09 mai 2019 16:52
par Boulanza
Le code finale à optimiser:
;=====================================
FileDelete(@ScriptDir & "\code.ini")
 Sleep(100)

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://www.whois.com/whois/autoitscript.com", 0)
$oHTTP.Send()
$txt = $oHTTP.Responsetext
$oHTTP = 0
$txt2 = StringRegExpReplace($txt, '', "")
;Msgbox(0,"", $txt2)
 FileWrite("code.ini", $txt2)
;~ Exit
;=============
Global $file = @ScriptDir & "\code.ini", $search = "Registry Registrant ID:"
Global $iLine = 0, $sLine = '', $iValid = 0
Global $hFile = FileOpen($file)
If $hFile = -1 Then
    MsgBox(0,'ERROR','Unable to open file for reading.')
    Exit 1
EndIf

; find the line that has the search string
While 1
    $iLine += 1
    $sLine = FileReadLine($hFile)
    If @error = -1 Then ExitLoop

    ; test the line for the $search string until the flag $iValid is set
    If StringInStr($sLine, $search) And Not $iValid Then
        $iValid = 1
        ContinueLoop
    EndIf

    If $iValid Then
        $iValid += 1
        ;ConsoleWrite($iLine & ':' & $sLine & @CRLF)
      ; Msgbox(0,"", $sLine)
FileWrite("Résultat.ini", $iLine & ':' & $sLine & @CRLF)
If $iValid > 10 Then ExitLoop
EndIf

WEnd
FileClose($hFile)
Sleep(100)
FileDelete(@ScriptDir & "\code.ini")
 Sleep(100)
;Exit

Local $file1 = @ScriptDir & "\Résultat.ini"
Local $inp = FileRead($file1)
Local $out = StringRegExpReplace($inp, '', '')
;~ ;MsgBox(0, "", $out)

            $STR = $out
            $STR = StringReplace($STR, "925:Registrant", " ")
         $STR = StringReplace($STR, "926:Registrant", " ")
         $STR = StringReplace($STR, "927:Registrant", " ")
         $STR = StringReplace($STR, "928:Registrant", " ")
         $STR = StringReplace($STR, "929:Registrant", " ")
         $STR = StringReplace($STR, "930:Registrant", " ")
         $STR = StringReplace($STR, "931:Registrant", " ")
         $STR = StringReplace($STR, "932:Registrant", " ")
         $STR = StringReplace($STR, "933:Registrant", " ")
         $STR = StringReplace($STR, "934:Registrant", " ")
         $STR = StringReplace($STR, "935:Registrant", " ")
         $STR = StringReplace($STR, "936:Registrant", " ")
         $STR = StringReplace($STR, "937:Registrant", " ")
         $STR = StringReplace($STR, "938:Registrant", " ")
         $STR = StringReplace($STR, "939:Registrant", " ")
         $STR = StringReplace($STR, "940:Registrant", " ")
;MsgBox(0, "", $STR)
;Exit
;============================================
;~ Local $file1 = @ScriptDir & "\Résultat.ini"
;~ Local $inp = FileRead($file1)
;~ Local $out = StringRegExpReplace($inp, '', '')

;~ $regex1 =   "(?i)([1-9]+)\s*(:)\h*(Registrant)"     ;"(?i)([1-9]+)\s*(:)\h*"    ;"(?i)([a-z]+)\s*(:)\h*(.*)"    ;"(?i).+Registrant:.*\v?" Registrant
;~          $txt1 = $out
;~          $txt1 = StringRegExpReplace($txt1, $regex1, "")
;~          msgbox(0,"2",$txt1)
;~          GUICtrlSetData($out, $txt1)
;~ Exit
;===========================================
;MsgBox(0, "", $STR)
;MsgBox(0, "Resultat", "Avant : "&$out&@CRLF&"Après : "&$STR)
 FileWrite("Code.ini", $STR );$STR   ;$txt1
FileDelete(@ScriptDir & "\Résultat.ini")
 Sleep(100)

Exit

Re: [R] Je cherche un script pour obtenir des informations sur les domaines à partir des serveurs WhoIs

Posté : ven. 10 mai 2019 16:10
par Boulanza
Bonjour,
Je viens de remarquer que Domain Name: il n'est pas dans la liste pourquoi ?
Comment ajouter "id="registrarData">Domain Name: autoitscript.com" parmi les éléments de recherche:
Global $file = @ScriptDir & "\code.ini", $search = "Registry Registrant ID: " pour avoir dans la liste: Domain Name: autoitscript.com

Une autre question: Pourquoi "whois_email" lors de la recherche nous donne comme repense ceci:
Registrant Email: 941:Registrant Email: <img src="/eimg/a/39/a3913c68f50559edd6e81cdf143cbbffca4b51d8.png" class="whois_email" alt="email">@1und1.de
Comment faire pour avoir l'email complète : Registrant Email: email@1und1.de ?

Merci d'avance pour votre aide
Cordialement.