Check if file exists in C
Don’t forget to define true and false constants. #define TRUE 1 #define FALSE 0 int file_exists(const char *filename) { FILE *file = fopen(filename, "r"); if (file) { fclose(file); return TRUE; }...
View ArticleCheck file extension in C
Don’t forget to define true and false constants. #define TRUE 1 #define FALSE 0 int is_exe_extension(const char *filename) { char *ext = strrchr(filename, '.'); if (!ext) return FALSE; else {...
View ArticleSMTP 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...
View ArticleCheck 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...
View ArticleCheck 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") != ""; } Check if specified process is 64 bit....
View ArticleCheck 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...
View ArticleCheck if file is in use in C#
There is no build-in function in c# to check if a file is in use. You can just try to open file for reading and catch the exception. This is not a 100% safe way because the file could become locked by...
View ArticleHow 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...
View ArticleHow 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,...
View ArticleUnit testing framework for C
Check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space, so Check can...
View Article