Monday 5 June 2017

விண்டோஸ் ஏபிஐ 32 ப்ரோக்ராம்மிங்(Win 32 API Programming)

A Simple Window

விண்டோஸ் ஏபிஐ 32 ப்ரோக்ராம்மிங் செய்வது பற்றி தெரிந்துகொள்ளலாம் என http://www.winprog.org/tutorial/ இந்த லிங்கில் படிக்க ஆரம்பித்தேன்

சற்று பார்க்க கடினமாய் இருந்தாலும்..கொஞ்சநேரத்தில் ஆர்வம் கூடியது

#include 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}

இதனை ரன் செய்யும்பொழுது ஒரு மெசேஜ் விண்டோ தோன்றிற்று


WinMain என்பது நாம் சி லாங்குவேஜில் மெயின் பங்க்ஷன் போல, இங்கிருந்துதான் ப்ரோக்ராம் துவங்கும்

அடுத்து ஒரு சிறிய விண்டோவை உருவாக்க..சற்று நிறைய லைன் கோடிங் தேவைப்படுகிறது, சி லாங்குவேஜை விட சிறிய அளவில் அவுட்புட் வருமென கூறுகிறார்கள் பாப்போம்

#include 

const char g_szClassName[] = "myWindowClass";

// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    //Step 1: Registering the Window Class
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, "Window Registration Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    // Step 2: Creating the Window
    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        "The title of my window",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, "Window Creation Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    // Step 3: The Message Loop
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}

 CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, 
இந்த லைன்நில் விண்டோ சைஸ் மட்டும் சிறிது மாற்றி பார்த்தேன், அவுட்புட்டில் விண்டோவின் அளவு சற்று பெரியதாகவே வந்தது  

const char g_szClassName[] = "myWindowClass";-->விண்டோஸ் கிளாஸ் உருவாக்கம் 


அடுத்து ஒரு விண்டோ உருவாக்கி அதனை கிளிக் செய்யும்பொழுது நம்முடைய EXE யின் Absolute Path காண்பிக்குமாறு கோடிங் செய்யப்போகிறோம் 


LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}


மெசேஜ் விண்டோ கோடிங்கில் கீழ் குறிப்பிட்டுள்ள லைன்களை புகுத்திவிட்டால் போதும்  

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   switch(msg)
   {
      case WM_LBUTTONDOWN:    // <- 0="" added="" break="" case="" default:="" defwindowproc="" destroywindow="" hwnd="" just="" lparam="" msg="" postquitmessage="" pre="" return="" stuff="" this="" we="" wm_close:="" wm_destroy:="" wparam="">

இந்த கோடை பழைய ப்ரோக்ராமுடன் இணைத்தபிறகு, ரன் செய்தால்..ஒரு விண்டோ புதிதாக தோன்றும்..அதனை கிளிக் செய்தால் exeயின் Absolute Path காட்டும் 


விண்டோஸ் ஏபிஐ 32 ப்ரோக்ராம்மிங்கில் மெசேஜ் என்றால் என்ன ?

மெசேஜ் என்பது ஒரு இன்டிஜெர் வால்யூ, 

#define WM_INITDIALOG                   0x0110

விண்டோசில் எங்கு ஒரு இடத்திலிருந்து இன்னொரு இடத்திற்கு தகவல் பரிமாற்ற தேவை இருந்தாலும் அதனை மெசேஜ் கொண்டே செயலாற்றப்படும் 

மெசேஜிற்கு இரண்டு பாராமீட்டர்கள் உள்ளது wParam மற்றும் lParam

WM_CLOSE மெசேஜ் இவ்வரிண்டையுமே பயன்படுத்தாது, அதனால் இதன் மதிப்பு 0

எ.கா: PostMessage(hwnd, WM_CLOSE, 0, 0);

ஒரு மெசேஜ் அனுப்ப PostMessage() அல்லது  SendMessage() பயன்படுத்தலாம் 

PostMessage() மெசேஜெய் மெசேஜ் க்யூவில் புகுத்திவிட்டு ரெட்டர்ன் ஆகிவிடும், அனால்  SendMessage() மெசேஜெய் நேரடியாக விண்டோவ்விற்கு செய்தியை அனுப்பிவிடும்..அந்த விண்டோ அதனை ப்ரோஸ்ஸ் செய்து முடிக்கும்வரை ரெட்டர்ன் ஆகாது 

PostMessage(hwnd, WM_CLOSE, 0, 0) இந்த மெசேஜ் கோடிங் வழியாக அனுப்புவதும் இந்த
ஐகானை கிளிக் செய்வதும் ஒரே முடிவுகளை அளிக்கும்

மெசேஜ் க்யூ என்றால் என்ன ?


மெசேஜ் க்யூ என்பது சில நேரங்களில் ஒன்றுக்கும் மேற்பட்ட மெஸ்ஸஜுகள் செயல்படுத்துவதற்காக கண்ட்ரோலுக்கு ஓரே சமயத்தில் வரும், அப்போது அதனால் உடனே அதற்கு பதிலளிலக்க முடியாமல் இருப்பதால்..வரும் அணைத்து மெஸ்ஸஜுகளையும் ஒரு வரிசையில் காக்கவைத்து ஒவ்வொன்றாக செயல்படுத்தும் உத்தி


மெசேஜ் லூப் என்றால் என்ன ?

while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
    TranslateMessage(&Msg);
    DispatchMessage(&Msg);
}


1. மெசேஜ் லூப்  முதலில் GetMessage() எனும் பன்க்ஷனை கால் செய்யும்.. GetMessage() மெசேஜ் க்யூவில் ஏதாவது உள்ளதா என பார்க்கும் 

1.1 ஏதாவது இருப்பின் GetMessage()  ஒரு பொசிட்டிவ் வால்யூவை மெசேஜ் லூப்பிற்கு அனுப்பும், எரர் ஏதேனும் இருப்பின் நெகடிவ் வால்யூ ரெட்டர்ன் ஆகும் 

1.2 மெசேஜ் க்யூவில் ஒன்றுமில்லையானால் மெஸேஜிற்காக காத்திருக்கும் 

2. மெசேஜ் க்யூவில் இருந்து, GetMessage() பாசிட்டிவ் வால்யூ ரெட்டர்ன் ஆனால்..அடுத்து TranslateMessage() ரன் ஆகும் 

3. அடுத்து DispatchMessage(), இது மெசஜை எந்த விண்டோவிற்குரியது என கண்டறிந்து அதற்குரிய Window Procedure ஐ கண்டறிந்து அதற்கு மெசேஜ் அனுப்பும் 


Friday 12 May 2017


நேஷனல் செக்யூரிட்டி ஏஜென்சி எனப்படும் அமெரிக்க அரசின் சைபர் நிறுவனமானான (NSA) வால் மைக்ரோ சாப்ட் விண்டோஸ் ஆப்பரேட்டிங் ஸிஸ்டத்தில்  கண்டுபிடிக்கப்பட்ட்ட  ஏடேர்னல் ப்ளூ (ETERNAL BLUE) எனப்படும் மென்பொருள் இழுக்கை(SOFTWARE BUG) ஹாக்கர்கள் திருடி அதைவைத்து வாண க்ரை (WANNA CRY) எனப்படும் மால்வேர் உருவாக்கி இதுவரை 100 நாடுகளின் கணினிகளை தங்களின் கட்டுப்பாட்டில் கொண்டுவந்துள்ளனர்

அதில் முக்கியமாக பிரிட்டனின் ஹெல்த் கேர் சிஸ்டம் முழுவதுமாக குழம்பிப்போய் உள்ளது, FEDEX மட்டும் பெரிய பெரிய நிறுவனங்களின் கணினிகள் எனக்ரிப்ட் செய்யப்பட்டு ஒன்றுமே செய்ய முடியாத நிலையில் உள்ளது, அவற்றை சரிசெய்ய 600 டாலர்கள் கேட்டுள்ளார் அவாஸ்டின் ரிப்போர்ட் படி இதுவரை 57,000 கணினிகள்  இந்த மால்வேறால் தாக்கப்பட்டுள்ளது என தெரியவந்துள்ளது

NSA விடமிருந்து ஹேக்கிங் டூல்களை திருடிய ஷாடோவ் ப்ரோக்கேர்ஸ் (The Shadow Brokers) எனப்படும் ஹேக்கிங் குழுமம் தான் இதனை செய்திருக்கக்கூடுமென எதிர்பார்க்கப்படுகிறது






Source:
http://www.bbc.com/news/technology-39896393
http://www.ndtv.com/world-news/british-hospitals-spanish-firms-among-targets-of-global-ransomware-attack-1692963
https://en.wikipedia.org/wiki/The_Shadow_Brokers

Wednesday 26 April 2017

Cisco Router/Switch Security Audit Tool(CRAT)


CRAT audits Cisco Switch/ Router by using Config file, this tool follow CIS Security Checklist, you can download that check list from here


சிஸ்கோ ரௌட்டர் மற்றும் சுவிட்ச் செக்யூரிட்டி ஆடிட் செய்ய உதவும் கருவி இது, இது சீஐஎஸ் செக்யூரிட்டி செக் லிஸ்டின் துணைகொண்டு உருவாக்கப்பட்டது 





Here is the link to download CRAT: here

Sample Output:
————-Checks followed———–
1 AAA New Model Enabled 16:aaa new-model
2 AAA Authentication for Login Enabled 21:aaa authentication login eap_methods group rad_eap
16.1 ‘exec-timeout’ not set to less than or equal to 10 minutes for line aux 0
17.1 ‘exec-timeout’ not set to less than or equal to 10 minutes for line con 0
19.1 ‘exec-timeout’ not set to less than or equal to 10 minutes for line vty 0 4
25 ‘service password-encryption’configured 6:no service password-encryption
36 Host name configured in this line: 8:hostname retail
41 Cisco Discovery Protocol Disabled on line number: 254:no cdp run
47 PAD service disabled on line number: 3:no service pad
53 Time stamp applied to debugging messages or system logging messages in 4:service timestamps debug datetime msec
66.1 Proxy-arp not disabled on: 31 interface dialer 1
66.1 Proxy-arp not disabled on: 63 interface FastEthernet2
66.1 Proxy-arp not disabled on: 66 interface FastEthernet3
66.1 Proxy-arp not disabled on: 69 interface FastEthernet4
66.1 Proxy-arp not disabled on: 72 interface FastEthernet5
66.1 Proxy-arp not disabled on: 75 interface FastEthernet6
66.1 Proxy-arp not disabled on: 78 interface FastEthernet7
66.1 Proxy-arp not disabled on: 81 interface FastEthernet8
66.1 Proxy-arp not disabled on: 84 interface FastEthernet9
66.1 Proxy-arp not disabled on: 88 interface FastEthernet0
66.1 Proxy-arp not disabled on: 99 interface FastEthernet1
66.1 Proxy-arp not disabled on: 134 interface Dot11Radio0
66.1 Proxy-arp not disabled on: 162 interface Dot11Radio0.1
66.1 Proxy-arp not disabled on: 173 interface Dot11Radio0.2
66.1 Proxy-arp not disabled on: 182 interface Dot11Radio0.3
66.1 Proxy-arp not disabled on: 191 interface Vlan1
66.1 Proxy-arp not disabled on: 200 interface Vlan2
66.1 Proxy-arp not disabled on: 205 interface Vlan3
66.1 Proxy-arp not disabled on: 210 interface BVI1
66.1 Proxy-arp not disabled on: 214 interface BVI2
66.1 Proxy-arp not disabled on: 217 interface BVI3
68.1 uRPF is not running on: 31 interface dialer 1
68.1 uRPF is not running on: 63 interface FastEthernet2
68.1 uRPF is not running on: 66 interface FastEthernet3
68.1 uRPF is not running on: 69 interface FastEthernet4
68.1 uRPF is not running on: 72 interface FastEthernet5
68.1 uRPF is not running on: 75 interface FastEthernet6
68.1 uRPF is not running on: 78 interface FastEthernet7
68.1 uRPF is not running on: 81 interface FastEthernet8
68.1 uRPF is not running on: 84 interface FastEthernet9
68.1 uRPF is not running on: 88 interface FastEthernet0
68.1 uRPF is not running on: 99 interface FastEthernet1
68.1 uRPF is not running on: 134 interface Dot11Radio0
68.1 uRPF is not running on: 162 interface Dot11Radio0.1
68.1 uRPF is not running on: 173 interface Dot11Radio0.2
68.1 uRPF is not running on: 182 interface Dot11Radio0.3
68.1 uRPF is not running on: 191 interface Vlan1
68.1 uRPF is not running on: 200 interface Vlan2
68.1 uRPF is not running on: 205 interface Vlan3
68.1 uRPF is not running on: 210 interface BVI1
68.1 uRPF is not running on: 214 interface BVI2
68.1 uRPF is not running on: 217 interface BVI3
————-Checks not followed———–
3 AAA Authentication for Enable mode not Enabled
4 Console Line Authentication not Enabled
5 TTY Line Authentication not Enabled
6 VTY Line Authentication not Enabled
7 AAA Accounting not enabled to log all Prevelidged commands
8 AAA Accounting connection not enabled to identify all outbound connections
9 AAA Accounting not enabled for EXEC shell session
10 AAA accounting not performed for all network-related service requests
11 AAA accounting not performed for all system-level events not associated with users such as reloads
12 privilege level for the Local user not enabled
13 SSH not configured for incoming VTY logins
14 EXEC process for the aux port is not disabled
15 ‘access-class’ for ‘line vty’ EXEC not enabled
20 ‘inbound connections for the aux port not disabled
21 exec banner is not set
22 login banner is not set
23 motd banner is not set
24 enable secret password not configured
26 user with an encrypted password is not enabled
27 simple network management protocol (SNMP) not disabled
28 ‘public’ for ‘snmp-server community’ not disabled
29 ‘write’ access not provided for SNMP community String
30 ACL not configured for each ‘snmp-server community
31 ACL not defined for SNMP protection
32 ‘snmp-server host’ not Enabled
37 IP domain name not configured in this line
38 IP ssh time-out not configured in this line number
39 IP ssh retries not configured in this line number
40 IP ssh version 2 not configured in this line number
42 Bootstrap Protocol (BOOTP) service not Disabled
43 Dynamic Host Configuration Protocol not Disabled
44 Identification Protocol not Disabled
45 TCP keepalives-in service not Enabled
46 TCP keepalives-out service not Enabled
48 Logging not enabled
49 Logging buffer not configured
50 Logging for console on critical events not configured
51 Logging host not configured
52 Logging for Trap events not configured
54 Logging for Source source-interface not configured
55 NTP authentication not configured
56 NTP authentication key not configured
57 NTP Trusted key not configured
58 NTP Trusted key not configured
59 IP address not configured for NTP Server
60 Multiple Loopback interface not configured
61 source-interface for tacacs not configured
62 source-interface for radius not configured
63 NTP source not configured to loopback
64 TFTP source not configured to loopback
65 Handling of IP datagrams with source routing header options not disabled
67 tunnel interface not disabled
69 Key chain not configured for Routing Protocol
70 Key value not available for key chain
71 key-string not configured
72 ‘address-family ipv4 autonomous-system’ not enabled on EIGRP routing
73 af-interface not set to default
74 EIGRP authentication not configured
75 af authentication mode not configured to md5
76 EIGRP authentication key-chain not configured
77 EIGRP authentication mode not configured to md5
78 OSPF authentication message Digest not configured
79 OSPF authentication message Digest not configured
80 RIPV2 packets authentication not enabled
81 RIPV2 authentication mode not configured to md5

82 BGP neighbor password not configured

Thursday 30 March 2017

Can't install Kali Linux from USB, fails to find CD-ROM drive(காலி லைனஸ் usb பெண் ட்ரைவ் வழியாக இன்ஸ்டால் செய்வதில் பிழை, சீடி ரோம் கண்டுபிடிப்பதில் பிழை )


காலி லைனஸ் usb  பெண் ட்ரைவ் வழியாக  இன்ஸ்டால் செய்வதில் பிழை, சீடி ரோம் கண்டுபிடிப்பதில் பிழை

  1. Unplug your USB from system and re insert it( usbயை  பிடுங்கி சொருகவும் )
  2. wait for mount/ detection (usb LED glow)(பெண் ட்ரைவில் நமது கணினியுடன் இணைத்துவிட்டதை உறுதிப்படுத்த விளக்கு எறியும்  )
  3. Hit Continue(இப்போது என்டர் செய்து இன்ஸ்டாலேஷனை தொடரவும் )

Sunday 19 March 2017

Kali Linux VDI Backup with Least Size


We can reduce Kali Linux VDI Memory size to the least using the following steps:
காலி லைனஸ் பேக்கப் செய்வது மற்றும் அதனை குறைந்த சைஸ்-கு கொண்டுவருவது பற்றி கீழ்காணும் பதிவில் காண்க :

1.Open Terminal and run these lines:
டெர்மினல் ஓபன் செய்து கீழுள்ள வரிகளை டைப் செய்யவும் :


sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile

First line will create a file called as "bigemptyfile"and write '0' until the free space available in Virtual Disk gets completed

Second line will delete that "bigemptyfile" which leads to deletion of empty space available in Virtual Disk
முதல் வரி "bigemptyfile" என்கிற பைலை உருவாக்கி அதில் பூச்சியத்தை அந்த டிஸ்கில் இடமுள்ளவரை எழுதிக்கொண்டே செல்லும் 

இரண்டாம் வரி முதல் வரியில் உருவாக்கிய  "bigemptyfile" என்கிற பைலை நீக்கும் 

இவ்வாறு நாம் வீணாய் வைத்திருக்கும் டிஸ்க் இடங்களை நீக்கிவிடலாம்

2. Clone Virtual machine using Virtual box, Virtual box software will reduce the Virtual disk size by removing free spaces while cloning 

  

 virtual box மென்பொருள் பயன்படுத்தி க்ளோன் செய்யவும் 

இப்படி க்ளோன் செய்யும் பொழுது virtual  box மென்பொருளே தேவையற்ற டிஸ்க் இடங்களை நீக்கிவிடும் 

3. Using 7zip we can reduce the VDI size by 3 times

7ஜிப் மென்பொருள் பயன்படுத்தி ரார் போர்மட்டிற்கு மாற்றினால் முந்திய அளவை விட மும்மடங்கு குறைந்த அளவிற்கு குறைக்கமுடியும் 









Thursday 9 March 2017

Kali Linux Update and Upgrade-(One solution to all problems)

Kali Linux Update and Upgrade

Source list for Kali Linux should be obtained from Kali Linux official Site
காலி லைனஸ் அப்டேட் மற்றும் அப்கிரேடு செய்ய கீழே கொடுக்கப்பட்டுள்ள உரலியை மட்டும் பயன்படுத்தவும், மற்றவை அனைத்தும் தவறானவை

kali-rolling is our current active repository since the release of Kali 2016.1. Kali Rolling users are expected to have the following entries in their sources.list:

deb http://http.kali.org/kali kali-rolling main contrib non-free
# For source package access, uncomment the following line
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free