题目链接: http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=43

知识点:js语法

这里这里→ http://ctf.idf.cn/game/web/43/index.php

思路:

查看网页源码,阅读js代码,发现函数实现了加密方法,但是解密的方法并没有实现,根据加密的部分我们容易写出解密的方法,如下:

<html>
<body> <script>
/**
* Pseudo md5 hash function
* @param {string} string
* @param {string} method The function method, can be 'ENCRYPT' or 'DECRYPT'
* @return {string}
*/
function pseudoHash(string, method) {
// Default method is encryption
if (!('ENCRYPT' == method || 'DECRYPT' == method)) {
method = 'ENCRYPT';
}
// Run algorithm with the right method
if ('ENCRYPT' == method) {
// Variable for output string
var output = '';
// Algorithm to encrypt
for (var x = 0, y = string.length, charCode, hexCode; x < y; ++x) {
charCode = string.charCodeAt(x);
if (128 > charCode) {
charCode += 128;
} else if (127 < charCode) {
charCode -= 128;
}
charCode = 255 - charCode;
hexCode = charCode.toString(16);
if (2 > hexCode.length) {
hexCode = '0' + hexCode;
} output += hexCode;
}
// Return output
return output;
} else if ('DECRYPT' == method) {
// Algorithm to encrypt
// Variable for output string
var output = '';
var charCode = '';
var hexCode = 0;
for(var i=0; i<string.length; i+=2){
if(string[i] == '0'){
charCode = string[i+1];
}
else{
charCode = string[i]+string[i+1];
} hexCode = parseInt(charCode, 16)
hexCode = 255 - hexCode
if(hexCode > 128){
hexCode -= 128
}
else if(hexCode < 128){
hexCode += 128
}
output += String.fromCharCode(hexCode);
}
// Return output
return output;
}
}
document.write(pseudoHash('46191d4b494a4e1c4f4a1d4d1a1b484f191d1e4a1e191a4f1d4f4c461e4a4a4f', 'DECRYPT'));
</script> </body>
</html>

解密的结果为“9fb4651c05b2ed70fba5afe0b039a550”,将该值粘入原网页的密码输入框,走你,得到答案“wctf{jS_decRypt__Eaaasy}”

IDF-CTF-简单的js加密 writeup的更多相关文章

  1. IDF-CTF-不难不易的js加密 writeup

    题目链接: http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=28 就是这里 → http://ctf.idf.c ...

  2. IDF实验室-简单编程-字符统计 writeup

    题目地址:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=37 网站:http://ctf.idf.cn/gam ...

  3. IDF实验室-简单的ELF逆向 writeup

    题目:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=39 下载得到ElfCrackMe1文件,直接用IDA打开 ...

  4. IDF实验室-简单的js解密

    根据加密方法推算解密方法,补全如下 <script> /** * Pseudo md5 hash function * @param {string} string * @param {s ...

  5. Python 爬虫js加密破解(四) 360云盘登录password加密

    登录链接:https://yunpan.360.cn/mindex/login 这是一个md5 加密算法,直接使用 md5加密即可实现 本文讲解的是如何抠出js,运行代码 第一部:抓包 如图 第二步: ...

  6. 翻译小工具制作,Python简单破解有道JS加密!

    写这篇文章之前,我记得我以前好像公布一次.百度翻译的接口把版本号修改可以得到老版本,而老版本是没JS加密的,有道的呢也是一样的. ! 不过今天的教程不会这么low,咱们今天就老老实实把有道翻译的JS破 ...

  7. 简单的Elf逆向Writeup

    ElfCrackMe1 html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acrony ...

  8. AES加密解密——AES在JavaWeb项目中前台JS加密,后台Java解密的使用

    一:前言 在软件开发中,经常要对数据进行传输,数据在传输的过程中可能被拦截,被监听,所以在传输数据的时候使用数据的原始内容进行传输的话,安全隐患是非常大的.因此就要对需要传输的数据进行在客户端进行加密 ...

  9. 使用Z3破解简单的XOR加密

    使用Z3破解简单的XOR加密 翻译:无名侠 原文地址: https://yurichev.com/blog/XOR_Z3/ 如果我们有一段用简单XOR加密过的文本,怎么寻找密钥呢?密钥的长度可能很长, ...

随机推荐

  1. js Array 数组方法扩展

    //去重复   Array.prototype.unique = function()  {     this.sort();     var re=[this[0]];     for(var i ...

  2. swift实现线程安全的栈和队列

    实现一个线程安全的栈 这里使用数组来存储栈的数据.不足之处在于本例中的Stack可以无限扩容,更好的是初始化时候指定一个最大容量,防止不断扩容申请内存导致内存不够的问题.这里的线程安全使用一个串行队列 ...

  3. Sql 使用游标

    DECLARE data_cursor CURSOR FOR WITH T0 AS ( SELECT COUNT(f.DeptID) SubmitCount , f.DeptID FROM biz.F ...

  4. 树——minimum-depth-of-binary-tree(二叉树的最小深度)

    问题: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the s ...

  5. PTA 错题记录

    程设期中考, 记录一下曾经做错的选择填空. 1. 2. 3. 4. 5. 6.

  6. 2018-10-10-weekly

    Algorithm 字典序排数 What 给定一个整数n,返回从1到n的字典顺序,例如,给定 n =13,返回 [1,10,11,12,13,2,3,4,5,6,7,8,9] ,尽可能的优化算法的时间 ...

  7. idea中ehcahe配置中 Cannot find the declaration of element 'ehcache'.

    ehcahe.xml 中报错: Cannot find the declaration of element 'ehcache'. 打开settings->languages&frame ...

  8. 01.helloworld--标签

    """参考网站:http://python.cocos2d.org/doc/programming_guide/index.html""" ...

  9. 4. jaxp----dom解析器(DocumentBuilderFactory、DocumentBuilder)

    1.DocumentBuilderFactory--解析器工厂(抽象类 javax.xml.parsers.DocumentBuilderFactory) newInstance()  获取 Docu ...

  10. man fdisk

    FDISK(8)       Linux Programmer?. Manual/Linux程序手册       FDISK(8) NAME/名称       fdisk - Partition ta ...