Comprobador masivo de pings-Online Status

y programas personales para otros como tu, puede que te corrijan ;)
Responder
Avatar de Usuario
BasicOs
Site Admin
Mensajes: 2091
Registrado: 21 Nov 2006, 19:24
Ubicación: El Internet - (Canarias, España)
Contactar:

Comprobador masivo de pings-Online Status

Mensaje por BasicOs »

Chequea via ping si unos ordenadores o unas webs van, siempre que tengan activado el devolver el PING.
Se puede cargar una lista de ips y nombres con este formato:
autoit.es
terra.es
87.106.181.57
Con algunas modificaciones de puede hacer una comprobación de puertos abiertos etc..

Enlace fuente: http://www.autoit.de/index.php?page=Thr ... adID=27263

Código: Seleccionar todo

#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Description=Checks via ping whether a computer / web site is pingable
#AutoIt3Wrapper_Res_Fileversion=0.9.2.0
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Version|0.92
#AutoIt3Wrapper_Res_Field=Build|2011-05-20 beta
#AutoIt3Wrapper_Res_Field=Coded by|UEZ
#AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time%
#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UPX_Parameters=--ultra-brute --crp-ms=999999 --all-methods --all-filters
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICON, 1,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICON, 2,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICON, 3,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, MENU, 166,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, DIALOG, 1000,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICONGROUP, 162,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICONGROUP, 164,
#AutoIt3Wrapper_Run_After=..\..\..\ResourceHacker\ResHacker.exe -delete %out%, %out%, ICONGROUP, 169,
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute --crp-ms=999999 --all-methods --all-filters "%out%"
;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <Array.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiIPAddress.au3>
#include <GUIListView.au3>
#include <GuiMenu.au3>
#include <GuiStatusBar.au3>
#include <iNet.au3>
#include <ListViewConstants.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#NoTrayIcon

Opt("MustDeclareVars", 1)
Opt("GUIDataSeparatorChar", "")
Opt("GUICloseOnESC", 0)

Global Const $ver = "v0.92 "
Global Const $build = "Build 2011-05-23 Beta"

Global Const $width = 505, $height = 600
Global Const $hGUI = GUICreate("Check Online Status " & $ver & $build, $width, $height, -1, -1) ; BitOR($WS_SIZEBOX,$WS_MAXIMIZEBOX,$WS_THICKFRAME, $GUI_SS_DEFAULT_GUI, $WS_TABSTOP)
GUISetIcon(@SystemDir & "\Shell32.dll", 14, $hGUI)
;~ GUISetBkColor(0xC0DCC0)
GUISetBkColor(0xB9D1EA)
;~ GUISetBkColor(0xD7E4F2)
;~ GUISetBkColor(0xFFFFE1)
;~ GUISetBkColor(0xA6CAF0)
;~ GUISetBkColor(0xFFFBF0)
;~ GUISetBkColor(0xFECFF4)

Global Const $MenuItem = GUICtrlCreateMenu("&?")
Global Const $mAbout = GUICtrlCreateMenuItem("About", $MenuItem)

Global Const $StatusBar = _GUICtrlStatusBar_Create($hGUI)
Global $StatusBar_PartsWidth[4] = [75, 105, 148, 200]
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar, "Items found:", 0)
_GUICtrlStatusBar_SetText($StatusBar, 0, 1)
_GUICtrlStatusBar_SetText($StatusBar, "Status:", 2)
_GUICtrlStatusBar_SetText($StatusBar, " Ready", 3)

Global Const $Progressbar = GUICtrlCreateProgress(8, 536, 489, 17, $PBS_SMOOTH)
Global Const $Label = GUICtrlCreateLabel("", 222, 538, 66, 17, $SS_CENTER + $SS_SIMPLE, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

Global Const $Group = GUICtrlCreateGroup(Chr(169) & " UEZ 2011 ", 4, 8, 497, 489, BitOR($GUI_SS_DEFAULT_GROUP, $BS_RIGHT))
GUICtrlSetFont(-1, 6, 200, 0, "Times New Roman")

Global Const $ListView = GUICtrlCreateListView("", 16, 32, 474, 454, _
        BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_AUTOARRANGE, $LVS_NOSORTHEADER, $WS_VSCROLL), _
        BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)
_GUICtrlListView_AddColumn($ListView, "Hostname", 215, 2)
_GUICtrlListView_AddColumn($ListView, "IP", 150, 2)
_GUICtrlListView_AddColumn($ListView, "Pingable", 80, 2)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global Const $bLoad = GUICtrlCreateButton("Load", 8, 504, 75, 25)
GUICtrlSetTip(-1, "Load a text file and create listview items")
Global Const $bPing = GUICtrlCreateButton("Ping", 96, 504, 75, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
Global Const $bExit = GUICtrlCreateButton("Exit", 422, 504, 75, 25)
Global Const $Checkbox = GUICtrlCreateCheckbox("Resolve hostname <=> IP address", 180, 508, 193, 17)
GUICtrlSetTip(-1, "It will slow down list creation if selected!")
_GDIPlus_Startup()
Global $hStream
Global $hImage_ok = Load_BMP_From_Mem(OK())
Global $hImage_nok = Load_BMP_From_Mem(NOK())

Global $hBmp_ok = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_ok)
Global $hBmp_nok = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_nok)

Global $hIcons = _GUIImageList_Create(16, 16, 5, 0)
_GUIImageList_Add($hIcons, $hBmp_nok)
_GUIImageList_Add($hIcons, $hBmp_ok)
_GUICtrlListView_SetImageList($ListView, $hIcons, 1)

_GDIPlus_ImageDispose($hImage_nok)
_GDIPlus_ImageDispose($hImage_ok)
_WinAPI_DeleteObject($hBmp_nok)
_WinAPI_DeleteObject($hBmp_ok)
_GDIPlus_Shutdown()

GUISetState(@SW_SHOW)
TCPStartup()

Global $aFileContent[1][1], $ad, $error = 0, $nMsg, $file, $msg, $k, $IPAddress1, $IPAddress2
Global Const $load_auto = "";

If $CmdLine[0] Then
    If FileExists($CmdLine[1]) Then $error = ParseFile($CmdLine[1])
Else
    If FileExists($load_auto) Then $error = ParseFile($load_auto)
EndIf

Global Const $aWS = WinGetPos($hGUI)
Global Const $minwidth = $aWS[2]
Global Const $minheight = $aWS[3]

Global Enum $idAddIP = 1000, $idDelItem
Global Const $hQMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hQMenu, 0, "Add IP subnet manually", $idAddIP)
_GUICtrlMenu_InsertMenuItem($hQMenu, 1, "", 0)
_GUICtrlMenu_InsertMenuItem($hQMenu, 2, "Delete selected item", $idDelItem)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

Global $dummy = GUICtrlCreateDummy()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $bExit
            TCPShutdown()
            GUIDelete($hGUI)
            Exit
        Case $mAbout
            MsgBox(64, "About", "Check Online Status" & @CRLF & $ver & $build & @CRLF & @CRLF & _
                                                 "Coded by UEZ ", 60)

        Case $bLoad
            $file = FileOpenDialog("Select a file with appropriate information", "", "Text File (*.txt;*.csv)")
            If Not @error Then
                _GUICtrlStatusBar_SetText($StatusBar, 0, 1)
                _GUICtrlStatusBar_SetText($StatusBar, " none", 3)
                _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
                $error = ParseFile($file)
            EndIf
        Case $bPing
            For $k = 1 To UBound($aFileContent) - 1
                _GUICtrlListView_AddSubItem($ListView, $k - 1, "", 2, 0xFF)
            Next
            _GUICtrlStatusBar_SetText($StatusBar, " Starting", 3)
            PingIt()
            GUICtrlSetData($Progressbar, 0)
        Case $dummy
            GUIRegisterMsg($WM_COMMAND, "")
            IPManual()
            GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    EndSwitch
WEnd

Func ParseFile($file)
    Local $sFile, $chk = 0
    $sFile = FileRead($file)
    _FileReadToArray($file, $aFileContent)

    If UBound($aFileContent) = 0 Then Return MsgBox(48, "Information", "Warning: List is empty!", 30)

    $chk = PlausibilityCheck($aFileContent)
    If $chk Then _GUICtrlStatusBar_SetText($StatusBar, " some wrong entries were detected and ignored!", 3)

    If Not UBound($aFileContent) Then Return MsgBox(48, "Information", "Warning: List is empty because wrong entries were ignored!", 30)

    _GUICtrlStatusBar_SetText($StatusBar, UBound($aFileContent) - 1, 1)
    GUICtrlSetState($ListView, $GUI_HIDE)
    GUISetState(@SW_DISABLE, $hGUI)
    Add2ListView()
    GUISetState(@SW_ENABLE, $hGUI)
    GUICtrlSetState($ListView, $GUI_SHOW)
    GUICtrlSetState($bPing, $GUI_ENABLE)
    Return $chk
EndFunc   ;==>ParseFile

Func PlausibilityCheck(ByRef $array)
    Local $i = 0, $err = False
    Local $regex, $aIP, $e, $s

    $i = 1
    While $i < UBound($array)
        $array[$i] = StringStripCR($array[$i])
        $array[$i] = StringStripWS($array[$i], 3)

        If StringInStr($array[$i], ".") = 0 Then
            $regex = StringRegExp($array[$i], "[^a-zA-Z0-9-_]", 3)
            If Not @error Or StringLen($array[$i]) < 1 Or StringLen($array[$i]) > 15 Then ; check computer name convention: check for disallowed characters in computer namecheck and string length
                $array[$i] = ""
                $err = True
            EndIf
        ElseIf StringInStr($array[$i], " ") Then
            $array[$i] = ""
            $err = True
        Else
            $aIP = StringRegExp($array[$i], "(\d+)\.(\d+)\.(\d+)\.(\d+)$", 3)
            If Not @error Then
                For $e = 0 To 3
                    If $aIP[$e] < 0 Or $aIP[$e] > 255 Then
                        $array[$i] = ""
                        $err = True
                    EndIf
                Next
            EndIf
        EndIf
        $i += 1
    WEnd

    $s = _ArrayToString($array)
    While True
        $s = StringReplace($s, "||", "|")
        If @extended = 0 Then ExitLoop
    WEnd
    If StringRight($s, 1) = "|" Then $s = StringTrimRight($s, 1)
    $array = StringSplit($s, "|", 2)

    $i = UBound($array)
    $array = _ArrayUnique($array, 1, 1)
    If UBound($array) <> $i Then $err = True

    Return $err
EndFunc   ;==>PlausibilityCheck

Func PingIt()
    Local $ping, $index, $i, $ec, $dll = DllOpen("user32.dll"), $aborted = False, $m, $c
    Local $om = MouseGetCursor()
    GUISetCursor(15, 1, $hGUI)
    GUISetState(@SW_DISABLE, $hGUI)
    _GUICtrlListView_Scroll($ListView, 0, -0xFFFF)
    $index = UBound($aFileContent) - 1
    $m = MouseGetPos()
    ToolTip("Hold ESC to abort!", $m[0], $m[1] - 50)
    For $i = 1 To UBound($aFileContent) - 1
        GUICtrlSetData($Progressbar, Ceiling(($i + 1) / $index * 100))
        GUICtrlSetData($Label, $i & "/" & $index)
        $c = StringRegExp($aFileContent[$i], "(\d+)\.(\d+)\.(\d+)\.(\d+)$", 3)
        If  Not @error Then
            If GUICtrlRead($Checkbox) = $GUI_CHECKED Then _GUICtrlListView_AddSubItem($ListView, $i - 1, _TCPIpToName($aFileContent[$i]), 0)
        Else
            If GUICtrlRead($Checkbox) = $GUI_CHECKED Then _GUICtrlListView_AddSubItem($ListView, $i - 1, TCPNameToIP($aFileContent[$i]), 1)
        EndIf
        GUICtrlSetData($Label, $i & "/" & $index)
        $ping = Ping($aFileContent[$i], 1000)
        $ec = @error
        If Not $ec Then
            _GUICtrlListView_AddSubItem($ListView, $i - 1, $ping & " ms", 2, 1)
        Else
            _GUICtrlListView_AddSubItem($ListView, $i - 1, "", 2, 0)
            _GUICtrlStatusBar_SetText($StatusBar, " unable to ping " & $aFileContent[$i], 3)
        EndIf
        GUICtrlSetData($Label, $i & "/" & $index)
        If $i > 15 Then _GUICtrlListView_Scroll($ListView, 0, 16)
        If _IsPressed("1B", $dll) Then
            ToolTip("")
            _GUICtrlStatusBar_SetText($StatusBar, " Aborted!", 3)
            $aborted = True
            ExitLoop
        EndIf
        If $i > 2 Then ToolTip("")
    Next
    DllClose($dll)
    GUISetState(@SW_ENABLE, $hGUI)
    GUISetCursor($om)
    If Not $aborted Then _GUICtrlStatusBar_SetText($StatusBar, " Finished", 3)
    Sleep(1000)
    Return $ec
EndFunc   ;==>PingIt

Func IPManual()
    GUISetState(@SW_DISABLE, $hGUI)
    Local Const $hGUI_IP = GUICreate("IP Range (class c only)", 354, 179, -1, -1, Default, $WS_EX_TOOLWINDOW, $hGUI)
    GUISetBkColor(0xBFCDDB)
    Local Const $Group_IP = GUICtrlCreateGroup("", 8, 8, 337, 153)
    Local Const $cIP = GUICtrlCreateCheckbox("Clear main list", 134, 116, 85, 17)
    GUICtrlSetTip(-1, "If selected main list will be cleaned, otherwise new values will be appended")
    GUICtrlSetState(-1, $GUI_UNCHECKED)
;~     GUICtrlSetState(-1, $GUI_DISABLE)
    Local Const $bCancelIP = GUICtrlCreateButton("Exit", 24, 112, 75, 25)
    Local Const $bStartIP = GUICtrlCreateButton("Add", 256, 112, 75, 25)
    Local Const $lEIP = GUICtrlCreateLabel("End IP:", 200, 40, 54, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    Local Const $lSIP = GUICtrlCreateLabel("Start IP:", 24, 40, 59, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    Local $ip = StringRegExpReplace(@IPAddress1, "(.*\.)\d+", "$1")
    $IPAddress1 = _GUICtrlIpAddress_Create($hGUI_IP, 24, 64, 130, 21)
    _GUICtrlIpAddress_Set($IPAddress1, $ip & "1")
    $IPAddress2 = _GUICtrlIpAddress_Create($hGUI_IP, 200, 64, 130, 21)
    _GUICtrlIpAddress_Set($IPAddress2, $ip & "254")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW, $hGUI_IP)

    Local $nMsg2, $start, $end, $f, $g, $prefix

    GUIRegisterMsg($WM_COMMAND, "Check_IP")
    While 1
        $nMsg2 = GUIGetMsg()
        Switch $nMsg2
            Case $GUI_EVENT_CLOSE, $bExit, $bCancelIP
                ExitLoop
            Case $bStartIP
                $start = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), ".*\.(\d+)$", "$1"))
                $end = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress2), ".*\.(\d+)$", "$1"))
                $prefix = StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), "(.*\.)\d+", "$1")
                If $start <= $end Then
                    If GUICtrlRead($cIP) = $GUI_CHECKED Then
                        $g = 1
                        Dim $aFileContent[$end - $start + 2]
                    Else
                        $g = UBound($aFileContent)
                        ReDim $aFileContent[UBound($aFileContent) + $end - $start + 1]
                    EndIf

                    $aFileContent[0] = UBound($aFileContent) - 1
                    GUICtrlSetState($ListView, $GUI_HIDE)

                    For $f = $start To $end
                        $aFileContent[$g] = $prefix & $f
                        $g += 1
                    Next
                    $aFileContent = _ArrayUnique($aFileContent, 1, 1)
                    $aFileContent[0] = UBound($aFileContent) - 1
                    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
                    Add2ListView()

                    GUICtrlSetState($ListView, $GUI_SHOW)
                    _GUICtrlStatusBar_SetText($StatusBar, UBound($aFileContent) - 1, 1)
                    _GUICtrlStatusBar_SetText($StatusBar, $end - $start + 1 & " values properly added", 3)
                    GUICtrlSetState($bPing, $GUI_ENABLE)
                Else
                    MsgBox(64, "Error", "Check last octets!", 30)
                EndIf
        EndSwitch
    WEnd
    GUISetState(@SW_ENABLE, $hGUI)
    GUIDelete($hGUI_IP)
    GUIRegisterMsg($WM_COMMAND, "")
EndFunc   ;==>IPManual

Func Check_IP($hWnd, $msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    Local $IP1_pre, $IP2_pre, $IP1_suf, $IP2_suf
    Local Const $EN_KILLFOCUS = 0x200

    Switch $lParam
        Case $IPAddress1
            $IP1_pre = StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), "(.*\.)\d+", "$1")
            $IP1_suf = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), ".*\.(\d+)$", "$1"))
            $IP2_suf = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress2), ".*\.(\d+)$", "$1"))
            If $IP1_suf  > $IP2_suf Then
                _GUICtrlIpAddress_Set($IPAddress2, _GUICtrlIpAddress_Get($IPAddress1))
            Else
                _GUICtrlIpAddress_Set($IPAddress2, $IP1_pre & $IP2_suf)
            EndIf
        Case $IPAddress2
            $IP2_pre = StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress2), "(.*\.)\d+", "$1")
            $IP1_suf = StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), ".*\.(\d+)$", "$1")
            _GUICtrlIpAddress_Set($IPAddress1, $IP2_pre & $IP1_suf)
    EndSwitch
    If _WinAPI_HiWord($wParam) = $EN_KILLFOCUS Then
        $IP1_suf = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress1), ".*\.(\d+)$", "$1"))
        $IP2_suf = Int(StringRegExpReplace(_GUICtrlIpAddress_Get($IPAddress2), ".*\.(\d+)$", "$1"))
        If $IP1_suf > $IP2_suf Then _GUICtrlIpAddress_Set($IPAddress2, _GUICtrlIpAddress_Get($IPAddress1))
    EndIf
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>Check_IP

Func Add2ListView()
    Local $j, $sData
    For $j = 1 To UBound($aFileContent) - 1
        $sData = $aFileContent[$j]
        If Not StringRegExp($aFileContent[$j], "(\d+)\.(\d+)\.(\d+)\.(\d+)$", 3) Then
            GUICtrlCreateListViewItem("", $ListView)
            _GUICtrlListView_AddSubItem($ListView, $j - 1, $sData, 1, -1)
        Else
            GUICtrlCreateListViewItem($sData, $ListView)
        EndIf
        GUICtrlSetBkColor(-1, 0xE8E8FF) ;RGB
    Next
EndFunc

Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    #forceref $hWnd, $Msg
    Switch $wParam
        Case $idAddIP
            GUICtrlSendToDummy($dummy)
        Case $idDelItem
            GUICtrlSetState($ListView, $GUI_HIDE)
            GUISetState(@SW_DISABLE, $hGUI)
            _ArrayDelete($aFileContent, _GUICtrlListView_GetSelectedIndices($ListView) + 1)
            _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
            Add2ListView()
            _GUICtrlStatusBar_SetText($StatusBar, UBound($aFileContent) - 1, 1)
            GUISetState(@SW_ENABLE, $hGUI)
            GUICtrlSetState($ListView, $GUI_SHOW)
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_COMMAND

Func WM_CONTEXTMENU($hWnd, $msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    Local $mi = GUIGetCursorInfo()
    If IsArray($mi) Then
        If $mi[4] = $ListView Then
            _GUICtrlMenu_TrackPopupMenu ($hQMenu, $hGUI)
        Return True
        EndIf
    EndIf
    Return True
EndFunc   ;==>WM_CONTEXTMENU

Func Load_BMP_From_Mem($mem_image) ;coded by UEZ - thanks to progandy for the MemGlobalAlloc lines
    Local $memBitmap, $len, $tMem, $hData, $pData, $hBitmapFromStream
    $memBitmap = Binary($mem_image) ;load image  saved in variable (memory) and convert it to binary
    $len = BinaryLen($memBitmap) ;get length of image

    $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory  ($GMEM_MOVEABLE = 0x0002)
    $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count  associated with a memory object that was allocated with GMEM_MOVEABLE

    If Not IsDeclared($hStream) Then Global $hStream
    $hStream = _WinAPI_CreateStreamOnHGlobal($pData) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    $hBitmapFromStream = _GDIPlus_BitmapCreateFromStream($hStream) ;Creates a Bitmap object based on an IStream COM interface
    $tMem = ""
    Return $hBitmapFromStream
EndFunc   ;==>Load_BMP_From_Mem

Func _WinAPI_CreateStreamOnHGlobal($hGlobal = 0, $fDeleteOnRelease = True) ;produces a memory leak! There is a workaround made by Progandy!
    Local $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "hwnd", $hGlobal, "int", $fDeleteOnRelease, "ptr*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[3]
EndFunc   ;==>_WinAPI_CreateStreamOnHGlobal

Func _GDIPlus_BitmapCreateFromStream($pStream)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[2]
EndFunc   ;==>_GDIPlus_BitmapCreateFromStream

Func OK() ;
    Local _
            $OK = '0x89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF61000002624944415478DA63FCFFFF3F032940B94D8AF9EFBBBF820F7A5EBE01F11949314038988F43CD477615AF00B7D9C589B74B5F1DFCB08624034C266ACC50D2914D67E36361D85F7776C1B31DAF7B893640BB4D31DEC85E7B01271F1BC399C557CE9FEFBEDD0B14E624CA00992C610DDB28E3135C22ECFCF7CF3F7DBD3FEE7C07C31F0656A0143F41030422B958CC63B4F6C8EB48DA7FFBFEE3FF5A97437D3F9EFE7A0A0A1220FE48D000B3396AE59681061D6CDCAC0CEB120E6CBDB7F2D956A0B008107F06E26B780D902B12D6F12B753C2124CECF7D76F5B547DB224EF401857981F81B10DF00E22B60035CB6984EE36267D73A5E7FA5F5CDF18F0780127F81E2FF824ED8EDD03454767FF7F6C3FF05C65BFB7EBCF8FD0A28C702C47780F822103F021B90F130F0BF84BC30C3BB379F7EAD09D95FFAFCE09BC55ABD322EAE0996AB18D8181876141F3B7073D6D375400D8240FC0CAAF936107F021B206E2514E23BDF7AAE989210DFFB579FFE6D483DD8615AA1E123A52EA6F7F0FCD30F3B7CCE7430FC0519C5F015E46C20BE0CC4AF817AFF800D60646464E79466F3F65E63394F489E8FFFCBD76F0C7FBEFF61F8CDF48B615FCC85C51F2F7CBF00D4C005C47781F83C103F04EAFB0E4FCA400398816C210E69D6708715BA3D4C6C'
            $OK &= '4CEC3FFFFD6478B4EDE5B3DBCDAF6600E59880F815D4E9A0C0FB000A23B80160062323C889A2BCFAEC599AFD52553FBFFD64B812FB7CFBDFF7FF6F02C5DF409D0D32E03950CF2F584CA14423D01050EA12E5D4622964F8CFA0F7FDFA9FFB403E48F175203E090DB82FFF913461A403A84BA440790788F58118E4D4B3407C06885F02D5FF45560F0094401C0EBF687F2D0000000049454E44AE426082'
    Return Binary($OK)
EndFunc   ;==>OK

Func NOK()
    Local _
            $NOK = '0x89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF61000003314944415478DAA5926B48536118C7DFF7B4CD4DE7DC20AFA9790953038B301925445214857EB014BA2B59A41F824A4A29342A52D2AE1059505452B42E445F4A29C42EA2ADBC2C74F3522E9D9BBA8B9B73677ACECECE7ADE710AFBDC81DF87F3BECFF37F9FE7F93F381008A0FFF9F0A747F78B72161CD75DD393717EB9D2D6AE3334B568BB6F3ED20FBBE0DE1F58F482B1A25CA654CA4B788A3FD2DCF661EEA14E7F0D9FD8B6E5F0DEE4A88655ABB322289E479C670E75F7E83AABDABE567758ADDD90E7050D7EBCF4C086A8C8D08621379D75FE4DDB953726CBFD0584784CAAC85BB932BB2023A56A577A7241A4DB2AE21C76D4FFCB34D968A22B9F5BA65A8C45F9E591F691DAD733ECAFAB8689CA6E9635405E18200D0A003220215BA5DC7F28397A5F3E9E5D1EE271A27E4E6A655431A3B1D671B5CE87BE7D66F98B771D8C5948A60006931631C622F85101CBC5186794C6C7EE3C2C766E5722245E60596414C98D5D0BBEC64B53DE11880921890099910DFF9911888805E5A55736E616655806CE24602E4C21C6A8CB4B99CA273C77667CDC14DCDB810901175E6C2388E01FBB0B2B687D4743842C4476D74CF7F9FC9CB42646927E799A315C30BBEF40583FA027AF432EF78F80F968699955DB7A4BC9CD4B34B4EC4BF5E8E4'
            $NOK &= '6D384E3A9518595C1523C9CC1F743577B8E97B703600CC1077FE0AB4EE29DE9A621D7C816C66790FBD64FCE04F7B2D8302A4DF700954762935BA24571A88DF6CB0977BFCFEAFA405C89D0F0A68D4EA8454157A1F6E35A6B959C4958ECCD60F308C85D8444A25C1326A89A2354DD5F4C446773639E61BC95E91790405A677E4D5D3D4DC69649B425A273BFE6A867EF9CC4E3B20605A287714E0D78787ED3A17157AB6D0E838E9E1F9EF4418EB37E52AA4518A77126A3E8771B850D798455B67726AFBBDEC2404F4013A4188F4AAAC4F8CBBDDEBF2D8356EF703F837E11BEBD644A85397B5A78A7C6B260C06BE6ECCF95863F790D789E79DC03054490B2E8952E461EA1C91A8E8A96BB6990C32D8424DE68AE3659989F51F8786C7CAF496B70C1F60E1B207E81286E55B6475482845257A799EEC8D3F28B0562A8D4E0A951E6B737BD0ACDF4F96C9097400BD825D81C5BB22ACBE0290FF065C149BF6DD07A3F30000000049454E44AE426082'
    Return Binary($NOK)
EndFunc   ;==>NOK
Salu22:)
Adjuntos
Pantalla de trabajo controlador de Status
Pantalla de trabajo controlador de Status
Portapapeles01.jpg (42.07 KiB) Visto 2185 veces
Cyber90
Mensajes: 9
Registrado: 16 May 2011, 16:28
Ubicación: Hacker ist not a Crime !

Re: Comprobador masivo de pings-Online Status

Mensaje por Cyber90 »

pero que quieres acer tu tio? lo quieres modificar?
Responder