Questions tagged [execve]
207 questions
0
votes
1 answer
execve on linux, execute from arguments
I need to create a program that allows the user to execute a command passed as argument using execve in linux. I'm not sure about the syntax of the execve command. I wrote the program but it doesn't work with multiple arguments and I can't figure…

Federico Zucchi
- 41
- 2
- 8
0
votes
1 answer
After fork(), how to keep running execve() in for() loop?
Here is an example, ignorning the error checking:
int main()
{
pid_t pid = fork();
if(0 == pid)
{
for(int i = 0; i < 5; ++i)
{
char* const args[] = { "/bin/ls", nullptr };
execve("/bin/ls", args,…
user7633138
0
votes
2 answers
Can't pass 2nd environment variable with execve
I would like to display 2 environment variables that are passed as argument to another process using execve() function:
Main.c:
int main(){
char USERNAME[10];
strcpy(USERNAME, "USERNAME=");
for (int i=1;i<10;i++){
…

SdFRO0QS78
- 91
- 1
- 2
- 5
0
votes
0 answers
How can a program be executed using execve()?
I'm trying to perform a simple test using the exec() function by emulating a Linux shell. The test program should take in commands in the following form: cmd arg1 arg2 ... where cmd is the command and arg1, arg2, ... are the command line arguments.…

Brandon Busby
- 91
- 3
0
votes
1 answer
execve x86 - Segmentation Fault
I keep getting segmentation faults on this could anybody help me on this one, I am kind of new to ASM
global _start
section .text
_start:
push dword 0x0068732F ; Push /sh
push dword 0x6E69622F ; Push /bin
mov eax, esp ; Store…

0xDeMoN
- 11
- 3
0
votes
2 answers
ffmpeg produces bad output when called from execve in c++
im writing a c++ program that involves ffmpeg being called from a c++ program. a couple of days ago i got it working using std::system
std::system("ffmpeg -threads auto -y -r 1.74659 -i /mnt/ev_ramdsk/1/%05d-capture.jpg -px_fmt yuv420p -preset…

Arheisel
- 186
- 11
0
votes
1 answer
Bus Error in OS X x86_64 in Execve call
I am trying to mimic Security Tubes execve tutorial (http://hackoftheday.securitytube.net/2013/04/demystifying-execve-shellcode-stack.html) in 64bit Asm. I am not sure where the bus error is coming from. I stepped through through the app in GDB…

Jlegend
- 531
- 1
- 6
- 19
0
votes
2 answers
unexpected EOF while looking for matching `'' while using execve()
I try to run multiple commands (or using simple output redirection) via execve().
When I put this (of course before I pass this string to function I split into spaces and put each each separate to char* []):
"bash -c ' /usr/bin/cat /root/script.sh >…

maslokarol
- 43
- 7
0
votes
1 answer
execve not taking environment parameters
I want to write a program which executes the Linux ls command.
I really only want to type in ls and not /bin/ls, so I want to do this using execve (execvp is not an option).
I tried:
char *env[] = {…

今天春天
- 941
- 1
- 13
- 27
0
votes
1 answer
Implement Pipe in C
I am implementing pipe in C. When I try the command 'cat aa | grep "something" ' in my program. The grep process just hanging there, seems waiting for input. I don't know why. Here is the core code. Just take ExecuteCommand as simply call execve…

Hengstar
- 180
- 2
- 13
0
votes
1 answer
Unexpected output after the first iteration of this code
I honestly have no idea how the following even happens. Here is the code:
while(1)
{
char** line = read_command();
char* command = line[0];
char** parameters = malloc(100);
int i;
for(i = 0; i < pNum; i++) // pNum is a global…

Armand Maree
- 488
- 2
- 6
- 21
0
votes
0 answers
No exiting CPE in the official CPE dictionary
In some CVE, we can read some CPE like :
cpe:/a:libcap:libcap:2.00
cpe:/a:gnome:libsoup:2.32.2
cpe:/a:libgtop:libgtop:2.14.5
But neither libcap nor libsoup nor libgtop are in the official CPE dictionary !!
(XML file or online search :…

JohnCage
- 37
- 5
0
votes
1 answer
execve to file I just wrote -- "Text file busy"
The intended behavior of the C program below is to copy its own executable file to a new randomly-named file, then execve that file, ad nauseum. This should create many, many copies of the executable. This is obviously a terrible idea, but it is…

Arandur
- 727
- 6
- 19
0
votes
1 answer
more than one command for system call in linux
I am trying to execute a program (say target.c) that has the following
void foo(char * arg)
{
char cmd[16];
char par[16];
char * p;
strcpy(cmd, "ls --color -l ");
strcpy(par, arg);
printf("You can use \"%s %s\" to list the…

proteann
- 33
- 1
- 7
0
votes
1 answer
Process controller running files in random order
I'm trying to execute and schedule my own list of processes read from a file. The files are running in a random order and I'm just curious as to why this is happening. I have simple print statements in the first, second, etc files that tell which is…

user3192682
- 123
- 1
- 2
- 11