CPT test exam compiling code


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers CPT test exam compiling code
# 1  
Old 05-26-2015
CPT test exam compiling code

Hello all
I am new to programming and trying to compile this code

Code:
#include <asm/unistd.h>
#include <sys/mman.h>
#include <unistd.h>
#include <errno.h>
 
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
 
#define __NR_real_mremap __NR_mremap
 
static inline _syscall5( void *, real_mremap, void *, old_address,
size_t, old_size, size_t, new_size,
unsigned long, flags, void *, new_address );
 
int main( void )
{
void *base;
 
base = mmap( NULL, 8192, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0 );
 
real_mremap( base, 0, 0, MREMAP_MAYMOVE | MREMAP_FIXED,
(void *) 0xC0000000 );
 
fork();
 
return( 0 );
}

This is for a practice exam for the CPT (Certified Penetration Tester). I am not sure about resolving the errors.

Thanks
# 2  
Old 05-26-2015
That code is linux specific for one thing, and depends on linux kernel headers for another, and probably a specific version of linux kernel headers. It certainly doesn't work here any more.
# 3  
Old 05-26-2015
Thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compiling source code issue

Need assistance in compile a source code with PERL flags Compile source code CDFconvert-2.2.3 which requires Fortran 90,Perl interpreter , Perl/TK module , NetCDF library , Gempak I have all the above required libraries . Issue is when compiling the source code it looks for local... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

2. Shell Programming and Scripting

Shc : trying to test functionality "test" compiling but can not execute

I am testing shc to see if it would help with my need. Im at a point where Im trying to compile and test the "test.ksh" file that comes in the tar ball : shc-3.8.9> shc -v -r -f test.ksh shc shll=ksh shc =-c shc =exec '%s' "$@" shc = shc opts= shc: cc test.ksh.x.c -o test.ksh.x... (7 Replies)
Discussion started by: popeye
7 Replies

3. Programming

Problems compiling code

I am trying to compile some code and getting lot of errors g++ -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG -DREAL=float -DGetREAL=Getfloat -IbaseLib -Itommy -Iothers ./source/main/RayTrac.cc -o raytrac ./source/main/RayTrac.cc:36:20: error: gendef.h: No such file or... (1 Reply)
Discussion started by: kristinu
1 Replies

4. UNIX for Dummies Questions & Answers

decryption of .cpt file

Hi i have the path for encrytion file in unix and i want to decrypt the .cpt file in unix and change the password how can i do that . (3 Replies)
Discussion started by: lily
3 Replies

5. UNIX Desktop Questions & Answers

decryption of .cpt file in unix

can some one help me how to decrypt a .txt.cpt file in unix i Double post (0 Replies)
Discussion started by: lily
0 Replies

6. Programming

Compiling and running Python code

Hey there, First post here in the Unix forums, but I have used them a lot for research over the last year. Anyways, to why I'm here now: I'm working on a project and I'll be using the AIS Parser SDK by Brian C. Lane (can't post the link, but google that and the first 8 links will be relevant) ... (4 Replies)
Discussion started by: pmd006
4 Replies

7. Windows & DOS: Issues & Discussions

Problem compiling C++ Code in Cygwin

Hello everyone. I just recently installed Cygwin and I am running it under Windows 7. My problem is that I cannot seem to compile any C++ code with g++. I've tried to compile C Code using gcc and that works just fine. But Whenever I try to compile some C++ code, g++ throws a whole bunch of... (6 Replies)
Discussion started by: Anlex
6 Replies

8. HP-UX

HP-UX CSA Certif Test exam

Hi All, i will pass the CSA exam next month. i'm looking for examples. thanks and best regards. (1 Reply)
Discussion started by: argaaz
1 Replies

9. UNIX for Dummies Questions & Answers

Compiling Code

Hi i am new to programming im having a bit of a problem i have installed kubuntu on my computer and i have wrote some code but when i go to compile it i get this error in the terminal ross@ubuntu:~/cp1$ g++ -ansi -pedantic array.cpp -o array ross@ubuntu:~/cp1$ array The program 'array' is... (3 Replies)
Discussion started by: RossMc
3 Replies

10. Programming

Error message of compiling a C code

Hi, Recently I have a C Code and i compile on my pc with gcc -D _t_1 -o a.out test.c It works fine for me on my pc. However, upon transferring the same code on Sun Solaris server, it breaks with the below message:- Undefined first referenced symbol ... (3 Replies)
Discussion started by: ahjiefreak
3 Replies
Login or Register to Ask a Question