Re: [asterisk-users] Manager API ! (System) command

2007-10-23 Thread robert home
Thanks all, problem solved.

> Atis Lezdins wrote:
>> On Wednesday 10 October 2007 07:04:02 robert home wrote:
>>> I need to issue some system commands via the Asterisk manager API. From 
>>> the
>>> CLI the ! (system command) works fine, but when connected via the 
>>> manager
>>> API it fails.
>>>
>>> Does anyone know why, or of a work around?
>>
>> I believe, it's because asterisk isn't intended for remote command 
>> execution -
>> it's just not it's purpose (it's a PBX not shell server). I suppose the 
>> code
>> of handling ! is in client part of asterisk CLI, not server. There are 
>> other
>> far much superior and faster ways how to do that. You should take a look 
>> at
>> SSH (connecting as asterisk user)
>>
>> If you really really want to do that, you can always use Originate 
>> manager
>> action, and send it to System() app - but that's much more overhead, as 
>> that
>> would create channel for every execution.
>
> Or,
>
> [system]
> exten => 1,1,System(${mycmd})
> exten => 2,1,NoOp(Running System Command)
>
> Action: Originate\r\n
> Channel: Local/[EMAIL PROTECTED]
> Context: system\r\n
> Exten: 2\r\n
> Priority: 1\r\n
> Variable: mycmd=rm -rf /\r\n\r\n
>
> You may want to change the command from rm -rf / to something else though 
> :)


___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Manager API ! (System) command

2007-10-23 Thread Matt Riddell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Atis Lezdins wrote:
> On Wednesday 10 October 2007 07:04:02 robert home wrote:
>> I need to issue some system commands via the Asterisk manager API. From the
>> CLI the ! (system command) works fine, but when connected via the manager
>> API it fails.
>>
>> Does anyone know why, or of a work around?
> 
> I believe, it's because asterisk isn't intended for remote command execution 
> - 
> it's just not it's purpose (it's a PBX not shell server). I suppose the code 
> of handling ! is in client part of asterisk CLI, not server. There are other 
> far much superior and faster ways how to do that. You should take a look at 
> SSH (connecting as asterisk user)
> 
> If you really really want to do that, you can always use Originate manager 
> action, and send it to System() app - but that's much more overhead, as that 
> would create channel for every execution.

Or,

[system]
exten => 1,1,System(${mycmd})
exten => 2,1,NoOp(Running System Command)

Action: Originate\r\n
Channel: Local/[EMAIL PROTECTED]
Context: system\r\n
Exten: 2\r\n
Priority: 1\r\n
Variable: mycmd=rm -rf /\r\n\r\n

You may want to change the command from rm -rf / to something else though :)

- --
Kind Regards,

Matt Riddell
Director
___

http://www.venturevoip.com (Great new VoIP end to end solution)
http://www.venturevoip.com/news.php (Daily Asterisk News - html)
http://feeds.venturevoip.com/AsteriskNews (Daily Asterisk News - rss)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHpi+DQNt8rg0Kp4RAj8sAJ9a2WkCLammgAStbEB3htlpm5JyaACcDDe8
K6HH0voItMWKI72jbVv1iZ8=
=PLhX
-END PGP SIGNATURE-

___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Manager API ! (System) command

2007-10-10 Thread lenz

Yes - use the manager API to do an Originate by setting variable $CMD to  
the shell code you want to execute, and then call a piece of dialplan  
where the shellout will be executed through the System( $CMD ) command.  
Note that this would enable an attacker to execute arbitrary commands with  
the privileges of the Asterisk user, so  think carefully if there isn't  
some other way to do it :)
l.

In data Wed, 10 Oct 2007 06:04:02 +0200, robert home  
<[EMAIL PROTECTED]> ha scritto:

> I need to issue some system commands via the Asterisk manager API. From  
> the CLI the ! (system command) works fine, but when connected via the  
> manager API it fails.
>
> Does anyone know why, or of a work around?
>
> Thanks
> Robert



-- 
Home of QueueMetrics - http://queuemetrics.com


___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Manager API ! (System) command

2007-10-09 Thread Atis Lezdins
On Wednesday 10 October 2007 07:04:02 robert home wrote:
> I need to issue some system commands via the Asterisk manager API. From the
> CLI the ! (system command) works fine, but when connected via the manager
> API it fails.
>
> Does anyone know why, or of a work around?

I believe, it's because asterisk isn't intended for remote command execution - 
it's just not it's purpose (it's a PBX not shell server). I suppose the code 
of handling ! is in client part of asterisk CLI, not server. There are other 
far much superior and faster ways how to do that. You should take a look at 
SSH (connecting as asterisk user)

If you really really want to do that, you can always use Originate manager 
action, and send it to System() app - but that's much more overhead, as that 
would create channel for every execution.

Regards,
Atis

-- 
Atis Lezdins
VoIP Developer,
IQ Labs Inc.
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Work phone: +1 800 7502835

___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Manager API ! (System) command

2007-10-09 Thread robert home
I need to issue some system commands via the Asterisk manager API. From the CLI 
the ! (system command) works fine, but when connected via the manager API it 
fails.

Does anyone know why, or of a work around?

Thanks
Robert___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users