Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    How to retrieve the OpCode?

    Hi,

    How could I retrieve the OpCode that PHP Engine generated for a script?
    PHP 5 & MySQL 5 (Y)

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    PHP is interpreted, so you're going to have a heck of a time getting this.
    You can get the source from the php website though, its through the QA but I can't remember what their link is off heart (at work, no bookmarks).
    Anyway, you can use that to determine what C instructions are used when PHP commands are issued. You can probably run that though a debugger and step though to the assembly to see what opcode is in use.
    Have fun, this will be the most painful task ever.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I know.

    I'm already working on it..
    PHP 5 & MySQL 5 (Y)

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    I forgot to ask, why would you need to know the opcode used for a specific script? I don't see any reason to handle this - there is a reason why we have high level programming languages nowadays.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    I forgot to ask, why would you need to know the opcode used for a specific script? I don't see any reason to handle this - there is a reason why we have high level programming languages nowadays.
    I need to analyze PHP code and I figured it would be easier to analyze the OpCode instead of PHP code itself.

    By analyzing I need to know exactly how everything is executed and what variables contain and what is outputted to where and what is passed into functions, etc.
    PHP 5 & MySQL 5 (Y)

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Sounds like you are trying to clean the params passed between pages so that your db etc won't be corrupted by injection attacks.

    I would have thought regex's and the 'escape string' or 'strip slashes' would do the trick. Sorry I am not proficient enough with php to recall properly, the mysql_escape_string syntax or the 'strip slashes' one.

    And if I have misunderstood , apologies for that too.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #8
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz View Post
    Sounds like you are trying to clean the params passed between pages so that your db etc won't be corrupted by injection attacks.

    I would have thought regex's and the 'escape string' or 'strip slashes' would do the trick. Sorry I am not proficient enough with php to recall properly, the mysql_escape_string syntax or the 'strip slashes' one.

    And if I have misunderstood , apologies for that too.

    bazz
    No need to apologize anything. Not exactly what I want to do, but the principles are the same - I want to know what happens in that PHP code what is passed to where.

    The BCompiler link was interesting.
    PHP 5 & MySQL 5 (Y)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •