famko Posted December 2, 2017 Posted December 2, 2017 Hi everyone, i am strungling with a small script. I want to use nslookup to retrieve the ipadress of a website and store the ipadres into $xxxx It is working with the script below. But i can't get i working without saving nslookup into nslookup.txt. Would nice if i can just save the @comspec command into $nslookup and then use the stringbetween. Would be nice if someone could help me with this #include<array.au3> #include <String.au3> $url = "www.spamhause.com" RunWait(@ComSpec & " /c nslookup "&$url& " > nslookup.txt", "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) FileOpen ("nslookup.txt") $sFileRead = FileReadLine ("nslookup.txt",5) local $aArray = _StringBetween($sFileRead, "Address: ", "") msgbox(0,"Ip adres=",$aArray[0])
Danyfirex Posted December 2, 2017 Posted December 2, 2017 You could do this: #include<array.au3> #include <String.au3> $url = "www.spamhause.com" Local $iPID=Run(@ComSpec & " /c nslookup " & $url , "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Local $sOutput="" While 1 $sOutput &= StdoutRead($iPID) If @error Then ; Exit the loop if the process closes or StdoutRead returns an error. ExitLoop EndIf WEnd Local $aIPs=StringRegExp($sOutput,'\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b',3) _ArrayDisplay($aIPs) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now