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

Javascript support #15

Open
0xh4di opened this issue Jan 14, 2020 · 5 comments
Open

Javascript support #15

0xh4di opened this issue Jan 14, 2020 · 5 comments

Comments

@0xh4di
Copy link

0xh4di commented Jan 14, 2020

Hi,

How can I enable Javascript support in your proxy?

@jabbany
Copy link
Owner

jabbany commented Jan 14, 2020

Javascript support (however much there is) is enabled by default.

KnProxy's support for JavaScript is very limited though, and basically comes in two forms:

  • If there is a string that looks kind of like an URL in JavaScript, KnProxy "may" be able to rewrite it to be proxied. This is not reliable though since there is not a real js "parser" just some regex doing the parsing, plus any compound URLs will likely break. This behavior can be turned off in conf.php through the ENABLE_JS_PARSING config.
  • A script is injected into the page, that attempts to override the XMLHttpRequest's open prototype and rewrite any URL passed in there to catch Ajax requests. This is also not reliable as some browsers prevent this being overwritten and it doesn't handle alternate methods of AJAX like fetch. This can be turned off thorugh ENABLE_INJECTED_AJAXFIX.

In general I don't recommend KnProxy for JS heavy web applications as they will likely not work. If possible, a pure tunneling proxy is going to be your best option there.

@0xh4di
Copy link
Author

0xh4di commented Jan 15, 2020

I have another issue on GZIP pages. That pages responded with gzip not shown correctly. I have a .JS file and server sent with GZIP compression, I`m able to see the JS file with curl --compress command but KnProxy not able to show the JS file.

Any idea?

@0xh4di
Copy link
Author

0xh4di commented Jan 15, 2020

fix!

replace gzinflate to gzdecode on file includes/module_http.php line 344

$spl[1] = gzdecode($spl[1]);

@0xh4di
Copy link
Author

0xh4di commented Jan 15, 2020

how can I disable URL encryption ?

@jabbany
Copy link
Owner

jabbany commented Jan 16, 2020

The url isn't "encrypted" per se. It's just encoded, mainly to make sure that special characters in the URL all get mapped back to alphanumeric characters so it doesn't break things when used as a query string. The code for it is in https://github.com/jabbany/knProxy/blob/master/includes/module_encoder.php . To disable the encoding, just swap out the encode and decode functions for something else. I would suggest at least using some other encoding like base64 just to make sure that the resulting rewritten URLs are still usable and parsed correctly.

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

No branches or pull requests

2 participants