Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 01-20-2003, 06:14 PM   #31 (permalink)
anon
Guest
 
Posts: n/a
Yeah, but using shell_exec() you can get the output into a variable, *hint* =)

Also if you are just way lazy and using something that doesn't redirect the output to a variable just do

some_command("$command|tee /blah");

then just use shell_exec to get the contents of blah. Of course thats just plain messy.


PS. Blah! Did you get passthrough thing with the errors back from php.net? I saw it yesterday and was looking today but couldn't find anything.
  Reply With Quote
Old 01-20-2003, 06:51 PM   #32 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
Vlad, you are like talking to a wall. i wonder if you even read your own posts .. or my posts... and if you do, then you need some serious comprehension help. your responses are completely inconsistant. i think you should be reading these posts with the intent to ask more questions rather than answer. ( ok there i vented )

from what i've read, you haven't got shell_exec() to give you any output .. and neither have i. there is a setting in your php.ini file that you have to set.

output_buffer "On"

i've set that and restarted apache, but it still doesn't give me any output. i've had other friends test it and it works fine. could be something buggy on my server. rh8/php4.2.3/apache1.2.7
sde is offline   Reply With Quote
Old 01-20-2003, 06:59 PM   #33 (permalink)
anon
Guest
 
Posts: n/a
Probably because I just think what you are saying is something else...

Because from what I understood is you explained that if you can get output into a variable you can do much more than if you just printed it. I agree there completely. So what I am saying is that to get output to a variable just use shell_exec(). So you can do:

$output = shell_exec("ls");

and now you can print it to screen, save it into a DB, mass mail it, loop it infinitely to crash NN whatever... Because other things like system() print it to screen directly. I have gotten shell_exec() to give me output.... All you have to do is $blah=shell_exec() and then $blah has the output. Or am I just reading your post wrong?
  Reply With Quote
Old 01-20-2003, 07:02 PM   #34 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
Quote:
Originally posted by sde
i've tested both of these to make sure that shell_exec() will actually work.

this is putting the command in the arguments
PHP Code:
<?
$output 
shell_exec('touch new_file.txt');
echo 
$output;
?>
and this would do the same thing except putting an executable filename in the arguments
PHP Code:
<?
$output 
shell_exec('script.sh');
echo 
$output;
?>
both of these will create 'new_file.txt' ( assuming script.sh just contains the same command as my first example. )

the problem is when you use any command that generates output. i tested it with 'echo' commands and also 'rm' commands that should not detect a file and give error output.

this bugs the heck out of me.
and this was my point .. this was quite a few posts ago ( posted by me ) .. i know how to do it , and it's not working. this is why i am saying you don't read.
sde is offline   Reply With Quote
Old 01-20-2003, 07:10 PM   #35 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Quote:
Originally posted by Vlad902
Probably because I just think what you are saying is something else...

Because from what I understood is you explained that if you can get output into a variable you can do much more than if you just printed it. I agree there completely. So what I am saying is that to get output to a variable just use shell_exec(). So you can do:

$output = shell_exec("ls");

and now you can print it to screen, save it into a DB, mass mail it, loop it infinitely to crash NN whatever... Because other things like system() print it to screen directly. I have gotten shell_exec() to give me output.... All you have to do is $blah=shell_exec() and then $blah has the output. Or am I just reading your post wrong?
Damn you are malicious!

Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 01-20-2003, 07:18 PM   #36 (permalink)
anon
Guest
 
Posts: n/a
OK, I now get what you mean . But truly it doesn't bother me that much, I am content using system("blah 2>&1"); if I need output and shell_exec if I need it stored in a variable.

1.)Do you mean Apache 1.3.27?
2.)Have you looked at their httpd.conf or php.ini files?
3.)Worth a try, make look at :
A.)updating Apache
B.)updating PHP (unlikely)
C.)Both
  Reply With Quote
Old 01-20-2003, 07:19 PM   #37 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
this works for me:

PHP Code:
<?
$foo 
shell_exec('pico test');
print 
"$foo";
?>
although it is un-readable, i can definetly see a connection...

Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 01-20-2003, 07:23 PM   #38 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Quote:
Originally posted by Vlad902
OK, I now get what you mean . But truly it doesn't bother me that much, I am content using system("blah 2>&1"); if I need output and shell_exec if I need it stored in a variable.

1.)Do you mean Apache 1.3.27?
2.)Have you looked at their httpd.conf or php.ini files?
3.)Worth a try, make look at :
A.)updating Apache
B.)updating PHP (unlikely)
C.)Both
1. ya, apache 1.2.x only went up to 1.2.6
2. how do we need he needs to update apache if we dont know his version!!!!



Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 01-20-2003, 08:37 PM   #39 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
that box is a mess anyway, .. i should just try it on another system, i'm sure it works cause of everyone who's tested it. i would just put something besides redhat 8 on it, but it's a game server, and full most of the time with players.

i'm just imagining how i can use that now, .. it's a pretty powerful feature.
sde is offline   Reply With Quote
Old 01-20-2003, 08:56 PM   #40 (permalink)
anon
Guest
 
Posts: n/a
/me if I owned a game server

MWHAHAHAHAHA!

sniff everything! EVERYTHING! HAHAHAHAHA!
Check refferer and spoof them for null sessions! HAHAHAHA! YES! YES!
Check usernames and IP and spoof on ports of popular IM protocols! MWAHAHAHAHAHAHAHAHA!


  Reply With Quote
Old 01-20-2003, 09:15 PM   #41 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
i'll give you the ip.. why don't you join? haha
sde is offline   Reply With Quote
Old 01-20-2003, 09:42 PM   #42 (permalink)
anon
Guest
 
Posts: n/a
Quote:
Originally posted by sde
i'll give you the ip.. why don't you join? haha
I'll give you my IP, make sure you have lots of null sessions on here and elsewhere
  Reply With Quote
Old 01-21-2003, 06:26 AM   #43 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Quote:
Originally posted by sde
i'll give you the ip.. why don't you join? haha
whats the ip?

or are you just kidding...


Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 01-21-2003, 07:00 AM   #44 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
no, it's a couinter-strike server
sde is offline   Reply With Quote
Old 01-21-2003, 10:59 AM   #45 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
I love that game!

Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 09:35 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting