Using Node.js for Javascript Analysis

本文介绍如何利用Node.js简化JavaScript代码分析过程,通过代码简化和变量设置,快速理解代码功能,避免阅读大量文本代码的困扰。实例展示了一个简化后的代码流程,包括将原始代码进行简化并使用Node.js执行,最终揭示了代码的功能,如潜在的恶意行为或功能实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I always find a need to check out some javascript, even when I know it's malicious I still have to know what it is doing. Doing it safely is always a good idea. Recently I found that Node.js works perfectly for this. This will document how to do this simply and easily. 

I don't think this is groundbreaking or new but I am documenting it because it took me a while to find a good way to do Javascript analysis. 

We start with our sample.

After laughing about the please use IE/Firefox I decided I don't like big blobs of text. This one is not bad but no real reason to not get into the habit of cleaning up the code. 

Lets quickly look at the code and see if we can simplify it without changing the functionality. 

So it looks like we can and this is what it will look like after a quick simplification.

We are now ready to start figuring out what this code does. We know it won't be much because the array is so small. For example some exploit kits are 17k items strong in the array.  

Lets fire up node.

Then looking at our Javascript above we can go ahead and setup some variables. I simplified the naming because I like simple. 

Once I had the variables setup I went into the main loop that happens to turn the array into a usable string in Javascript. Then execute "e" which was eval and is now console.log

We can now see some more useless code around the vars because they are not used. This simple email attachment would have redirected to Blackhole Exploit kit. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

danhuang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值