eval

Alternatives to JavaScript eval() for parsing JSON

Deadly 提交于 2019-11-27 07:39:42
Quick Question. Eval in JavaScript is unsafe is it not? I have a JSON object as a string and I need to turn it into an actual object so I can obtain the data: function PopulateSeriesFields(result) { data = eval('(' + result + ')'); var myFakeExample = data.exampleType } If it helps I am using the $.ajax method from jQuery. Thanks Well, safe or not, when you are using jQuery, you're better to use the $.getJSON() method, not $.ajax(): $.getJSON(url, function(data){ alert(data.exampleType); }); eval() is usually considered safe for JSON parsing when you are only communicating with your own server

Evaluate javascript on a local html file (without browser)

﹥>﹥吖頭↗ 提交于 2019-11-27 07:26:20
问题 This is part of a project I am working on for work. I want to automate a Sharepoint site, specifically to pull data out of a database that I and my coworkers only have front-end access to. I FINALLY managed to get mechanize (in python) to accomplish this using Python-NTLM, and by patching part of it's source code to fix a reoccurring error. Now, I am at what I would hope is my final roadblock: Part of the form I need to submit seems to be output of a JavaScript function :| and lo and behold..

eval() does not return the function results

大憨熊 提交于 2019-11-27 07:20:50
问题 I have a method name that is stored in a column in the DB that looks like this: customs::nicknames($data) This is the related class: class customs extends service { function __construct() { parent::__construct(); } public static function nicknames($data) { return $data; } } When I call it in this way: $merge = eval($error['custom'] . ';'); The contents of the $data variable is not returned. Just to give it a try I tried with echo and it is correctly returning the array to string conversion

Get variable from a string

元气小坏坏 提交于 2019-11-27 07:12:47
问题 Does anyone know how could I select a variable from a String in JavaScript? Here's what I'm basically trying to achieve: var myLang = "ESP"; var myText_ESP = "Hola a todos!"; var myText_ENG = "Hello everybody!"; console.log(myText_ + myLang); // This should trace "Hola a todos!" Thanks! 回答1: var hellos = { ESP: 'Hola a todos!', ENG: 'Hello everybody!' }; var myLang = 'ESP'; console.log(hellos[myLang]); I don't like putting everything in global scope, and then string accessing window

Python eval: is it still dangerous if I disable builtins and attribute access?

我的未来我决定 提交于 2019-11-27 07:05:10
We all know that eval is dangerous , even if you hide dangerous functions, because you can use Python's introspection features to dig down into things and re-extract them. For example, even if you delete __builtins__ , you can retrieve them with [c for c in ().__class__.__base__.__subclasses__() if c.__name__ == 'catch_warnings'][0]()._module.__builtins__ However, every example I've seen of this uses attribute access. What if I disable all builtins, and disable attribute access (by tokenizing the input with a Python tokenizer and rejecting it if it has an attribute access token)? And before

Safely sandbox and execute user submitted JavaScript?

空扰寡人 提交于 2019-11-27 06:48:33
I would like to have the ability to let users submit arbitrary JavaScript code, which is then sent to a Node.JS server and safely executed before the output is sent back to multiple clients (as JSON). The eval function comes to mind, but I know this has multiple security concerns (the user submitted code would be able to access Node's File API, etc). I have seen some projects like Microsoft Web Sandbox and Google Caja which allow execution of sanitized markup and script (for embedding third-party ads on websites), but it seems that these are client-side tools and I'm not sure if they can be

HyperLink with NavigateUrl with Eval(). Where is the mistake?

自作多情 提交于 2019-11-27 06:35:12
问题 First I was changing HyperLink.NavigateUrl in code-behind on Page_Load() . But after I decided to do it in design using Eval() method. <asp:HyperLink runat="server" NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Eval("type"), Eval("id")) %>' Text="Refuse" /> or <asp:HyperLink ID="urlRefuse" runat="server" NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Request["type"], Request["id"]) %>' Text="Refuse" /> where id and type - are variables from Request . But it

Understanding ASP.NET Eval() and Bind()

倾然丶 夕夏残阳落幕 提交于 2019-11-27 06:19:08
Can anyone show me some absolutely minimal ASP.NET code to understand Eval() and Bind() ? It is best if you provide me with two separate code-snippets or may be web-links. For read-only controls they are the same. For 2 way databinding, using a datasource in which you want to update, insert, etc with declarative databinding, you'll need to use Bind . Imagine for example a GridView with a ItemTemplate and EditItemTemplate . If you use Bind or Eval in the ItemTemplate , there will be no difference. If you use Eval in the EditItemTemplate , the value will not be able to be passed to the Update

安全类和远程类shell脚本

北城以北 提交于 2019-11-27 05:59:07
批量杀php小马脚本 find /home/hatdot/ -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval\(gunerpress|eval\(base64_decoolcode|spider_bc">>/tmp/test.txt grep -r -include=*.php '[^a-z]eval($_POST' . >> /tmp/test.txt grep -r -include=*.php 'file_put_contents(.*$_POST\[ .*\ ]);' . >> /tmp/test.txt find /home/hatdot/ -name "*.php" -type f -print 0 | xargs -0 egrep "(phpspy|c99sh|milw0rm|eval\(gzuncompress\(base64_decoolcode|eval\(base64_decoolcode|spider_bc|gzinflate)" | awk -F: '{print $1}' | sort | uniq >> /tmp/test.txt python批量杀php小马 #!/usr/bin/python # -*- coding: utf-8 -*- #blog:www.sinesafe.com

FEL表达式的用法

非 Y 不嫁゛ 提交于 2019-11-27 05:44:17
 Fel是开放的,引擎执行中的多个模块都可以扩展或替换。Fel的执行主要是通过函数实现,运算符(+、-等都是Fel函数),所有这些函数都是可以替换的,扩展函数也非常简单。 Fel有双引擎,同时支持解释执行和编译执行。可以根据性能要求选择执行方式。编译执行就是将表达式编译成字节码(生成java代码和编译模块都是可以扩展和替换的)  FEL可以进行算数运算以及逻辑运算,也可以调用类的静态方法、非静态方法。 只需要一个jar包: 1. 简单使用 1. 简单计算 private static void calculate() { // 算数运算 FelEngine fel = new FelEngineImpl(); Object result = fel.eval("1.5898*1+75"); System.out.println(result); // 逻辑运算 Object result2 = fel.eval("1 == 2 || '1'.equals('1')"); System.out.println(result2); } 结果: 76.5898 true 2. 变量用法 private static void variables() { // 变量 FelEngine fel = new FelEngineImpl(); FelContext ctx = fel