C program to find file properties using stat() function

Stat Linux

Stat() function in C is used to retrieve information about the file by accepting the filepath as an argument to it. Stat() function can help us to extract following information about any file using C program. File type and mode Number of hard links from the file User ID of file owner Group ID of … Read more

Understanding wireless beacon packet ( captured using pcap API’s )

As per Wikipedia, Beacon frame is one of the management frames in IEEE 802.11 based WLANs. It contains all the information about the network. Beacon frames are transmitted periodically, they serve to announce the presence of a wireless LAN and to synchronise the members of the service set. Beacon frames are transmitted by the access point (AP) in an infrastructure basic … Read more

How to get mac-id using ipaddress in Linux ?

Make sure you ping that IP atleast once so this can get address into ARP table. PING 192.168.1.105 (192.168.1.105) 56(84) bytes of data.64 bytes from 192.168.1.105: icmp_seq=1 ttl=128 time=4.68 ms— 192.168.1.105 ping statistics —1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 4.681/4.681/4.681/0.000 ms Now user arp command to get rest of … Read more

How to disable and / or enable ICMP ping from Linux host ?

To disable the ICMP ping from certain Linux host, lets say which has IP of 192.168.0.100 use below command, Type below command on the console of linux PC on which you are trying to enable / disable the ping. Now, if you try to ping to same machine, we will get something like below, Now … Read more

How executable is created during compilation on Linux ?

This code is tested on Ubuntu . You may need to twick the script if you use a different Linux version. The steps for compilation as as below, write a source code helloworld.c run a preprocessor which create helloworld.i run a compiler which creates helloworld.s by taking preprocessed file helloworld.i as input. run a assembler which … Read more

What is the Difference between Process and Thread ?

Creating a new thread is very similar to forking a new process, but there are differences. When a new process is forked, it shares relatively little data with the parent process which created it, when a new thread is created, it shares much more information (such as all the global variables and static local variables, … Read more

Difference between Spinlock and Semaphore

Spinlocks Spinlocks assume the data you are protecting is accessed in both interrupt-handlers and normal kernel code. If you know your data is unique to user-context kernel code (e.g., a system call), you can use the basic spin_lock() and spin_unlock() methods that acquire and release the specified lock without any interaction with interrupts. Spinlocks should … Read more

How to identify IP Address’s of all devices in a network ?

Sometimes someone from within your network starts consuming lot of bandwidth and you just needed to identify how many devices are connected to your network / WiFi. You can easily do it by logging into your router admin panel but what if you don’t have permissions to access the router panel. In the above scenario, … Read more