Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Jumping to machine code

Reply
Thread Tools

Jumping to machine code

 
 
Derek Fountain
Guest
Posts: n/a
 
      11-03-2004
I have a string in my Perl which contains the machine code for a short
program I want to run. I want Perl to jump to it. It's the last thing my
script will do, so I don't care about returning safely, etc. Ideally the
Perl will just exit neatly, but I really don't mind. I just need that
machine code to execute. I'm on Win32, but a cross platform method would be
good.

How can I do that?
 
Reply With Quote
 
 
 
 
Andrew Bryson
Guest
Posts: n/a
 
      11-03-2004
"Derek Fountain" <(E-Mail Removed)> wrote in message
news:41888be4$0$32221$(E-Mail Removed)...
>I have a string in my Perl which contains the machine code for a short
> program I want to run. I want Perl to jump to it. It's the last thing my
> script will do, so I don't care about returning safely, etc. Ideally the
> Perl will just exit neatly, but I really don't mind. I just need that
> machine code to execute. I'm on Win32, but a cross platform method would
> be
> good.
>
> How can I do that?


Have you considered putting the machine code into a .com file and just
running it with system() ?

Andrew


 
Reply With Quote
 
 
 
 
Derek Fountain
Guest
Posts: n/a
 
      11-03-2004
Andrew Bryson wrote:
> Have you considered putting the machine code into a .com file and just
> running it with system() ?


Yes, but the application doesn't easily allow disk access, plus I need
speed. Is that all a .com file is - no headers or other confusing stuff I
would need to generate?
 
Reply With Quote
 
John
Guest
Posts: n/a
 
      11-03-2004
Derek Fountain wrote:
> Andrew Bryson wrote:
>
>>Have you considered putting the machine code into a .com file and just
>>running it with system() ?

>
>
> Yes, but the application doesn't easily allow disk access, plus I need
> speed. Is that all a .com file is - no headers or other confusing stuff I
> would need to generate?


First, there is no such thing as "cross platform machine code."

Second, a Perl script must do an awful lot of disk access to get
started, so what's the problem?

Third, if you are so concerned about speed, WTF are you doing running it
from within Perl?

Fourth, this sounds like an attempt at injecting a virus in Perl code.

Could you please tell us what this marvelous piece of machine code is
going to do, and given that Perl is SOOO slow compared to machine code,
what benefit you think you're going to get from this approach?


 
Reply With Quote
 
Lukas Mai
Guest
Posts: n/a
 
      11-03-2004
Derek Fountain schrob:
> I have a string in my Perl which contains the machine code for a short
> program I want to run. I want Perl to jump to it. It's the last thing my
> script will do, so I don't care about returning safely, etc. Ideally the
> Perl will just exit neatly, but I really don't mind. I just need that
> machine code to execute. I'm on Win32, but a cross platform method would be
> good.


> How can I do that?


You could use Inline::ASM or Inline::C with something like:
void execute(char *code) {
((void (*)(void))code)();
}

HTH, Lukas
--
print+74.117.115.116,,qq.\c!..not::.her,Perl=>q$ha cker,$,!($,=$")
 
Reply With Quote
 
Derek Fountain
Guest
Posts: n/a
 
      11-04-2004
> First, there is no such thing as "cross platform machine code."

I know that, but I can put the right flavour of machine code into the string
dynamically.

> Second, a Perl script must do an awful lot of disk access to get
> started, so what's the problem?


Perl scripts start with a lot of disk *reading*, I don't have easy write
access.

> Third, if you are so concerned about speed, WTF are you doing running it
> from within Perl?


The usual balance of convenience and speed; writing a file to disk might tip
the balance the wrong way.

> Fourth, this sounds like an attempt at injecting a virus in Perl code.


It might sound like it, but no. Close though, I'm working with the
metasploit framework and want to test some payloads.

> Could you please tell us what this marvelous piece of machine code is
> going to do, and given that Perl is SOOO slow compared to machine code,
> what benefit you think you're going to get from this approach?


Since your attitude is that of an idiot, and you clearly have no intention
of helping me with my genuine, legitimate problem, no.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
jumping beens, well... jumping programs, aaahuuu-aah jalkadir C++ 3 10-05-2005 02:41 PM
Jumping wireless Connections Greg Wireless Networking 13 08-24-2005 03:05 AM
Jumping wireless Connections Greg Wireless Networking 11 07-14-2005 09:00 PM
DataGrid: jumping to the append row (asterisk) David Bird via .NET 247 ASP .Net 0 04-16-2004 02:07 PM



Advertisments