SetEnv Posted December 8, 2008 Share Posted December 8, 2008 Hello! First of all: I'm sorry about my verry bad english... Now... I tried to write a simple function to get the abuse email related to an IP. The code is not working, and I don't know why... In fact: you can telnet 'whois.ripe.net 43' and ask for whois any ip/address you want. Then, you will receive the answer containing all the infos... Here's the not-working-code ... GetProviderMail() Func GetProviderMail() $gSocket = TCPConnect("whois.ripe.net", "43") If $gSocket <> -1 Then ; If no error then TCPSend($gSocket, "4.2.2.4") ; ask about 4.2.2.4 (for example) $gSocket = -1 Do $gSocket = TCPAccept($gSocket) Until $gSocket <> -1 $gData = TCPRecv($gSocket,2048) $gDataSplit = StringSplit($gData,":") If $gDataSplit[1] == "e-mail" Then TrayTip("server","AbuseEmail for '4.2.2.4' is:"& $gDataSplit[2],5,2) EndIf EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted December 8, 2008 Developers Share Posted December 8, 2008 to get you started: GetProviderMail() Func GetProviderMail() $gData = "" TCPStartup() $gSocket = TCPConnect(TCPNameToIP("whois.ripe.net"), 43) If $gSocket <> -1 Then; If no error then TCPSend($gSocket, "4.2.2.4"); ask about 4.2.2.4 (for example) sleep(500) $gData &= TCPRecv($gSocket, 2048) ConsoleWrite('$gData = ' & $gData & @crlf & '>Error code: ' & @error & @crlf);### Debug Console EndIf TCPShutdown() EndFunc ;==>GetProviderMail SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 Oh... i'm so noobish. Thanks! :-s Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 (edited) It seems I can't receive all the response... I just read the 'first' blockI'm using a while to re-read the datas, but apparently, that's not working.Could you tell me where i'm wrong? Thankseg:% Some informations % here about ripe.net% ...% http://www.ripe.net <here should come the informationsabout the requested ip>The code:GetProviderMail() Func GetProviderMail() $gData = "" TCPStartup() $gSocket = TCPConnect(TCPNameToIP("whois.ripe.net"), 43) If $gSocket <> -1 Then; If no error then TCPSend($gSocket, "4.2.2.4"); ask about 4.2.2.4 (for example) sleep(500) While 1 $gData = TCPRecv($gSocket, 2048) If $gData == -1 Then ExitLoop Else $gSplit = StringSplit($gData,":") ; split data For $gVar = $gSplit[0] To 1 Step -1 Debug($gSplit[$gVar]) ;### Debug TrayTip Next EndIf WEnd EndIf TCPShutdown() EndFunc ;==>GetProviderMail Func Debug($dbg) TrayTip("DEBUG:",$dbg,3, 1) Sleep(3100) EndFunc ;==>Debug Edited December 8, 2008 by SetEnv Link to comment Share on other sites More sharing options...
Pain Posted December 8, 2008 Share Posted December 8, 2008 (edited) Try mine, I did this some days ago. TCPStartUp() $Domain = TCPNameToIP("whois.ripe.net");whois.arin.net whois.internic.net whois.ripe.net $Port = 43 $Address = '4.2.2.4' Global $recv $socket = TCPConnect($Domain, $Port) If $socket <> -1 Then TCPSend($socket, $Address & @CRLF) Do $recv &= TCPRecv($socket, 2048) Until @error ConsoleWrite($recv) TCPCloseSocket($socket) EndIf TCPShutdown() Edited December 8, 2008 by Pain Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 (edited) Yup, Your code seems work perfectly ! But (yeah...) the datas are not totally received :-s Your code with little modifications: GetAbuseEmail() Func GetAbuseEmail() TCPStartUp() $Domain = TCPNameToIP("whois.ripe.net");whois.arin.net whois.internic.net whois.ripe.net $Port = 43 $Address = '-B 4.2.2.4' ; flag -B used to force 'update' (whois.ripe.net args) Global $recv $socket = TCPConnect($Domain, $Port) If $socket <> -1 Then TCPSend($socket, $Address & @CRLF) Do $recv &= TCPRecv($socket, 2048) Until @error TrayTip("debug", $recv, 4, 1) Sleep(2000) TCPCloseSocket($socket) EndIf TCPShutdown() EndFunc ;==> GetAbuseEmail Edited December 8, 2008 by SetEnv Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 Sorry Pain, your code is perfect ! It's just that traytip(title, string, time,type) seems bug if the char '"' is in the string. Link to comment Share on other sites More sharing options...
Pain Posted December 8, 2008 Share Posted December 8, 2008 (edited) It works just fine for me. TrayTip("", 'A "traytip"', 4, 1) Sleep(5000) Edited December 8, 2008 by Pain Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 Yeah but, Traytip("test", "test "test", 3, 3) Will not work, and it's normal... And, in whois.ripe.net response, there was some '"' or "'" That's why when i tryied to traytip() thoses chains containing '"' or "'" , I saw nothing. Now, without traytip(), the code woks perfectly and I can extract the email adress That's why I think Traytip() is bugged =) Link to comment Share on other sites More sharing options...
Pain Posted December 8, 2008 Share Posted December 8, 2008 (edited) It's not bugged, from the helpfile Message the balloon tip will display. (255 characters maximum) Try with ConsoleWrite(StringLen($recv)), I got 1934 so that might be the reason why. TCPStartUp() $Domain = TCPNameToIP("whois.ripe.net");whois.arin.net whois.internic.net whois.ripe.net $Port = 43 $Address = '-B 4.2.2.4' Global $recv $socket = TCPConnect($Domain, $Port) If $socket <> -1 Then TCPSend($socket, $Address & @CRLF) Do $recv &= TCPRecv($socket, 2048) Until @error ;~ ConsoleWrite($recv) TrayTip("",StringLeft($recv, 255), 4, 1) Sleep(2000) TCPCloseSocket($socket) EndIf TCPShutdown() Edited December 8, 2008 by Pain Link to comment Share on other sites More sharing options...
SetEnv Posted December 8, 2008 Author Share Posted December 8, 2008 grmbl.. Ok =) I dind't RTFM :-/ Link to comment Share on other sites More sharing options...
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