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

variable 'htmlparser_opts' is not declared #64

Open
PR0J3CT12 opened this issue Oct 25, 2023 · 3 comments
Open

variable 'htmlparser_opts' is not declared #64

PR0J3CT12 opened this issue Oct 25, 2023 · 3 comments

Comments

@PR0J3CT12
Copy link

Im getting error "variable 'htmlparser_opts' is not declared" after local htmlparser = require ("htmlparser"). How can i fix it?

@msva
Copy link
Owner

msva commented Nov 3, 2023

Can you add more information, please?

  1. how did you installed package?
  2. how do you use it (interactively, or in script)
  3. can you post full stacktrace, please?

@PR0J3CT12
Copy link
Author

PR0J3CT12 commented Jan 22, 2024

Mb im doing something wrong, but im trying to use library in nse(nmap scripting engine). Im not sure, that i can use libraries like in pure lua.

  1. luarocks install htmlparser
  2. as i said before, im trying to use it in nse script
/usr/local/share/lua/5.3/htmlparser.lua:14: variable 'htmlparser_opts' is not declared
stack traceback:
	[C]: in function 'error'
	/usr/bin/../share/nmap/nselib/strict.lua:80: in metamethod '__index'
	/usr/local/share/lua/5.3/htmlparser.lua:14: in main chunk
	[C]: in function 'require'
	/usr/bin/../share/nmap/scripts/http-ssrf.nse:14: in function </usr/bin/../share/nmap/scripts/http-ssrf.nse:1>

UPD:
lib "gumbo" is working with nse, as i can see, idk why)
Снимок

@msva
Copy link
Owner

msva commented Jan 23, 2024

It seems, this engine redefines the metatables, and this causes a problem (originally the line it points to calls a function that checks if htmlparser_opts is a table, and it being nil is originally acceptable option (it just won't return anything).

Also, I just tested on clean lua5.3 and there is no such error. So it is definitelly the engine's who is guilty.

As a workaround I suggest you to just define htmlparser_opts (global) variable as ampty table (or not empty, if you want to modify some settings) before require"htmlparser".

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