Jump to content

Metin Içindeki Ip Adreslerini Almak


blue_life

Recommended Posts

Bu konuda; bir yazı içindeki ip adresini nasıl alabileceğimiz ile ilgili örnek vermek vermek istiyorum.
Ilk önce basit bir örnek vermek istiyorum. Kısaca bir yazı içindeki Ip adresini alalım.
[codebox]Global $IP_LIST = _BL_IPLIST_TOARRAY("Şimdi bu yazı içindeki 188.72.217.38 ipsini alalım.")
For $I = 1 to $IP_LIST[0]
MsgBox(64,$I,$IP_LIST[$I])
Next

Func _BL_IPLIST_TOARRAY($BL_GET_TEXT)
; Writed to BlueLife
Local $BL_IPLIST[1] = [0], $BL_SPLIT, $BL_CHECK
Local $BL_FIND_IP = StringRegExp($BL_GET_TEXT, '((?:\d+)(?:\.\d+){3})', 3)
For $I = 0 To UBound($BL_FIND_IP) - 1
$BL_SPLIT = StringSplit($BL_FIND_IP[$I], ".")
If $BL_SPLIT[0] <> 4 Or $BL_SPLIT[1] < 1 Then ContinueLoop
$BL_CHECK = True
For $1 = 1 To $BL_SPLIT[0]
If ($BL_SPLIT[$1] < 0 Or $BL_SPLIT[$1] > 255) Or StringIsDigit($BL_SPLIT[$1]) = 0 Then
$BL_CHECK = False
ExitLoop
EndIf
Next
If $BL_CHECK Then
$BL_IPLIST[0] += 1
ReDim $BL_IPLIST[$BL_IPLIST[0] + 1]
$BL_IPLIST[$BL_IPLIST[0]] = $BL_FIND_IP[$I]
EndIf
Next
If $BL_IPLIST[0] = 0 Then SetError(1)
Return $BL_IPLIST
EndFunc ;==>_BL_IPLIST_TOARRAY[/codebox]

Şimdi internete çıkıp yapıp, ip adresimizi yazan herangi bir siteden uzak ip adresimizi alalım.
[codebox]Global $READ_SITE = InetRead('http://www.ip-numaram.com',1)
Global $IP_LIST = _BL_IPLIST_TOARRAY(BinaryToString($READ_SITE)) ;Aldığımız yazıdaki ipleri buluyoruz.
For $I = 1 to $IP_LIST[0]
MsgBox(64,$I,$IP_LIST[$I])
Next

Func _BL_IPLIST_TOARRAY($BL_GET_TEXT)
; Writed to BlueLife
Local $BL_IPLIST[1] = [0], $BL_SPLIT, $BL_CHECK
Local $BL_FIND_IP = StringRegExp($BL_GET_TEXT, '((?:\d+)(?:\.\d+){3})', 3)
For $I = 0 To UBound($BL_FIND_IP) - 1
$BL_SPLIT = StringSplit($BL_FIND_IP[$I], ".")
If $BL_SPLIT[0] <> 4 Or $BL_SPLIT[1] < 1 Then ContinueLoop
$BL_CHECK = True
For $1 = 1 To $BL_SPLIT[0]
If ($BL_SPLIT[$1] < 0 Or $BL_SPLIT[$1] > 255) Or StringIsDigit($BL_SPLIT[$1]) = 0 Then
$BL_CHECK = False
ExitLoop
EndIf
Next
If $BL_CHECK Then
$BL_IPLIST[0] += 1
ReDim $BL_IPLIST[$BL_IPLIST[0] + 1]
$BL_IPLIST[$BL_IPLIST[0]] = $BL_FIND_IP[$I]
EndIf
Next
If $BL_IPLIST[0] = 0 Then SetError(1)
Return $BL_IPLIST
EndFunc ;==>_BL_IPLIST_TOARRAY[/codebox]

Şimdi ise internete çıkıp yapıp, domain kontrolü yapan bir siteden www.youtube.com sitesi için ip adreslerini sıralayalım.
Tabi siz farklı domainler içinde kullanabilirsiniz. Bu arada örnekte ilk sıradaki ip bizim uzakip adresimiz.
[codebox]#include <Array.au3>

Global $WEB_SITE = "www.youtube.com"
Global $READ_SITE = InetRead('http://centralops.net/co/DomainDossier.aspx?__VIEWSTATE=&addr=' & $WEB_SITE,1)
Global $IP_LIST = _BL_IPLIST_TOARRAY(BinaryToString($READ_SITE)) ;Aldığımız yazıdaki ipleri buluyoruz.

_ArrayDisplay($IP_LIST)

Func _BL_IPLIST_TOARRAY($BL_GET_TEXT)
; Writed to BlueLife
Local $BL_IPLIST[1] = [0], $BL_SPLIT, $BL_CHECK
Local $BL_FIND_IP = StringRegExp($BL_GET_TEXT, '((?:\d+)(?:\.\d+){3})', 3)
For $I = 0 To UBound($BL_FIND_IP) - 1
$BL_SPLIT = StringSplit($BL_FIND_IP[$I], ".")
If $BL_SPLIT[0] <> 4 Or $BL_SPLIT[1] < 1 Then ContinueLoop
$BL_CHECK = True
For $1 = 1 To $BL_SPLIT[0]
If ($BL_SPLIT[$1] < 0 Or $BL_SPLIT[$1] > 255) Or StringIsDigit($BL_SPLIT[$1]) = 0 Then
$BL_CHECK = False
ExitLoop
EndIf
Next
If $BL_CHECK Then
$BL_IPLIST[0] += 1
ReDim $BL_IPLIST[$BL_IPLIST[0] + 1]
$BL_IPLIST[$BL_IPLIST[0]] = $BL_FIND_IP[$I]
EndIf
Next
If $BL_IPLIST[0] = 0 Then SetError(1)
Return $BL_IPLIST
EndFunc ;==>_BL_IPLIST_TOARRAY[/codebox]
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...