Click here

Monday, August 8, 2016

Windows shortcut to Mute/unMute volume

you can create a Master Volume Shortcut and also assign a Shortcut Key.

Right click on a empty area on desktop, and click on New and Shortcut. 

Paste the following in to the location of the item area:-

%windir%\System32\SndVol.exe -f 49825268

Click Next button and give a name to the Shortcut and click Finish.

Now You right click on it and select Properties.

Click Shortcut tab.

Assign your desired shortcut key like F8 or F9 in the Shortcut Key area.

Click OK/Apply.

Monday, August 1, 2016

Decoding Machine check register exception

Dump
CPU 0: Machine Check Exception: 0000000000000004
CPU 1: Machine Check Exception: 0000000000000005
      Bank 5: b200000802000e0f


Kernel Code snippet:

rdmsr (MSR_IA32_MC0_STATUS+i*4,low, high);  - reads the values of 64 bit machine check registers
        if (high & (1<<31)) {
            if (high & (1<<29))
                recover |= 1;
            if (high & (1<<25))
                recover |= 2;
            printk (KERN_EMERG "Bank %d: %08x%08x", i, high, low);
if (recover & 2)
        panic ("CPU context corrupt");

Decoding : 

( Reference Document)
You will need to browse to Intel’s website hosting Intel® 64 and IA-32 Architectures Software Developer Manuals. There, download a manual named “Intel 64 and IA-32 Architectures Software Developer’s Manual Combined Volumes 3A, 3B, and 3C: System Programming Guide”.

(Reference: https://vmxp.wordpress.com/2014/10/27/debugging-machine-check-errors-mces/comment-page-1/)

IA32_MCi_STATUS MSRS
Each IA32_MCi_STATUS MSR contains information related to a machine-check error if its VAL (valid) flag is set.

Bank 5: b200000802000e0f  - In hex format


63 62 61 60 59 58 57 56 55  54 53      52 - 38                37   36-32         31 - 16                     
1    0  1   1   0   0  1    0  0     00        000000000000000  0    01000   0000 0010 0000 0000   

 15  - 0
0000 1110 0000 1111  ( Bank value in binary format)


63 -  VAL -MCi_STATUS register valid
61 - Uncorrected error
60  - Error reporting enabled
57 - Processor context corrupt

Model specific errors   ( 16 – 31 bits) - Model-specific error code field, bits 31:16
27-25 bits - Bus queue error type

000 for BQ_ERR_HARD_TYPE error
001 for BQ_ERR_DOUBLE_TYPE error   --  It’s Double bit error detected on data read in our case
010 for BQ_ERR_AERR2_TYPE error
100 for BQ_ERR_SINGLE_TYPE error
101 for BQ_ERR_AERR1_TYPE error

0 -15 -  Specifies the machine-check architecture-
defined error code for the machine-check error condition detected
IA32_MCi_Status [15:0] Compound Error Code Encoding


Wednesday, July 27, 2016

Configure webserver in Virtual box

Guest OS: Ubuntu 15.04
Host OS:   Windows

1) Install apache in webserver
         sudo apt-get install apache2

2) Check the status of webserver
            sudo service apache2 status

3) Configure a static file of your own

       sudo vi /var/www/html/hello.txt

4) To access the webpage from host OS, you need to configure " Host-Only adapter" in adapter settings

settings->Network->adapter1

5) After adpater settings check for interface IP inside VM ( Mostly its in 192.168.*.* range). Also ping the IP from host OS to validate the IP connectivity.

6) Access the configured static webpage from host OS
  http://192.168.*.*/hello.txt

Wednesday, February 3, 2016

Virtual box VM communication

In order to communicate between the VM's and also to connect to  an internet, please follow the below steps

1) Select Settings->network-> Attached to :Internal network from virtual Box GUI


2) Once VM boots up, we need to configure static IP's for an interface  to communicate between the VM's.
You need to stop networking service in VM's from resetting an interface.

3) Suppose if you want to connect to an internet  you need to configure NAT network 

File->preferences->Network  and add NAT networks

Tuesday, July 28, 2015

rsyslog

we can do lot of things with rsyslog. But its quite difficult to find the right options to achieve our goals. Templates in rsyslog are little bit confusing. Hereby I have shared the useful commands and tips which I have used so far.

Option 1
If you want to log messages contains specific string(IP, MAC etc), you can use the below option

:msg, contains, "172.71.12.19" /var/log/userip.log
 
This option logs all the messages with string "172.17.12.19" in userip.log 


Option2
Before I go to option2 , I want to explain few concepts for better understanding


In syslog, we configure sending logs using facility.severity, where facility is the name of the (let's call it) "component" of the system, such as kernel, authentication, and so on; and severity is the "level" of each of the logs logged by a facility, such as info (informational), crit (critical) logs.
So, if I want to send kernel critical logs, I'll use kern.crit.
The combination of facility and severity is known as the priority, for example...
  • priority = kern.crit
  • facility = kern
  • severity = crit

The facilities local0 to local7 are "custom" unused facilities that syslog provides for the user. If a developer create an application and wants to make it log to syslog, or if you want to redirect the output of anything to syslog (for example, Apache logs), you can choose to send it to any of the local# facilities. Then, you can use /etc/syslog.conf (or /etc/rsyslog.conf) to save the logs being sent to that local# to a file, or to send it to a remote server.

Suppose you have a configuration in syslog to log all the dameons using local0 facility

local0.*  /var/log/messages.log

If you want to skip the specific daemon(snort) logs from messages.log and want to log in a specific file then we need to use option 2.



:msg, contains, "snort"          -/var/log/messages

& ~


Symbol "~ " -denotes discards logging  


The configuration uses a property-based filter to see if the string "snort is contained" inside the MSG part of the syslog message. If so, the message is written to /var/log/messages. The next line then discards all messages that have been written.



Sunday, February 9, 2014

Compiling and Running 32 bit UML on 64 bit Debian operating system

Steps followed
============
1) apt-get install uml-utilities
2) sudo apt-get install gcc-multilib
C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)
http://stackoverflow.com/questions/12591629/gcc-cannot-find-bits-predefs-h-on-i686
Since we are compiling the UML kernel for 32 bit in 64 bit operating system, we need a gcc-multilib package to solve the library issues
3) #include<sys/stat.h> in ./arch/um/os-Linux/mem.c
http://stackoverflow.com/questions/5918539/c-warning-implicit-declaration-of-function-fchmod
4) The below patch needs to be applied
 In some cases gcc >= 4.5.2 will optimize away current_thread_info().
To prevent gcc from doing so the stack address has to be obtained
via inline asm.

LKML-Reference: http://marc.info/?i=201104132150.05623.richard@...>

Acked-by: Kirill A. Shutemov <kirill@...>
Signed-off-by: Richard Weinberger <richard@...>
---
 arch/um/include/asm/thread_info.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
index e2cf786..5bd1bad 100644
--- a/arch/um/include/asm/thread_info.h
+++ b/arch/um/include/asm/thread_info.h
@@ -49,7 +49,10 @@ static inline struct thread_info *current_thread_info(void)
 {
         struct thread_info *ti;
         unsigned long mask = THREAD_SIZE - 1;
-       ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
+       void *p;
+
+       asm volatile ("" : "=r" (p) : "0" (&ti));
+       ti = (struct thread_info *) (((unsigned long)p) & ~mask);
         return ti;
 }

--
1.7.4.2

http://sourceforge.net/mailarchive/message.php?msg_id=27397459

Compilation steps
================
1) make mrproper ARCH=um
2) make menuconfig ARCH=um SUBARCH=i386
http://uml.devloop.org.uk/faq.html
3) make ARCH=um SUBARCH=i386

Sunday, January 26, 2014

Ping -What happens!!

Everybody knows that the ping utility is used to check network connectivity between two hosts, but what happens when a user issues a ping? This article is designed to explain the basics of what happens on a network when a ping is issued. Imagine the following scenario;

You have PC-A in subnet 192.168.1.0/24, PC-B in subnet 192.168.2.0/24 and a router connected to both subnets. You need to check if PC-A can connect to PC-B.


For the purposes of this article we will use the following IP addresses and MAC addresses;

PC-A
192.168.1.10 MAC Address 00:00:00:00:00:10
Default Gateway 192.168.1.15

Router Interface E0
192.168.1.15 MAC Address 00:00:00:00:00:15

Router Interface E1
192.168.2.20 MAC Address 00:00:00:00:00:20

PC-B
192.168.2.25 MAC Address 00:00:00:00:00:25
Default Gateway 192.168.2.20

A user on PC-A types in “ping 192.168.2.25”

The first thing to happen is that ICMP (Internet Control Management Protocol) creates data. This is just the alphabet. IP (Internet Protocol) on PC-A creates a packet containing the Destination IP Address (192.168.2.25), the Source IP Address (192.168.1.10), the data, and a protocol field. The protocol field informs the receiving host where to pass the data to, in this example the protocol field would be set to 0x1h to indicate ICMP. (0x indicates that the following is an hexadecimal number)

Once the packet has been created ARP (Address Resolution Protocol) is then used to identify the MAC (Media Access Control / Hardware address / Burned Address) address of the destination host. This can happen in a number of ways, the first to happen is that ARP checks it’s cache to see if it has a match to the Destination IP Address. If not then ARP sends out an ARP broadcast to the Ethernet MAC broadcast address (FF:FF:FF:FF:FF:FF)

“Who has 192.168.2.25? Please tell 000000000010”

You will notice that PC-A is asking for replies to be sent to the MAC address. This is because computers communicate only with MAC addresses on LANs (Local Area Networks)

If no response is received by PC-A, then ARP & IP assume that 192.168.2.25 is on a remote subnet and therefore would require routing. At this point the IP address and the MAC address of the default gateway is required. In a Windows machine the registry is consulted in order to get the IP address of the default gateway (192.168.1.15). ARP then consults it’s cache to see if it has match to the IP address of the default gateway, if not then another ARP broadcast is sent

“Who has 192.168.1.15? Please tell 000000000010”

Because this is a broadcast ALL hosts on the 192.168.1.0/24 subnet will receive this frame. The router interface E0 will read the frame and identify itself as the interface with the requested IP address. The router will then reply;

“I have 192.168.1.15. MAC address is 000000000015”

As the request asked for a reply direct to PC-A the frame sent from the router will be directed towards PC-A and not sent as a broadcast. The router will also cache the MAC address of PC-A, which it received via the broadcast sent by ARP to locate the MAC address of the router.

Once IP at PC-A as received the message from the router interface it will pass the packet created earlier and the MAC Destination address down to the Data Link Layer.

The Data Link Layer creates a frame containing the Destination MAC address, the Source MAC address, A FCS (Frame Check Sequence, used to verify the data has not been corrupted) and an Ether_Type field, in this example the field will be set to 0x8 to indicate IP. This Frame encapsulates the packet passed down from IP at the Network Layer. The MAC address of the router is also cached into the ARP cache on PC-A

Once the frame has been created it is passed down to the Physical Layer where the frame is placed onto the wire one bit at a time. Every host on subnet 192.168.1.0/24 will receive this frame, build it, and check the Destination MAC address, if it is not a match the frame is discarded. At the router interface, E0, the Destination MAC address is a match. The router then checks the Ether_Type field (0x8 = IP) pulls the packet from the frame, discards the frame and passes the packet up to IP at the Network Layer.

At the Network Layer the Destination IP address is checked to see if it is a match, in this example the Destination IP address is 192.168.2.25, however the IP address of the router interface which received the frame is 192.168.1.15, and is not a match. The router then consults it’s routing table for the destination IP network address (192.168.2.0). If there is no match in the routing table the packet is discarded and a “Destination Network unavailable” message is returned to PC-A

If there is a match in the routing table then the router will switch the packet to the interface configured to send information to the destination IP Network Address, in this example E1.

Interface E1 now needs to know the MAC address of the machine with IP address 192.168.2.25. The first thing it does is check the ARP cache, no match in the cache, E1 then send out an ARP broadcast.

“Who has 192.168.2.25? Please tell 000000000020”

Because PC-B is on the same subnet as E1, PC-B responds

“I have 192.168.2.25. MAC address is 0000000025”

IP at Interface E1, on the router, then passes the packet (created at PC-A) and the Destination MAC address for 192.168.2.25 down to the Data Link Layer. The Data Link Layer then creates a frame containing the Destination MAC address, Source MAC address, FCS and an Ether_Type field (again set to 0x1h to indicate IP), which encapsulates the IP packet.
(The MAC address of PC-B is placed into the ARP cache on Interface E1, and the MAC address of interface E1 is placed into the cache of PC-B)

The frame is then passed down to the Physical Layer to be placed on the wire one bit at a time. Again all hosts on the 192.168.2.0/24 subnet will receive the frame, build it, check it, discard it with the exception of PC-B which will match the Destination MAC address. PC-B will then check the Ether_Type field, pull the packet from the frame, discard the frame and pass the packet to the protocol indicated in the Ether_Type field, in this example IP.

IP then checks the Destination IP address in the packet and finds a match. It will then check the Protocol field (0x1h = ICMP) and pass the data to ICMP. ICMP recognises that the data sent is an echo request, and will then create an echo response message.

The echo response is then passed to IP, which will then build a packet, consisting of the Destination IP address (192.168.1.10), the Source IP address (192.168.2.25) the data from ICMP, and the protocol field. Once the packet is built the MAC address of the IP address 192.168.1.10 is required. ARP checks it’s cache, if there is no match an ARP broadcast is sent.

“Who has 192.168.1.10? Please tell 000000000025”

Because 192.168.1.10 is on a remote subnet, and routers do not pass broadcasts there is no response.

The default gateway is then required for PC-B. The default gateway is configured as 192.168.2.20 and the ARP cache is checked. As PC-B cached the MAC address of interface E1, a match is found and there is no need to send out an ARP broadcast.

Now that the MAC address of the default gateway has been resolved the packet and the Destination MAC address is then passed down to the Data Link Layer.

At the Data Link Layer a frame is built which consists of the Destination MAC address, the Source MAC address, the FCS and the Ether_Type field (again set to 0x8 to indicate IP). The frame encapsulates the packet passed down from IP. The complete frame is then passed down to the Physical Layer to be put onto the wire one bit at a time.

At Interface E1 of the router, the frame is received, the Destination MAC address is then checked and found to be a match. The Ether_Type field is then checked, the packed is pulled from the frame, the frame is discarded and the packed passed to IP, as indicated in the Ether_Type field.

IP on E1 checks the IP destination address and finds it is not a match. It then consults the routing table for the IP Network Address (192.168.1.0/24), if a match is found the packet is switched to the Interface configured for the 192.168.1.0/24 network, in this example E0.

If no match is found then the packet is discarded. PC-A will receive a time-out error in this case, as the time set to receive replies has been exceeded. A destination network unavailable message is NOT sent to PC-A. If the message could be sent to PC-A then the router would obviously have a route to PC-A’s network and then would not need to generate the message!!

On Interface E0, the interface configured for 192.168.1.0/24, IP and ARP will then locate the MAC address for the IP address 192.168.1.10. ARP checks the cache, because the MAC address for PC-A was cached on the outgoing trip, there is a match and the packet and frame are then passed down to the Data Link Layer.

The Data Link Layer will then build a frame, consisting of the Destination MAC address, the Source MAC address, Ether_Type field and the FCS. This frame encapsulates the packet passed down from IP and then passes the frame down to the Physical Layer to be placed onto the wire, one bit at a time.

PC-A receives the frame sent from interface E0 on the router, checks the MAC address, finds a match, reads the Ether_Type field, pulls the packet from the frame, discards the frame and passes the packet to IP as indicated in the Ether_Type field. IP checks the Destination IP address and finds a match. IP will then read the Protocol field (0x1h = ICMP) and passes the data to ICMP.

ICMP recognises the data as an echo response, ICMP acknowledges receipt by sending information to the user interface, (“!” with Cisco routers, “Reply from 192.168.2.25…….” and additional information in Windows), and then builds another echo request and the whole process begins again.

The above is designed to give an overview of what happens on the network when data is sent from one machine to another. This is by no way to be considered complete as there are additional parameters which can be configured and created both within the IP packet and the Data-Link Frame. The above assumes the use of Ethernet_II frames on the network. No matter how big the network or how many routers the data passes through the process is identical to the above.

Omicron - people gathers in crowd

Amidst omicron thread, people are gathered in crowd at markets and public places to buy their daily needs. Because of full lockdown at Sunda...