Ammar
Okay... Then I think I'm done with this. However I'll give my best before the week ends. 😂
But still, it is still strange to me, undefined8 should be 8 bit type. But the assignment is insane value of integer.
J.K. – Tessier-Ashpool Customer Support
lmao
J.K. – Tessier-Ashpool Customer Support
I can't read strncmp. It's a thunk function and it's all tabbed '?? ??'s
J.K. – Tessier-Ashpool Customer Support
How is it? Can you dump it on pastebin.com?
Okay! I will paste the entire file to explain whatever I need to in the future.
J.K. – Tessier-Ashpool Customer Support
J.K. – Tessier-Ashpool Customer Support
Ahh... I pasted only the main
Ammar
codeshare.io/2EKn70
What is this? It is just #incude
J.K. – Tessier-Ashpool Customer Support
Sorry. I should check it now.
J.K. – Tessier-Ashpool Customer Support
This is the main. But lacking other function calls. 🙄
Ammar
It just shows single line #include on my end.
J.K. – Tessier-Ashpool Customer Support
Still?
Onkar
I have a problem based on Dynamic programming ... I am not getting way to solve it ... Can anyone take a look ?
J.K. – Tessier-Ashpool Customer Support
It just shows single line #include on my end.
Sorry. The last is an O, not a 0. 🤦🏻‍♂
Ammar
Sorry. The last is an O, not a 0. 🤦🏻‍♂
Ok, I got the code. What calling convention is it?
Onkar
Problem Description Robin bought a sequence consist of characters '(', ')', '{', '}', '[', ']'. A sequence is valid if it follows any one of the following rule: An empty sequnce is valid. If X is valid sequence, then '(' + X + ')' or '{' + X + '}' or '[' + X + ']' is also valid. If X and Y are valid, then X + Y is also valid. His brother played with the sequence and misplaced some of the characters, those misplaced characters are denoted by '?' in string A. Inorder to make the sequence valid again, he decided to replace the character '?'. Your task is to determing the number of valid sequences that can be created by replacing '?'. Since the answer could be large output answer % 109 + 7. Problem Constraints 2 <= |A| <= 150 Length of string A is always even. Input Format First and only argument is a string A. Output Format Return an integer denoting the number of valid sequences. Input 1: A = "??}(??" Input 2: A = "]???" Output 1: 3 Output 2: 0
J.K. – Tessier-Ashpool Customer Support
Ammar
I think it's AMD64
It doesn't look System V AMD64 to me. I searched for RDI assignment but found nothing. In SysV ABI, the first argument of function call is RDI. So it is not SysV. Where did you run the binary?
J.K. – Tessier-Ashpool Customer Support
Kali Linux. The one that was provided to us with the tools they put for us.
Ammar
Kali Linux. The one that was provided to us with the tools they put for us.
Can you run this command? file <the_elf_file> Replace <the_elf_file> with the binary file name. What does it show?
J.K. – Tessier-Ashpool Customer Support
Sure. Gimme a sec.
J.K. – Tessier-Ashpool Customer Support
Ammar
Check the first line in codeshare. I pasted it.
Well, it is exactly System V AMD64.
J.K. – Tessier-Ashpool Customer Support
BTW. I'm going to paste the original code. I've seen the types that were edited by me at the C window.
Ammar
It seems I found the culprit, why I didn't see RDI and RSI. 00101272 48 89 ce MOV argv,RCX 00101275 48 89 c7 MOV argc,RAX 00101278 e8 b3 fd CALL strncmp Ghidra replaced them with argv and argc. Compiling those bytes with nasm yields correct Assembly code. section .text _start: db 0x48, 0x89, 0xce db 0x48, 0x89, 0xc7 ————— 0: 48 89 ce mov %rcx,%rsi 3: 48 89 c7 mov %rax,%rdi
J.K. – Tessier-Ashpool Customer Support
I replaced them. 🤦🏻‍♂ Because of convention
J.K. – Tessier-Ashpool Customer Support
NOW I pasted the original code. Unedited. But only the main
Anonymous
hello guys someone help me in create a program in C++ on the quad formula
Ammar
I replaced them. 🤦🏻‍♂ Because of convention
I tried to decompile it by hand, I believe the result in C for that strncmp call only will be like this. main: [P1] MOV qword ptr [RBP + local_108],RSI [....] [P2] MOV RAX, 0x336f69646c327b69 [P2] mov qword ptr [RBP - 0x40], RAX [....] [P1] MOV RAX,qword ptr [RBP + local_108] [P1] MOV RAX,qword ptr [RAX + 0x8] [P1] MOV qword ptr [RBP + local_18],RAX [P2] LEA RCX,[RBP + -0x40] [P1] MOV RAX,qword ptr [RBP + local_18] [....] [P3] MOV EDX,0x22 [....] [P2] MOV RSI,RCX [P1] MOV RDI,RAX CALL strncmp [P1] is where param1 of strncmp came from. [P2] is where param2 of strncmp came from. [P3] is where param3 of strncmp came from. ———————— int main(int edi, char **rsi) { uint64_t rbp_0x40 = 0x336f69646c327b69; strncmp(*(rsi + 1), (char *)&rbp_0x40, 0x22); }
Ammar
And as we have discussed above, x86-64 is little endian arch, so the second param for strncmp call will be equivalent to: strrev(hex2bin('336f69646c327b69')) or "i{2ldio3"
J.K. – Tessier-Ashpool Customer Support
i see
J.K. – Tessier-Ashpool Customer Support
i have no words to describe how thankful for your efforts.
Anonymous
Quad formula?
quadratic formula X=[-b+/-(√b-4ac)]÷2a
Talula
quadratic formula X=[-b+/-(√b-4ac)]÷2a
You mean quadratic equation... and what is the problem in solving that?
Talula
quadratic formula X=[-b+/-(√b-4ac)]÷2a
See problem is not so simple... to solve it you have to have bit of AI involved.
Anonymous
write a program under that
Natasha
The code I'm running - #include <iostream> #include "bignumber.h" using namespace std; int main() { // use the maximum long long fundamental type value in calculations long long value1{9'223'372'036'854'775'807ll}; // max long long value cout << "long long value1: " << value1 << "\nvalue1 - 1: " << value1 - 1 // OK << "\nvalue1 + 1: " << value1 + 1; // result is undefined // use an arbitrary precison integer BigNumber value2{value1}; cout << "\n\nBignumber value2: " << value2 << "\nvalue2 - 1: " << value2 - 1 // OK << "\nvalue2 + 1: " << value2 + 1; // OK // powers of 100,000,000 with long long long long value3{100'000'000}; cout << "\n\nvalue3: " << value3; int counter{2}; while(counter < 5) { value3 *= 100'000'000; // quickly exceds maximum long long value cout << "\nvalue3 to the power " << counter << ": " << value3; ++counter; } // powers of 100,000,000 with BigNumber BigNumber value4{100'000'000}; cout << "\n\nvalue4: " << value1 << endl; counter = 2; while (counter <= 5) { cout << "value4.pow(" << counter << "): " << value4.pow(counter) << endl; ++counter; } cout << endl; } The error I'm getting - [student@localhost C++]$ g++ file03_05.cpp -o cpp_exe/file03_05 /tmp/ccEINwE7.o: In function `main': file03_05.cpp:(.text+0x93): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0xb7): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x10b): undefined reference to `operator-(BigNumber, long long const&)' file03_05.cpp:(.text+0x11d): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x165): undefined reference to `operator+(BigNumber, long long const&)' file03_05.cpp:(.text+0x177): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x24d): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0x2d0): undefined reference to `BigNumber::pow(int)' file03_05.cpp:(.text+0x2df): undefined reference to `operator<<(std::ostream&, BigNumber const&)' collect2: error: ld returned 1 exit status
Natasha
The code I'm running - #include <iostream> #include "bignumber.h" using namespace std; int main() { // use the maximum long long fundamental type value in calculations long long value1{9'223'372'036'854'775'807ll}; // max long long value cout << "long long value1: " << value1 << "\nvalue1 - 1: " << value1 - 1 // OK << "\nvalue1 + 1: " << value1 + 1; // result is undefined // use an arbitrary precison integer BigNumber value2{value1}; cout << "\n\nBignumber value2: " << value2 << "\nvalue2 - 1: " << value2 - 1 // OK << "\nvalue2 + 1: " << value2 + 1; // OK // powers of 100,000,000 with long long long long value3{100'000'000}; cout << "\n\nvalue3: " << value3; int counter{2}; while(counter < 5) { value3 *= 100'000'000; // quickly exceds maximum long long value cout << "\nvalue3 to the power " << counter << ": " << value3; ++counter; } // powers of 100,000,000 with BigNumber BigNumber value4{100'000'000}; cout << "\n\nvalue4: " << value1 << endl; counter = 2; while (counter <= 5) { cout << "value4.pow(" << counter << "): " << value4.pow(counter) << endl; ++counter; } cout << endl; } The error I'm getting - [student@localhost C++]$ g++ file03_05.cpp -o cpp_exe/file03_05 /tmp/ccEINwE7.o: In function `main': file03_05.cpp:(.text+0x93): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0xb7): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x10b): undefined reference to `operator-(BigNumber, long long const&)' file03_05.cpp:(.text+0x11d): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x165): undefined reference to `operator+(BigNumber, long long const&)' file03_05.cpp:(.text+0x177): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x24d): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0x2d0): undefined reference to `BigNumber::pow(int)' file03_05.cpp:(.text+0x2df): undefined reference to `operator<<(std::ostream&, BigNumber const&)' collect2: error: ld returned 1 exit status
help me please
Nuriddin
help me please
Fot What ?
Natasha
Fot What ?
To compile the program
Talula
help me please
Are you sure you have bignumber.h?
Natasha
wait
Kishore
That's great💯
Natasha
@Tazmikar As you can see here I have bignumber.h file in the same directory in which I have .cpp fie that file03_05.cpp -rw-rw-r--. 1 student student 3814 May 28 00:16 Arithmetic.txt -rw-r--r--. 1 student student 10922 May 25 2017 bignumber.h -rw-rw-r--. 1 student student 2653 May 28 13:20 ControlStatement_01.txt drwxrwxr-x. 2 student student 142 May 29 07:32 cpp_exe -rw-rw-r--. 1 student student 293 May 27 19:55 file02_01.cpp -rw-rw-r--. 1 student student 263 May 27 19:59 file02_02.cpp -rw-rw-r--. 1 student student 236 May 27 20:07 file02_03.cpp -rw-rw-r--. 1 student student 859 May 27 20:31 file02_04.cpp -rw-rw-r--. 1 student student 1097 May 28 00:40 file02_05.cpp -rw-rw-r--. 1 student student 1244 May 28 09:09 file02_06.cpp -rw-rw-r--. 1 student student 1333 May 28 13:40 file03_01.cpp -rw-rw-r--. 1 student student 2713 May 28 14:56 file03_02.cpp -rw-rw-r--. 1 student student 862 May 28 16:52 file03_03.cpp -rw-rw-r--. 1 student student 632 May 28 16:23 file03_04.cpp -rw-rw-r--. 1 student student 1199 May 29 07:07 file03_05.cpp -rw-rw-r--. 1 student student 2183 May 28 23:33 Fundamental_Data_Types_+_Arbitrary_Precison_Integers.txt -rw-rw-r--. 1 student student 3263 May 28 12:29 Keywords.txt drwxrwxr-x. 3 student student 23 May 29 07:04 library -rw-rw-r--. 1 student student 4370 May 28 17:38 List_Initialization_Compound_Assignment_Increment.txt [student@localhost C++]$ g++ file03_05.cpp -o cpp_exe/file03_05 /tmp/ccCq39Fl.o: In function `main': file03_05.cpp:(.text+0x93): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0xb7): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x10b): undefined reference to `operator-(BigNumber, long long const&)' file03_05.cpp:(.text+0x11d): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x165): undefined reference to `operator+(BigNumber, long long const&)' file03_05.cpp:(.text+0x177): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x24d): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0x2d0): undefined reference to `BigNumber::pow(int)' file03_05.cpp:(.text+0x2df): undefined reference to `operator<<(std::ostream&, BigNumber const&)' collect2: error: ld returned 1 exit status
klimi
@Tazmikar As you can see here I have bignumber.h file in the same directory in which I have .cpp fie that file03_05.cpp -rw-rw-r--. 1 student student 3814 May 28 00:16 Arithmetic.txt -rw-r--r--. 1 student student 10922 May 25 2017 bignumber.h -rw-rw-r--. 1 student student 2653 May 28 13:20 ControlStatement_01.txt drwxrwxr-x. 2 student student 142 May 29 07:32 cpp_exe -rw-rw-r--. 1 student student 293 May 27 19:55 file02_01.cpp -rw-rw-r--. 1 student student 263 May 27 19:59 file02_02.cpp -rw-rw-r--. 1 student student 236 May 27 20:07 file02_03.cpp -rw-rw-r--. 1 student student 859 May 27 20:31 file02_04.cpp -rw-rw-r--. 1 student student 1097 May 28 00:40 file02_05.cpp -rw-rw-r--. 1 student student 1244 May 28 09:09 file02_06.cpp -rw-rw-r--. 1 student student 1333 May 28 13:40 file03_01.cpp -rw-rw-r--. 1 student student 2713 May 28 14:56 file03_02.cpp -rw-rw-r--. 1 student student 862 May 28 16:52 file03_03.cpp -rw-rw-r--. 1 student student 632 May 28 16:23 file03_04.cpp -rw-rw-r--. 1 student student 1199 May 29 07:07 file03_05.cpp -rw-rw-r--. 1 student student 2183 May 28 23:33 Fundamental_Data_Types_+_Arbitrary_Precison_Integers.txt -rw-rw-r--. 1 student student 3263 May 28 12:29 Keywords.txt drwxrwxr-x. 3 student student 23 May 29 07:04 library -rw-rw-r--. 1 student student 4370 May 28 17:38 List_Initialization_Compound_Assignment_Increment.txt [student@localhost C++]$ g++ file03_05.cpp -o cpp_exe/file03_05 /tmp/ccCq39Fl.o: In function `main': file03_05.cpp:(.text+0x93): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0xb7): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x10b): undefined reference to `operator-(BigNumber, long long const&)' file03_05.cpp:(.text+0x11d): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x165): undefined reference to `operator+(BigNumber, long long const&)' file03_05.cpp:(.text+0x177): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x24d): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0x2d0): undefined reference to `BigNumber::pow(int)' file03_05.cpp:(.text+0x2df): undefined reference to `operator<<(std::ostream&, BigNumber const&)' collect2: error: ld returned 1 exit status
and your implementation is in the .h file too or are you missing that?
klimi
wdym bruh?
you have the header file for BigNumber.h but where is the code? the actuall implementation
klimi
The code I'm running - #include <iostream> #include "bignumber.h" using namespace std; int main() { // use the maximum long long fundamental type value in calculations long long value1{9'223'372'036'854'775'807ll}; // max long long value cout << "long long value1: " << value1 << "\nvalue1 - 1: " << value1 - 1 // OK << "\nvalue1 + 1: " << value1 + 1; // result is undefined // use an arbitrary precison integer BigNumber value2{value1}; cout << "\n\nBignumber value2: " << value2 << "\nvalue2 - 1: " << value2 - 1 // OK << "\nvalue2 + 1: " << value2 + 1; // OK // powers of 100,000,000 with long long long long value3{100'000'000}; cout << "\n\nvalue3: " << value3; int counter{2}; while(counter < 5) { value3 *= 100'000'000; // quickly exceds maximum long long value cout << "\nvalue3 to the power " << counter << ": " << value3; ++counter; } // powers of 100,000,000 with BigNumber BigNumber value4{100'000'000}; cout << "\n\nvalue4: " << value1 << endl; counter = 2; while (counter <= 5) { cout << "value4.pow(" << counter << "): " << value4.pow(counter) << endl; ++counter; } cout << endl; } The error I'm getting - [student@localhost C++]$ g++ file03_05.cpp -o cpp_exe/file03_05 /tmp/ccEINwE7.o: In function `main': file03_05.cpp:(.text+0x93): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0xb7): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x10b): undefined reference to `operator-(BigNumber, long long const&)' file03_05.cpp:(.text+0x11d): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x165): undefined reference to `operator+(BigNumber, long long const&)' file03_05.cpp:(.text+0x177): undefined reference to `operator<<(std::ostream&, BigNumber const&)' file03_05.cpp:(.text+0x24d): undefined reference to `BigNumber::BigNumber(long long)' file03_05.cpp:(.text+0x2d0): undefined reference to `BigNumber::pow(int)' file03_05.cpp:(.text+0x2df): undefined reference to `operator<<(std::ostream&, BigNumber const&)' collect2: error: ld returned 1 exit status
this code?
klimi
this code?
because you don't have it there
Talula
It's in file03_05.cpp
See what it is saying is that, it is unable to find reference of BigNumber in the code... now it could be because it is not implemented like that.
Natasha
this code?
yeah that's in file03_05.cpp
klimi
yeah that's in file03_05.cpp
and where in that file you have the BigNumber class and things?
Talula
Hmmmmm
I mean it could be that you think bignumber.h is the actual file which has class definition for BigNumber... but does it?
Natasha
yes
klimi
x
Anonymous
#include<iostream> using namespace std; class three_d {int x,y,z; public: three_d( ){x = y = z = 0;} three_d(int i,int j, int k) {x=i;y=j;z=k;} three_d operator+(three_d op2); void show (); }; three_d three_d:: operator+(three_d op2) { three_d temp; temp.x=x +op2.x; temp.y=y +op2.y; temp.z=z +op2.z; return temp; } void three_d::show() { cout<<x<<","; cout<<y<<","; cout<<z<<"\n"; } int main( ) { three_d a(1,2,3) ,b(10,10,10),c; a.show(); b.show(); c=a+b; c.show(); c=a+b+c; c.show();}
klimi
Anonymous
with?
How I can Add operator (-)and operator(= )for the three_d program👆🏻
klimi
the same way as you did with operator + ?
Anonymous
the same way as you did with operator + ?
The professor told me that the solution method was wrong ، so I need help☹️
klimi
https://en.cppreference.com/w/cpp/language/operators see the documentation then
J.K. – Tessier-Ashpool Customer Support
@ammarfaizi2 Do you recommend learning ASM apart from any CTF? 🤔 I've been formed as a developer in some modern techs and now I'm starting in cyber security. I'm still choosing my path and I don't see things water clear yet. I'm looking for some recommendations or some advice, if you don't mind. 😌
Anonymous
Hi
Anonymous
How can help me to write 2 code with visual studio 8
Anonymous
And I don't have a loptop
Ammar
@ammarfaizi2 Do you recommend learning ASM apart from any CTF? 🤔 I've been formed as a developer in some modern techs and now I'm starting in cyber security. I'm still choosing my path and I don't see things water clear yet. I'm looking for some recommendations or some advice, if you don't mind. 😌
I don't think everybody should learn ASM. But if you love it, that is what you should do. Yeah, mostly CTF *that requires reverse engineering* does need ASM knowledge to work with. But not every CTF, some of them don't touch ELF file at all. So it is your choice to pick the way you go.
Anonymous
??
I am study and my laptop it still
Φ ☭
I am study and my laptop it still
You mean your laptop was stolen by someone??
Φ ☭
Hey why did you reported?? He is trying....
Anonymous
Yehh🤕🤕
Φ ☭
Yehh🤕🤕
I can't help you with that bro :)