Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to load contents of alert screen ? #231

Open
GoogleCodeExporter opened this issue Aug 5, 2015 · 0 comments
Open

How to load contents of alert screen ? #231

GoogleCodeExporter opened this issue Aug 5, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

I'm using Pyv8 to display an deobfuscated HTML file's contents(using 'alert') 
on cmd. But I need double-decoding to see complete code. Can I make 
first-decoded file's contents on alert screen as a HTML file?

I'll show you simple examples to get answers.

↓ First, It's content of test.html
a="abcdefgh"
b="bcdefghi"
c="cdefghij"
d="defghijk"

↓ Second, It's content of test.py to remove 'a' and add 'alert(b)', 
'alert(c)'.
import sys,re,PyV8

class Global(PyV8.JSClass):

    def alert(self, value):
        print value

ctx = PyV8.JSContext(Global())
ctx.enter()

original=open ('test.html','r').read()

if original.find("a+?'"):
    original = re.sub("a+?'",'',original)

first=original+'''alert(b)\n'''+'''alert(c)'''

open('decode.html','w').write(first)

print ctx.eval(first)

↓ compile result of test.py
bcdefghi
cdefghij
None

and I want to add string this code. ( alert(d) )

↓ I tried it........
import sys,re,PyV8

class Global(PyV8.JSClass):

    def alert(self, value):
        print value

ctx = PyV8.JSContext(Global())
ctx.enter()

original=open ('test.html','r').read()

if original.find("a+?'"):
    original = re.sub("a+?'",'',original)

first=original+'''alert(b)\n'''+'''alert(c)'''

open('decode.html','w').write(first)

second = ctx.eval(first) + 'alert(d)'

↓ I only get ctx.eval(fist) and error message.
bcdefghi
cdefghij

Traceback (most recent call last):
  File "C:/Users/KOREA/Desktop/test.py", line 20, in <module>
    second = ctx.eval(first) + 'alert(d)'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

How to process " second = ctx.eval(first) + 'alert(d)' " ? plz help.


1.I print an HTML file's contents on html using Pyv8 with 'alert'


2.I want to make and write file with printed content in alert screen


3.I tried like second = ctx.eval(first) + 'alert(d)' and only to get error 
message.




Original issue reported on code.google.com by Clanic....@gmail.com on 12 Apr 2014 at 10:53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant