Skip to main content

Posts

Showing posts from 2021

Linked List

Linked list can be considered as list of nodes ,where each node consist of data to be stored as well as the address of the next node. Example : consider we have a linked-list as [data | addr_of_nxt_node] -> [data | addr_of_nxt_node] -> [data | addr_of_nxt_node] -> [data | NULL] Last element of the linked list will always hold the addr of next node as NULL ,which will be the indication while traversing the list that linkedlist ends here Linked-List operations : - Insert node at begining. - Insert node at position. - Delete node from linkedlist. - Search node in linkedlist. - Sort linkedlist. Demonstration : Let's start Implementing the linkedlist First we need to define the struct of a node As we can see we will define the struct with help of struct where data will be the addr where we will store the values to be stored and next will be used to store the addr of the next ndoe adjacent to current node. Since we have defined the structure of the node ,now l

QUEUE

queue works on the simple principle FIFO (First In First Out) The very simple example of queues are consider you are visit your favourite restaurant and there you are standing in a line to order a food This is nothing but a queue ,the person who comes first will be able to order his/her food first and then second person and so on ,same is the case with the queue ,element added in queue will be removed from the queue first. Example : |COUNTER| person1 <- person2 <- person3 |COUNTER| person2 <- person3 |COUNTER| person2 <- person3 so person1 is in front of the counter so person1 will order the food and will leave the lineand then person2 will be on the counter and will order the food and so on . Let's Dig in the coding part ,how we will design the queue Queue Operations: 1. Enqueue() : To add an element in the queue in front position 2. Dequeue() : To remove an element from the queue from front position Demonstration : First of all we will define pointers

STACK

## It is a linear data structre that follows the principle of LIFO i.e Last In First Out Assume you are putting plates on top of previous plate ,like below : Plate-A -> Plate-B -> Plate-C        Plate-A ->  Plate-B           ->  Plate-A in order to get the Plate-A we need to remove all the plate on top of Plate-A which are Plate-B ,Plate-C which is the plate added at last will be remove first which is nothing but LIFO. ## Stack Operations: 1. Push Operation : to add an element in the stack 2. Pop Operation : to remove an element from TOP of the stack 3. Peek Operation : to print the topmost element without removing it from the stack 4. is_full Operation : whether stack is full or not 5. is_empty Operation: whether stack is empty or not ## Demonstration : # we will include the mandate libraries first Then we will define the struct of stack using struct in c. # Although there are n number of ways to implement stack ,so demonstration here is one of t

Asymptotic notations

## ASYMPTOTIC NOTATION : Efficiency of algorithm depends on amount of time ,storage and other resources required to execute an algorithm. Efficiency is measured with help of asymptotic notations. Asymptotic notations are mathematical notations used to decribe execution time of an algorithm when input tends towards a particular value or limiting value. THREE ASYMPTOTIC NOTATIONS : 1. Big-O notation : used to measure the worst case scenerio of an algorithm .It generally gives an upper bound. in simple words we can say that (O) notation is used to measure the maximum time that an algorithm can take to execute. 2. Omega notations : used to measure the best case scenerio of an algorithm .It generally gives lower bound .In simple words we can say that theta notation is used to measure the minimum time that an alogrithm can take to execute. 3. Theta notations : used to measure the average case scenerio of an alogrithm .It generally gives the average bound. In simple words we

Data Structure & Algorithm

## DATA STRUCTURES : It is a way of arranging data on a computer so that it can be accessed & updated efficiently ## ALGORITHMS : Algorithms are an instructions or a way to solve the problem using the data which is stored with the help of data structure. ## TWO TYPES OF DATA STRUCTURE: 1. Linear data structure : 1) Arrays 2) Stack 3) Queue 4) Linked-List 2. Non-Linear data structure: 1. Graphs 2. Trees

Command & Control Trojan With Python

INTRODUCTION Command and Control Trojan : With this Trojan we will be able to asynchronously control ,udpate and recieve data from deployed implants.So we will use Github as a way to store implant configuration information and exfiltrated data as well as any modules that the implanted needs in order to execute tasks.Since Github is encrypted over SSL ,and there are very few enterprises which might have blocked github itself. Let's have a walkthrough of the code on how we can build our github based command and control trojan from scratch. NOTE : you can integrate any module or features availble in this hacking scripts like keylogger ,backdoor etc with this Trojan ## Required Libraries : github3 : To connect authenticate and communicate between the trojan and the attacker via github repo which holds the configuration file threading : To perform some task in threads os : To runs some system commands importlib : to import the library if not exist base64 : to perform th

Python Keylogger

Creating a Keylogger in Python Introduction : Keylogging is one of the old school ways but still most affective way to capture the sensitive information from the victim's like credentials ,sensative conversation ,sensive emails etc. Lets walkthrough from the code and try to build our own keylogger from scratch You can also checkout some other hacking scripts in python : scripts Required Libraries ## ctypes : This library will provide the C compatible data types as well as will allows us calling functions in DDL / shared libraries pythoncom : This library provide support for the microsoft component object model(COM) pyHook : This provides the callbacks for global mouse and keyboard events in windows. win32clipboard : This will help to access the windows clipboard api. ## We will first call 'GetforegroundWindow()' method which will return the handle to the active window on the desktop .Then we will pass th

[OpenSSL]
Sign/Verify the message with Python

Sign & Verify Messages with OpenSSL in Python Introduction We will learn on how we sign our messages / logs with openssl in python as well as verify them. Lets walkthrough the code and learn how we can build signing and verifying mechanism from scratch using python You can also checkout other hacking scripts in this page hacking scripts ## Required Libraries openssl : which will be the base requirement and contains the methods Generate keys ,sign ,verify hashlib : This library will be used to generate the hash sys : This is not mandatory since we are only using this to take command line arguements ## Generate and dump the public/private key Let's first create an object using 'PKey()' ,and generate the dsa keys. Then lets store the keys in diff files using dump method ## Once the keys are generated ,we can now proceed towards signing the message We