Tag: check

C#

How to check the machine type in C#

public enum ChassisTypes { Other = 1, Unknown, Desktop, LowProfileDesktop, PizzaBox, MiniTower, Tower, Portable, Laptop, Notebook, Handheld, DockingStation, AllInOne, SubNotebook, SpaceSaving, LunchBox, MainSystemChassis, ExpansionChassis, SubChassis, BusExpansionChassis, PeripheralChassis, StorageChassis, RackMountChassis, SealedCasePC }   public ChassisTypes GetCurrentChassisType() { try { ManagementClass mc = new ManagementClass("Win32_SystemEnclosure"); foreach (ManagementObject mo in mc.GetInstances()) foreach (int i in (UInt16[])(mo["ChassisTypes"])) if (i …

Kohana, PHP

How to avoid repeating code to check if a user is logged in

First of all create your own Controller that all other controllers will inherit from. Name it Mycontroller, for example: defined(’SYSPATH’) or die(’No direct script access.’);   class Controller_Mycontroller extends Controller {   public function before() { parent::before(); //…. }   } // Enddefined(‘SYSPATH’) or die(‘No direct script access.’); class Controller_Mycontroller extends Controller { public function …

Microsoft SQL Server

Check for null passwords in Sql Server

One of the many ways to secure SQL Server is to review all passwords. You must also check for null passwords and if you locate any, change them. To list all users with null passwords, execute the following sql command: USE master GO   SELECT name, password FROM syslogins WHERE password IS NULL;use master go …

C#

Check whether the system is 32 bit or 64 bit

Check if the system is 64 bit. public Boolean Is64Bit_1() { return System.Environment.GetEnvironmentVariable("ProgramW6432") != ""; }public Boolean Is64Bit_1() { return System.Environment.GetEnvironmentVariable("ProgramW6432") != ""; } Check if specified process is 64 bit. [System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true, CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi)] [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool IsWow64Process([System.Runtime.InteropServices.In] IntPtr hProcess, [System.Runtime.InteropServices.Out] out Boolean lpSystemInfo);   public Boolean Is64Bit_2() …

C#

Check if computer is alive with C#

To check if a computer in the network is alive we are going to ping it through C# and Ping class. Ping ping = new Ping(); PingReply pingReply; pingReply = ping.Send(ip, timeout); if (pingReply.Status == IPStatus.Success) { …. } else { …. }Ping ping = new Ping(); PingReply pingReply; pingReply = ping.Send(ip, timeout); if (pingReply.Status …

Brute-force, Enumeration

SMTP Users enumeration

* Open your BackTrack machine * GoTo Applications->BackTrack->Information Gathering->Network Analysis->SMTP Analysis * Choose smtp-user-enum * Execute: ./smtp-user-enum.pl -v -M RCPT -u info@example.org -t mail.example.org./smtp-user-enum.pl -v -M RCPT -u info@example.org -t mail.example.org -v Verbose -M mode Method to user for username guessing (RCPT here) -u user Check if this user exists -t host SMTP server