Question

In: Computer Science

You will be traversing structures as part of the project. However, as practice, we will traverse...

You will be traversing structures as part of the project. However, as practice, we will traverse some structures, for which the source code is already known to us, to remove some of the ambiguity inherent in dealing with undocumented or under-documented Windows structures. Here we know the structures and what their members are.

The task for this assignment is to “fill in the blanks” in the in-line Assembly, so that the requested data is populated with the appropriate information. To do this, you must engage in experimentation with traversing structures to discover the correct values.

#include <stdio.h>

#include <windows.h>

struct address {

     char street1[20]; // +0

     char zip[20];   // +0x14

     char state[20];   // +0x28

};

struct college {

     int id;               // +0

     char name[40]; // +0x4

     struct address address_info; // + 0x2C

};

struct personal {

     int id;

     char nickname[20];

     int age;

     char gender[4];

};

struct student {

     int id;                               // +0x0

     char fname[20];                // +0x4

     char lname[20];                  // +0x18

     struct college college_info;// +0x2C

     struct personal personal_info; // +0x?? What is the size of the COLLEGE struct?

};

int main(int argc, char argv[], char envp[]) {

     char*var = NULL;

     struct student student1 = { 1, "Howareyou", "you", 1101, "System Eng", "111 Ave", "55442", "IO", 1,"Howareyou", 40,'m'};

     printf("[*] Student Name: %s\n", student1.personal_info.gender);

     _asm {

           lea eax, student1

           lea eax, [eax + 0x30]

           mov var, eax

     }

     printf("[*] School name: %s\n", var);

           _asm {

           lea eax, student1

           lea eax, [eax + 0x0]

           mov var, eax

     }

     printf("[*] Street: %s\n", var);

           _asm {

           lea eax, student1

           lea eax, [eax + 0x0]

           mov var, eax

     }

     printf("[*] State: %s\n", var);

           _asm {

           lea eax, student1

           lea eax, [eax + 0x0]

           mov var, eax

     }

     printf("[*] Nickname: %s\n", var);

}

Solutions

Expert Solution

Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks.

#include <stdio.h>

#include <windows.h>

struct address {

char street1[20]; // +0

char zip[20]; // +0x14

char state[20]; // +0x28

};//size = 0x3C

struct college {

int id; // +0

char name[40]; // +0x4

struct address address_info; // + 0x2C

};//size=0x68

struct personal {

int id; // +0

char nickname[20];// +0x04

int age; //+0x18

char gender[4]; //+0x1C

};//size=0x20

struct student {

int id; // +0x0

char fname[20]; // +0x4

char lname[20]; // +0x18

struct college college_info;// +0x2C

struct personal personal_info; // +0x94 What is the size of the COLLEGE struct?

};//size=B4

int main(int argc, char argv[], char envp[]) {

char*var = NULL;

struct student student1 = { 1, "Howareyou", "you", 1101, "System Eng", "111 Ave", "55442", "IO", 1,"Howareyou", 40,'m'};

printf("[*] Student Name: %s %s\n", student1.fname,student1.lname);

_asm {

lea eax, student1

lea eax, [eax + 0x30]

mov var, eax

}

printf("[*] School name: %s\n", var);

_asm {

lea eax, student1

lea eax, [eax + 0x58]

mov var, eax

}

printf("[*] Street: %s\n", var);

_asm {

lea eax, student1

lea eax, [eax + 0x80]

mov var, eax

}

printf("[*] State: %s\n", var);

_asm {

lea eax, student1

lea eax, [eax + 0x98]

mov var, eax

}

printf("[*] Nickname: %s\n", var);
   system("pause");
}

Output:


Related Solutions

Case Study: Project Communications Management: Best Practices in Practice As part of a large IT systems...
Case Study: Project Communications Management: Best Practices in Practice As part of a large IT systems integration project for the State of California, I witnessed the Project Management Office (PMO) do an excellent job of ensuring that the project stakeholders were properly informed of the project’s progress, outstanding issues, risks, and change requests. Information was gathered from multiple sources (for example, Project Schedule, Issue and Risk Repositories, Testing Tool Data Metrics, Change Request Log, and so on) and compiled into...
We continue from the two tables in lab 3 part 2, and practice with functions and...
We continue from the two tables in lab 3 part 2, and practice with functions and the GROUP BY statement. The data in each table should be as below Table Product: PROD_ID PROD_NAME PROD_PRICE PROD_VENDOR 1101 Table 100 2 1102 Chair 80 3 1103 Armchair 90 2 1104 Nightstand 110 1 1105 Bed 200 3 1106 Dresser 150 3 1107 Daybed 190 2 1108 Ash Table 120 2 1109 Cherry Table 130 2 1110 Table - High 100 2 1111...
We continue from the two tables in lab 3 part 2, and practice with functions and...
We continue from the two tables in lab 3 part 2, and practice with functions and the GROUP BY statement. The data in each table should be as below Table Product: PROD_ID PROD_NAME PROD_PRICE PROD_VENDOR 1101 Table 100 2 1102 Chair 80 3 1103 Armchair 90 2 1104 Nightstand 110 1 1105 Bed 200 3 1106 Dresser 150 3 1107 Daybed 190 2 1108 Ash Table 120 2 1109 Cherry Table 130 2 1110 Table - High 100 2 1111...
This problem will give you hands-on practice with the following programming concepts: • All programming structures...
This problem will give you hands-on practice with the following programming concepts: • All programming structures (Sequential, Decision, and Repetition) • Methods • Random Number Generation (RNG) Create a Java program that teaches people how to multiply single-digit numbers. Your program will generate two random single-digit numbers and wrap them into a multiplication question. The program will provide random feedback messages. The random questions keep generated until the user exits the program by typing (-1). For this problem, multiple methods...
The goal of this part is to give you a chance to practice working through the...
The goal of this part is to give you a chance to practice working through the steps of calculating variance. Use the table of scores (X values) below to complete the following calculations. Assume the data in the table represents a sample, not a population. Use the extra columns in the table to show your work. X 20 22 18 15 21 Question 2.1 (0.5 points) – Calculate the deviation score for each x value Question 2.2 (0.5 points) –...
Project Assignment The purpose of this assignment is for you to gain practice in applying the...
Project Assignment The purpose of this assignment is for you to gain practice in applying the concepts and techniques we learned in class. In order to complete the assignment, please do the following: 1. find or create a data set containing values of at least one interval or ratio variable for at least one-hundred cases (n >= 100); 1 2. provide basic descriptive statistics to summarize the central tendency and variability of the data; 3. provide at least one table...
Dietary Analysis Project PART 2: ANALYSIS Part 2 of the Dietary Analysis Project requires you to...
Dietary Analysis Project PART 2: ANALYSIS Part 2 of the Dietary Analysis Project requires you to thoughtfully analyze your current dietary practices. Part 2 should be completed using professional writing. Your analysis should include the following paragraphs. ? First Paragraph: Evaluation of your current energy intake and Body Mass Index (BMI): How does your energy (kcal) intake compare to your recommendation? Were you surprised by your energy intake? Why or why not? Calculate your Body Mass Index (BMI). Does your...
You are evaluating a project which has a useful life of 5 years. However, you suspect...
You are evaluating a project which has a useful life of 5 years. However, you suspect that the project’s economic life might be different. The initial investment for the project is $5,000,000. The cash flows for the 5 years are $1.5 million, $1.7 million, $1.8 million, $2 million, and $2 million. The abandonment value of the project in each of the first 4 years is $4.2 million, $4 million, $3.5 million, and $2 million.  The abandonment value for the 5th year...
You are evaluating a project which has a useful life of 5 years.  However, you suspect that...
You are evaluating a project which has a useful life of 5 years.  However, you suspect that the project’s economic life might be different.  The initial investment for the project is $5,000,000.  The cash flows for the 5 years are $5 million, $1.7 million, $1.8 million, $2 million, and $2 million.  The abandonment value of the project in each of the first 4 years is $4.2 million, $4 million, $3.5 million, and $2 million.   The abandonment value for the 5th year is incorporated into the...
Part 1: A five-sided closed field traverse has the following distances in feet: AB = 647.25;...
Part 1: A five-sided closed field traverse has the following distances in feet: AB = 647.25; BC = 203.03; CD = 720.35; and DE = 610.24; and EA = 285.13. The interior angles are as follows (measured as angles to the right): A = 100º 45' 37"; B = 231º 23' 43"; C = 17º 12' 59"; D = 89º 03' 28"; and E = 101º 34' 24". The bearing of AB is S 53º 04' 43" E. Determine the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT