Tag: version

C

Get Windows version in C

I am not gonna use GetVersionEx or GetVersion. Both these functions may be altered or unavailable for releases after Windows 8.1. I am not gonna use either Version Helper functions. #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <stdbool.h>     #define WIN_XP 0x0501 #define WIN_XP64PRO 0x0502 #define WIN_VISTA 0x0600 #define WIN_WIN7 0x0601 #define WIN_WIN8 0x0602 …

C#

Get Windows version, Architecture and Service pack

Let’s see how can we get Windows Version, CPU architecture and Windows Service Pack in Windows using C#. We are going to use GetVersionEx and OSVERSIONINFOEX structure from Windows API. Windows API: [StructLayout(LayoutKind.Sequential)] private struct OSVERSIONINFOEX { public int dwOSVersionInfoSize; public int dwMajorVersion; public int dwMinorVersion; public int dwBuildNumber; public int dwPlatformId; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = …

CakePHP, PHP

Get MySQL version in CakePHP 3

You need to import ConnectionManager: use CakeDatasourceConnectionManager;use CakeDatasourceConnectionManager; $stmt = ConnectionManager::get(’default’)->query(’SELECT version() as v’); $stmt->execute(); echo $stmt->fetch(’assoc’)[’v’];$stmt = ConnectionManager::get(‘default’)->query(‘SELECT version() as v’); $stmt->execute(); echo $stmt->fetch(‘assoc’)[‘v’]; More on executing CakePHP custom queries, here.

C#

Extract executable assembly/version information

Methods we are going to use: GetFileVersionInfo Retrieves version information for the specified file. GetFileVersionInfoSize Determines whether the operating system can retrieve version information for a specified file. If version information is available, GetFileVersionInfoSize returns the size, in bytes, of that information. VerQueryValue Retrieves specified version information from the specified version-information resource. To retrieve the …

Apache, PHP, Servers/Services

Hide PHP version from hachers!

Another small step to a more secure web server is to hide PHP version. To do this you have to locate your php.ini file in your server. Usually php.ini is located in /etc or /etc/php5/apache2. 1. Make a backup of your php.ini file. 2. Open php.ini file for edit. 3. Locate line: expose_php = On …

Linux, proFTPD, Servers/Services

Hide ProFTPD version from hachers

Lets edit proftpd.conf 1. Keep a backup first of /etc/proftpd.conf file 2. sudo nano /etc/proftpd.conf To hide proftpd version we add a line above ServerName ServerIdent Off We can also change proftpd service name for the outside world: ServerName “MyFTPServer” or put something else 3. Restart proftpd service sudo /etc/init.d/proftpd restart

Apache, Servers/Services

Hide Apache version from hackers

A first line of defense in web application world is to hide as much info as possible from HTTP headers! In this article we will see how easy it is to hide apache’s version number. 1. Keep a backup of file /etc/apache2/apache2.conf. 2. Open /etc/apache2/apache2.conf file for edit. For ubuntu users issue the following command: …