Skip to content
Permalink
Browse files

Release 1.0.7

    - NEW: killall program
    - NEW: su (change current user)
    - NEW: change banner/server name/server port/mother port/mother name by console.
    - NEW: upgrade the server using his mother.
    - NEW: help re-arrange.
    - NEW: PRX_ATTACH
  • Loading branch information
unmanarc committed Apr 20, 2003
1 parent 69338ee commit ff6b24faeb67084a64de73a7fae11248181aa4d9
@@ -0,0 +1,50 @@
#include "StdAfx.h"
#include "connector.h"

Cconnector::Cconnector(void)
{
}

Cconnector::~Cconnector(void)
{
}

void Cconnector::connectto(char *ip,unsigned int port)
{
struct hostent *hentry;
struct sockaddr_in Server_add;
WORD wVersionRequested;
WSADATA wsaData;
// Start Winsock
wVersionRequested = MAKEWORD( 1, 0 );
if( WSAStartup( wVersionRequested, &wsaData ) == 0 )
{

SOCKET Sock = socket( AF_INET, SOCK_STREAM, 0 ); //open socket
// Connect Server
if ((hentry = gethostbyname(ip)) == NULL)
{
//error: go out. Cannot resolve.
return;
}
else
{
// Make Socket
memset((char *)&Server_add, 0, sizeof(Server_add));
memcpy(&Server_add.sin_addr.s_addr, *(hentry->h_addr_list),sizeof(Server_add.sin_addr.s_addr));
//host are copied to Server_add
Server_add.sin_port = htons(port);
Server_add.sin_family = AF_INET;

// Connect Server
if( connect( Sock, (struct sockaddr *) &Server_add, sizeof( Server_add ) ) == 0 )
{
closesocket(Sock);
}
else
return;
}
}
else
return;
}
@@ -0,0 +1,9 @@
#pragma once

class Cconnector
{
public:
void connectto(char *ip,unsigned int port);
Cconnector(void);
~Cconnector(void);
};
@@ -98,7 +98,7 @@ int Ccore::start_instance(SOCKET d,BOOL asproxy, char *ip)
time(&cnts[z].since); //assing time of connection
BOOL prx=1; // start proxy as TRUE

if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE","Received connection.","none");
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE ","Received connection.","none");

prx=asproxy; //if proxy do more rounds
BOOL cntw=FALSE;
@@ -130,26 +130,17 @@ int Ccore::start_instance(SOCKET d,BOOL asproxy, char *ip)
strcpy(svrs[gd].ip,cnts[z].ip_from);
svrs[gd].f=cnts[z].socket;
cnts[z].busy=0;
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE","Proxy attached.","proxy");
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE ","Proxy attached.",svrs[gd].nameserver);
return -1;
}
//Connection started... we can send any data-. (sending banner)
protocol.cls();
protocol.setposxy(15,6);
protocol.setcolor(15);
protocol.senddata("URCS - Unmanarc Remote Control Server - 1.0.6");
//center banner.... (80)
protocol.setcolor(7);
size_t lugar=strlen(data_g.server_banner);
if (lugar>80) protocol.setposxy(1,8);
else
{
lugar=lugar/2;
lugar=40-lugar;
protocol.setposxy((int)lugar,8);
}
protocol.senddata(data_g.server_banner);
// protocol.senddata("\n");
protocol.senddatacenter(BANNER,7);
protocol.senddata("\n");
protocol.setdefaultcolor();
protocol.senddatacenter(data_g.server_banner,8);

int level; //privilege levels
if (data_g.installed) level=0; //privilege level on logon
else level=4; //privilege level on instalation
@@ -172,8 +163,16 @@ int Ccore::start_instance(SOCKET d,BOOL asproxy, char *ip)
if (level==3)
{
//Logged on.
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE","Logged on.",cnts[z].c_User);
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE ","Logged on.",cnts[z].c_User);
protocol.cls();
// print banner

protocol.setcolor(LIGHTGREEN);
protocol.senddata(" /\\ Unmanarc Remote Control Server - URCS\n");
protocol.senddata(" / | \\ Trinity Glow - 1.0.7\n");
protocol.senddata("/ | \\ http://urcs.unmanarc.com/\n");
protocol.senddata("--------- -------------------------------------\n");
protocol.setdefaultcolor();
Cintep intep; //make new interpreter
intep.start_intep(cnts,z,protocol.getkey());
// print command line take parameter and process them
@@ -189,6 +188,7 @@ int Ccore::start_instance(SOCKET d,BOOL asproxy, char *ip)
if (b>=0) b=intep.run(cnts,svrs,z); //run command line
if (!intep.passed) protocol.senddata("\nCommand line error\n"); //when command cannot be excecuted show this
}
if (b==-15) return -15;
cont=0;
}
if (level==2)
@@ -244,7 +244,7 @@ int Ccore::start_instance(SOCKET d,BOOL asproxy, char *ip)
if(asproxy) //end of while...
protocol.sendclose();
}
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE","Closed Connection.",cnts[z].c_User);
if (data_g.log_data) _log.logg(cnts[z].ip_from,"CORE ","Closed Connection.",cnts[z].c_User);
cnts[z].m_mem.release_mem();
cnts[z].busy=0;
}
@@ -31,6 +31,14 @@ Cfns::~Cfns()
{ //destructor
}

char *Cfns::extview(char *filename)
{
int lg=strrpointer(filename, '.');
//search back for .
strncpy(returned,filename+lg+1,12);
returned[12]=0;
return returned;
}
long Cfns::GetFreeDiskSpaceInKB(LPSTR pFile)
{
DWORD dwFreeClusters, dwBytesPerSector, dwSectorsPerCluster, dwClusters;
@@ -121,7 +129,7 @@ int Cfns::strrpointer(char *pointer, char pnt)
int point=(int)strlen(pointer);
while(point>0)
{
if (pointer[strlen(pointer)-point]==pnt)
if (pointer[point]==pnt)
return point;
point--;
}
@@ -560,7 +568,7 @@ time_t Cfns::TimetFromFt(FILETIME pft)
}
char *Cfns::md5sum(char *value)
{
memset(&returned,0,COMMAND_LINE);
strncpy(returned,CMD5Checksum::GetMD5((BYTE*)value,(UINT)strlen(value)),32); //checksum Md5 is 32 bytes in hex.
//memset(&returned,0,COMMAND_LINE);
strcpy(returned,CMD5Checksum::GetMD5((BYTE*)value,(UINT)strlen(value))); //checksum Md5 is 32 bytes in hex.
return returned;
}
@@ -39,6 +39,7 @@ class Cfns
char *convert_vars(char *instr, con_v mx[SERVER_CONNECTIONS], int xlogon);//Transform % lang.
char *depstring(char *dep);//convert all /32 to /0
char *md5sum(char *value); //calculate md5 sum of any string
char *extview(char *filename); //retrive extension from file

BOOL cmpfirstword(char *WordVariable,char *WordStatic); //compare the first word of a string
BOOL KillProcess(unsigned long pid); //kill a process
@@ -124,9 +124,9 @@ void Cini::LoadData()
break;
}

GetModuleFileName(NULL,lcname,512);
GetWindowsDirectory(windir,512);
GetSystemDirectory(sysdir,512);
GetModuleFileName(NULL,lcname,_MAX_PATH);
GetWindowsDirectory(windir,_MAX_PATH);
GetSystemDirectory(sysdir,_MAX_PATH);

// Verify the lcfn (local name of file)
strcpy(lnif,lcname);
@@ -139,7 +139,6 @@ void Cini::LoadData()
*/



Cfns funciones;
strcpy(lcfn, lnif+funciones.strrpointer(lnif,'\\')+1);

@@ -153,7 +152,7 @@ void Cini::LoadData()

//Get data from INI file
GetPrivateProfileString("URCS","server_banner","Misconfigured.",server_banner,256,ini_filename);
GetPrivateProfileString("URCS","server_prompt","#",server_prompt,256,ini_filename);
GetPrivateProfileString("URCS","server_prompt","",server_prompt,256,ini_filename);
GetPrivateProfileString("URCS","server_name","default-misconfigured",server_name,256,ini_filename);
GetPrivateProfileString("URCS","server_port","3359",lport,10,ini_filename);
GetPrivateProfileString("URCS","mother_name","200.16.194.34",mother_name,256,ini_filename); //this 000.000.000.000 you can change it directly from PXE.
@@ -27,21 +27,23 @@ class Cini
s_proxyinf GetProxy();

//Datos del ini:

char server_prompt[256];
char server_banner[256];
char server_name[256];
char mother_name[256];

int mport;
int port;
BOOL log_data;
BOOL crypted;

//Datos del sistema:

char lcname[512];
char lcfn[512];
char windir[512];
char sysdir[512];
char lcname[_MAX_PATH];
char lcfn[_MAX_PATH];
char windir[_MAX_PATH];
char sysdir[_MAX_PATH];
BOOL nt;
BOOL installed;

@@ -134,7 +134,7 @@ void Cinstall::OnBnClickedButton1()
itoa(m_mport,portob,10);

PutData("URCS","server_banner",banner);
PutData("URCS","server_prompt","[$d $u]#");
PutData("URCS","server_prompt","[$d $u]");
PutData("URCS","server_name",servername);
PutData("URCS","server_port",portoa);
PutData("URCS","mother_name",m_mhost);
BIN +624 Bytes (100%) installer/installer.aps
Binary file not shown.
BIN +24 KB (120%) installer/installer.ncb
Binary file not shown.
@@ -172,6 +172,43 @@ LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_VENEZUELA
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 275, 126
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Installing"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LISTBOX IDC_LIST1,7,7,261,94,LBS_SORT | LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
WS_EX_STATICEDGE
PUSHBUTTON "install",IDC_BUTTON1,7,104,261,15
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 268
TOPMARGIN, 7
BOTTOMMARGIN, 119
END
END
#endif // APSTUDIO_INVOKED


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@@ -217,43 +254,6 @@ END
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\installer.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 275, 126
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Installing"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LISTBOX IDC_LIST1,7,7,261,94,LBS_SORT | LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
WS_EX_STATICEDGE
PUSHBUTTON "install",IDC_BUTTON1,7,104,261,15
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 268
TOPMARGIN, 7
BOTTOMMARGIN, 119
END
END
#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
BIN -512 Bytes (94%) installer/installer.suo
Binary file not shown.
@@ -48,7 +48,7 @@ END_MESSAGE_MAP()
CinstallerDlg::CinstallerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CinstallerDlg::IDD, pParent)
, m_startatwin(TRUE)
, m_log(TRUE)
, m_log(FALSE)
, banner(_T("Misconfigured"))
, servername(_T("misconfigured"))
, m_lport(3359)
@@ -113,7 +113,42 @@ BOOL CinstallerDlg::OnInitDialog()
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here

LONG lRet;
HKEY hKey;
DWORD dwBufLen = 1024;
char dato[1024];
BOOL sc=1;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"),
0,
KEY_QUERY_VALUE,
&hKey
) == ERROR_SUCCESS)
{
lRet = RegQueryValueEx(hKey,
TEXT("DefaultDomainName"),
NULL,
NULL,
(LPBYTE)dato,
&dwBufLen);
RegCloseKey(hKey);
if(lRet != ERROR_SUCCESS) sc=0;
}
else sc=0;
if (sc!=0)
{
UpdateData(1);
char datab[1080];
strcpy(datab,"Welcome to ");
strcat(datab,dato);
servername=dato;
banner=datab;
UpdateData(0);
}

//GET THIS KEY AND
// \
return TRUE; // return TRUE unless you set the focus to a control
}

BIN +0 Bytes (100%) installer/res/bitmap1.bmp
Binary file not shown.
BIN +0 Bytes (100%) installer/res/installer.ico
Binary file not shown.

0 comments on commit ff6b24f

Please sign in to comment.
You can’t perform that action at this time.